protected void lbtnDelete_Click(object sender, EventArgs e)
        {
            List <object> fieldValues = ASPxGridView1_Order.GetSelectedFieldValues(new string[] { "ID" });

            foreach (var item in fieldValues)
            {
                _OrderRepo.Remove(Utils.CIntDef(item));
            }
            Response.Redirect("danh-sach-don-hang.aspx");
        }
Example #2
0
        private void LoadList()
        {
            try
            {
                int userId = Utils.CIntDef(Session["Userid"]);
                var list   = _OrderDeliRepo.GetByWhereAll(txtKeyword.Value, Utils.CIntDef(ddlOrder.SelectedValue), 0, pickerAndCalendarFrom.returnDate, pickerAndCalendarTo.returnDate);

                HttpContext.Current.Session["LoadOrder"] = list;
                ASPxGridView1_Order.DataSource           = list;
                ASPxGridView1_Order.DataBind();
            }
            catch //(Exception)
            {
                //throw;
            }
        }
        private void LoadOrder()
        {
            try
            {
                int userId      = Utils.CIntDef(Session["Userid"]);
                var list        = _OrderRepo.GetByWhereAll(txtKeyword.Value, Utils.CIntDef(ddlCustomer.SelectedValue), Utils.CIntDef(ddlStatus.SelectedItem.Value), userId, pickerAndCalendarFrom.returnDate, pickerAndCalendarTo.returnDate);
                int grouptypeId = Utils.CIntDef(Session["groupType"]);
                if (grouptypeId == Cost.GROUPTYPE_ADMIN)
                {
                    list = _OrderRepo.GetByWhereAll(txtKeyword.Value, Utils.CIntDef(ddlCustomer.SelectedValue), Utils.CIntDef(ddlStatus.SelectedItem.Value), 0, pickerAndCalendarFrom.returnDate, pickerAndCalendarTo.returnDate);
                }

                HttpContext.Current.Session["LoadOrder"] = list;
                ASPxGridView1_Order.DataSource           = list;
                ASPxGridView1_Order.DataBind();
            }
            catch //(Exception)
            {
                //throw;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            bool isPermission = _UnitDataRepo.checkPermissionPage("danh-sach-don-hang.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)
            {
                pickerAndCalendarFrom.returnDate = DateTime.Now.AddMonths(-2);
                pickerAndCalendarTo.returnDate   = DateTime.Now;
                LoadCustomer();
                LoadOrder();
            }
            else
            {
                ASPxGridView1_Order.DataSource = HttpContext.Current.Session["listOrder"];
                ASPxGridView1_Order.DataBind();
            }
        }