using IronIntel.Contractor;
using IronIntel.Contractor.Site;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Security_UserManage : UserManageBasePage
{
    protected string IID;
    public bool IsDealer = IronIntel.Contractor.SystemParams.IsDealer;
    public bool CustomerRecordLisence = false;
    public bool WorkOrderLisence = false;

    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)
            {
                // todo nothing
                IID = GetCurrentLoginSession().User.UID;
                CustomerRecordLisence = SystemParams.HasLicense("CustomerRecord");
                WorkOrderLisence = SystemParams.HasLicense("WorkOrder");
            }
        }
    }
    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;
        }
    }
}