コード例 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (IsPostBack) return;
     csBaoCao ob = new csBaoCao();
     string cmdText = string.Format("EXEC bc_getUsersByDonvi @userID={0}, @maDV=0", UserId);
     cmdText = "EXEC bc_getUsersByDonvi @userID=" + UserId;
     DataSet ds = ob.fillDataset(cmdText);
     ddDonVi.DataSource = ds.Tables[1];
     ddDonVi.DataBind();
     ddNguoiNhan.DataSource = ds.Tables[0];
     ddNguoiNhan.DataBind();
     //if (UserId > 0)
     //{
     //    ddNguoiNhan.DataSource = ob.fillDataset(cmdText);
     //    ddNguoiNhan.DataTextField = "DisplayName";
     //    ddNguoiNhan.DataValueField = "Username";
     //    ddNguoiNhan.DataBind();
     //}
     if (Request["reply"] != null)
     {
         tbNguoiNhan.Text = Request["reply"];
     }
     if (Request["forward"] != null)
     {
         cmdText = string.Format("EXEC bc_getsChiTietBC @userName='******', @idBC={1}", UserInfo.Username, Request["forward"]);
         ds = ob.fillDataset(cmdText);
         try
         {
             tbTieuDe.Text = ds.Tables[0].Rows[0][4].ToString();
             tbNoiDung.Text = ds.Tables[0].Rows[0][5].ToString();
             tbDinhKem.Text = ds.Tables[0].Rows[0][6].ToString();
         }
         catch { }
     }
 }
コード例 #2
0
 protected void ddDonVi_SelectedIndexChanged(object sender, EventArgs e)
 {
     csBaoCao ob = new csBaoCao();
     string cmd = string.Format("EXEC ChungNT.BC_getUsers '{0}'", ddDonVi.SelectedValue);
     ddNguoiNhan.DataSource = ob.fillDataset(cmd).Tables[0];
     ddNguoiNhan.DataBind();
 }
コード例 #3
0
 protected void bindData()
 {
     try
     {
         string view = Request["view"] == null ? "inbox" : Request["view"].ToLower();
         if (view == "inbox") cbMax.Visible = false;
         else
         {
             cbMax.Visible = true;
             view = cbMax.Checked ? "full" : "sent";
         }
         string cmdText = string.Format("EXEC ChungNT.BC_getBaoCao {0}, {1}, '{2}'", ModuleId, UserId, view);
         csBaoCao ob = new csBaoCao();
         DataSet ds = ob.fillDataset(cmdText);
         DataColumn dc = new DataColumn("LinkBC");
         ds.Tables[0].Columns.Add(dc);
         ds.Tables[0].AcceptChanges();
         foreach (DataRow dr in ds.Tables[0].Rows)
         {
             dr.BeginEdit();
             dr["LinkBC"] = DotNetNuke.Common.Globals.NavigateURL(TabId, "XEMBC", "mid/" + ModuleId + "/id/" + dr[0].ToString());
             dr.EndEdit();
         }
         gvBaoCao.DataSource = ds;
         gvBaoCao.DataBind();
     }
     catch { }
 }
コード例 #4
0
 protected void upload()
 {
     if (fileUpload.HasFile)
     {
         //if (fileUpload.PostedFile.ContentLength > 1048576)                             
         string ext = Path.GetExtension(fileUpload.FileName).ToUpper();
         if (ext == ".PDF" || ext == ".DOC" || ext == ".DOCX" || ext == ".XLS" || ext == ".XLSX" || ext == ".RAR")
         {
             try
             {
                 string cv_folder = string.Format(@"{0}{1}\", Server.MapPath(@"Portals\0\"), DateTime.Today.Year);
                 if (!Directory.Exists(cv_folder)) Directory.CreateDirectory(cv_folder);
                 //string my_filename = DateTime.Now.ToString("yyyyMMddHHmmss") + ext.ToLower();
                 csBaoCao ob = new csBaoCao();
                 string my_filename = ob.rewriteFilename(fileUpload.FileName);
                 fileUpload.SaveAs(cv_folder + my_filename);
                 if (tbDinhKem.Text.Length > 0) tbDinhKem.Text += ", ";
                 tbDinhKem.Text += string.Format("http://{0}{1}/Portals/0/{2}/{3}",
                     Request.Url.Host, Request.ApplicationPath, DateTime.Today.Year, my_filename);
             }
             catch (Exception ex) { lbError.Text = ex.Message; }
         }
         else lbError.Text = "Chỉ chấp nhận các định dạng pdf, doc, docx, xls, xlsx, rar";
     }
     else lbError.Text = "Chưa chọn file đính kèm";
 }
コード例 #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack) return;
            if (UserId < 1) Response.Redirect(DotNetNuke.Common.Globals.NavigateURL("Login"));
            csBaoCao ob = new csBaoCao();
            DataSet ds = ob.fillDataset("EXEC ChungNT.BC_getUsers 'ALL'");
            ddNguoiNhan.DataSource = ds.Tables[0];
            ddNguoiNhan.DataBind();
            ddDonVi.DataSource = ds.Tables[1];
            ddDonVi.DataBind();

            if (Request["reply"] != null) tbNguoiNhan.Text = Request["reply"];
            if (Request["forward"] != null)
                try
                {
                    lbForward.Text = Request["forward"];
                    string cmdText = string.Format("EXEC ChungNT.BC_getChiTiet {0}, {1}", lbForward.Text, UserId);
                    ds = ob.fillDataset(cmdText);
                    tbTieuDe.Text = ds.Tables[0].Rows[0][3].ToString();
                    tbNoiDung.Text = ds.Tables[0].Rows[0][4].ToString();
                    cmdText = string.Format("EXEC ChungNT.BC_getFiles {0}, {1}", lbForward.Text, UserId);
                    gvDinhKem.DataSource = ob.fillDataset(cmdText);
                    gvDinhKem.DataBind();

                    tbNoiDung.Enabled = false;
                    tbTieuDe.Enabled = false;
                    fileUpload.Enabled = false;
                    btThemFile.Visible = false;
                }
                catch { }
        }
コード例 #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (IsPostBack) return;
     string cmdText = string.Format("EXEC bc_getsChiTietBC @userName='******', @idBC={1}", UserInfo.Username, Request["idBC"]);
     csBaoCao ob = new csBaoCao();
     DataSet ds = ob.fillDataset(cmdText);
     try
     {
         hlChuyen.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "GuiBC", "mid/" + ModuleId + "/forward/" + ds.Tables[0].Rows[0][0].ToString());
         hlTraLoi.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "GuiBC", "mid/" + ModuleId + "/reply/" + ds.Tables[0].Rows[0][2].ToString());
         lbUserName.Text = ds.Tables[0].Rows[0][3].ToString();
         lbTieuDe.Text = ds.Tables[0].Rows[0][4].ToString();
         lbNoiDung.Text = ds.Tables[0].Rows[0][5].ToString();
         lbThoiGian.Text = "vào lúc " + ds.Tables[0].Rows[0][7].ToString();
     }
     catch (Exception ex) { lbTieuDe.Text = ex.Message; }
     // Tạo liên kết đến file đính kèm
     lbDinhKem.Text = "";
     string[] split = ds.Tables[0].Rows[0][6].ToString().Split(',');
     foreach (string s in split)
     {
         try
         {
             cmdText = "EXEC bc_getsFile " + int.Parse(s);
             if (lbDinhKem.Text.Length > 0) lbDinhKem.Text += "<br />";
             lbDinhKem.Text += string.Format("[+] <a href='{0}/DesktopModules/CNT.BaoCao/fileview.aspx?ID={1}' target='_blank'>{2}</a>",
               Request.ApplicationPath, int.Parse(s), ob.fillDataset(cmdText).Tables[0].Rows[0][0].ToString());                   
         }
         catch
         {
             if (lbDinhKem.Text.Length > 0) lbDinhKem.Text += "<br />";
             lbDinhKem.Text += string.Format("[+] <a href='{0}' target='_blank'>{0}</a>", s);
         }
     }
     // Hiện tên nhãn
     if (ds.Tables[0].Rows[0][1].ToString() == "$$$")
     {
         lbNhan.Text = "";
         lbNguoiGui.Text = "Gửi đến";
         btSave.Visible = false;
         ddNhan.Visible = false;
     }
     else
     {
         lbNhan.Text = ds.Tables[0].Rows[0][1].ToString();
         lbNguoiGui.Text = "Gửi từ";
         ddNhan.Visible = true;
         btSave.Visible = true;
         cmdText = "EXEC bc_getsNhan @userID=" + UserId;
         ds = ob.fillDataset(cmdText);
         DataRow dr = ds.Tables[0].NewRow();
         dr[0] = "0";
         dr[1] = "Chọn danh mục";
         ds.Tables[0].Rows.InsertAt(dr, 0);
         ddNhan.DataSource = ds;
         ddNhan.DataBind();
     }
 }
コード例 #7
0
 protected void getNhom()
 {
     csBaoCao ob = new csBaoCao();
     string cmdText = string.Format("EXEC [bc_getsNhom] @userID={0}, @nhomID=0", UserId);
     ddNhom.DataSource = ob.fillDataset(cmdText);
     ddNhom.DataTextField = "TenNhom";
     ddNhom.DataValueField = "IDNhom";
     ddNhom.DataBind();
 }
コード例 #8
0
 protected void btSave_Click(object sender, EventArgs e)
 {
     string cmdText = string.Format("update bc_BaoCao set TrangThai={0} where ID={1} and NguoiNhan='{2}'",
         ddNhan.SelectedValue, Request["idBC"], UserInfo.Username);
     csBaoCao ob = new csBaoCao();
     ob.fillDataset(cmdText);
     string ok = "inbox";
     if (ddNhan.SelectedValue != "0") ok = ddNhan.SelectedValue;
     Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(TabId, "", "view/" + ok));
 }
コード例 #9
0
 protected void btDanhMuc_Click(object sender, EventArgs e)
 {
     if (tbDanhMuc.Text.Trim().Length == 0)
         lbError.Text = "Chưa nhập tên danh mục";
     else
     {
         string cmdText = string.Format("EXEC [bc_setsNhan] @userID={0}, @tenNhan=N'{1}'", UserId, tbDanhMuc.Text);
         csBaoCao ob = new csBaoCao();
         ob.executeData(cmdText);
         tbDanhMuc.Text = "";
         lbError.Text = "Thêm danh mục thành công";
         getsNhanBC();
     }
 }
コード例 #10
0
 public void getsNhanBC()
 {
     string cmdText = "EXEC [bc_getsNhan] @userID=" + UserId;
     csBaoCao ob = new csBaoCao();
     DataSet ds = ob.fillDataset(cmdText);
     DataColumn dc = new DataColumn("LinkNhan");
     ds.Tables[0].Columns.Add(dc);
     ds.Tables[0].AcceptChanges();
     foreach (DataRow dr in ds.Tables[0].Rows)
     {
         dr.BeginEdit();
         dr["LinkNhan"] = DotNetNuke.Common.Globals.NavigateURL(TabId, "", "view/" + dr["IDNhan"].ToString());
         dr.EndEdit();
     }
     dlNhan.DataSource = ds;
     dlNhan.DataBind();
 }
コード例 #11
0
 protected void btTim_Click(object sender, EventArgs e)
 {
     if (tbTuNgay.Text.Trim() != "")
     {
         if (tbDenNgay.Text.Trim() == "")
         {
             lbError.Text = "Chưa nhập khoảng thời gian";
             return;
         }
         try
         {
             tbTuNgay.Text = DateTime.Parse(tbTuNgay.Text).ToString("yyyy-MM-dd");
             tbDenNgay.Text = DateTime.Parse(tbDenNgay.Text).ToString("yyyy-MM-dd");
         }
         catch
         {
             lbError.Text = "Định dạng ngày tháng không đúng";
             return;
         }
     }
     try
     {
         csBaoCao ob = new csBaoCao();
         string cmdText = string.Format("EXEC [bc_getsTimKiem] @userName = '******'", UserInfo.Username);
         if (tbNguoiGui.Text.Trim() != "") cmdText = string.Format("{0}, @nguoiGui = '{1}'", cmdText, tbNguoiGui.Text);
         if (tbNoiDung.Text.Trim() != "") cmdText = string.Format("{0}, @noiDung = N'%{1}%'", cmdText, tbNoiDung.Text);
         if (tbTuNgay.Text.Trim() != "") cmdText = string.Format("{0}, @tuNgay = '{1}', @denNgay = '{2}'", cmdText, tbTuNgay.Text, tbDenNgay.Text);
         DataSet ds = ob.fillDataset(cmdText);
         DataColumn dc = new DataColumn("LinkBC");
         ds.Tables[0].Columns.Add(dc);
         ds.Tables[0].AcceptChanges();
         foreach (DataRow dr in ds.Tables[0].Rows)
         {
             dr.BeginEdit();
             dr["LinkBC"] = DotNetNuke.Common.Globals.NavigateURL(TabId, "XemBC", "mid/" + ModuleId + "/idBC/" + dr[0].ToString());
             dr.EndEdit();
         }
         gvBaoCao.DataSource = ds;
         gvBaoCao.DataBind();
         lbError.Text = "";
     }
     catch (Exception ex)
     {
         lbError.Text = ex.Message;
     }
 }
コード例 #12
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (IsPostBack) return;
     if (Request["ID"] == null) return;
     try
     {
         csBaoCao ob = new csBaoCao();
         DataSet ds = ob.fillDataset("EXEC ChungNT.BC_getFile " + Request["ID"]);
         Response.Buffer = true;
         if (ds.Tables[0].Rows[0]["FileName"].ToString().ToLower().EndsWith(".pdf")) { }
         else
         {
             Response.ClearHeaders();
             Response.AddHeader("content-disposition", "attachment; filename=" + ds.Tables[0].Rows[0]["FileName"].ToString());
         }
         Response.ContentType = ds.Tables[0].Rows[0]["FileType"].ToString();
         Byte[] pdfData = (byte[])ds.Tables[0].Rows[0]["FileData"];
         Response.BinaryWrite(pdfData);
     }
     catch { }
 }
コード例 #13
0
        protected void savePDF()
        {
            if (UserId < 1) Response.Redirect(DotNetNuke.Common.Globals.NavigateURL("Login"));
            if (fileUpload.HasFile)
                try
                {
                    int fileLenght = fileUpload.PostedFile.ContentLength;
                    byte[] fileData = new byte[fileLenght];
                    fileUpload.PostedFile.InputStream.Read(fileData, 0, fileLenght);
                    string cmdTxt = string.Format("EXEC ChungNT.BC_setFile {0}, N'{1}', '{2}', {3}, @fileData",
                        UserId, fileUpload.FileName, fileUpload.PostedFile.ContentType, fileLenght);
                    SqlParameter para = new SqlParameter("@fileData", fileData);
                    csBaoCao ob = new csBaoCao();
                    ob.fillDataset_Para(cmdTxt, para);

                    gvDinhKem.DataSource = ob.fillDataset("EXEC ChungNT.BC_getFiles 0, " + UserId);
                    gvDinhKem.DataBind();
                }
                catch { lbError.Text = "Có lỗi trong quá trình đính kèm"; }
            else lbError.Text = "Chưa chọn file đính kèm";
        }
コード例 #14
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (IsPostBack) return;
     if (UserId < 1) Response.Redirect(DotNetNuke.Common.Globals.NavigateURL("Login"));
     csBaoCao ob = new csBaoCao();
     DataSet ds;
     string cmdText, thisModule = "386";
     try
     {
         cmdText = "EXEC dnn_GetModuleByDefinition @PortalId=0, @FriendlyName=N'CNT.BaoCao'";
         ds = ob.fillDataset(cmdText);
         thisModule = ds.Tables[0].Rows[0][3].ToString();
     }
     catch { }
     hlSoan.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "GuiBC", "mid/" + thisModule);
     hlThuDen.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "", "view/inbox");
     hlThuDi.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "", "view/sent");
     hlTimKiem.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "TimBC", "mid/" + thisModule);
     hlNhom.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "NhomBC", "mid/" + thisModule);
     hlDanhMuc.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "NhanBC", "mid/" + thisModule);
     try
     {
         cmdText = "exec bc_getsNhan @userID=" + UserId;
         ds = ob.fillDataset(cmdText);
         DataColumn dc = new DataColumn("LinkNhan");
         ds.Tables[0].Columns.Add(dc);
         ds.Tables[0].AcceptChanges();
         foreach (DataRow dr in ds.Tables[0].Rows)
         {
             dr.BeginEdit();
             dr["LinkNhan"] = DotNetNuke.Common.Globals.NavigateURL(TabId, "", "view/" + dr["IDNhan"].ToString());
             dr.EndEdit();
         }
         dlNhan.DataSource = ds.Tables[0];
         dlNhan.DataBind();
     }
     catch { }
 }
コード例 #15
0
 protected void getThanhVien(string idNhom)
 {
     string cmdText = "select Username, DisplayName from dnn_Users order by Username";
     csBaoCao ob = new csBaoCao();
     DataSet ds = ob.fillDataset(cmdText);
     DataColumn dc = new DataColumn("Check");
     dc.DataType = System.Type.GetType("System.Boolean");
     ds.Tables[0].Columns.Add(dc);
     ds.Tables[0].AcceptChanges();
     if (idNhom == "")
     {
         foreach (DataRow dr in ds.Tables[0].Rows)
         {
             dr.BeginEdit();
             dr["Check"] = false;
             dr.EndEdit();
         }
     }
     else
         try
         {
             cmdText = string.Format("EXEC [bc_getsNhom] @userID={0}, @nhomID={1}", UserId, idNhom);
             DataSet dsTemp = ob.fillDataset(cmdText);
             tbTenNhom.Text = dsTemp.Tables[0].Rows[0][1].ToString();
             string[] split = dsTemp.Tables[0].Rows[0][2].ToString().Split(',');
             foreach (DataRow dr in ds.Tables[0].Rows)
             {
                 dr.BeginEdit();
                 dr["Check"] = false;
                 foreach (string s in split)
                     if (s.Trim() == dr[0].ToString()) dr["Check"] = true;
                 dr.EndEdit();
             }
         }
         catch { }
     gvThanhVien.DataSource = ds;
     gvThanhVien.DataBind();
 }
コード例 #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack) return;
            try
            {
                string ID = Request["id"] == null ? "0" : Request["id"];
                string cmdText = string.Format("EXEC ChungNT.BC_getChiTiet {0}, {1}", ID, UserId);
                csBaoCao ob = new csBaoCao();
                DataSet ds = ob.fillDataset(cmdText);
                lbUsername.Text = ds.Tables[0].Rows[0][1].ToString();
                lbDisplayName.Text = ds.Tables[0].Rows[0][2].ToString();
                lbTieuDe.Text = ds.Tables[0].Rows[0][3].ToString();
                lbNoiDung.Text = ds.Tables[0].Rows[0][4].ToString();
                lbThoiGian.Text = ds.Tables[0].Rows[0][5].ToString();
                hlTraLoi.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "GUIBC", "mid/" + ModuleId, "reply/" + ds.Tables[0].Rows[0][1].ToString());
                hlChuyenTiep.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "GUIBC", "mid/" + ModuleId, "forward/" + ds.Tables[0].Rows[0][0].ToString());
                hlDong.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId);

                cmdText = string.Format("EXEC ChungNT.BC_getFiles {0}, {1}", ID, UserId);
                gvDinhKem.DataSource = ob.fillDataset(cmdText);
                gvDinhKem.DataBind();
            }
            catch (Exception ex) { lbTieuDe.Text = ex.Message; }
        }
コード例 #17
0
 protected void btGuiDi_Click(object sender, EventArgs e)
 {
     if (tbNguoiNhan.Text.Trim() == "")
     {
         lbError.Text = "Chưa nhập người nhận";
         return;
     }
     if (tbTieuDe.Text.Trim() == "")
     {
         lbError.Text = "Chưa nhập tiêu đề";
         return;
     }
     if (fileUpload.HasFile) savePDF(); //upload();
     string[] split = tbNguoiNhan.Text.Split(',');
     DataSet ds;
     string sent = "";
     foreach (string myS in split)
     {
         string cmd = string.Format(@"DECLARE @return_value int
             EXEC @return_value = bc_setsBaoCao @nguoiGui='{0}', @nguoiNhan='{1}', @tieuDe=N'{2}', @noiDung=N'{3}', @dinhKem='{4}'",
             UserInfo.Username, myS.Trim().ToLower(), tbTieuDe.Text, tbNoiDung.Text, tbDinhKem.Text);
         csBaoCao ob = new csBaoCao();
         //ob.executeData(cmd);
         ds = ob.fillDataset(cmd);
         if (ds.Tables.Count > 0)
             if (ds.Tables[0].Rows.Count > 0)
             {
                 if (sent.Length > 0) sent += ", ";
                 sent += ds.Tables[0].Rows[0][0].ToString();
             }
     }
     lbError.Text = "Gửi báo cáo thành công. Danh sách người nhận : <b>" + sent + "</b>";
     tbNguoiNhan.Text = "";
     tbTieuDe.Text = "";
     tbNoiDung.Text = "";
     tbDinhKem.Text = "";
     lbDinhKem_Name.Text = "";
 }
コード例 #18
0
 protected void btGuiDi_Click(object sender, EventArgs e)
 {
     if (fileUpload.HasFile) savePDF();
     if (UserId < 1) Response.Redirect(DotNetNuke.Common.Globals.NavigateURL("Login"));
     try
     {
         csBaoCao ob = new csBaoCao();
         DataSet ds;
         string cmd, baoCao = lbForward.Text;
         if (lbForward.Text == "0")
         {
             cmd = string.Format("EXEC ChungNT.BC_setBaoCao 0, {0}, N'{1}', N'{2}', {3}", UserId, tbTieuDe.Text, tbNoiDung.Text, ModuleId);
             ds = ob.fillDataset(cmd);
             baoCao = ds.Tables[0].Rows[0][0].ToString();
         }
         string sent = "Gửi đến:";
         string[] split = tbNguoiNhan.Text.Split(',');
         foreach (string user in split)
             try
             {
                 cmd = string.Format("EXEC ChungNT.BC_setShare {0}, '{1}'", baoCao, user.Trim().ToLower());
                 ds = ob.fillDataset(cmd);
                 ds.Tables[0].Rows[0][0].ToString();
                 sent = string.Format("{0} {1},", sent, user.Trim().ToLower());
             }
             catch { }
         lbError.Text = "Lưu công văn thành công. " + sent;
         btThemNguoi.Enabled = false;
         btThemFile.Enabled = false;
         btGuiDi.Enabled = false;
     }
     catch { lbError.Text = "Có lỗi xảy ra trong quá trình gửi đi"; }
 }
コード例 #19
0
 // 2013-04-05 Save PDF to SQL
 protected void savePDF()
 {
     if (fileUpload.HasFile)
     {
         string ext = Path.GetExtension(fileUpload.FileName).ToUpper();
         if (ext == ".PDF" || ext == ".DOC" || ext == ".DOCX" || ext == ".XLS" || ext == ".XLSX" || ext == ".RAR")
         {
             try
             {
                 int fileLenght = fileUpload.PostedFile.ContentLength;
                 byte[] fileData = new byte[fileLenght];
                 fileUpload.PostedFile.InputStream.Read(fileData, 0, fileLenght);
                 string cmdTxt = string.Format("EXEC bc_setsFile N'{0}', '{1}', {2}, @fileData",
                     fileUpload.FileName, fileUpload.PostedFile.ContentType, fileLenght);
                 SqlParameter para = new SqlParameter("@fileData", fileData);
                 csBaoCao ob = new csBaoCao();
                 DataSet ds = ob.fillDataset_Para(cmdTxt, para);
                 if (ds.Tables[0].Rows[0][0].ToString() != "0")
                 {
                     if (tbDinhKem.Text.Length > 0) tbDinhKem.Text += ", ";
                     tbDinhKem.Text += ds.Tables[0].Rows[0][0].ToString();
                     if (lbDinhKem_Name.Text.Length > 0) lbDinhKem_Name.Text += ", ";
                     lbDinhKem_Name.Text += fileUpload.FileName;
                 }
             }
             catch (Exception ex) { lbError.Text = ex.Message; }
         }
         else lbError.Text = "Chỉ chấp nhận các định dạng pdf, doc, docx, xls, xlsx, rar";
     }
     else lbError.Text = "Chưa chọn file đính kèm";
 }
コード例 #20
0
 protected void ddDonVi_SelectedIndexChanged(object sender, EventArgs e)
 {
     csBaoCao ob = new csBaoCao();
     string cmdText = string.Format("EXEC bc_getUsersByDonvi @userID={0}, @maDV={1}", UserId, ddDonVi.SelectedValue);
     DataSet ds = ob.fillDataset(cmdText);
     ddNguoiNhan.DataSource = ds.Tables[0];
     ddNguoiNhan.DataBind();
 }
コード例 #21
0
 protected void btCapNhat_Click(object sender, EventArgs e)
 {
     if (tbTenNhom.Text.Trim() == "")
     {
         lbError.Text = "Chưa nhập tên nhóm";
         return;
     }
     string thanhVien = "";
     for (int i = 0; i < gvThanhVien.Rows.Count; i++)
     {
         bool check = ((CheckBox)gvThanhVien.Rows[i].FindControl("CheckBox1")).Checked;
         if (check) thanhVien += ", " + gvThanhVien.Rows[i].Cells[1].Text;
     }
     if (thanhVien.Length < 2)
     {
         lbError.Text = "Chưa chọn thành viên trong nhóm";
         return;
     }
     else thanhVien = thanhVien.Remove(0, 2);
     string nhomID = lbIDSua.Text == "" ? "0" : lbIDSua.Text;
     string cmdText = string.Format("EXEC [bc_setsNhom] @userID={0}, @nhomID={1}, @tenNhom=N'{2}', @thanhVien=N'{3}'",
         UserId, nhomID, tbTenNhom.Text, thanhVien);
     csBaoCao ob = new csBaoCao();
     ob.executeData(cmdText);
     lbError.Text = "Cập nhật nhóm người nhận thành công";
     getNhom();
     lbIDSua.Text = "";
     tbTenNhom.Text = "";
     getThanhVien(lbIDSua.Text);
 }