using Foresight.Fleet.Services.User;
using IronIntel.Contractor;
using IronIntel.Contractor.Site.Security;
using System;

public partial class JobsiteLimitManagement : JobsiteLimitBasePage
{
    public bool IsDealer = IronIntel.Contractor.SystemParams.IsDealer;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!CheckLoginSession())
        {
            // TODO: sub page
            //RedirectToLoginPage();
        }
        else
        {
            string methodName = Request.Form["MethodName"];
            if (!string.IsNullOrEmpty(methodName))
            {
                ProcessRequest(methodName);
            }
            else if (!IsPostBack)
            {
                Title = PageTitle;
                bool permission = CheckRight(SystemParams.CompanyID, Feature.JOBSITE_LIMIT);
                if (!permission)
                    RedirectToLoginPage();
            }
        }
    }

    protected override int FeatureID
    {
        get
        {
            return Foresight.Fleet.Services.User.Feature.JOBSITE_LIMIT;
        }
    }

    public bool IsAdmin
    {
        get
        {
            var user = GetCurrentUser();
            if (user.UserType == IronIntel.Contractor.Users.UserTypes.SupperAdmin || user.UserType == IronIntel.Contractor.Users.UserTypes.Admin)
                return true;
            else
                return false;
        }

    }
}