protected void Page_Load(object sender, EventArgs e) { try { txtHop.Attributes.Add("OnKeyPress", "if (event.keyCode == 13) {" + ClientScript.GetPostBackEventReference(txtHop, String.Empty) + "}"); logic = new VanBanHoSoLogic(); attachLogic = new AttachmentLogic(); lstCoQuan = logic.getAllCoQuan(); lstDoMat = logic.getAllDoMat(); lstLoaiVanBan = logic.getAllLoaiVanBan(); dgvApprover.PageSize = Constants.GRIDVIEW_PAGE_SIZE; if (!IsPostBack) { string hoSoId = Request["HoSoID"]; string phongId = Request["PhongID"]; string hop = Request["Hop"]; hidPageIndex.Value = "1"; hidHoSoID.Value = hoSoId; if (hoSoId != null && hoSoId.Trim().Length > 0) { Su_HoSo hoSoObj = logic.findHoSoById(hoSoId); if (hoSoObj != null) { string maP = hoSoObj.MaPhong; Su_PhongLuuTru phongObj = logic.findPhongByMaPhong(maP); if (phongObj != null) { phongId = phongObj.MaPhong; } hop = hoSoObj.HopSo; } } resetField(phongId, hop, hoSoId); currentHS = hoSoId; } else { Control postBackCtrl = GetPostBackControl(Page); if (postBackCtrl != null && "txtHop".Equals(postBackCtrl.ID)) { string phongId = ddlPhong.SelectedValue; string hop = txtHop.Text; string hoSoId = ""; resetField(phongId, hop, hoSoId); } } Int32.TryParse(hidPageIndex.Value, out pageIndex); if (currentHS != null && currentHS.Trim().Length > 0) { loadDataToGridView(currentHS); } } catch (Exception ex) { logger.Error("PageLoad error: ", ex); Response.Redirect("~/ThongBaoLoi.aspx", false); } }
private void resetField(string phong, string hop, string hoSo) { lstPhong = logic.getAllPhong(); ddlPhong.Items.Clear(); ddlPhong.DataSource = lstPhong; ddlPhong.DataTextField = "TenPhong"; ddlPhong.DataValueField = "MaPhong"; ddlPhong.DataBind(); if (phong != null && phong.Trim().Length > 0) { ddlPhong.SelectedValue = phong; } else { ddlPhong.SelectedValue = "0"; } logger.Info("QLVanBanHoSo search HS by phong: " + phong + "; and Hop: " + hop); lstHoSo = logic.findHoSoByPhongHop(phong, hop); logger.Info("QLVanBanHoSo search HS result: " + lstHoSo.Count.ToString()); ddlHoSo.Items.Clear(); ddlHoSo.DataSource = lstHoSo; ddlHoSo.DataTextField = "HoSoSo"; ddlHoSo.DataValueField = "ID"; ddlHoSo.DataBind(); if (hoSo != null && hoSo.Trim().Length > 0) { logger.Info("QLVanBanHoSo hoSo: " + hoSo); ddlHoSo.SelectedValue = hoSo; Su_HoSo tempHs = logic.findHoSoById(hoSo); if (tempHs != null) { txtHop.Text = tempHs.HopSo; } } else { ddlHoSo.SelectedValue = "0"; txtHop.Text = hop; dgvApprover.DataSource = null; dgvApprover.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { try { string id = Request["ObjectID"]; string type = Request["ObjectType"]; string idRoot = Request["RootId"]; int iId = 0; Int32.TryParse(id, out iId); hidId.Value = id; hidPrefix.Value = type; if (idRoot != null) { hidRootId.Value = idRoot; } //load dropbox bindingDDLs(); if (AttachmentLogic.ATTACHMENT_TYPE_HS.Equals(type)) { try { curHoSo = dataContext.Su_HoSos.Where(p => p.ID == iId).First(); row1VB.Visible = false; row2VB.Visible = false; row3VB.Visible = false; vbTaiLieu.Visible = false; ddlCoQuan.SelectedValue = curHoSo.Coquan; ddlPhong.SelectedValue = curHoSo.MaPhong; ddlMucLuc.SelectedValue = curHoSo.MucLucSo; txtHoSoSo.Text = curHoSo.HoSoSo; //txtKyHieu.Text = curHoSo.KyHieu; //txtSoluongto.Text = curHoSo.SoLuong; } catch (Exception ex) { logger.Error("Page_Load error: ", ex); } } else if (AttachmentLogic.ATTACHMENT_TYPE_VB.Equals(type)) { try { curVanBan = dataContext.Su_VanbanTrongHoSos.Where(p => p.ID == iId).First(); int hsId = 0; Int32.TryParse(curVanBan.Hoso_ID, out hsId); curHoSo = dataContext.Su_HoSos.Where(p => p.ID == hsId).First(); ddlCoQuan.SelectedValue = curHoSo.Coquan; ddlPhong.SelectedValue = curHoSo.MaPhong; ddlMucLuc.SelectedValue = curHoSo.MucLucSo; txtHoSoSo.Text = curHoSo.HoSoSo; txtKyHieu.Text = curVanBan.KyHieuVanBan; txtSoluongto.Text = curVanBan.SoLuongTo; vbHoSo.Visible = false; } catch (Exception ex) { logger.Error("Page_Load error: ", ex); } } else { throw new Exception("Request data error"); } List <Su_Attachment> lstAttach = logic.getAttachment(type, iId); rptDocs.DataSource = lstAttach; rptDocs.DataBind(); } catch (Exception ex) { logger.Error("Page load error: ", ex); Response.Redirect("~/ThongBaoLoi.aspx", false); } }