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("CA0012"); 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()); Companies_Purchase_Info info = new Companies_Purchase_Info(mKey); info.Delete(); DataTable nTable = Companies_Purchase_Data.GetList(nPageSize, nPageNumber, txtSearch.Text); GV_Companie.DataSource = nTable; GV_Companie.DataBind(); LoadPages(); } catch { Response.Write("<script >alert('Có lỗi gì đó vui lòng thử lại!')</script>"); } } }
protected void LoadInfo(int Key) { Companies_Purchase_Info info = new Companies_Purchase_Info(Key); txtCompanyName.Text = info.CompanyName; txtAdddress.Text = info.Address; txtCity.Text = info.City; DLLCountry.SelectedValue = info.Country; }
protected void SaveInfo() { Companies_Purchase_Info info = new Companies_Purchase_Info(int.Parse(txtKey.Text)); info.CompanyName = txtCompanyName.Text; info.Address = txtAdddress.Text; info.City = txtCity.Text; info.Country = DLLCountry.SelectedValue; info.Save(); }