protected void Page_Load(object sender, EventArgs e)
        {
            getCookies _getCookies = new getCookies();
            _getCookies.getCookiesNew();
            int _grouptype = Utils.CIntDef(Session["Grouptype"], 0);
            if (_grouptype != 1 && _grouptype != 2)
            {
                txtDaThu.Enabled = txtFromDate.Visible = false;
            }


            _id = Utils.CIntDef(Request.QueryString["id"]);
            idNameUser.Visible = false;
            ddlType.Enabled = _id == 0 ? true : false;
            if (!IsPostBack)
            {
                Getinfo();
                //TestPermission();
                ddlType_SelectedIndexChanged(sender, e);
                LoadTypeReg(_id);
                CheckTypeReg(_id);
            }
            else
            {
                if (HttpContext.Current.Session["companies.listmenucha"] != null)
                {
                    ASPxTreeList_menu.DataSource = HttpContext.Current.Session["companies.listmenucha"];
                    ASPxTreeList_menu.DataBind();
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            getCookies _getCookies = new getCookies();
            _getCookies.getCookiesNew();
            TestPermission();

            if (!IsPostBack)
            {
                pickdate_Begin.returnDate = Convert.ToDateTime("01/01/2015");
                fromDate = pickdate_Begin.returnDate;
                pickdate_End.returnDate = DateTime.Now;
                toDate = pickdate_End.returnDate;
                _getCookies.getCookiesNew();//cấp lại session
                LoadProject();
            }
            else
            {
                ASPxGridView1_project.DataSource = HttpContext.Current.Session["listHopDong"];
                ASPxGridView1_project.DataBind();
            }
        }
        public void TestPermission()
        {
            try
            {
                getCookies _getCookies = new getCookies();
                _getCookies.getCookiesNew();

                if (Session["Grouptype"].ToString() != "1" && Session["Grouptype"].ToString() != "2")
                {
                    lbtnDelete.Visible = false;
                }
            }
            catch (Exception) { Response.Redirect("trang-chu.aspx"); }
        }
        public void TestPermission()
        {
            try
            {
                getCookies _getCookies = new getCookies();
                _getCookies.getCookiesNew();

                int _groupType = Utils.CIntDef(Session["Grouptype"]);
                if (_groupType != 1 && _groupType != 2 && _groupType != 14)
                {
                    iListBtn.Visible = false;
                    imgBtnImport.Visible = fileUpload.Visible = false;
                }

                //Bổ sung cho Hành chánh dc nhập
                if (_groupType == 7)
                {
                    iListBtn.Visible = true;
                    btnSync.Visible = false;
                }
            }
            catch (Exception) { Response.Redirect("trang-chu.aspx"); }
        }
        public void TestPermission()
        {
            try
            {
                getCookies _getCookies = new getCookies();
                _getCookies.getCookiesNew();

                if (_id != 0)
                {
                    int _idUser = Utils.CIntDef(Session["Userid"]);
                    int _idGroup = Utils.CIntDef(Session["Grouptype"], 0);
                    if (_idGroup != 1 && _idGroup != 2)
                    {
                        var obj = _MerThanhLyHopDongDVData.GetById(_id);
                        if (obj != null)
                        {
                            if (Utils.CIntDef(obj.USER_ID) != _idUser)
                                Response.Redirect("danh-sach-bien-ban-thanh-ly-hop-dong.aspx");
                            else
                            {
                                if (obj.MER_STATUS == 1)
                                {
                                    string strScript = "<script>";
                                    strScript += "alert(' Hợp đồng này đã được xử lý xong, bạn không có quyền chỉnh sửa!');";
                                    strScript += "window.location='danh-sach-bien-ban-thanh-ly-hop-dong.aspx';";
                                    strScript += "</script>";
                                    Page.RegisterClientScriptBlock("strScript", strScript);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception) { Response.Redirect("danh-sach-hop-dong-ke-toan.aspx"); }
        }
        public void TestPermission()
        {
            try
            {
                getCookies _getCookies = new getCookies();
                _getCookies.getCookiesNew();

                int _idUser = Utils.CIntDef(Session["Userid"], 0);
                int _idGroup = Utils.CIntDef(Session["Grouptype"], 0);
                if (_idGroup != 1 && _idGroup != 7)
                {
                    FileManager1.Visible = true;
                    Panel_upload.Visible = false;
                    Panel_deny.Visible = false;
                    FileManager1.ReadOnly = false;
                    FileManager1.AllowDelete = false;//Cho phép Xóa
                    FileManager1.AllowOverwrite = true;
                }
                else
                {
                    FileManager1.Visible = true;
                    Panel_upload.Visible = false;
                    Panel_deny.Visible = false;
                    FileManager1.ReadOnly = false;
                    FileManager1.AllowDelete = true;//Cho phép Xóa
                    FileManager1.AllowOverwrite = true;
                }
            }
            catch (Exception) { Response.Redirect("trang-chu.aspx"); }
        }
        public void TestPermission()
        {
            try
            {
                getCookies _getCookies = new getCookies();
                _getCookies.getCookiesNew();

                //groupType = 7 là hành chánh, nhớ kiểm tra lại
                int _groupType = Utils.CIntDef(Session["Grouptype"]);
                if (_groupType != 1 && _groupType != 2 && _groupType != 14 && _groupType != 12 && _groupType != 7)
                {
                    //Phần chung
                    btnSave.Visible = false;
                    btnSaveT1.Visible = btnSaveT2.Visible = btnSaveT3.Visible = btnSaveT4.Visible = btnSaveT5.Visible =
                        btnSaveT6.Visible = btnSaveT7.Visible = btnSaveT8.Visible = btnSaveT9.Visible = btnSaveT10.Visible =
                        btnSaveT11.Visible = btnSaveT12.Visible = btnSaveT13.Visible = false;

                    //Dành cho giao nhận
                    if (_groupType == 6)
                    {
                        pMain.Visible = pMonth1.Visible = pMonth2.Visible = pMonth3.Visible = pMonth4.Visible = pMonth5.Visible = 
                            pMonth6.Visible = pMonth7.Visible = pMonth8.Visible = pMonth9.Visible = pMonth10.Visible = 
                            pMonth11.Visible = pMonth12.Visible = pMonth13.Visible = pDebt.Visible = false;
                        ddlNam.Enabled = false;

                        int _monthNow = Utils.CIntDef(DateTime.Now.Month);
                        switch (_monthNow)
                        {
                            case 1: pMonth1.Visible = btnSaveT1.Visible = true; break;
                            case 2: pMonth2.Visible = btnSaveT2.Visible = true; break;
                            case 3: pMonth3.Visible = btnSaveT3.Visible = true; break;
                            case 4: pMonth4.Visible = btnSaveT4.Visible = true; break;
                            case 5: pMonth5.Visible = btnSaveT5.Visible = true; break;
                            case 6: pMonth6.Visible = btnSaveT6.Visible = true; break;
                            case 7: pMonth7.Visible = btnSaveT7.Visible = true; break;
                            case 8: pMonth8.Visible = btnSaveT8.Visible = true; break;
                            case 9: pMonth9.Visible = btnSaveT9.Visible = true; break;
                            case 10: pMonth10.Visible = btnSaveT10.Visible = true; break;
                            case 11: pMonth11.Visible = btnSaveT11.Visible = true; break;
                            case 12: pMonth12.Visible = btnSaveT12.Visible = true; break;
                        }
                    }
                }
            }
            catch (Exception) { Response.Redirect("trang-chu.aspx"); }
        }
 public void TestPermission()
 {
     try
     {
         getCookies _getCookies = new getCookies();
         _getCookies.getCookiesNew();
     }
     catch (Exception) { Response.Redirect("trang-chu.aspx"); }
 }
        public void TestPermission()
        {
            try
            {
                getCookies _getCookies = new getCookies();
                _getCookies.getCookiesNew();

                int _groupType = Utils.CIntDef(Session["Grouptype"]);
                if (_groupType != 1 && _groupType != 2 && _groupType != 3 && _groupType != 14)
                {
                    string strScript = "<script>";
                    strScript += "alert('Bạn không được cấp quyền truy cập trang này!');";
                    strScript += "window.location='trang-chu.aspx';";
                    strScript += "</script>";
                    Page.RegisterClientScriptBlock("strScript", strScript);
                }
                else {
                    if (_groupType == 3)
                    {
                        tEditText.Visible = false;
                        lbtnSave.Visible = false;
                        lbtnDelete.Visible = false;
                    }
                }
            }
            catch (Exception) { Response.Redirect("trang-chu.aspx"); }
        }