Beispiel #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (!Page.IsPostBack)
         {
             if (UserInfo.Profile.Website != null)
             {
                 website = UserInfo.Profile.Website;
             }
             if (Request.QueryString["NhanHieuID"] != null)
             {
                 NhanHieuID = int.Parse(Request.QueryString["NhanHieuID"]);
             }
             if (Request.QueryString["BienDongID"] != null)
             {
                 BienDongID = int.Parse(Request.QueryString["BienDongID"]);
             }
             if (Request.QueryString["Status"] != null)
             {
                 Status = int.Parse(Request.QueryString["Status"]);
             }
             if (NhanHieuID == 0 || BienDongID == 0 || Status == 0)
             {
                 btnThucHien.Visible = false;
                 return;
             }
             if (Status == 6)
             {
                 lblNamHieuLuc.Visible = true;
                 txtNamHieuLuc.Visible = true;
                 lblFromDate.Visible   = true;
                 txtFromDate.Visible   = true;
                 txtFromDate.Text      = DateTime.Now.ToString("dd/MM/yyyy");
             }
             else
             {
                 lblNamHieuLuc.Visible = false;
                 txtNamHieuLuc.Visible = false;
                 lblFromDate.Visible   = false;
                 txtFromDate.Visible   = false;
             }
             StatusName = cont.GetStatus(Status);
             if (UserInfo.Profile.Website != null)
             {
                 website = UserInfo.Profile.Website;
             }
             if (UserInfo.IsSuperUser || UserInfo.IsInRole("Administrators") || cont.HasRole(UserInfo.Roles, "QuanLy"))
             {
                 admin = true;
             }
             cont.NhanHieu_CheckValid(NhanHieuID, BienDongID, admin, website, Status, out Valid, out ShowDonVi, out DonVi);
             if (Valid)
             {
                 if (ShowDonVi)
                 {
                     LoadDonVis();
                     if (DonVi != "")
                     {
                         ListItem li = ddlDonVi.Items.FindByValue(DonVi);
                         if (li != null)
                         {
                             li.Selected      = true;
                             ddlDonVi.Enabled = false;
                         }
                     }
                 }
                 else
                 {
                     ddlDonVi.Visible = false;
                     lblDonVi.Visible = false;
                 }
                 btnThucHien.Visible = true;
             }
             else
             {
                 btnThucHien.Visible = false;
                 return;
             }
         }
     }
     catch (Exception ex)
     {
     }
 }
Beispiel #2
0
 private void SetButtonStatus()
 {
     if (UserInfo.IsSuperUser || UserInfo.IsInRole("Administrators") || cont.HasRole(UserInfo.Roles, "QuanLy"))
     {
         if (hdIsReferenced.Value == "0")
         {
             if (website != hdUnit.Value)
             {
                 SetButton(true, false, false, false, false, false, false, false);
             }
             else
             {
                 SetButton(true, true, false, false, true, true, false, false);
             }
         }
         else
         {
             if (hdStatusID.Value == "1")
             {
                 SetButton(true, true, false, false, true, true, false, false);
             }
             else if (hdStatusID.Value == "2")
             {
                 SetButton(true, false, false, false, false, false, false, false);
             }
             else if (hdStatusID.Value == "3")
             {
                 SetButton(true, false, false, false, false, false, false, false);
             }
             else if (hdStatusID.Value == "4")
             {
                 SetButton(true, true, false, false, true, false, true, true);
             }
             else if (hdStatusID.Value == "5")
             {
                 SetButton(true, true, false, false, true, true, false, false);
             }
             else if (hdStatusID.Value == "6")
             {
                 SetButton(true, true, false, false, false, false, false, false);
             }
         }
     }
     else
     {
         if (hdIsReferenced.Value == "0")
         {
             if (website != hdUnit.Value)
             {
                 if (hdNhanHieuID.Value == "0")
                 {
                     SetButton(true, false, false, false, false, false, false, false);
                 }
                 else
                 {
                     SetButton(false, false, false, false, false, false, false, false);
                 }
             }
             else
             {
                 SetButton(true, true, true, false, false, false, false, false);
             }
         }
         else
         {
             if (hdStatusID.Value == "1")
             {
                 SetButton(false, false, false, true, false, false, false, false);
             }
             else if (hdStatusID.Value == "2")
             {
                 SetButton(true, true, true, false, false, false, false, false);
             }
             else if (hdStatusID.Value == "3")
             {
                 SetButton(true, true, true, false, false, false, false, false);
             }
             else if (hdStatusID.Value == "4")
             {
                 SetButton(false, false, false, false, false, false, false, false);
             }
             else if (hdStatusID.Value == "5")
             {
                 SetButton(false, false, false, false, false, false, false, false);
             }
             else if (hdStatusID.Value == "6")
             {
                 SetButton(false, false, false, false, false, false, false, false);
             }
         }
     }
     udpButton.Update();
 }