using Foresight.Fleet.Services.User;
using IronIntel.Contractor;
using IronIntel.Contractor.Site.Maintenance;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class WorkOrderStatusManagement : WorkOrderBasePage
{
    protected string IID;
    public bool IsDealer = IronIntel.Contractor.SystemParams.IsDealer;
    public bool EmailSubscribe = false;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!CheckLoginSession())
        {
            RedirectToLoginPage();
        }
        else
        {
            string methodName = Request.Form["MethodName"];
            if (!string.IsNullOrEmpty(methodName))
            {
                ProcessRequest(methodName);
            }
            else if (!IsPostBack)
            {
                this.Title = PageTitle;
                bool license = SystemParams.HasLicense("WorkOrder");
                if (!license)
                    RedirectToLoginPage();

                bool permission = CheckRight(SystemParams.CompanyID, Feature.WORK_ORDER);
                if (!permission)
                    RedirectToLoginPage();
            }
        }
    }

    public bool IsSupperAdmin
    {
        get
        {
            var user = GetCurrentUser();
            return user.UserType == IronIntel.Contractor.Users.UserTypes.SupperAdmin;
        }
    }

    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;
        }
    }
}