protected void Page_Load(object sender, EventArgs e)
 {
     if (UserAcc.UserExpired())
     {
         SetBodyEventOnLoad(SystemFunction.PopupLogin());
     }
     else
     {
         if (!IsPostBack)
         {
             PTTGC_EPIEntities db  = new PTTGC_EPIEntities();
             string            str = Request.QueryString["strid"];
             if (!string.IsNullOrEmpty(str))
             {
                 int nFacID = SystemFunction.GetIntNullToZero(STCrypt.Decrypt(str));
                 hdfFacID.Value = str;
                 ltrCreate.Text = "<a class=\"btn btn-primary btn-sm btn-block\" href=\"admin_asset_update.aspx?strid=" + HttpUtility.UrlEncode(str) + "\"><i class=\"fa fa-plus\"></i>&nbsp;Create Sub-facility</a>";
                 var itemHeader = db.mTFacility.FirstOrDefault(w => w.ID == nFacID);
                 if (itemHeader != null)
                 {
                     var itemCompany = db.mTCompany.FirstOrDefault(w => w.ID == itemHeader.CompanyID);
                     ltrHeader.Text = "<a href='admin_company_lst.aspx' style='color:white'>Organization</a> >  <a style='color:white' href='admin_facility_lst.aspx?strid=" + HttpUtility.UrlEncode(STCrypt.Encrypt(itemCompany.ID + "")) + "'> " + itemCompany.Name + "</a> > " + itemHeader.Name;//กำหนด Header
                 }
             }
             SystemFunction.BindDropdownPageSize(ddlPageSize, null);
         }
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (UserAcc.UserExpired())
        {
            SetBodyEventOnLoad(SystemFunction.PopupLogin());
        }
        else
        {
            if (!IsPostBack)
            {
                SystemFunction.BindDropdownPageSize(ddlPageSize, null);
                GETDDL();

                int Prms = SystemFunction.GetPermissionMenu(36);
                //hdfPrmsMenu.Value = Prms + "";
                //bool isView = Prms == 1;
                //if (isView)
                //{
                //    DivCreate_Workflow.Visible = false;
                //    ckbAll.Visible = false;
                //    btnDel.Visible = false;
                //}
            }
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (UserAcc.UserExpired())
     {
         SetBodyEventOnLoad(SystemFunction.PopupLogin());
     }
     else
     {
         if (!IsPostBack)
         {
             UserAcc ua = UserAcc.GetObjUser();
             hidUserID.Value        = ua.nUserID + "";
             hidEncryptUserID.Value = STCrypt.Encrypt(hidUserID.Value);
             SetData(hidUserID.Value.toIntNullToZero());
             //txtOldPass.Attributes.Add("type", "password");
             //string strID = Request.QueryString["strid"];
             //if (!string.IsNullOrEmpty(strID))
             //{
             //    hidUserID.Value = STCrypt.Decrypt(strID);
             //    SetData(hidUserID.Value.toIntNullToZero());
             //    hidEncryptUserID.Value = STCrypt.Encrypt(hidUserID.Value);
             //}
         }
     }
 }
Esempio n. 4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (UserAcc.UserExpired())
     {
         SetBodyEventOnLoad(SystemFunction.PopupLogin());
     }
     else
     {
         if (!IsPostBack)
         {
             string strID = Request.QueryString["strid"];
             if (!string.IsNullOrEmpty(strID))
             {
                 hdfEncryptCompanyID.Value = STCrypt.Decrypt(strID);
                 SetData(hdfEncryptCompanyID.Value.toIntNullToZero());
                 hdfEncryptCompanyID.Value = STCrypt.Encrypt(hdfEncryptCompanyID.Value);
             }
             else
             {
                 //CR. 06.02.2019 Sync from SAP
                 txtCode.Enabled        = false;
                 txtCompanyName.Enabled = false;
             }
         }
     }
 }
Esempio n. 5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (UserAcc.UserExpired() && SystemFunction.GetURL(Page.AppRelativeVirtualPath.ToString()) != "helper_indicator.aspx")
     {
         SetBodyEventOnLoad(SystemFunction.PopupLogin());
     }
     else
     {
         //var DataRole = UserAcc.GetRolePermission(UserAcc.GetObjUser().nUserID + "");
         //dvUSer.Visible = true;
         //if (DataRole.Count == 1)
         //{
         //    liChange.Visible = false;
         //    liChange2.Visible = false;
         //}
         string Url = SystemFunction.GetURL(Page.AppRelativeVirtualPath);
         if (SystemFunction.GetURL(Page.AppRelativeVirtualPath.ToString()) != "helper_indicator.aspx")
         {
             lrtMenu.Text         = SystemFunction.HTML_Menubar(Url);
             lrtNav_menu.Text     = SystemFunction.HTML_Navtab(Url);
             lrtNav_UserMenu.Text = SystemFunction.HTML_NavtabUser(Url);
         }
         else
         {
             dvUSer.Visible = false;
         }
         ltrFullName1.Text   = ltrFullName2.Text = UserAcc.GetObjUser().sFullName;
         ltrActionRole1.Text = ltrActionRole2.Text = UserAcc.GetObjUser().sActionRoleName;
     }
 }
Esempio n. 6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (UserAcc.UserExpired())
        {
            SetBodyEventOnLoad(SystemFunction.PopupLogin());
        }
        else
        {
            if (!IsPostBack)
            {
                int Prms = SystemFunction.GetPermissionMenu(34);
                hdfPrmsMenu.Value = Prms + "";
                IsView            = Prms == 1;
                if (IsView)
                {
                    ckbAll.Visible    = false;
                    btnDel.Visible    = false;
                    btnCreate.Visible = false;
                }

                SystemFunction.BindDropdownPageSize(ddlPageSize, null);
                BlindDDL();
            }
        }
    }
    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 (UserAcc.UserExpired())
        {
            SetBodyEventOnLoad(SystemFunction.PopupLogin());
        }
        else
        {
            if (!IsPostBack)
            {
                SystemFunction.BindDropdownPageSize(ddlPageSize, null);

                int nRole = UserAcc.GetObjUser().nRoleID;
                if (nRole == 3 || nRole == 4)
                {
                    hdfPrmsMenu.Value = "2";
                }
                else
                {
                    hdfPrmsMenu.Value = "0";
                }

                BindDDL();
            }
        }
    }
    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());
            }
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (UserAcc.UserExpired())
     {
         SetBodyEventOnLoad(SystemFunction.PopupLogin());
     }
     else
     {
         if (!IsPostBack)
         {
             SystemFunction.BindDropdownPageSize(ddlPageSize, null);
         }
     }
 }
Esempio n. 11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        SetBodyEventOnLoad("");
        if (UserAcc.UserExpired())
        {
            SetBodyEventOnLoad(SystemFunction.PopupLogin());
        }
        else
        {
            if (!IsPostBack)
            {
                PTTGC_EPIEntities env     = new PTTGC_EPIEntities();
                string            sFormID = Request.QueryString["strid"];    // Form ID
                string            sLevel  = Request.QueryString["strlevel"]; // Level (L1 = 3,L2 = 4 ,L0 = 2) After Decrypt
                int nFormID   = 0; int.TryParse(STCrypt.Decrypt(sFormID), out nFormID);
                var gDataForm = env.TEPI_Forms.FirstOrDefault(w => w.FormID == nFormID);
                if (!string.IsNullOrEmpty(sFormID))
                {
                    if (gDataForm != null)
                    {
                        hidFacility.Value      = gDataForm.FacilityID.ToString();
                        hidIndicator.Value     = gDataForm.IDIndicator.ToString();
                        hidOperationType.Value = gDataForm.OperationTypeID.ToString();
                        hidYear.Value          = gDataForm.sYear;

                        var qOpera    = env.mOperationType.FirstOrDefault(w => w.ID == gDataForm.OperationTypeID);
                        var qFac      = env.mTFacility.FirstOrDefault(w => w.ID == gDataForm.FacilityID);
                        var qGroupInd = env.mTIndicator.FirstOrDefault(w => w.ID == gDataForm.IDIndicator);
                        lblGroupIndicator.Text = qGroupInd != null ? qGroupInd.Indicator : "";
                        lblOperationtype.Text  = qOpera.Name;
                        lblFacility.Text       = qFac != null ? qFac.Name : "";
                        lblYear.Text           = gDataForm.sYear;
                    }

                    hidFormID.Value = STCrypt.Decrypt(sFormID);
                    if (!string.IsNullOrEmpty(sLevel))
                    {
                        hidLevel.Value = STCrypt.Decrypt(sLevel);
                    }
                }
                else
                {
                    Response.Redirect("epi_mytask.aspx");
                }
            }
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (UserAcc.UserExpired())
     {
         SetBodyEventOnLoad(SystemFunction.PopupLogin());
     }
     else
     {
         if (!IsPostBack)
         {
             string strID = Request.QueryString["str"];
             if (!string.IsNullOrEmpty(strID))
             {
                 hdfProductID.Value = STCrypt.Decrypt(strID);
                 SetData(hdfProductID.Value);
             }
         }
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (UserAcc.UserExpired())
     {
         SetBodyEventOnLoad(SystemFunction.PopupLogin());
     }
     else
     {
         if (!IsPostBack)
         {
             string str = Request.QueryString["strid"];
             if (!string.IsNullOrEmpty(str))
             {
                 hidEncyptID.Value = str;
                 hidnID.Value      = STCrypt.Decrypt(str);
                 SETDATA(hidnID.Value);
             }
         }
     }
 }
Esempio n. 14
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"));
             }
         }
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (UserAcc.UserExpired())
     {
         SetBodyEventOnLoad(SystemFunction.PopupLogin());
     }
     else
     {
         if (!IsPostBack)
         {
             SystemFunction.BindDropdownPageSize(ddlPageSize, null);
             string OperationID = Request.QueryString["strid"];
             if (!string.IsNullOrEmpty(OperationID))
             {
                 int nID = int.Parse(STCrypt.Decrypt(OperationID));
                 hdfEncryptOperationID.Value = OperationID;
                 hdfOperationID.Value        = STCrypt.Decrypt(hdfEncryptOperationID.Value);
                 SETDATA(nID);
             }
         }
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (UserAcc.UserExpired())
     {
         SetBodyEventOnLoad(SystemFunction.PopupLogin());
     }
     else
     {
         if (!IsPostBack)
         {
             PTTGC_EPIEntities db = new PTTGC_EPIEntities();
             UserAcc           ua = UserAcc.GetObjUser();
             var get_user         = db.mTUser.FirstOrDefault(w => w.ID == ua.nUserID);
             if (get_user != null)
             {
                 txtName.Text     = get_user.Firstname + "  " + get_user.Lastname;
                 txtEmail.Text    = get_user.Email;
                 txtName.Enabled  = false;
                 txtEmail.Enabled = false;
             }
         }
     }
 }