protected void btt_OK_Click(object sender, EventArgs e) { //Access the File using the Name of HTML INPUT File. HttpPostedFile postedFile = Request.Files["uploadfile"]; //Check if File is available. if (postedFile != null && postedFile.ContentLength > 0) { //Save the File. string filePath = Server.MapPath("~/upload/") + Path.GetFileName(postedFile.FileName); postedFile.SaveAs(filePath); try { string value = id_nguoi_duyet.Value; Business.PR pr = new Business.PR(); DataTable tb = pr.PheDuyetPR(Convert.ToInt32(id_pr.Value), Convert.ToDateTime(ngayduyetpr_hid.Value), Convert.ToDateTime(ngaynhanpr_hid.Value), Convert.ToInt32(value), 3, postedFile.FileName); Response.Write("<script language='javascript'>alert('Đã cập nhật thông tin phê duyệt của PR');window.location.href='../../default.aspx';</script>"); } catch (Exception ex) { Context.Response.Write(ex.ToString()); } } }
public List <PR> LayDanhSachPR(int action, int id, int id_phongban, int sopr, string sopr_full, int nam, string congdung, string ngaytao, int thangtao, int tongsoluongyeucau, double tongtien, string ghichu, string ngayduyet, int id_nguoiduyet, int id_nguoidexuat, int tinhtrang, string prscanfile, bool sendmail, string tieude1, string tieude2, string tieude3, string tieude4, string tieude5, string tieude6, double ngansachduocduyet1, double ngansachduocduyet2, double ngansachduocduyet3, double ngansachduocduyet4, double ngansachduocduyet5, double ngansachduocduyet6, double dexuatlannay1, double dexuatlannay2, double dexuatlannay3, double dexuatlannay4, double dexuatlannay5, double dexuatlannay6, double luyke1, double luyke2, double luyke3, double luyke4, double luyke5, double luyke6, double thuathieu1, double thuathieu2, double thuathieu3, double thuathieu4, double thuathieu5, double thuathieu6) { DateTime ngtao, ngduyet; DAC kn = new DAC(); List <PR> pr_col = new List <PR>(); if (string.IsNullOrEmpty(ngaytao) == true) { ngtao = Convert.ToDateTime(DateTime.Now.ToShortDateString()); } else { ngtao = Convert.ToDateTime(ngaytao); } if (string.IsNullOrEmpty(ngayduyet) == true) { ngduyet = Convert.ToDateTime(DateTime.Now.ToShortDateString()); } else { ngduyet = Convert.ToDateTime(ngayduyet); } SqlParameter pm = new SqlParameter("@action", action); SqlParameter pm2 = new SqlParameter("@id", id); SqlParameter pm3 = new SqlParameter("@idphongban", id_phongban); SqlParameter pm4 = new SqlParameter("@sopr", sopr); SqlParameter pm5 = new SqlParameter("@sopr_full", sopr_full); SqlParameter pm6 = new SqlParameter("@nam", nam); SqlParameter pm7 = new SqlParameter("@congdung", congdung); SqlParameter pm8 = new SqlParameter("@ngaytao", ngtao); SqlParameter pm9 = new SqlParameter("@thangtao", thangtao); SqlParameter pm10 = new SqlParameter("@tongsoluongyeucau", tongsoluongyeucau); SqlParameter pm11 = new SqlParameter("@tongtien", tongtien); SqlParameter pm12 = new SqlParameter("@ghichu", ghichu); SqlParameter pm13 = new SqlParameter("@ngayduyet", ngduyet); SqlParameter pm14 = new SqlParameter("@idnguoiduyet", id_nguoiduyet); SqlParameter pm15 = new SqlParameter("@idnguoidexuat", id_nguoidexuat); SqlParameter pm16 = new SqlParameter("@tinhtrang", tinhtrang); SqlParameter pm17 = new SqlParameter("@prscanfile", prscanfile); SqlParameter pm18 = new SqlParameter("@sendmail", sendmail); SqlParameter pm19 = new SqlParameter("@tieude1", tieude1); SqlParameter pm20 = new SqlParameter("@tieude2", tieude2); SqlParameter pm21 = new SqlParameter("@tieude3", tieude3); SqlParameter pm22 = new SqlParameter("@tieude4", tieude4); SqlParameter pm23 = new SqlParameter("@tieude5", tieude5); SqlParameter pm24 = new SqlParameter("@tieude6", tieude6); SqlParameter pm25 = new SqlParameter("@ngansachduocduyet1", ngansachduocduyet1); SqlParameter pm26 = new SqlParameter("@ngansachduocduyet2", ngansachduocduyet2); SqlParameter pm27 = new SqlParameter("@ngansachduocduyet3", ngansachduocduyet3); SqlParameter pm28 = new SqlParameter("@ngansachduocduyet4", ngansachduocduyet4); SqlParameter pm29 = new SqlParameter("@ngansachduocduyet5", ngansachduocduyet5); SqlParameter pm30 = new SqlParameter("@ngansachduocduyet6", ngansachduocduyet6); SqlParameter pm31 = new SqlParameter("@dexuatlannay1", dexuatlannay1); SqlParameter pm32 = new SqlParameter("@dexuatlannay2", dexuatlannay2); SqlParameter pm33 = new SqlParameter("@dexuatlannay3", dexuatlannay3); SqlParameter pm34 = new SqlParameter("@dexuatlannay4", dexuatlannay4); SqlParameter pm35 = new SqlParameter("@dexuatlannay5", dexuatlannay5); SqlParameter pm36 = new SqlParameter("@dexuatlannay6", dexuatlannay6); SqlParameter pm37 = new SqlParameter("@luyke1", luyke1); SqlParameter pm38 = new SqlParameter("@luyke2", luyke2); SqlParameter pm39 = new SqlParameter("@luyke3", luyke3); SqlParameter pm40 = new SqlParameter("@luyke4", luyke4); SqlParameter pm41 = new SqlParameter("@luyke5", luyke5); SqlParameter pm42 = new SqlParameter("@luyke6", luyke6); SqlParameter pm43 = new SqlParameter("@thuathieu1", thuathieu1); SqlParameter pm44 = new SqlParameter("@thuathieu2", thuathieu2); SqlParameter pm45 = new SqlParameter("@thuathieu3", thuathieu3); SqlParameter pm46 = new SqlParameter("@thuathieu4", thuathieu4); SqlParameter pm47 = new SqlParameter("@thuathieu5", thuathieu5); SqlParameter pm48 = new SqlParameter("@thuathieu6", thuathieu6); SqlParameter[] param = new SqlParameter[48] { pm, pm2, pm3, pm4, pm5, pm6, pm7, pm8, pm9, pm10, pm11, pm12, pm13, pm14, pm15, pm16, pm17, pm18, pm19, pm20, pm21, pm22, pm23, pm24, pm25, pm26, pm27, pm28, pm29, pm30, pm31, pm32, pm33, pm34, pm35, pm36, pm37, pm38, pm39, pm40, pm41, pm42, pm43, pm44, pm45, pm46, pm47, pm48 }; DataTable tb = kn.get_by_procedure("proc_Action_PR", param); if (tb != null) { foreach (DataRow row in tb.Rows) { PR pr = new PR(); pr.ID_PR = Convert.ToInt32(row["ID"]); pr.ID_PhongBan = Convert.ToInt32(row["ID_PhongBan"]); if (tb.Columns.Contains("TenVietTat") == true) { pr.Ten_PhongBan = row["TenVietTat"].ToString(); } pr.So_PR = Convert.ToInt32(row["SoPR"]); pr.So_PR_Full = row["SoPR_Full"].ToString(); pr.Nam = Convert.ToInt32(row["Nam"]); pr.Cong_Dung = row["CongDung"].ToString(); pr.Ngay_Tao = Convert.ToDateTime(row["NgayTao"]); pr.Thang_Tao = Convert.ToInt32(row["ThangTao"]); pr.Tong_So_Luong_Yeu_cau = Convert.ToInt32(row["TongSoLuongYeuCau"]); pr.Tong_Tien = Convert.ToDouble(row["TongTien"]); if (!row.IsNull("GhiChu")) { pr.Ghi_Chu = row["GhiChu"].ToString(); } if (!row.IsNull("NgayDuyet")) { pr.Ngay_Duyet = Convert.ToDateTime(row["NgayDuyet"]); } if (!row.IsNull("ID_NguoiDuyet")) { pr.ID_Nguoi_Duyet = Convert.ToInt32(row["ID_NguoiDuyet"]); } pr.ID_Nguoi_De_Xuat = Convert.ToInt32(row["ID_NguoiDeXuat"]); if (tb.Columns.Contains("TenHienThi") == true) { pr.Ten_Nguoi_De_Xuat = row["TenHienThi"].ToString(); } pr.Tinh_Trang = Convert.ToInt32(row["TinhTrang"]); if (!row.IsNull("PRScanFile")) { pr.PR_Scan_File = row["PRScanFile"].ToString(); } pr.Sent_Mail = Convert.ToBoolean(row["SendMail"]); if (!row.IsNull("TieuDe1")) { pr.Tieu_De_1 = row["TieuDe1"].ToString(); } if (!row.IsNull("TieuDe2")) { pr.Tieu_De_2 = row["TieuDe2"].ToString(); } if (!row.IsNull("TieuDe3")) { pr.Tieu_De_3 = row["TieuDe3"].ToString(); } if (!row.IsNull("TieuDe4")) { pr.Tieu_De_4 = row["TieuDe4"].ToString(); } if (!row.IsNull("TieuDe5")) { pr.Tieu_De_5 = row["TieuDe5"].ToString(); } if (!row.IsNull("TieuDe6")) { pr.Tieu_De_6 = row["TieuDe6"].ToString(); } if (!row.IsNull("NganSachDuocDuyet1")) { pr.Ngan_Sach_Duoc_Duyet_1 = Convert.ToDouble(row["NganSachDuocDuyet1"]); } if (!row.IsNull("NganSachDuocDuyet2")) { pr.Ngan_Sach_Duoc_Duyet_2 = Convert.ToDouble(row["NganSachDuocDuyet2"]); } if (!row.IsNull("NganSachDuocDuyet3")) { pr.Ngan_Sach_Duoc_Duyet_3 = Convert.ToDouble(row["NganSachDuocDuyet3"]); } if (!row.IsNull("NganSachDuocDuyet4")) { pr.Ngan_Sach_Duoc_Duyet_4 = Convert.ToDouble(row["NganSachDuocDuyet4"]); } if (!row.IsNull("NganSachDuocDuyet5")) { pr.Ngan_Sach_Duoc_Duyet_5 = Convert.ToDouble(row["NganSachDuocDuyet5"]); } if (!row.IsNull("NganSachDuocDuyet6")) { pr.Ngan_Sach_Duoc_Duyet_6 = Convert.ToDouble(row["NganSachDuocDuyet6"]); } if (!row.IsNull("DeXuatLanNay1")) { pr.De_Xuat_Lan_Nay_1 = Convert.ToDouble(row["DeXuatLanNay1"]); } if (!row.IsNull("DeXuatLanNay2")) { pr.De_Xuat_Lan_Nay_2 = Convert.ToDouble(row["DeXuatLanNay2"]); } if (!row.IsNull("DeXuatLanNay3")) { pr.De_Xuat_Lan_Nay_3 = Convert.ToDouble(row["DeXuatLanNay3"]); } if (!row.IsNull("DeXuatLanNay4")) { pr.De_Xuat_Lan_Nay_4 = Convert.ToDouble(row["DeXuatLanNay4"]); } if (!row.IsNull("DeXuatLanNay5")) { pr.De_Xuat_Lan_Nay_5 = Convert.ToDouble(row["DeXuatLanNay5"]); } if (!row.IsNull("DeXuatLanNay6")) { pr.De_Xuat_Lan_Nay_6 = Convert.ToDouble(row["DeXuatLanNay6"]); } if (!row.IsNull("LuyKe1")) { pr.Luy_Ke_1 = Convert.ToDouble(row["LuyKe1"]); } if (!row.IsNull("LuyKe2")) { pr.Luy_Ke_2 = Convert.ToDouble(row["LuyKe2"]); } if (!row.IsNull("LuyKe3")) { pr.Luy_Ke_3 = Convert.ToDouble(row["LuyKe3"]); } if (!row.IsNull("LuyKe4")) { pr.Luy_Ke_4 = Convert.ToDouble(row["LuyKe4"]); } if (!row.IsNull("LuyKe5")) { pr.Luy_Ke_5 = Convert.ToDouble(row["LuyKe5"]); } if (!row.IsNull("LuyKe6")) { pr.Luy_Ke_6 = Convert.ToDouble(row["LuyKe6"]); } if (!row.IsNull("ThuaThieu1")) { pr.Thua_Thieu_1 = Convert.ToDouble(row["ThuaThieu1"]); } if (!row.IsNull("ThuaThieu2")) { pr.Thua_Thieu_2 = Convert.ToDouble(row["ThuaThieu2"]); } if (!row.IsNull("ThuaThieu3")) { pr.Thua_Thieu_3 = Convert.ToDouble(row["ThuaThieu3"]); } if (!row.IsNull("ThuaThieu4")) { pr.Thua_Thieu_4 = Convert.ToDouble(row["ThuaThieu4"]); } if (!row.IsNull("ThuaThieu5")) { pr.Thua_Thieu_5 = Convert.ToDouble(row["ThuaThieu5"]); } if (!row.IsNull("ThuaThieu6")) { pr.Thua_Thieu_6 = Convert.ToDouble(row["ThuaThieu6"]); } pr_col.Add(pr); } } return(pr_col); }