Example #1
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("CA0004");
            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());
                    Environment_Info info = new Environment_Info(mKey);
                    info.Delete();
                    DataTable nTable = Environments_Data.GetList(nPageSize, nPageNumber, txtSearch.Text);
                    GV_Environments.DataSource = nTable;
                    GV_Environments.DataBind();
                }
                catch
                {
                    Response.Write("<script >alert('Có lỗi gì đó vui lòng thử lại!')</script>");
                }
            }
        }
Example #2
0
        private void LoadData()
        {
            int       nPageNumber = int.Parse(txtPageNumber.Text);
            int       nPageSize   = int.Parse(txtPageSize.Text);
            DataTable nTable      = Environments_Data.GetList(nPageSize, nPageNumber, txtSearch.Text);

            GV_Environments.DataSource = nTable;
            GV_Environments.DataBind();
            LoadPages();
        }
Example #3
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      = Environments_Data.GetList(nPageSize, 1, txtSearch.Text);

            GV_Environments.DataSource = nTable;
            GV_Environments.DataBind();
            LoadPages();
        }
Example #4
0
        protected void LoadPages()
        {
            int nPageNumber = int.Parse(txtPageNumber.Text);
            int nPageSize   = int.Parse(txtPageSize.Text);

            int nTotalRecord = Environments_Data.Count(txtSearch.Text);

            if (nTotalRecord > nPageSize)
            {
                PageNumbers.Visible = true;
                DataTable nTable = TNLibrary.WEB.LoadDataToToolboxWeb.LoadPageSize(nPageSize, nTotalRecord, nPageNumber);
                PageNumbers.SelectedIndex = (nPageNumber - 1) - (int.Parse(nTable.Rows[0][0].ToString()) - 1);
                PageNumbers.DataSource    = nTable;
                PageNumbers.DataBind();
            }
            else
            {
                PageNumbers.Visible = false;
            }
        }