示例#1
0
        protected void cmdView_Click1(object sender, ImageClickEventArgs e)
        {
            txtPageNumber.Text = "1";
            int       nPageNumber = int.Parse(txtPageNumber.Text);
            int       nPageSize   = int.Parse(txtPageSize.Text);
            DataTable nTable      = Ward_Data.GetList(nPageSize, nPageNumber, txtSearch.Text, DDLDistrict.SelectedValue.ToInt());

            if (nTable.Rows.Count == 0)
            {
                nTable.Rows.Add(0, 0, 0, "", "");//, 0, "", 0, "", 0, "");
            }
            GV_Ward.DataSource = nTable;
            GV_Ward.DataBind();
            LoadPages();
        }
示例#2
0
        public void LoadData()
        {
            int       nPageNumber = int.Parse(txtPageNumber.Text);
            int       nPageSize   = int.Parse(txtPageSize.Text);
            DataTable nTable      = Ward_Data.GetList(nPageSize, nPageNumber, txtSearch.Text, DDLDistrict.SelectedValue.ToInt());

            GV_Ward.DataSource = nTable;
            if (nTable.Rows.Count == 0)
            {
                nTable.Rows.Add(0, 0, 0, "", "");//, 0, "", 0, "", 0, "");
            }
            GV_Ward.DataBind();
            DateTime dt = DateTime.Now;

            LoadPages();
        }
示例#3
0
        protected void GrDelete(object sender, CommandEventArgs e)
        {
            int nPageNumber             = int.Parse(txtPageNumber.Text);
            int nPageSize               = int.Parse(txtPageSize.Text);
            SessionUserLogin nUserLogin = (SessionUserLogin)Session["UserLogin"];

            nUserLogin.CheckRole("CA0017");
            if (!nUserLogin.Role.Del)
            {
                Response.Write("<script >alert('Bạn không có quyền xóa danh mục này!')</script>");
            }
            else
            {
                try
                {
                    int           mKey = int.Parse(e.CommandArgument.ToString());
                    District_Info info = new District_Info(mKey);
                    //if ((DateTime.Now - info.).TotalDays > 7)
                    //{
                    //    Response.Write("<script >alert('Dữ liệu đã quá 7 ngày, không được phép xóa!')</script>");
                    //}
                    //else
                    {
                        info.Delete();
                        DataTable nTable = Ward_Data.GetList(nPageSize, nPageNumber, txtSearch.Text, DDLDistrict.SelectedValue.ToInt());
                        if (nTable.Rows.Count == 0)
                        {
                            nTable.Rows.Add(0, 0, 0, "", "");//, 0, "", 0, "", 0, "");
                        }
                        GV_Ward.DataSource = nTable;
                        GV_Ward.DataBind();
                        LoadPages();
                    }
                }
                catch
                {
                    Response.Write("<script >alert('Có lỗi gì đó vui lòng thử lại!')</script>");
                }
            }
        }