protected void Page_Load(object sender, EventArgs e)
    {
        if (!UserAcc.UserExpired())
        {
            if (!IsPostBack)
            {
                setCBL();
                string sQueryStrIndID = Request.QueryString["in"];
                if (!string.IsNullOrEmpty(sQueryStrIndID))
                {
                    hdfIndID.Value = STCrypt.Encrypt(sQueryStrIndID);

                    ((_MP_EPI_FORMS)this.Master).hdfPRMS      = SystemFunction.GetPermissionMenu(15) + "";
                    ((_MP_EPI_FORMS)this.Master).hdfCheckRole = UserAcc.GetObjUser().nRoleID + "";
                }
                else
                {
                    SetBodyEventOnLoad(SystemFunction.DialogWarningRedirect(SystemFunction.Msg_HeadWarning, "Invalid Data", "Intensity_from.aspx"));// กรณีเข้ามาด้วย link ที่ไม่มี Querystring
                }
            }
        }
        else
        {
            SetBodyEventOnLoad(SystemFunction.PopupLogin());
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (!UserAcc.UserExpired())
            {
                PTTGC_EPIEntities db       = new PTTGC_EPIEntities();
                string            str      = Request.QueryString["strid"];
                string            strFacID = Request.QueryString["strFacID"];
                int  nFacilityID           = 0;
                bool IsNew = false;
                if (!string.IsNullOrEmpty(str))
                {
                    hdfReturnStr.Value += "&&strid=" + HttpUtility.UrlEncode(str);
                    int nComID = SystemFunction.GetIntNullToZero(STCrypt.Decrypt(str));
                    hdfComType.Value = nComID == 1 ? "PTT" : "GC";
                    hdfComID.Value   = str;
                    var itemCompany = db.mTCompany.FirstOrDefault(w => w.ID == nComID && w.cDel == "N");
                    if (itemCompany != null)
                    {
                        if (!string.IsNullOrEmpty(strFacID))
                        {
                            IsNew               = false;
                            nFacilityID         = SystemFunction.GetIntNullToZero(STCrypt.Decrypt(strFacID));
                            hdfFacilityID.Value = strFacID;
                            var itemFacility = db.mTFacility.FirstOrDefault(w => w.cDel == "N" && w.ID == nFacilityID);
                            if (itemFacility != null)
                            {
                                ltrHeader.Text = "<a href='admin_company_lst.aspx' style='color:white'>Organization</a> > <a href='admin_facility_lst.aspx?strid=" + HttpUtility.UrlEncode(str) + "' style='color:white'>" + itemCompany.Name + "</a> > " + itemFacility.Name + "  > Edit";//กำหนด Header กรณีเข้ามา EDIT
                            }
                        }
                        else
                        {
                            IsNew          = true;
                            ltrHeader.Text = "<a href='admin_company_lst.aspx' style='color:white'>Organization</a> > <a href='admin_facility_lst.aspx?strid=" + HttpUtility.UrlEncode(str) + "' style='color:white'>" + itemCompany.Name + "</a> > Facility  > Create";//กำหนด Header  กรณีเข้ามา ADD
                        }

                        hdfIsNew.Value = IsNew ? "C" : "E";
                    }
                    setDDL_Cbl(IsNew, nComID);
                    setData(nFacilityID);
                }
                if (string.IsNullOrEmpty(str) && string.IsNullOrEmpty(strFacID))
                {
                    SetBodyEventOnLoad(SystemFunction.DialogWarningRedirect(SystemFunction.Msg_HeadWarning, "Invalid Data", "admin_company_lst.aspx"));// กรณีเข้ามาด้วย link ที่ไม่มี Querystring
                }
            }
            else
            {
                SetBodyEventOnLoad(SystemFunction.PopupLogin());
            }
        }
    }
Exemple #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         SystemFunction.BindDropdownPageSize(ddlPageSize, null);
         SystemFunction.BindDropdownPageSize(ddlPageSizeGC, null);
         if (!UserAcc.UserExpired())
         {
             string str = Request.QueryString["strid"];
             if (!string.IsNullOrEmpty(str))
             {
                 if (SystemFunction.GetIntNullToZero(STCrypt.Decrypt(str)) != 1)
                 {
                     SetBodyEventOnLoad("$('div[id$=divContentGC]').show();$('div[id$=divContent]').hide()");
                 }
                 else
                 {
                     SetBodyEventOnLoad("$('div[id$=divContentGC]').hide();$('div[id$=divContent]').show()");
                 }
                 PTTGC_EPIEntities db = new PTTGC_EPIEntities();
                 int nComID           = SystemFunction.GetIntNullToZero(STCrypt.Decrypt(str));
                 hdfComID.Value = STCrypt.Encrypt(nComID + "");
                 var itemCompany = db.mTCompany.FirstOrDefault(w => w.ID == nComID && w.cDel == "N");
                 if (itemCompany != null)
                 {
                     ltrHeader.Text = "<a href='admin_company_lst.aspx' style='color:white'>Organization</a> > " + itemCompany.Name;//กำหนด Header
                 }
                 ltrCreateGC.Text = "<a class=\"btn btn-primary btn-sm btn-block\" href=\"admin_facility_update.aspx?strid=" + HttpUtility.UrlEncode(STCrypt.Encrypt(nComID + "")) + "\"><i class=\"fa fa-plus\"></i>&nbsp;Create Facility</a>";
                 ltrCreate.Text   = "<a class=\"btn btn-primary btn-sm btn-block\" href=\"admin_facility_update.aspx?strid=" + HttpUtility.UrlEncode(STCrypt.Encrypt(nComID + "")) + "\"><i class=\"fa fa-plus\"></i>&nbsp;Create Facility</a>";
             }
             else
             {
                 SetBodyEventOnLoad(SystemFunction.DialogWarningRedirect(SystemFunction.Msg_HeadWarning, "Invalid Data", "admin_company_lst.aspx"));// กรณีเข้ามาด้วย link ที่ไม่มี Querystring
             }
         }
         else
         {
             SetBodyEventOnLoad(SystemFunction.PopupLogin());
         }
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (UserAcc.UserExpired())
     {
         SetBodyEventOnLoad(SystemFunction.PopupLogin());
     }
     else
     {
         if (!IsPostBack)
         {
             if (UserAcc.GetObjUser().nRoleID == 4 || UserAcc.GetObjUser().nRoleID == 1)//ENVI Corporate(L2) & System Admin
             {
                 BindDDL();
             }
             else
             {
                 SetBodyEventOnLoad(SystemFunction.DialogWarningRedirect(SystemFunction.Msg_HeadWarning, "No permission !", "epi_mytask.aspx"));
             }
         }
     }
 }