コード例 #1
0
 protected void onDgvDatabind(object sender, GridViewRowEventArgs e)
 {
     try
     {
         if (e.Row.RowType == DataControlRowType.DataRow)
         {
             DataRowView item = (DataRowView)e.Row.DataItem;
             if (item != null)
             {
                 int id = (int)item["ID"];
                 List <Su_Attachment> lstAttachment = attachLogic.getAttachment(AttachmentLogic.ATTACHMENT_TYPE_VB, id);
                 Repeater             rpt           = (Repeater)e.Row.FindControl("rptAttachment");
                 if (rpt != null)
                 {
                     rpt.DataSource = lstAttachment;
                     rpt.DataBind();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         logger.Error("Dgv data bind error: ", ex);
         Response.Redirect("~/ThongBaoLoi.aspx", false);
     }
 }
コード例 #2
0
        //private List<su_dinhkiemvanban> lstAttachment = new List<su_dinhkiemvanban>();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                try
                {
                    bindingDDLs();
                    if (Session[VanBanTrongHoSoLogic.SESSION_SEC_ID] != null)
                    {
                        btAddApprover.Text = "Cập nhật";
                        ldhead.InnerText   = "CHI TIẾT VĂN BẢN TRONG HỒ SƠ";

                        sec = um.getVanBanTrongHoSo(Int32.Parse(Session[VanBanTrongHoSoLogic.SESSION_SEC_ID].ToString()));
                        if (sec != null)
                        {
                            ddlCoQuan.SelectedValue      = sec.Coquan;
                            ddlPhong.SelectedValue       = sec.MaPhong;
                            ddlMucLuc.SelectedValue      = sec.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;
                            // fileUrl = "http://" +  Request.Url.Host + ":" + Request.Url.Port + "/files/" + sec.FilePath;
                            //fileUrl = "files/" + sec.FilePath;
                            //fileName = sec.FilePath;
                            List <Su_Attachment> lstAttach = attachLogic.getAttachment(AttachmentLogic.ATTACHMENT_TYPE_VB, sec.ID);
                            rptDocs.DataSource = lstAttach;
                            rptDocs.DataBind();
                        }
                    }
                    else
                    {
                        ldhead.InnerText = "THÊM MỚI VĂN BẢN TRONG HỒ SƠ";
                        sec = new VanBanTrongHoSo();
                    }
                }
                catch (Exception ex)
                {
                    Logger.logmessage(classobject, "Page_Load", ex.Message + ex.StackTrace);  Response.Redirect("~/ThongBaoLoi.aspx", false);
                }
            }
        }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
        protected void onDgvDatabind(object sender, GridViewRowEventArgs e)
        {
            try
            {
                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    Su_VanbanTrongHoSo item = (Su_VanbanTrongHoSo)e.Row.DataItem;
                    if (item != null)
                    {
                        List <Su_Attachment> lstAttachment = attachLogic.getAttachment(AttachmentLogic.ATTACHMENT_TYPE_VB, item.ID);
                        Repeater             rpt           = (Repeater)e.Row.Cells[6].FindControl("rptAttachment");
                        if (rpt != null)
                        {
                            rpt.DataSource = lstAttachment;
                            rpt.DataBind();
                        }
                        Label lblCoQuan = null, lblLoaiVanBan = null, lblDoMat = null, lblSTT = null;
                        lblCoQuan     = (Label)e.Row.FindControl("lblCoQuan");
                        lblLoaiVanBan = (Label)e.Row.FindControl("lblLoaiVanBan");
                        lblDoMat      = (Label)e.Row.FindControl("lblDoMat");
                        lblSTT        = (Label)e.Row.FindControl("lblSTT");
                        if (lblSTT != null)
                        {
                            stt++;
                            lblSTT.Text = stt.ToString();
                        }
                        if (lblCoQuan != null)
                        {
                            lblCoQuan.Text = item.TacGia;
                            //foreach (Su_CoQuanLuuTru cq in lstCoQuan)
                            //{
                            //    if (cq.Code.Equals(item.CoQuan))
                            //    {
                            //        lblCoQuan.Text = cq.Name;
                            //        break;
                            //    }
                            //}
                        }
                        if (lblLoaiVanBan != null)
                        {
                            foreach (Su_LoaiVanban cq in lstLoaiVanBan)
                            {
                                if (cq.ID.ToString().Equals(item.LoaiVanBan))
                                {
                                    lblLoaiVanBan.Text = cq.Name;
                                    break;
                                }
                            }
                        }
                        if (lblDoMat != null)
                        {
                            foreach (Su_DoMat cq in lstDoMat)
                            {
                                if (cq.ID.ToString().Equals(item.DoMat))
                                {
                                    lblDoMat.Text = cq.Name;
                                    break;
                                }
                            }
                        }
                    }
                }
                else if (e.Row.RowType == DataControlRowType.Pager)
                {
                    e.Row.Visible = true;
                    DropDownList pageList  = (DropDownList)e.Row.FindControl("PageDropDownList");
                    Label        pageLabel = (Label)e.Row.FindControl("CurrentPageLabel");

                    if (pageList != null)
                    {
                        // Create the values for the DropDownList control based on
                        // the  total number of pages required to display the data
                        // source.
                        for (int i = 0; i < pageCount; i++)
                        {
                            // Create a ListItem object to represent a page.
                            int      pageNumber = i + 1;
                            ListItem li         = new ListItem(pageNumber.ToString());

                            // If the ListItem object matches the currently selected
                            // page, flag the ListItem object as being selected. Because
                            // the DropDownList control is recreated each time the pager
                            // row gets created, this will persist the selected item in
                            // the DropDownList control.
                            if (i == pageIndex - 1)
                            {
                                li.Selected = true;
                            }

                            // Add the ListItem object to the Items collection of the
                            // DropDownList.
                            pageList.Items.Add(li);
                        }
                    }

                    if (pageLabel != null)
                    {
                        // Calculate the current page number.
                        int currentPage = pageIndex;

                        // Update the Label control with the current page information.
                        pageLabel.Text = "Page " + currentPage.ToString() +
                                         " of " + pageCount;
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("Dgv data bind error: ", ex);
                Response.Redirect("~/ThongBaoLoi.aspx", false);
            }
        }
コード例 #5
0
        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);
                }
            }
        }
コード例 #6
0
        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);
            }
        }