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();
                }
            }
        }
Example #2
0
 private void CheckArea(int _idUser)
 {
     if (_idUser > 0)
     {
         var list = db.NV_GIAONHANs.Where(n => n.USER_ID == _idUser).ToList();
         foreach (TreeListNode node in ASPxTreeList_menu.GetAllNodes())
         {
             int _idmenu = Utils.CIntDef(node.Key, 0);
             for (int i = 0; i < list.Count; i++)
             {
                 if (Utils.CIntDef(list[i].PROP_ID) == _idmenu)
                 {
                     node.Selected = true;
                 }
             }
         }
         //Lấy vị trí khác
         for (int i = 0; i < list.Count; i++)
         {
             int _prop_id   = Utils.CIntDef(list[i].PROP_ID_OTHER);
             int _count_chk = chkOtherPos.Items.Count;
             for (int j = 0; j < _count_chk; j++)
             {
                 if (Utils.CIntDef(chkOtherPos.Items[j].Value) == _prop_id)
                 {
                     chkOtherPos.Items[j].Selected = true;
                 }
             }
         }
     }
 }
 private bool CheckEmptType()
 {
     if (ASPxTreeList_menu.GetSelectedNodes().Count > 0)
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
Example #4
0
        private void SaveData(int _idUser)
        {
            string strLink = "";

            try
            {
                int i     = 0;
                var gcdel = (from gp in db.NV_GIAONHANs
                             where gp.USER_ID == _idUser
                             select gp);

                db.NV_GIAONHANs.DeleteAllOnSubmit(gcdel);

                foreach (TreeListNode node in ASPxTreeList_menu.GetSelectedNodes())
                {
                    int _idmenu = Utils.CIntDef(node.Key, 0);
                    if (_idmenu > 0)
                    {
                        NV_GIAONHAN grinsert = new NV_GIAONHAN();
                        grinsert.USER_ID        = _idUser;
                        grinsert.USER_NAME      = GetUser(_idUser);
                        grinsert.PROP_PARENT_ID = Utils.CIntDef(ddlThanhPho.SelectedValue);
                        grinsert.PROP_ID        = _idmenu;
                        db.NV_GIAONHANs.InsertOnSubmit(grinsert);
                    }
                    i++;
                }
                for (int k = 0; k < chkOtherPos.Items.Count; k++)
                {
                    if (chkOtherPos.Items[k].Selected)
                    {
                        NV_GIAONHAN grinsert = new NV_GIAONHAN();
                        grinsert.USER_ID        = _idUser;
                        grinsert.USER_NAME      = GetUser(_idUser);
                        grinsert.PROP_PARENT_ID = Utils.CIntDef(ddlThanhPho.SelectedValue);
                        grinsert.PROP_ID_OTHER  = Utils.CIntDef(chkOtherPos.Items[k].Value);
                        db.NV_GIAONHANs.InsertOnSubmit(grinsert);
                    }
                }

                db.SubmitChanges();
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
            }
            finally
            {
                if (!string.IsNullOrEmpty(strLink))
                {
                    Response.Redirect(strLink);
                }
            }
        }
 protected void lbtnDelete_Click1(object sender, EventArgs e)
 {
     foreach (TreeListNode node in ASPxTreeList_menu.GetSelectedNodes())
     {
         int _idmenu = Utils.CIntDef(node.Key, 0);
         var list    = db.TYPE_COMPANies.Where(n => n.TYPE_ID == _idmenu);
         db.TYPE_COMPANies.DeleteAllOnSubmit(list);
         db.SubmitChanges();
     }
     //Loadmenu();
     Response.Redirect("danh-sach-loai-hinh-doanh-nghiep.aspx");
 }
 protected void lbtnDelete_Click1(object sender, EventArgs e)
 {
     foreach (TreeListNode node in ASPxTreeList_menu.GetSelectedNodes())
     {
         int _idmenu = Utils.CIntDef(node.Key, 0);
         var list    = db.MENU_PARENTs.Where(n => n.MENU_PAR_ID == _idmenu);
         db.MENU_PARENTs.DeleteAllOnSubmit(list);
         db.SubmitChanges();
     }
     //Loadmenu();
     Response.Redirect("danh-sach-menu-cha.aspx");
 }
        private void Save(string strLink = "")
        {
            try
            {
                Delete_group_menu();
                if (_groupid == 0)
                {
                    GROUP group = new GROUP();
                    group.GROUP_NAME = Txtname.Text;
                    group.GROUP_TYPE = Utils.CIntDef(Rdtype.SelectedValue);
                    db.GROUPs.InsertOnSubmit(group);
                    db.SubmitChanges();
                    var getlink = db.GROUPs.OrderByDescending(n => n.GROUP_ID).Take(1).ToList();
                    if (getlink.Count > 0)
                    {
                        _groupid = getlink[0].GROUP_ID;
                        strLink  = string.IsNullOrEmpty(strLink) ? "chi-tiet-nhom-quan-tri.aspx?groupid=" + getlink[0].GROUP_ID : strLink;
                    }
                }
                else
                {
                    var list = db.GROUPs.Where(n => n.GROUP_ID == _groupid).ToList();
                    foreach (var i in list)
                    {
                        i.GROUP_NAME = Txtname.Text;
                        i.GROUP_TYPE = Utils.CIntDef(Rdtype.SelectedValue);
                    }
                    db.SubmitChanges();
                    strLink = string.IsNullOrEmpty(strLink) ? "chi-tiet-nhom-quan-tri.aspx?groupid=" + _groupid : strLink;
                }

                foreach (TreeListNode node in ASPxTreeList_menu.GetSelectedNodes())
                {
                    int        menu_id = Utils.CIntDef(node.Key);
                    GROUP_MENU grmenu  = new GROUP_MENU();
                    grmenu.GROUP_ID = _groupid;
                    grmenu.MENU_ID  = menu_id;
                    db.GROUP_MENUs.InsertOnSubmit(grmenu);
                    db.SubmitChanges();
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (!string.IsNullOrEmpty(strLink))
                {
                    Response.Redirect(strLink);
                }
            }
        }
Example #8
0
        private void LoadTypeReg(int _id_prof)
        {
            try
            {
                //Kiểm tra type của prof
                int _type    = 0;
                var _objType = db.PROFILE_NEWs.Where(n => n.ID == _id_prof).ToList();
                if (_objType.Count > 0)
                {
                    _type = Utils.CIntDef(_objType[0].PROF_TYPE);
                }
                var AllList = (from g in db.TYPE_COMPANies
                               where g.TYPE_RANK > 0 && (g.TYPE_REG == null || g.TYPE_REG == _type)
                               select new
                {
                    g.TYPE_ID,
                    g.TYPE_PARENT,
                    g.TYPE_RANK,
                    g.TYPE_NAME
                });

                if (AllList.ToList().Count > 0)
                {
                    DataRelation relCat;
                    Session["companies.listmenucha"] = DataUtil.LINQToDataTable(AllList);
                    DataTable tbl = Session["companies.listmenucha"] as DataTable;

                    DataSet ds = new DataSet();
                    ds.Tables.Add(tbl);

                    tbl.PrimaryKey = new DataColumn[] { tbl.Columns["TYPE_ID"] };
                    relCat         = new DataRelation("TYPE_PARENT", ds.Tables[0].Columns["TYPE_ID"], ds.Tables[0].Columns["TYPE_PARENT"], false);

                    ds.Relations.Add(relCat);
                    DataSet   dsCat    = ds.Clone();
                    DataTable CatTable = ds.Tables[0];

                    unit_data.TransformTableWithSpace(ref CatTable, dsCat.Tables[0], relCat, null);

                    HttpContext.Current.Session["companies.listmenucha"] = dsCat.Tables[0];
                    ASPxTreeList_menu.DataSource = dsCat.Tables[0];
                    ASPxTreeList_menu.DataBind();
                }
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         Loadmenu();
     }
     else
     {
         if (HttpContext.Current.Session["ktoan.listmenucha"] != null)
         {
             ASPxTreeList_menu.DataSource = HttpContext.Current.Session["ktoan.listmenucha"];
             ASPxTreeList_menu.DataBind();
         }
     }
 }
Example #10
0
 private void CheckTypeReg(int _id_prof)
 {
     if (_id_prof > 0)
     {
         var list = db.TYPE_LIST_CHOOSEs.Where(n => n.PROF_ID == _id_prof).ToList();
         foreach (TreeListNode node in ASPxTreeList_menu.GetAllNodes())
         {
             int _idmenu = Utils.CIntDef(node.Key, 0);
             for (int i = 0; i < list.Count; i++)
             {
                 if (Utils.CIntDef(list[i].TYPE_ID) == _idmenu)
                 {
                     node.Selected = true;
                 }
             }
         }
     }
 }
        private void LoadCat()
        {
            try
            {
                var AllList = (from g in db.TYPE_COMPANies
                               where g.TYPE_RANK > 0
                               select new
                {
                    g.TYPE_ID,
                    g.TYPE_PARENT,
                    g.TYPE_RANK,
                    g.TYPE_ACTIVE,
                    g.ORDERBY,
                    g.TYPE_NAME
                });

                if (AllList.ToList().Count > 0)
                {
                    DataRelation relCat;
                    Session["companies.listmenucha"] = DataUtil.LINQToDataTable(AllList);
                    DataTable tbl = Session["companies.listmenucha"] as DataTable;

                    DataSet ds = new DataSet();
                    ds.Tables.Add(tbl);

                    tbl.PrimaryKey = new DataColumn[] { tbl.Columns["TYPE_ID"] };
                    relCat         = new DataRelation("TYPE_PARENT", ds.Tables[0].Columns["TYPE_ID"], ds.Tables[0].Columns["TYPE_PARENT"], false);

                    ds.Relations.Add(relCat);
                    DataSet   dsCat    = ds.Clone();
                    DataTable CatTable = ds.Tables[0];

                    unit_data.TransformTableWithSpace(ref CatTable, dsCat.Tables[0], relCat, null);

                    HttpContext.Current.Session["companies.listmenucha"] = dsCat.Tables[0];
                    ASPxTreeList_menu.DataSource = dsCat.Tables[0];
                    ASPxTreeList_menu.DataBind();
                }
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
            }
        }
Example #12
0
        private void Remove_Check()
        {
            int _count_chk = chkOtherPos.Items.Count;

            for (int j = 0; j < _count_chk; j++)
            {
                chkOtherPos.Items[j].Selected = false;
            }

            if (ddlNhanVienGN.SelectedValue == "0" || ddlThanhPho.SelectedValue == "0")
            {
                ASPxTreeList_menu.ClearNodes();
            }

            foreach (TreeListNode node in ASPxTreeList_menu.GetAllNodes())
            {
                node.Selected = false;
            }
        }
        private void SaveTypeReg(int _id_prof)
        {
            string strLink = "";

            try
            {
                int i     = 0;
                var gcdel = (from gp in db.TYPE_LIST_CHOOSEs
                             where gp.PROF_ID == _id_prof
                             select gp);

                db.TYPE_LIST_CHOOSEs.DeleteAllOnSubmit(gcdel);

                foreach (TreeListNode node in ASPxTreeList_menu.GetSelectedNodes())
                {
                    int _idmenu = Utils.CIntDef(node.Key, 0);
                    if (_idmenu > 0)
                    {
                        TYPE_LIST_CHOOSE grinsert = new TYPE_LIST_CHOOSE();
                        grinsert.PROF_ID = _id_prof;
                        grinsert.TYPE_ID = _idmenu;

                        db.TYPE_LIST_CHOOSEs.InsertOnSubmit(grinsert);
                    }

                    i++;
                }

                db.SubmitChanges();
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
            }
            finally
            {
                if (!string.IsNullOrEmpty(strLink))
                {
                    Response.Redirect(strLink);
                }
            }
        }
Example #14
0
        protected void ddlThanhPho_SelectedIndexChanged(object sender, EventArgs e)
        {
            Remove_Check();//Bỏ note cũ

            int _idPr = Utils.CIntDef(ddlThanhPho.SelectedValue);
            var obj   = _UnitData.Loaddistric(_idPr);

            if (obj.Count > 0)
            {
                HttpContext.Current.Session["listmenuQuanHuyen"] = obj;
                ASPxTreeList_menu.DataSource = obj;
                ASPxTreeList_menu.DataBind();

                int iUser = Utils.CIntDef(ddlNhanVienGN.SelectedValue);
                if (iUser > 0)
                {
                    CheckArea(iUser);
                }
            }
        }
Example #15
0
 protected void Page_Load(object sender, EventArgs e)
 {
     _id = Utils.CIntDef(Request.QueryString["id"]);
     if (!IsPostBack)
     {
         TestPermission();
         Load_Grid();
         Load_UserGiaoNhan();
         Load_ThanhPho();
         Getinfo();
     }
     else
     {
         if (HttpContext.Current.Session["listmenuQuanHuyen"] != null)
         {
             ASPxTreeList_menu.DataSource = HttpContext.Current.Session["listmenuQuanHuyen"];
             ASPxTreeList_menu.DataBind();
         }
     }
 }
Example #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            bool isPermission = _UnitDataRepo.checkPermissionPage("danh-sach-menu-cha.aspx", Utils.CIntDef(Session["groupId"]), Utils.CIntDef(Session["groupType"]));

            if (!isPermission)
            {
                Response.Write("<script>alert('Bạn không có quyền truy cập vào trang này');location.href='trang-chu.aspx';</script>");
            }
            if (!IsPostBack)
            {
                Loadmenu();
            }
            else
            {
                if (HttpContext.Current.Session["ktoan.listmenucha"] != null)
                {
                    ASPxTreeList_menu.DataSource = HttpContext.Current.Session["ktoan.listmenucha"];
                    ASPxTreeList_menu.DataBind();
                }
            }
        }
 public void Check_menu()
 {
     try
     {
         var list = db.GROUP_MENUs.Where(n => n.GROUP_ID == _groupid).ToList();
         foreach (var i in list)
         {
             foreach (TreeListNode node in ASPxTreeList_menu.GetAllNodes())
             {
                 if (i.MENU_ID == Utils.CIntDef(node.Key))
                 {
                     node.Selected = true;
                     break;
                 }
             }
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
 public void Loadmenu()
 {
     try
     {
         var list = db.MENU_PARENTs.Where(n => n.MENU_PAR_ACTIVE == 1).ToList();
         if (list.Count > 0)
         {
             ASPxTreeList_menu.DataSource = list;
             ASPxTreeList_menu.DataBind();
             HttpContext.Current.Session["ktoan.listmenu"] = list;
         }
         else
         {
             HttpContext.Current.Session["ktoan.listmenu"] = null;
             ASPxTreeList_menu.DataSource = list;
             ASPxTreeList_menu.DataBind();
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     _groupid = Utils.CIntDef(Request.QueryString["groupid"]);
     if (_groupid == 0)
     {
         Response.Redirect("trang-chu.aspx");
     }
     if (!IsPostBack)
     {
         //Loadgroup();
         Loadmenu();
         Getinfo();
         Check_menu();
     }
     else
     {
         if (HttpContext.Current.Session["ktoan.listmenu"] != null)
         {
             ASPxTreeList_menu.DataSource = HttpContext.Current.Session["ktoan.listmenu"];
             ASPxTreeList_menu.DataBind();
         }
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            bool isPermission = _UnitDataRepo.checkPermissionPage("chi-tiet-nhom-quan-tri.aspx", Utils.CIntDef(Session["groupId"]), Utils.CIntDef(Session["groupType"]));

            if (!isPermission)
            {
                Response.Write("<script>alert('Bạn không có quyền truy cập vào trang này');location.href='trang-chu.aspx';</script>");
            }
            _groupid = Utils.CIntDef(Request.QueryString["groupid"]);
            if (!IsPostBack)
            {
                Loadmenu();
                Getinfo();
                Check_menu();
            }
            else
            {
                if (HttpContext.Current.Session["ktoan.listmenu"] != null)
                {
                    ASPxTreeList_menu.DataSource = HttpContext.Current.Session["ktoan.listmenu"];
                    ASPxTreeList_menu.DataBind();
                }
            }
        }
 public void Loadmenu()
 {
     try
     {
         var list = db.MENU_PARENTs.Where(n => n.MENU_NAME == txtKeyword.Value || txtKeyword.Value == "" || txtKeyword.Value == null).
                    OrderByDescending(n => n.ORDERBY).ToList();
         if (list.Count > 0)
         {
             HttpContext.Current.Session["ktoan.listmenucha"] = list;
             ASPxTreeList_menu.DataSource = list;
             ASPxTreeList_menu.DataBind();
         }
         else
         {
             HttpContext.Current.Session["ktoan.listmenucha"] = null;
             ASPxTreeList_menu.DataSource = list;
             ASPxTreeList_menu.DataBind();
         }
     }
     catch (Exception)
     {
         throw;
     }
 }