private HoSoViewModel GetHoSo(HoSo x) { var autoList = LocalHops(GetHops()); var model = new HoSoViewModel { Id = x.Id, BienMucHoSo = x.BienMucHoSo, GhiChu = x.GhiChu, PhongLuuTru = x.PhongLuuTru, LoaiHoSo = x.LoaiHoSo, HoSoCons = x.HoSoCons, TapHoSo = x.TapHoSo, TinhTrang = x.TinhTrang, ThoiGianBaoQuan = x.ThoiGianBaoQuan, User = x.User, TaiLieuVanBans = x.TaiLieuVanBans, NgayTao = x.NgayTao, NgayCapNhat = x.NgayCapNhat, TrangThai = x.TrangThai, Hop = x.Hop, HopId = autoList.FirstOrDefault(p => p.Id == x.HopId).Text, LoaiHoSoId = x.LoaiHoSoId, TapHoSoId = x.TapHoSoId, UserId = x.UserId }; return(model); }
public int Update(HoSo obj) { SqlParameter[] para = { new SqlParameter("IDHoSo", obj.IDHoSo), new SqlParameter("SoThe", obj.SoThe), new SqlParameter("HoDem", obj.HoDem), new SqlParameter("Ten", obj.Ten), new SqlParameter("NgaySinh", obj.NgaySinh), new SqlParameter("GioiTinh", obj.GioiTinh), new SqlParameter("SDT", obj.SDT), new SqlParameter("IDDanToc", obj.IDDanToc), new SqlParameter("IDTonGiao", obj.IDTonGiao), new SqlParameter("IDTrinhDoVH", obj.IDTrinhDoVH), new SqlParameter("IDTrinhDo", obj.IDTrinhDo), new SqlParameter("IDDonVi", obj.IDDonVi), new SqlParameter("IDDoiTuong", obj.IDDoiTuong), new SqlParameter("IDNgoaiNgu", obj.IDNgoaiNgu), new SqlParameter("ChieuCao", obj.ChieuCao), new SqlParameter("CanNang", obj.CanNang), new SqlParameter("LinkAnhCaNhan", obj.LinkAnhCaNhan), new SqlParameter("CMT", obj.CMT), }; return(base.ExecuteSQL("HoSo_Update", para)); }
public ActionResult DeleteConfirmed(int id) { HoSo hoSo = db.HoSoes.Find(id); db.HoSoes.Remove(hoSo); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult EditHoSo(string id) { using (QUANGHANHABCEntities db = new QUANGHANHABCEntities()) { HoSo hoSo = db.HoSoes.Where(x => x.MaNV == id).FirstOrDefault <HoSo>(); return(View(hoSo)); } }
public ActionResult Edit([Bind(Include = "id,NgayTao,DichVu,GhiChu,BenhNhan_id")] HoSo hoSo) { if (ModelState.IsValid) { db.Entry(hoSo).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.BenhNhan_id = new SelectList(db.BenhNhans, "id", "TenBN", hoSo.BenhNhan_id); return(View(hoSo)); }
protected bool validateObject(HoSo sec) { bool result = true; if (!um.validateSecNameNull(sec.TieuDe)) { result = false; Response.Write("<script language='javascript'> { alert('Tiêu đề không được phép để trống');}</script>"); } return(result); }
public ActionResult Edit([Bind(Include = "IDHoSo,IDBenhNhan,IDBacSi,NgayKham,KetQua,GhiChu")] HoSo hoSo) { if (ModelState.IsValid) { db.Entry(hoSo).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.IDBacSi = new SelectList(db.Bacsis, "IDBacsi", "HoTen", hoSo.IDBacSi); ViewBag.IDBenhNhan = new SelectList(db.BenhNhans, "IDBenhNhan", "HoTen", hoSo.IDBenhNhan); return(View(hoSo)); }
public ActionResult EditHoSo(HoSo hoSo) { using (QUANGHANHABCEntities db = new QUANGHANHABCEntities()) { if (hoSo != null) { db.Entry(hoSo).State = EntityState.Modified; db.SaveChanges(); } return(RedirectToAction("listAllHoSo")); } }
public ActionResult Create([Bind(Include = "id,NgayTao,DichVu,GhiChu,BenhNhan_id")] HoSo hoSo) { if (ModelState.IsValid) { db.HoSos.Add(hoSo); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.BenhNhan_id = new SelectList(db.BenhNhans, "id", "TenBN", hoSo.BenhNhan_id); return(View(hoSo)); }
// GET: Admin/HoSoes/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } HoSo hoSo = db.HoSoes.Find(id); if (hoSo == null) { return(HttpNotFound()); } return(View(hoSo)); }
// GET: Admin/HoSoes/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } HoSo hoSo = db.HoSos.Find(id); if (hoSo == null) { return(HttpNotFound()); } ViewBag.BenhNhan_id = new SelectList(db.BenhNhans, "id", "TenBN", hoSo.BenhNhan_id); return(View(hoSo)); }
// GET: Admin/HoSoes/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } HoSo hoSo = db.HoSoes.Find(id); if (hoSo == null) { return(HttpNotFound()); } ViewBag.IDBacSi = new SelectList(db.Bacsis, "IDBacsi", "HoTen", hoSo.IDBacSi); ViewBag.IDBenhNhan = new SelectList(db.BenhNhans, "IDBenhNhan", "HoTen", hoSo.IDBenhNhan); return(View(hoSo)); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { try { bindingDDLs(); if (Session[HoSoLogic.SESSION_SEC_ID] != null) { btAddApprover.Text = "Cập nhật"; ldhead.InnerText = "CHI TIẾT HỒ SƠ"; sec = um.getHoSo(Int32.Parse(Session[HoSoLogic.SESSION_SEC_ID].ToString())); if (sec != null) { ddlCoQuan.SelectedValue = sec.Coquan; ddlPhong.SelectedValue = sec.MaPhong; ddlMucLuc.SelectedValue = sec.MucLucSo; ddlHopSo.SelectedValue = sec.HopSo; txtHoSoSo.Text = sec.HoSoSo; ddlNgonNgu.SelectedValue = sec.NgonNgu; txtKyHieu.Text = sec.KyHieu; txtTieude.Text = sec.TieuDe; txtGhiChu.Text = sec.GhiChu; txtThoiGianBatDau.Text = sec.ThoiGianBatDau; txtThoiGiankT.Text = sec.ThoiGianKetThuc; txtButtich.Text = sec.ButTich; txtSoluongto.Text = sec.SoLuong; ddlThoiHan.SelectedValue = sec.ThoiHanBaoQuan; ddlChedoSD.SelectedValue = sec.CheDoSuDung; ddlTinhTrang.SelectedValue = sec.TinhTrangVatLy; } } else { ldhead.InnerText = "THÊM MỚI HỒ SƠ"; sec = new HoSo(); } } catch (Exception ex) { Logger.logmessage(classobject, "Page_Load", ex.Message + ex.StackTrace); Response.Redirect("~/ThongBaoLoi.aspx", false); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { try { bindingDDLs(); if (Request.QueryString["hid"] != null) { hs = hsLogic.getHoSo(Int32.Parse(Request.QueryString["hid"].ToString())); hidHoSo.Value = Request.QueryString["hid"].ToString(); ddlCoQuan.SelectedValue = hs.Coquan; txtMucLuc.Text = hs.MucLucSo; ddlPhong.SelectedValue = hs.MaPhong; txtHoSoSo.Text = hs.HoSoSo; } if (Session[VanBanTrongHoSoLogic.SESSION_SEC_ID] != null) { btAddApprover.Text = "Cập nhật tiếp tục đính kèm"; ldhead.InnerText = "CHỈNH SỬA VĂN BẢN TRONG HỒ SƠ"; sec = um.getVanBanTrongHoSo(Int32.Parse(Session[VanBanTrongHoSoLogic.SESSION_SEC_ID].ToString())); if (sec != null) { hidHoSo.Value = sec.Hoso_ID; ddlCoQuan.SelectedValue = sec.Coquan; ddlPhong.SelectedValue = sec.MaPhong; txtMucLuc.Text = hs.MucLucSo; ddlNgonNgu.SelectedValue = sec.NgonNgu; txtHoSoSo.Text = sec.HoSoSo; txtKyHieu.Text = sec.KyHieuVanBan; txtGhiChu.Text = sec.GhiChu; txtButtich.Text = sec.ButTich; txtSoluongto.Text = sec.SoLuongTo; txtThoiGian.Text = sec.ThoiGian; txtKyhieuThongtin.Text = sec.KiHieuThongTin; txtToSo.Text = sec.ToSo; txtTrichYeu.Text = sec.TrichYeu; txtTacgia.Text = sec.TacGia; ddlLoaivanban.SelectedValue = sec.LoaiVanBan; ddlMucDoTinCay.SelectedValue = sec.MucDoTinCay; ddlDomat.SelectedValue = sec.DoMat; ddlTinhTrang.SelectedValue = sec.TinhTrangVatLy; List <Su_Attachment> lstAttach = attachLogic.getAttachment(AttachmentLogic.ATTACHMENT_TYPE_VB, sec.ID); dgvAttachment.DataSource = lstAttach; dgvAttachment.DataBind(); if (sec.ThoiHanBaoQuan != null && sec.ThoiHanBaoQuan.Length > 0) { ddlThoiHan.SelectedValue = sec.ThoiHanBaoQuan; } } else { string mss = HtmlUtil.getErrorTag("Không tìm thấy văn bản."); Logger.logmessage(classobject, "Page_Load", "Khong tim thay van ban: " + Session[VanBanTrongHoSoLogic.SESSION_SEC_ID].ToString()); } } else { ldhead.InnerText = "THÊM MỚI VĂN BẢN TRONG HỒ SƠ"; sec = new VanBanTrongHoSo(); if (Session[VanBanTrongHoSoLogic.SESSION_VANBAN_CACHE] != null) { VanBanTrongHoSo temp = (VanBanTrongHoSo)Session[VanBanTrongHoSoLogic.SESSION_VANBAN_CACHE]; if (temp != null) { txtKyhieuThongtin.Text = temp.KiHieuThongTin; txtSoluongto.Text = temp.SoLuongTo; txtThoiGian.Text = temp.ThoiGian; if (temp.NgonNgu != null && temp.NgonNgu.Length > 0) { ddlNgonNgu.SelectedValue = temp.NgonNgu; } txtToSo.Text = temp.ToSo; txtTrichYeu.Text = temp.TrichYeu; if (temp.LoaiVanBan != null && temp.LoaiVanBan.Length > 0) { ddlLoaivanban.SelectedValue = temp.LoaiVanBan; } if (temp.DoMat != null && temp.DoMat.Length > 0) { ddlDomat.SelectedValue = temp.DoMat; } txtTacgia.Text = temp.TacGia; txtButtich.Text = temp.ButTich; if (temp.MucDoTinCay != null && temp.MucDoTinCay.Length > 0) { ddlMucDoTinCay.SelectedValue = temp.MucDoTinCay; } if (temp.ThoiHanBaoQuan != null && temp.ThoiHanBaoQuan.Length > 0) { ddlThoiHan.SelectedValue = temp.ThoiHanBaoQuan; } txtGhiChu.Text = temp.GhiChu; if (temp.TinhTrangVatLy != null && temp.TinhTrangVatLy.Length > 0) { ddlTinhTrang.SelectedValue = temp.TinhTrangVatLy; } } } } } catch (Exception ex) { Logger.logmessage(classobject, "Page_Load", ex.Message + ex.StackTrace); Response.Redirect("~/ThongBaoLoi.aspx", false); } } }
protected void btAddApprover_Click(object sender, EventArgs e) { try { if (!isUpdate()) { sec = new HoSo(); sec.Coquan = ddlCoQuan.SelectedValue; sec.MaPhong = ddlPhong.SelectedValue; sec.MucLucSo = txtMucLuc.Text; sec.HopSo = txtHopSo.Text; sec.HoSoSo = txtHoSoSo.Text; sec.NgonNgu = ddlNgonNgu.SelectedValue; sec.KyHieu = txtKyHieu.Text; sec.TieuDe = txtTieude.Text; sec.GhiChu = txtGhiChu.Text; sec.ThoiGianBatDau = Request.Form[txtThoiGianBatDau.UniqueID]; sec.ThoiGianKetThuc = Request.Form[txtThoiGiankT.UniqueID]; sec.ButTich = txtButtich.Text; sec.SoLuong = txtSoluongto.Text; sec.ThoiHanBaoQuan = ddlThoiHan.SelectedValue; sec.CheDoSuDung = ddlChedoSD.SelectedValue; sec.TinhTrangVatLy = ddlTinhTrang.SelectedValue; } else { sec = um.getHoSo(Int32.Parse(Session[HoSoLogic.SESSION_SEC_ID].ToString())); sec.Coquan = ddlCoQuan.SelectedValue; sec.MaPhong = ddlPhong.SelectedValue; sec.MucLucSo = txtMucLuc.Text; sec.HopSo = txtHopSo.Text; sec.HoSoSo = txtHoSoSo.Text; sec.NgonNgu = ddlNgonNgu.SelectedValue; sec.KyHieu = txtKyHieu.Text; sec.TieuDe = txtTieude.Text; sec.GhiChu = txtGhiChu.Text; sec.ThoiGianBatDau = Request.Form[txtThoiGianBatDau.UniqueID]; sec.ThoiGianKetThuc = Request.Form[txtThoiGiankT.UniqueID]; sec.ButTich = txtButtich.Text; sec.SoLuong = txtSoluongto.Text; sec.ThoiHanBaoQuan = ddlThoiHan.SelectedValue; sec.CheDoSuDung = ddlChedoSD.SelectedValue; sec.TinhTrangVatLy = ddlTinhTrang.SelectedValue; } if (!isUpdate()) { if (validateObject(sec)) { int newId = um.addHoSo(sec); sec.ID = newId; if (fulAttach.HasFile) { string filePath = attachLogic.createAttachment(Server.MapPath("~/files"), AttachmentLogic.ATTACHMENT_TYPE_HS, fulAttach.PostedFile.FileName, fulAttach, newId); Logger.logmessage(classobject, "btAddApprover_Click", "Attach success " + fulAttach.PostedFile.FileName); } } else { Logger.logmessage(classobject, "btAddApprover_Click", "Ho so validate fail " + sec.HoSoSo); } // listAllSec(); } else { if (validateObject(sec)) { sec.ID = Int32.Parse(SecID); um.updateHoSo(sec); if (fulAttach.HasFile) { string filePath = attachLogic.createAttachment(Server.MapPath("~/files"), AttachmentLogic.ATTACHMENT_TYPE_HS, fulAttach.PostedFile.FileName, fulAttach, sec.ID); Logger.logmessage(classobject, "btAddApprover_Click", "Attach success " + fulAttach.PostedFile.FileName); } //Xóa đính kèm foreach (GridViewRow r in dgvAttachment.Rows) { if (r.RowType == DataControlRowType.DataRow) { CheckBox chkDel = (CheckBox)r.FindControl("chkDeleteAttachment"); if (chkDel != null && chkDel.Checked) { int k = 0; string sK = dgvAttachment.DataKeys[r.RowIndex].Value.ToString(); Int32.TryParse(sK, out k); attachLogic.deleteAttachmentFromHoSo(sec.ID, k); } } } } else { Logger.logmessage(classobject, "btAddApprover_Click", "Ho so validate fail " + sec.HoSoSo); } } if (chkUploadMore.Checked) { Response.Redirect("QLFileDinhKem.aspx?ObjectID=" + sec.ID.ToString() + "&ObjectType=" + AttachmentLogic.ATTACHMENT_TYPE_HS, false); } else { Response.Redirect("QLHoSo.aspx", false); } } catch (Exception ex) { Logger.logmessage(classobject, "btAddApprover_Click", ex.Message + ex.StackTrace); Response.Redirect("~/ThongBaoLoi.aspx", false); } }
protected void btAddApprover_Click(object sender, EventArgs e) { try { if (!isUpdate()) { sec = new HoSo(); sec.Coquan = ddlCoQuan.SelectedValue; sec.MaPhong = ddlPhong.SelectedValue; sec.MucLucSo = ddlMucLuc.SelectedValue; sec.HopSo = ddlHopSo.SelectedValue; sec.HoSoSo = txtHoSoSo.Text; sec.NgonNgu = ddlNgonNgu.SelectedValue; sec.KyHieu = txtKyHieu.Text; sec.TieuDe = txtTieude.Text; sec.GhiChu = txtGhiChu.Text; sec.ThoiGianBatDau = txtThoiGianBatDau.Text; sec.ThoiGianKetThuc = txtThoiGiankT.Text; sec.ButTich = txtButtich.Text; sec.SoLuong = txtSoluongto.Text; sec.ThoiHanBaoQuan = ddlThoiHan.SelectedValue; sec.CheDoSuDung = ddlChedoSD.SelectedValue; sec.TinhTrangVatLy = ddlTinhTrang.SelectedValue; } else { sec.Coquan = ddlCoQuan.SelectedValue; sec.MaPhong = ddlPhong.SelectedValue; sec.MucLucSo = ddlMucLuc.SelectedValue; sec.HopSo = ddlHopSo.SelectedValue; sec.HoSoSo = txtHoSoSo.Text; sec.NgonNgu = ddlNgonNgu.SelectedValue; sec.KyHieu = txtKyHieu.Text; sec.TieuDe = txtTieude.Text; sec.GhiChu = txtGhiChu.Text; sec.ThoiGianBatDau = txtThoiGianBatDau.Text; sec.ThoiGianKetThuc = txtThoiGiankT.Text; sec.ButTich = txtButtich.Text; sec.SoLuong = txtSoluongto.Text; sec.ThoiHanBaoQuan = ddlThoiHan.SelectedValue; sec.CheDoSuDung = ddlChedoSD.SelectedValue; sec.TinhTrangVatLy = ddlTinhTrang.SelectedValue; } if (!isUpdate()) { if (validateObject(sec)) { um.addHoSo(sec); } // listAllSec(); } else { if (validateObject(sec)) { sec.ID = Int32.Parse(SecID); um.updateHoSo(sec); } } Response.Redirect("QLHoSo.aspx", false); } catch (Exception ex) { Logger.logmessage(classobject, "btAddApprover_Click", ex.Message + ex.StackTrace); Response.Redirect("~/ThongBaoLoi.aspx", false); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { try { bindingDDLs(); string selectedPhong = Request["phongCode"]; if (Session[HoSoLogic.SESSION_SEC_ID] != null) { btAddApprover.Text = "Cập nhật"; ldhead.InnerText = "CHỈNH SỬA HỒ SƠ"; sec = um.getHoSo(Int32.Parse(Session[HoSoLogic.SESSION_SEC_ID].ToString())); hidIdPhong.Value = sec.ID.ToString(); if (sec != null) { ddlCoQuan.SelectedValue = sec.Coquan; ddlPhong.SelectedValue = sec.MaPhong; //ddlMucLuc.SelectedValue = sec.MucLucSo; txtMucLuc.Text = sec.MucLucSo; txtHopSo.Text = sec.HopSo; txtHoSoSo.Text = sec.HoSoSo; ddlNgonNgu.SelectedValue = sec.NgonNgu; txtKyHieu.Text = sec.KyHieu; txtTieude.Text = sec.TieuDe; txtGhiChu.Text = sec.GhiChu; txtThoiGianBatDau.Text = sec.ThoiGianBatDau; txtThoiGiankT.Text = sec.ThoiGianKetThuc; txtButtich.Text = sec.ButTich; txtSoluongto.Text = sec.SoLuong; ddlThoiHan.SelectedValue = sec.ThoiHanBaoQuan; ddlChedoSD.SelectedValue = sec.CheDoSuDung; ddlTinhTrang.SelectedValue = sec.TinhTrangVatLy; //loadDatabase List <Su_Attachment> lstAttach = attachLogic.getAttachment(AttachmentLogic.ATTACHMENT_TYPE_HS, sec.ID); dgvAttachment.DataSource = lstAttach; dgvAttachment.DataBind(); } } else { ldhead.InnerText = "THÊM MỚI HỒ SƠ"; if (selectedPhong != null && selectedPhong.Trim().Length > 0) { ddlPhong.SelectedValue = selectedPhong; } sec = new HoSo(); } } catch (Exception ex) { Logger.logmessage(classobject, "Page_Load", ex.Message + ex.StackTrace); Response.Redirect("~/ThongBaoLoi.aspx", false); } } else { int tId = 0; Int32.TryParse(hidIdPhong.Value, out tId); sec = um.getHoSo(tId); } }