protected void btnExportToExxcel_ServerClick(object sender, EventArgs e) { string path = string.Concat(Server.MapPath("~/Upload/NhanTin/" + FileUpload1.FileName)); if (!FileUpload1.FileName.Equals("")) { string sl = "0"; FileUpload1.SaveAs(path); List <Donvi> lsdv = obj.GetDonVi(true); if (lsdv != null) { if (lsdv.Count > 0) { DataTable dt = Bussiness.NhanTinExcel(path, Doanhnghiepid, 1, lsdv[0].AGENTID.Trim(), lsdv[0].APIUSER.Trim(), lsdv[0].APIPASS.Trim()); ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "alertMessage('Thành công!','success','Đã nhắn tin vui lòng kiểm tra file trả về để xem lỗi nếu có.!');", true); // LoadGrid(0); if (dt.Rows.Count > 1) { ExportToExcel(dt); } } } } else { ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "alertMessage('Cảnh báo!','warning','Vui lòng chọn file để nhắn tin!!');", true); } LoadGrid(0, 1000, "NhanTinExcel"); }
protected void Page_Load(object sender, EventArgs e) { try { if (!AppSessionInfo.CurrentUser.TenDangNhap.Equals("")) { lsdv = objbn.GetDonVi(true); LoadGird(); } else { Response.Redirect(AppUrls.LOGIN); } } catch { Response.Redirect(AppUrls.LOGIN); } }
private void LoadDonVi() { List <Donvi> lsdonvi = obj.GetDonVi(true); if (lsdonvi != null) { if (lsdonvi.Count > 0) { txttendonvi.Text = lsdonvi[0].TenDonVi; txtdienthoai.Text = lsdonvi[0].DienThoai; txtdiachi.Text = lsdonvi[0].Diachi; txtagentid.Text = lsdonvi[0].AGENTID; txtapiuser.Text = lsdonvi[0].APIUSER; txtapipass.Text = lsdonvi[0].APIPASS; txtusername.Text = lsdonvi[0].UserName; CheckBox1.Checked = bool.Parse(lsdonvi[0].HoatDong.ToString()); lbnhomid.Text = lsdonvi[0].ID.ToString(); } } }