protected void SaveInfo() { PostharvestHandling_Info info = new PostharvestHandling_Info(int.Parse(txtKey.Text)); info.Datetime = DateTime.ParseExact(txtDatetime.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture); info.SeedsKey = DDLSeeds.SelectedValue.ToInt(); info.Method = txtMethod.Text; info.MemberKey = Session["EmployeeKey"].ToInt(); info.Save(); }
protected void LoadInfo(int Key) { PostharvestHandling_Info info = new PostharvestHandling_Info(Key); if (Key == 0) { DateTime time = DateTime.Now; txtDatetime.Text = time.ToString("dd/MM/yyyy"); } else { txtDatetime.Text = info.Datetime.ToString("dd/MM/yyyy"); } txtMethod.Text = info.Method; DDLSeeds.SelectedValue = info.SeedsKey.ToString(); }
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("CU0013"); 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()); PostharvestHandling_Info info = new PostharvestHandling_Info(mKey); if ((DateTime.Now - info.Datetime).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 = PostharvestHandling_Data.GetList(Convert.ToInt16(Session["EmployeeKey"]), nPageSize, nPageNumber, DDLSeeds.SelectedValue.ToInt()); if (nTable.Rows.Count == 0) { nTable.Rows.Add("", 0, 0, 0, "", null); } GV_PostharvestHandling.DataSource = nTable; GV_PostharvestHandling.DataBind(); LoadPages(); } } catch { Response.Write("<script >alert('Có lỗi gì đó vui lòng thử lại!')</script>"); } } }