Пример #1
0
        protected void lbtnDelete_Click(object sender, EventArgs e)
        {
            List <object> fieldValues = ASPxGridView1_Material.GetSelectedFieldValues(new string[] { "ID" });

            foreach (var item in fieldValues)
            {
                _MaterialRepo.Remove(Utils.CIntDef(item));
            }
            Response.Redirect("nguyen-lieu.aspx");
        }
        private void LoadMaterial()
        {
            try
            {
                var list = _MaterialRepo.GetAll();

                HttpContext.Current.Session["listMaterial"] = list;
                ASPxGridView1_Material.DataSource           = list;
                ASPxGridView1_Material.DataBind();
            }
            catch //(Exception)
            {
                //throw;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            bool isPermission = _UnitDataRepo.checkPermissionPage("kho-nguyen-lieu.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>");
            }
            id = Utils.CIntDef(Request.QueryString["id"]);
            if (!IsPostBack)
            {
                LoadMaterial();
            }
            else
            {
                ASPxGridView1_Material.DataSource = HttpContext.Current.Session["listMaterial"];
                ASPxGridView1_Material.DataBind();
            }
        }