public static string GetMenuTopCanhBao() { StringBuilder menuHtml = new StringBuilder(); DateTime tuNgay = DateTime.Now.AddDays(-50); DateTime denNgay = DateTime.Now.AddDays(10); foreach (var quyen in arrayQuyenTop) { if (checkQuyen(quyen)) { switch (quyen) { case (int)QuyenIndex.DuyetHoSo: List <RedirectLink> lstContent = new List <RedirectLink>(); string trangthai = ""; trangthai += ((int)TrangThaiHoSo.TuChoi).ToString() + "," + ((int)TrangThaiHoSo.NhapLieu).ToString() + "," + ((int)TrangThaiHoSo.ThamDinh).ToString() + "," + ((int)TrangThaiHoSo.BoSungHoSo).ToString() + "," + ((int)TrangThaiHoSo.GiaiNgan).ToString(); var lstNotApprove = new HoSoBLL().DSHoSoDuyetChuaXem(GlobalData.User.IDUser, 0, 0, tuNgay, denNgay, string.Empty, string.Empty, 1, trangthai); if (lstNotApprove != null) { foreach (var item in lstNotApprove) { RedirectLink rl = new RedirectLink(); rl.Title = "[" + item.MaHoSo + "] " + item.TenKH; rl.Link = "/DuyetHoSo/XemHSByID/" + item.ID; lstContent.Add(rl); } } menuHtml.Append(ListNotApprove(lstContent, "fa fa-envelope", "icon-animated-vertical", "/DuyetHoSo/Index", "Hồ sơ chưa duyệt")); break; //case (int)QuyenIndex.Public: // var lstRequetDoNotBrowse = new RequestBLL().GetMyProgress(GlobalData.User.IDUser, ((int)Utility.RequestStatus.DoNotBrowse).ToString()); // lstContent = lstRequetDoNotBrowse.Select(x => x.RequestCode).ToList(); // menuHtml.Append(ListDoNotBrowse(lstContent, "fa fa-envelope", "icon-animated-vertical", "/MyProcessRequest/Index", Resources.Global.MenuWarning_MyRequest_DoNotRequest)); // break; } } } if (GlobalData.User != null) { List <RedirectLink> lstContent = new List <RedirectLink>(); string trangthai = ""; //trangthai += "," + ((int)TrangThaiHoSo.TuChoi).ToString(); var lstDoNotBrowse = new HoSoBLL().DSHoSoChuaXem(GlobalData.User.IDUser, tuNgay, denNgay, string.Empty, string.Empty, trangthai); if (lstDoNotBrowse != null) { foreach (var item in lstDoNotBrowse) { RedirectLink rl = new RedirectLink(); rl.Title = "[" + item.MaHoSo + "] " + item.TenKH; rl.Link = "/QuanLyHoSo/XemHSByID/" + item.ID; lstContent.Add(rl); } } menuHtml.Append(ListDoNotBrowse(lstContent, "fa fa-bell", "icon-animated-vertical", "/QuanLyHoSo/DanhSachHoSo", "Thông báo chưa xem")); } return(menuHtml.ToString()); }
public JsonResult TimHS(string fromDate, string toDate, string maHS, string sdt) { List <HoSoCuaToiModel> rs = new List <HoSoCuaToiModel>(); try { DateTime dtFromDate = DateTime.MinValue, dtToDate = DateTime.MinValue; if (fromDate != "") { dtFromDate = DateTimeFormat.ConvertddMMyyyyToDateTime(fromDate); } if (toDate != "") { dtToDate = DateTimeFormat.ConvertddMMyyyyToDateTime(toDate); } string trangthai = ""; //trangthai += ((int)TrangThaiHoSo.KhongDuyet).ToString()+"," + ((int)TrangThaiHoSo.Nhap).ToString() + "," + ((int)TrangThaiHoSo.Duyet).ToString() + "," + ((int)TrangThaiHoSo.ChoDuyet).ToString(); rs = new HoSoBLL().TimHoSoCuaToi(GlobalData.User.IDUser, dtFromDate, dtToDate, maHS, sdt, trangthai); if (rs == null) { rs = new List <HoSoCuaToiModel>(); } return(ToJsonResponse(true, null, rs)); } catch (BusinessException ex) { return(ToJsonResponse(false, ex.Message)); } }
public JsonResult LayDSGhichu(int id) { List <GhichuViewModel> rs = new HoSoBLL().LayDanhsachGhichu(id); if (rs == null) { rs = new List <GhichuViewModel>(); } return(ToJsonResponse(true, null, rs)); }
public JsonResult LayDSGhichu(int hosoId) { List <GhichuViewModel> rs = new HoSoBLL().LayDanhsachGhichu(hosoId, (int)HosoType.HosoCourrier); if (rs == null) { rs = new List <GhichuViewModel>(); } return(ToJsonResponse(true, null, rs)); }
public async Task <JsonResult> TimHSQL(string fromDate, string toDate, string maHS, string cmnd, int loaiNgay = 1, int maNhom = 0, int maThanhVien = 0, string freetext = null, string status = null, int page = 1, int limit = 10 ) { List <HoSoQuanLyModel> lstHoso = new List <HoSoQuanLyModel>(); int totalRecord = 0; if (!string.IsNullOrWhiteSpace(freetext) && freetext.Length > 50) { return(ToJsonResponse(false, "Từ khóa tìm kiếm không được nhiều hơn 50 ký tự")); } try { DateTime dtFromDate = DateTime.MinValue, dtToDate = DateTime.MinValue; if (fromDate != "") { dtFromDate = DateTimeFormat.ConvertddMMyyyyToDateTime(fromDate); } if (toDate != "") { dtToDate = DateTimeFormat.ConvertddMMyyyyToDateTime(toDate); } string trangthai = string.IsNullOrWhiteSpace(status) ? Helpers.Helpers.GetAllStatusString() : status; //trangthai += var isAdmin = await _rpEmployee.CheckIsAdmin(GlobalData.User.IDUser); totalRecord = new HoSoBLL().CountHoSoQuanLy(GlobalData.User.IDUser, maNhom, maThanhVien, dtFromDate, dtToDate, maHS, cmnd, trangthai, loaiNgay, freetext); lstHoso = new HoSoBLL().TimHoSoQuanLy(GlobalData.User.IDUser, maNhom, maThanhVien, dtFromDate, dtToDate, maHS, cmnd, trangthai, loaiNgay, freetext, page, limit, isAdmin: isAdmin); if (lstHoso == null) { lstHoso = new List <HoSoQuanLyModel>(); } var result = DataPaging.Create(lstHoso, totalRecord); return(ToJsonResponse(true, null, result)); } catch (BusinessException ex) { return(ToJsonResponse(false, ex.Message)); } }
public JsonResult XoaHS(int hsID) { try { bool rs = new HoSoBLL().XoaHS(hsID, GlobalData.User.IDUser, DateTime.Now); if (rs) { return(ToJsonResponse(true)); } return(ToJsonResponse(false)); } catch (Exception) { return(ToJsonResponse(false)); } }
public async Task <ActionResult> SuaHoSo() { ViewBag.formindex = Infrastructures.ControllerRoles.Roles["profile_list"]._formindex; if (Session["AddNewHoSoID"] == null) { return(RedirectToAction("Index")); } var hoso = new HoSoBLL().LayChiTiet((int)Session["AddNewHoSoID"]); ViewBag.HoSo = hoso; ViewBag.MaDoiTac = await _rpPartner.LayMaDoiTac(hoso.SanPhamVay); ViewBag.MaTinh = new KhuVucBLL().LayMaTinh(hoso.MaKhuVuc); Session["LstFileHoSo"] = hoso.LstTaiLieu; return(View()); }
public static void SendMailToAdmin(int id, string url) { try { var hoSo = new HoSoBLL().LayChiTiet(id); if (hoSo != null) { var lstUserApprove = new NhanVienNhomBLL().LayDSNhanVien(hoSo.HoSoCuaAi, (int)QuyenIndex.DuyetHoSo); if (lstUserApprove != null) { foreach (var item in lstUserApprove) { string mailTo = ""; string subject = "[FINTECHCOM]{0}"; string mailBody = ""; string genderSend = ""; UserPMModel userSend = new UserPMBLL().GetUserByID(hoSo.HoSoCuaAi.ToString()); UserPMModel userReceive = item; mailTo = userReceive.Email; string genderReceive = ""; string template = ""; mailBody += "<p style=\"margin-left:20px;margin-top:20px\"><font size=\"2.5\" face=\"Arial\">Dear{0} {1}\r\n\r\n"; mailBody += "Bạn được chọn để duyệt hồ sơ bởi {2} {3}.\r\n"; mailBody += "Hồ sơ: {4}\r\n"; mailBody += "Mã hồ sơ: <a href='" + url + "/DuyetHoSo/XemHSByID/" + id + "'>{5}</a>\r\n\r\n"; mailBody += "Vui lòng click vào link bên dưới {6} thực hiện việc kiểm duyệt.\r\n\r\n"; mailBody += "http://" + url + "/DuyetHoSo/XemHSByID/" + id + ".\r\n\r\n"; mailBody += "Đây là một email được tạo ra hệ thống. Xin vui lòng không trả lời tin nhắn này.\r\n"; //mailBody += "Nếu bạn có bất kỳ thắc mắc, xin vui lòng liên hệ {7}\r\n"; mailBody += "Trân trọng,\r\n\r\n"; mailBody += "VIETBANK – HỆ THỐNG KIỂM DUYỆT HỒ SƠ\r\n\r\n</font></p>"; template += "<html><table style=\"width: 700px\" cellpadding=\"0\" cellspacing=\"0\"><tr style =\"background-color:#0D622F\"><td style =\"width:15%;float:left\"><img style=\"width:120px;margin-left: 20px;margin-top: 20px;\" src ='" + CMLink.PathLogo + "'></td><td style=\"width:85%\"><p style=\"float:left; margin: 10px 0px 10px 15px\"><font size=\"6\" face=\"VIETBANK – HỆ THỐNG KIỂM DUYỆT HỒ SƠ\" style=\"color:white\">HỆ THỐNG KIỂM DUYỆT HỒ SƠ</font></p ></td></tr>"; template += "<tr style=\"background-color:#61ec66\" align=\"left\" ><td colspan='2'>###</td></tr>"; template += "</table></html>"; mailBody = mailBody.Replace("\r\n", "<br>"); mailBody = string.Format(mailBody, genderReceive, userReceive.FullName, genderSend, userSend.FullName, hoSo.TenKhachHang, hoSo.MaHoSo, "đây"); template = template.Replace("###", mailBody); SendMail(mailTo, string.Format(subject, hoSo.TenKhachHang), hoSo.TenKhachHang, template); } } } } catch { } }
public async Task <ActionResult> Edit(int id) { ViewBag.formindex = LstRole["DanhSachHoSo"]._formindex; if (id <= 0) { return(RedirectToAction("DanhSachHoSo")); } var hoso = new HoSoBLL().LayChiTiet(id); new HoSoXemBLL().DaXem(id); ViewBag.HoSo = hoso; ViewBag.MaDoiTac = await _rpPartner.LayMaDoiTac(hoso.SanPhamVay); ViewBag.MaTinh = new KhuVucBLL().LayMaTinh(hoso.MaKhuVuc); //Session["QL_LstFileHoSo"] = hoso.LstTaiLieu; ViewBag.LstLoaiTaiLieu = new LoaiTaiLieuBLL().LayDS(); return(View()); }
public async Task <ActionResult> Edit(int id) { ViewBag.formindex = LstRole["Index"]._formindex; if (id <= 0) { return(RedirectToAction("Index")); } ViewBag.ID = id; var hoso = new HoSoBLL().LayChiTiet(id); ViewBag.HoSo = hoso; ViewBag.MaDoiTac = await _rpPartner.LayMaDoiTac(hoso.SanPhamVay); ViewBag.MaTinh = new KhuVucBLL().LayMaTinh(hoso.MaKhuVuc); ViewBag.LstLoaiTaiLieu = new LoaiTaiLieuBLL().LayDS(); ViewBag.SellCode = new UserPMBLL().GetUserByID(hoso.HoSoCuaAi.ToString()); //Session["Duyet_LstFileHoSo"] = hoso.LstTaiLieu; new HoSoDuyetXemBLL().DaXem(hoso.ID); return(View()); }
public async Task <ActionResult> Save(string hoten, string phone, string phone2, string ngayNhanDon, int hoSoCuaAi, string cmnd, int gioiTinh , int maKhuVuc, string diaChi, int sanPhamVay, string tenCuaHang, bool baoHiem, int thoiHanVay, string soTienVay, int trangthai, string ghiChu, string birthDayStr, string cmndDayStr, int courier = 0, List <int> FileRequireIds = null) { string error = ""; if (GlobalData.User.UserType == (int)UserTypeEnum.Sale || trangthai == (int)TrangThaiHoSo.Nhap) { trangthai = (int)TrangThaiHoSo.NhapLieu; } try { if (hoten == string.Empty) { return(ToJsonResponse(false, "Vui lòng nhập họ tên")); } if (phone == string.Empty) { return(ToJsonResponse(false, "Vui lòng nhập số điện thoại")); } if (ngayNhanDon == string.Empty) { return(ToJsonResponse(false, "Vui lòng nhập ngày nhận đơn")); } if (cmnd == string.Empty) { return(ToJsonResponse(false, "Vui lòng nhập CMND")); } if (diaChi == string.Empty) { return(ToJsonResponse(false, "Vui lòng nhập địa chỉ")); } if (maKhuVuc == 0) { return(ToJsonResponse(false, "Vui lòng chọn quận/ huyện")); } else if (sanPhamVay == 0) { return(ToJsonResponse(false, "Vui lòng chọn sản phẩm vay")); } if (soTienVay == string.Empty) { return(ToJsonResponse(false, "Vui lòng nhập số tiền vay")); } if (string.IsNullOrWhiteSpace(birthDayStr)) { return(ToJsonResponse(false, "Vui lòng nhập ngày sinh")); } if (string.IsNullOrWhiteSpace(cmndDayStr)) { return(ToJsonResponse(false, "Vui lòng nhập ngày cấp cmnd")); } if (trangthai <= 0) { return(ToJsonResponse(false, "Vui lòng chọn trạng thái")); } if (!string.IsNullOrWhiteSpace(ghiChu) && ghiChu.Length > 300) { return(ToJsonResponse(false, "Nội dung ghi chú không được nhiều hơn 300 ký tự")); } try { var lstLoaiTaiLieu = await _rpTailieu.LayDS(); if (lstLoaiTaiLieu == null) { await _rpLog.InsertLog("Update-Quanlyhoso", "lstLoaiTaiLieu = null"); } if (lstLoaiTaiLieu != null) { lstLoaiTaiLieu.RemoveAll(x => x.BatBuoc == 0); var missingNames = BusinessExtension.GetFilesMissingV2(lstLoaiTaiLieu, FileRequireIds); if (!string.IsNullOrWhiteSpace(missingNames)) { return(ToJsonResponse(false, $"Vui lòng nhập: {missingNames}")); } } } catch (Exception e) { error = e.Dump(); } if (!string.IsNullOrWhiteSpace(error)) { await _rpLog.InsertLog("Update-Quanlyhoso", error); } HoSoModel hs = new HoSoModel(); hs.ID = (int)Session["QL_HoSoID"]; hs.TenKhachHang = hoten; hs.SDT = phone; hs.SDT2 = phone2; if (ngayNhanDon != string.Empty) { hs.NgayNhanDon = DateTimeFormat.ConvertddMMyyyyToDateTime(ngayNhanDon); } hs.HoSoCuaAi = hoSoCuaAi; hs.MaNguoiCapNhat = GlobalData.User.IDUser; hs.NgayCapNhat = DateTime.Now; hs.CMND = cmnd; hs.GioiTinh = gioiTinh; hs.MaKhuVuc = maKhuVuc; hs.DiaChi = diaChi; hs.CourierCode = courier; hs.SanPhamVay = sanPhamVay; hs.TenCuaHang = tenCuaHang; hs.CoBaoHiem = baoHiem ? 1 : 0; hs.MaTrangThai = trangthai; hs.HanVay = thoiHanVay; if (soTienVay == string.Empty) { soTienVay = "0"; } hs.SoTienVay = Convert.ToDecimal(soTienVay); var dtBirthDayConvert = DateTimeFormat.ConvertddMMyyyyToDateTimeV2(birthDayStr); if (!dtBirthDayConvert.Success) { return(ToJsonResponse(false, dtBirthDayConvert.Message)); } else { hs.BirthDay = dtBirthDayConvert.Value; } var dtCmnd = DateTimeFormat.ConvertddMMyyyyToDateTimeV2(cmndDayStr); if (!dtCmnd.Success) { return(ToJsonResponse(false, dtCmnd.Message)); } else { hs.CmndDay = dtCmnd.Value; } //hs.MaTrangThai = (int)TrangThaiHoSo.NhapLieu; hs.MaKetQua = (int)KetQuaHoSo.Trong; if (hs.ID > 0) { var hoso = new HoSoBLL().LayChiTiet(hs.ID); if (hoso == null) { return(ToJsonResponse(false, "Hồ sơ không tồn tại", hs.ID)); } hs.DisbursementDate = hoso.DisbursementDate; if (hs.MaTrangThai == (int)TrangThaiHoSo.GiaiNgan) { hs.DisbursementDate = DateTime.Now; } bool isCheckMaSanPham = false; //// chỉnh sửa if (new HoSoBLL().CapNhatHoSo(hs, null, ref isCheckMaSanPham)) { new HoSoDuyetXemBLL().Them(hs.ID); } else { if (isCheckMaSanPham) { return(ToJsonResponse(false, "Mã sản phẩm đã được sử dụng bởi 1 hồ sơ khác, vui lòng chọn mã sản phẩm khác")); } } } await AddGhichu(hs.ID, ghiChu); return(ToJsonResponse(true, Resources.Global.Message_Succ, hs.ID)); } catch (Exception ex) { error = error.Dump(); await _rpLog.InsertLog("quanlyhoso", error); return(ToJsonResponse(false, ex.Message)); } }
public async Task <ActionResult> SaveDaft(string hoten, string phone, string phone2, string ngayNhanDon, int hoSoCuaAi, string cmnd, int gioiTinh , int maKhuVuc, string diaChi, int courier, int sanPhamVay, string tenCuaHang, int baoHiem, int thoiHanVay, string soTienVay, string ghiChu, string birthDayStr, string cmndDayStr) { if (!string.IsNullOrWhiteSpace(ghiChu) && ghiChu.Length > 200) { return(ToResponse(false, "Nội dung ghi chú không được lớn hơn 200")); } try { if (hoten == string.Empty) { return(ToResponse(false, "Vui lòng nhập họ tên")); } HoSoModel hs = new HoSoModel(); hs.ID = (int)Session["AddNewHoSoID"]; hs.TenKhachHang = hoten; hs.SDT = phone; hs.SDT2 = phone2; if (ngayNhanDon != string.Empty) { hs.NgayNhanDon = DateTimeFormat.ConvertddMMyyyyToDateTime(ngayNhanDon); } hs.BirthDay = string.IsNullOrWhiteSpace(birthDayStr) ? DateTime.Now : DateTimeFormat.ConvertddMMyyyyToDateTime(birthDayStr); hs.CmndDay = string.IsNullOrWhiteSpace(cmndDayStr) ? DateTime.Now : DateTimeFormat.ConvertddMMyyyyToDateTime(cmndDayStr); hs.HoSoCuaAi = hoSoCuaAi; hs.MaNguoiTao = GlobalData.User.IDUser; hs.NgayTao = DateTime.Now; hs.CMND = cmnd; hs.GioiTinh = gioiTinh; hs.MaKhuVuc = maKhuVuc; hs.DiaChi = diaChi; hs.CourierCode = courier; hs.SanPhamVay = sanPhamVay; hs.TenCuaHang = tenCuaHang; hs.CoBaoHiem = baoHiem; hs.HanVay = thoiHanVay; if (soTienVay == string.Empty) { soTienVay = "0"; } hs.SoTienVay = Convert.ToDecimal(soTienVay); hs.MaTrangThai = (int)TrangThaiHoSo.Nhap; hs.MaKetQua = (int)KetQuaHoSo.Trong; List <TaiLieuModel> lstTaiLieu = new List <TaiLieuModel>(); int result = 0; if (hs.ID > 0) { bool isCheckMaSanPham = false; //// chỉnh sửa if (new HoSoBLL().Luu(hs, lstTaiLieu, ref isCheckMaSanPham)) { result = 1; } else { if (isCheckMaSanPham) { return(ToResponse(false, "Mã sản phẩm đã được sử dụng bởi 1 hồ sơ khác, vui lòng chọn mã sản phẩm khác")); } } await AddGhichu(hs.ID, ghiChu); return(ToResponse(true, Resources.Global.Message_Succ, hs.ID)); } else { bool isCheckMaSanPham = false; result = new HoSoBLL().Them(hs, lstTaiLieu, ref isCheckMaSanPham); if (result > 0) { Session["AddNewHoSoID"] = result; } else { if (isCheckMaSanPham) { return(ToResponse(false, "Mã sản phẩm đã được sử dụng bởi 1 hồ sơ khác, vui lòng chọn mã sản phẩm khác")); } } await AddGhichu(result, ghiChu); } if (result > 0) { return(ToResponse(true, Resources.Global.Message_Succ, result)); } else { return(ToResponse(false, "Không thành công, vui lòng thử lại sau")); } } catch (BusinessException ex) { return(ToResponse(false, ex.Message)); } }
public async Task <ActionResult> Save(string hoten, string phone, string phone2, string ngayNhanDon, int hoSoCuaAi, string cmnd, int gioiTinh , int maKhuVuc, string diaChi, int courier, int sanPhamVay, string tenCuaHang, int baoHiem, int thoiHanVay, string soTienVay, string ghiChu, string birthDayStr, string cmndDayStr, string link = null, int provinceId = 0, int doitacF88Value = 0, List <int> FileRequireIds = null, int partnerType = 0) { if (!string.IsNullOrWhiteSpace(ghiChu) && ghiChu.Length > 200) { return(ToResponse(false, "Nội dung ghi chú không được lớn hơn 200")); } try { if (hoten == string.Empty) { return(ToResponse(false, "Vui lòng nhập họ tên")); } if (phone == string.Empty) { return(ToResponse(false, "Vui lòng nhập số điện thoại")); } if (ngayNhanDon == string.Empty) { return(ToResponse(false, "Vui lòng nhập ngày nhận đơn")); } if (cmnd == string.Empty) { return(ToResponse(false, "Vui lòng nhập CMND")); } if (diaChi == string.Empty) { return(ToResponse(false, "Vui lòng nhập địa chỉ")); } if (maKhuVuc == 0) { return(ToResponse(false, "Vui lòng chọn quận/ huyện")); } if (sanPhamVay == 0) { return(ToResponse(false, "Vui lòng chọn sản phẩm vay")); } if (soTienVay == string.Empty) { return(ToResponse(false, "Vui lòng nhập số tiền vay")); } if (string.IsNullOrWhiteSpace(birthDayStr)) { return(ToResponse(false, "Vui lòng nhập ngày sinh")); } if (string.IsNullOrWhiteSpace(cmndDayStr)) { return(ToResponse(false, "Vui lòng nhập ngày cấp cmnd")); } List <TaiLieuModel> lstTaiLieu = (List <TaiLieuModel>)Session["LstFileHoSo"]; var lstLoaiTaiLieu = await _rpTailieu.GetLoaiTailieuList(); lstLoaiTaiLieu.RemoveAll(x => x.BatBuoc == 0); if (lstLoaiTaiLieu != null) { var missingNames = BusinessExtension.GetFilesMissingV2(lstLoaiTaiLieu, FileRequireIds); if (!string.IsNullOrWhiteSpace(missingNames)) { return(ToResponse(false, $"Vui lòng nhập: {missingNames}", 0)); } } HoSoModel hs = new HoSoModel(); hs.ID = (int)Session["AddNewHoSoID"]; hs.TenKhachHang = hoten; hs.SDT = phone; hs.SDT2 = phone2; if (ngayNhanDon != string.Empty) { hs.NgayNhanDon = DateTimeFormat.ConvertddMMyyyyToDateTime(ngayNhanDon); } hs.BirthDay = string.IsNullOrWhiteSpace(birthDayStr) ? DateTime.Now : DateTimeFormat.ConvertddMMyyyyToDateTime(birthDayStr); hs.CmndDay = string.IsNullOrWhiteSpace(cmndDayStr) ? DateTime.Now : DateTimeFormat.ConvertddMMyyyyToDateTime(cmndDayStr); hs.HoSoCuaAi = hoSoCuaAi; hs.MaNguoiTao = GlobalData.User.IDUser; hs.NgayTao = DateTime.Now; hs.CMND = cmnd; hs.GioiTinh = gioiTinh; hs.MaKhuVuc = maKhuVuc; hs.DiaChi = diaChi; hs.CourierCode = courier; hs.SanPhamVay = sanPhamVay; hs.TenCuaHang = tenCuaHang; hs.CoBaoHiem = baoHiem; hs.HanVay = thoiHanVay; if (soTienVay == string.Empty) { soTienVay = "0"; } hs.SoTienVay = Convert.ToDecimal(soTienVay); hs.MaTrangThai = (int)TrangThaiHoSo.NhapLieu; hs.MaKetQua = (int)KetQuaHoSo.Trong; int result = 0; if (hs.ID > 0) { bool isCheckMaSanPham = false; //// chỉnh sửa if (new HoSoBLL().Luu(hs, lstTaiLieu, ref isCheckMaSanPham)) { result = 1; new HoSoDuyetXemBLL().Them(hs.ID); MailCM.SendMailToAdmin(hs.ID, Request.Url.Authority); } else { if (isCheckMaSanPham) { return(ToResponse(false, "Mã sản phẩm đã được sử dụng bởi 1 hồ sơ khác, vui lòng chọn mã sản phẩm khác")); } } await AddGhichu(hs.ID, ghiChu); return(ToResponse(true, Resources.Global.Message_Succ, hs.ID)); } else { bool isCheckMaSanPham = false; result = new HoSoBLL().Them(hs, lstTaiLieu, ref isCheckMaSanPham); if (result > 0) { Session["AddNewHoSoID"] = result; new HoSoDuyetXemBLL().Them(result); MailCM.SendMailToAdmin(result, Request.Url.Authority); } else { if (isCheckMaSanPham) { return(ToResponse(false, "Mã sản phẩm đã được sử dụng bởi 1 hồ sơ khác, vui lòng chọn mã sản phẩm khác")); } } await AddGhichu(result, ghiChu); } if (result > 0) { return(ToResponse(true, Resources.Global.Message_Succ, result)); } else { return(ToResponse(false, "Không thành công, vui lòng thử lại sau")); } } catch (BusinessException ex) { return(ToResponse(false, ex.Message)); } }
public ActionResult DownloadReport(int maNhom, int maThanhVien, string fromDate, string toDate, string maHS, string cmnd, int loaiNgay) { string newUrl = string.Empty; try { List <HoSoDuyetModel> rs = new List <HoSoDuyetModel>(); DateTime dtFromDate = DateTime.MinValue, dtToDate = DateTime.MinValue; if (fromDate != "") { dtFromDate = DateTimeFormat.ConvertddMMyyyyToDateTime(fromDate); } if (toDate != "") { dtToDate = DateTimeFormat.ConvertddMMyyyyToDateTime(toDate); } string trangthai = ""; trangthai += ((int)TrangThaiHoSo.TuChoi).ToString() + "," + ((int)TrangThaiHoSo.NhapLieu).ToString() + "," + ((int)TrangThaiHoSo.ThamDinh).ToString() + "," + ((int)TrangThaiHoSo.BoSungHoSo).ToString() + "," + ((int)TrangThaiHoSo.Cancel).ToString() + "," + ((int)TrangThaiHoSo.DaDoiChieu).ToString() + "," + ((int)TrangThaiHoSo.PCB).ToString() + "," + ((int)TrangThaiHoSo.GiaiNgan).ToString(); int totalRecord = new HoSoBLL().CountHosoDuyet(GlobalData.User.IDUser, maNhom, maThanhVien, dtFromDate, dtToDate, maHS, cmnd, loaiNgay, trangthai); rs = new HoSoBLL().TimHoSoDuyet(GlobalData.User.IDUser, maNhom, maThanhVien, dtFromDate, dtToDate, maHS, cmnd, loaiNgay, trangthai, string.Empty, 1, totalRecord, true); if (rs == null) { rs = new List <HoSoDuyetModel>(); } string destDirectory = VS_LOAN.Core.Utility.Path.DownloadBill + "/" + DateTime.Now.Year.ToString() + "/" + DateTime.Now.Month.ToString() + "/"; bool exists = System.IO.Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + destDirectory); if (!exists) { System.IO.Directory.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory + destDirectory); } string fileName = "Report-DSHS" + DateTime.Now.ToString("ddMMyyyyHHmmssfff") + ".xlsx"; using (FileStream stream = new FileStream(Server.MapPath(destDirectory + fileName), FileMode.CreateNew)) { Byte[] info = System.IO.File.ReadAllBytes(Server.MapPath(VS_LOAN.Core.Utility.Path.ReportTemplate + "Report-DSHS.xlsx")); stream.Write(info, 0, info.Length); using (ZipArchive archive = new ZipArchive(stream, ZipArchiveMode.Update)) { string nameSheet = "DSHS"; ExcelOOXML excelOOXML = new ExcelOOXML(archive); int rowindex = 4; if (rs != null) { excelOOXML.InsertRow(nameSheet, rowindex, rs.Count - 1, true); for (int i = 0; i < rs.Count; i++)// dòng { excelOOXML.SetCellData(nameSheet, "A" + rowindex, (i + 1).ToString()); excelOOXML.SetCellData(nameSheet, "B" + rowindex, rs[i].MaHoSo.ToString()); excelOOXML.SetCellData(nameSheet, "C" + rowindex, rs[i].NgayTao.ToString("dd/MM/yyyy")); excelOOXML.SetCellData(nameSheet, "D" + rowindex, rs[i].DoiTac); excelOOXML.SetCellData(nameSheet, "E" + rowindex, rs[i].CMND); excelOOXML.SetCellData(nameSheet, "F" + rowindex, rs[i].TenKH); excelOOXML.SetCellData(nameSheet, "G" + rowindex, rs[i].TrangThaiHS); excelOOXML.SetCellData(nameSheet, "H" + rowindex, rs[i].KetQuaHS); excelOOXML.SetCellData(nameSheet, "I" + rowindex, rs[i].NgayCapNhat == DateTime.MinValue ? "" : rs[i].NgayCapNhat.ToString("dd/MM/yyyy")); excelOOXML.SetCellData(nameSheet, "J" + rowindex, rs[i].MaNV); excelOOXML.SetCellData(nameSheet, "K" + rowindex, rs[i].NhanVienBanHang); excelOOXML.SetCellData(nameSheet, "L" + rowindex, rs[i].DoiNguBanHang); excelOOXML.SetCellData(nameSheet, "M" + rowindex, rs[i].CoBaoHiem == true ? "N" : "Y"); excelOOXML.SetCellData(nameSheet, "N" + rowindex, rs[i].DiaChiKH); excelOOXML.SetCellData(nameSheet, "O" + rowindex, rs[i].GhiChu); excelOOXML.SetCellData(nameSheet, "P" + rowindex, rs[i].MaNVLayHS); rowindex++; } } archive.Dispose(); } stream.Dispose(); } bool result = true; if (result) { newUrl = "/File/GetFile?path=" + destDirectory + fileName; return(ToJsonResponse(true, null, newUrl)); } return(ToJsonResponse(false)); } catch (BusinessException ex) { return(ToJsonResponse(false, ex.Message)); } }
public async Task <ActionResult> SaveDaft(string hoten, string phone, string phone2, string ngayNhanDon, int hoSoCuaAi, string cmnd, int gioiTinh , int maKhuVuc, string diaChi, int sanPhamVay, string tenCuaHang, int baoHiem, int thoiHanVay, string soTienVay, int trangthai, string ghiChu, string birthDayStr, string cmndDayStr, int courier = 0) { if (trangthai <= 0 && GlobalData.User.UserType != (int)UserTypeEnum.Sale) { return(ToJsonResponse(false, "Vui lòng chọn trạng thái")); } if (hoten == string.Empty) { return(ToJsonResponse(false, "Vui lòng nhập họ tên")); } if (string.IsNullOrWhiteSpace(birthDayStr)) { return(ToJsonResponse(false, "Vui lòng nhập ngày sinh")); } if (string.IsNullOrWhiteSpace(cmndDayStr)) { return(ToJsonResponse(false, "Vui lòng nhập ngày cấp cmnd")); } try { HoSoModel hs = new HoSoModel(); hs.ID = (int)Session["QL_HoSoID"]; hs.TenKhachHang = hoten; hs.SDT = phone; hs.SDT2 = phone2; if (ngayNhanDon != string.Empty) { hs.NgayNhanDon = DateTimeFormat.ConvertddMMyyyyToDateTime(ngayNhanDon); } hs.HoSoCuaAi = hoSoCuaAi; hs.MaNguoiTao = GlobalData.User.IDUser; hs.NgayTao = DateTime.Now; hs.CMND = cmnd; hs.GioiTinh = gioiTinh; hs.MaKhuVuc = maKhuVuc; hs.DiaChi = diaChi; hs.CourierCode = courier; hs.SanPhamVay = sanPhamVay; hs.TenCuaHang = tenCuaHang; hs.CoBaoHiem = baoHiem; hs.HanVay = thoiHanVay; if (soTienVay == string.Empty) { soTienVay = "0"; } hs.SoTienVay = Convert.ToDecimal(soTienVay); hs.MaTrangThai = (int)TrangThaiHoSo.Nhap; hs.MaKetQua = (int)KetQuaHoSo.Trong; var dtBirthDayConvert = DateTimeFormat.ConvertddMMyyyyToDateTimeV2(birthDayStr); if (!dtBirthDayConvert.Success) { return(ToJsonResponse(false, dtBirthDayConvert.Message)); } else { hs.BirthDay = dtBirthDayConvert.Value; } var dtCmnd = DateTimeFormat.ConvertddMMyyyyToDateTimeV2(cmndDayStr); if (!dtCmnd.Success) { return(ToJsonResponse(false, dtCmnd.Message)); } else { hs.CmndDay = dtCmnd.Value; } List <TaiLieuModel> lstTaiLieu = null; int result = 0; if (hs.ID > 0) { bool isCheckMaSanPham = false; //// chỉnh sửa if (new HoSoBLL().Luu(hs, lstTaiLieu, ref isCheckMaSanPham)) { result = 1; } else { if (isCheckMaSanPham) { return(ToJsonResponse(false, "Mã sản phẩm đã được sử dụng bởi 1 hồ sơ khác, vui lòng chọn mã sản phẩm khác")); } } } else { bool isCheckMaSanPham = false; result = new HoSoBLL().Them(hs, lstTaiLieu, ref isCheckMaSanPham); if (result > 0) { Session["QL_LstFileHoSo"] = result; } else { if (isCheckMaSanPham) { return(ToJsonResponse(false, "Mã sản phẩm đã được sử dụng bởi 1 hồ sơ khác, vui lòng chọn mã sản phẩm khác")); } } } await AddGhichu(hs.ID, ghiChu); if (result > 0) { return(ToJsonResponse(true, Resources.Global.Message_Succ, hs.ID)); } return(ToJsonResponse(false, "Không thành công, xin thử lại sau")); } catch (BusinessException ex) { return(ToJsonResponse(false, ex.Message)); } }
public async Task <JsonResult> CapNhat(int id, string hoten, string phone, string phone2, string ngayNhanDon, int hoSoCuaAi, string cmnd, int gioiTinh , int maKhuVuc, string diaChi, int sanPhamVay, string tenCuaHang, int baoHiem, int thoiHanVay, string soTienVay, int trangThai, int ketQua, string ghiChu, string birthDayStr, string cmndDayStr, int courier = 0, List <int> FileRequireIds = null) { try { if (hoten == string.Empty) { return(ToJsonResponse(false, "Vui lòng nhập họ tên")); } if (phone == string.Empty) { return(ToJsonResponse(false, "Vui lòng nhập số điện thoại")); } if (ngayNhanDon == string.Empty) { return(ToJsonResponse(false, "Vui lòng nhập ngày nhận đơn")); } if (cmnd == string.Empty) { return(ToJsonResponse(false, "Vui lòng nhập CMND")); } if (diaChi == string.Empty) { return(ToJsonResponse(false, "Vui lòng nhập địa chỉ")); } if (maKhuVuc == 0) { return(ToJsonResponse(false, "Vui lòng chọn quận/ huyện")); } if (sanPhamVay == 0) { return(ToJsonResponse(false, "Vui lòng chọn sản phẩm vay")); } if (soTienVay == string.Empty) { return(ToJsonResponse(false, "Vui lòng nhập số tiền vay")); } if (string.IsNullOrWhiteSpace(birthDayStr)) { return(ToJsonResponse(false, "Vui lòng nhập ngày sinh")); } if (string.IsNullOrWhiteSpace(cmndDayStr)) { return(ToJsonResponse(false, "Vui lòng nhập ngày cấp cmnd")); } //List<TaiLieuModel> lstTaiLieu = (List<TaiLieuModel>)Session["Duyet_LstFileHoSo"]; List <LoaiTaiLieuModel> lstLoaiTaiLieu = new LoaiTaiLieuBLL().LayDS(); lstLoaiTaiLieu.RemoveAll(x => x.BatBuoc == 0); if (lstLoaiTaiLieu != null) { var missingNames = BusinessExtension.GetFilesMissingV2(lstLoaiTaiLieu, FileRequireIds); if (!string.IsNullOrWhiteSpace(missingNames)) { return(ToJsonResponse(false, $"Vui lòng nhập: {missingNames}")); } } HoSoModel hs = new HoSoModel(); hs.ID = id; hs.TenKhachHang = hoten; hs.SDT = phone; hs.SDT2 = phone2; if (ngayNhanDon != string.Empty) { hs.NgayNhanDon = DateTimeFormat.ConvertddMMyyyyToDateTime(ngayNhanDon); } hs.HoSoCuaAi = hoSoCuaAi; hs.MaNguoiCapNhat = GlobalData.User.IDUser; hs.NgayCapNhat = DateTime.Now; hs.CMND = cmnd; hs.GioiTinh = gioiTinh; hs.MaKhuVuc = maKhuVuc; hs.DiaChi = diaChi; hs.CourierCode = courier; hs.SanPhamVay = sanPhamVay; hs.TenCuaHang = tenCuaHang; hs.CoBaoHiem = baoHiem; hs.HanVay = thoiHanVay; var dtBirthDayConvert = DateTimeFormat.ConvertddMMyyyyToDateTimeV2(birthDayStr); if (!dtBirthDayConvert.Success) { return(ToJsonResponse(false, dtBirthDayConvert.Message)); } else { hs.BirthDay = dtBirthDayConvert.Value; } var dtCmnd = DateTimeFormat.ConvertddMMyyyyToDateTimeV2(cmndDayStr); if (!dtCmnd.Success) { return(ToJsonResponse(false, dtCmnd.Message)); } else { hs.CmndDay = dtCmnd.Value; } if (soTienVay == string.Empty) { soTienVay = "0"; } hs.SoTienVay = Convert.ToDecimal(soTienVay); hs.MaTrangThai = trangThai; hs.MaKetQua = ketQua; int result = 0; if (hs.ID > 0) { var hosoOld = new HoSoBLL().LayChiTiet(id); if (!(hosoOld.MaTrangThai == trangThai && hosoOld.MaKetQua == ketQua)) { new HoSoXemBLL().Them(hosoOld.ID); } hs.DisbursementDate = hosoOld.DisbursementDate; if (hs.MaTrangThai == (int)TrangThaiHoSo.GiaiNgan) { hs.DisbursementDate = DateTime.Now; } bool isCheckMaSanPham = false; //// chỉnh sửa if (new HoSoBLL().CapNhatHoSo(hs, null, ref isCheckMaSanPham)) { result = 1; } else { if (isCheckMaSanPham) { return(ToJsonResponse(false, "Mã sản phẩm đã được sử dụng bởi 1 hồ sơ khác, vui lòng chọn mã sản phẩm khác")); } } } if (result > 0) { bool rs = new HoSoBLL().CapNhatTrangThaiHS(id, GlobalData.User.IDUser, DateTime.Now, trangThai, ketQua, ghiChu); if (rs) { GhichuModel ghichu = new GhichuModel { UserId = GlobalData.User.IDUser, HosoId = hs.ID, Noidung = ghiChu, CommentTime = DateTime.Now, TypeId = (int)NoteType.Hoso }; await _rpNote.AddNoteAsync(ghichu); return(ToJsonResponse(true, Resources.Global.Message_Succ, hs.ID)); } return(ToJsonResponse(false, "Không thành công, xin thử lại sau")); } return(ToJsonResponse(false, "Không thành công, xin thử lại sau")); } catch (Exception e) { return(ToJsonResponse(false, e.Message)); } }
public ActionResult DownloadReport(int maNhom, int maThanhVien, string fromDate, string toDate, string maHS, string cmnd, int loaiNgay) { if (GlobalData.User.IDUser != 1) { return(RedirectToAction("DanhSachHoSo")); } string newUrl = string.Empty; try { List <HoSoQuanLyModel> rs = new List <HoSoQuanLyModel>(); DateTime dtFromDate = DateTime.MinValue, dtToDate = DateTime.MinValue; if (fromDate != "") { dtFromDate = DateTimeFormat.ConvertddMMyyyyToDateTime(fromDate); } if (toDate != "") { dtToDate = DateTimeFormat.ConvertddMMyyyyToDateTime(toDate); } string trangthai = Helpers.Helpers.GetAllStatusString(); int totalRecord = new HoSoBLL().CountHoSoQuanLy(GlobalData.User.IDUser, maNhom, maThanhVien, dtFromDate, dtToDate, maHS, cmnd, trangthai, loaiNgay, freeText: null); if (totalRecord <= 0) { return(ToResponse(false, "Không có dữ liệu")); } rs = new HoSoBLL().TimHoSoQuanLy(maNVDangNhap: GlobalData.User.IDUser, maNhom: maNhom, maThanhVien: maThanhVien, tuNgay: dtFromDate, denNgay: dtToDate, maHS: maHS, cmnd: cmnd, trangthai: trangthai, loaiNgay: loaiNgay, freeText: string.Empty, page: 1, limit: totalRecord, isDownload: true); if (rs == null) { rs = new List <HoSoQuanLyModel>(); } string destDirectory = VS_LOAN.Core.Utility.Path.DownloadBill + "/" + DateTime.Now.Year.ToString() + "/" + DateTime.Now.Month.ToString() + "/"; bool exists = System.IO.Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + destDirectory); if (!exists) { System.IO.Directory.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory + destDirectory); } string fileName = "Report-DSHS" + DateTime.Now.ToString("ddMMyyyyHHmmssfff") + ".xlsx"; using (FileStream stream = new FileStream(Server.MapPath(destDirectory + fileName), FileMode.CreateNew)) { Byte[] info = System.IO.File.ReadAllBytes(Server.MapPath(VS_LOAN.Core.Utility.Path.ReportTemplate + "Report-DSHS.xlsx")); stream.Write(info, 0, info.Length); using (ZipArchive archive = new ZipArchive(stream, ZipArchiveMode.Update)) { string nameSheet = "DSHS"; ExcelOOXML excelOOXML = new ExcelOOXML(archive); int rowindex = 4; if (rs != null) { excelOOXML.InsertRow(nameSheet, rowindex, rs.Count - 1, true); for (int i = 0; i < rs.Count; i++)// dòng { excelOOXML.SetCellData(nameSheet, "A" + rowindex, (i + 1).ToString()); excelOOXML.SetCellData(nameSheet, "B" + rowindex, rs[i].MaHoSo.ToString()); excelOOXML.SetCellData(nameSheet, "C" + rowindex, rs[i].NgayTao.ToString("dd/MM/yyyy")); excelOOXML.SetCellData(nameSheet, "D" + rowindex, rs[i].DoiTac); excelOOXML.SetCellData(nameSheet, "E" + rowindex, rs[i].CMND); excelOOXML.SetCellData(nameSheet, "F" + rowindex, rs[i].Phone); excelOOXML.SetCellData(nameSheet, "G" + rowindex, rs[i].TenKH); excelOOXML.SetCellData(nameSheet, "H" + rowindex, rs[i].TrangThaiHS); excelOOXML.SetCellData(nameSheet, "I" + rowindex, rs[i].KetQuaHS); excelOOXML.SetCellData(nameSheet, "J" + rowindex, rs[i].NgayCapNhat == DateTime.MinValue ? "" : rs[i].NgayCapNhat.ToString("dd/MM/yyyy")); excelOOXML.SetCellData(nameSheet, "K" + rowindex, rs[i].MaNV); excelOOXML.SetCellData(nameSheet, "L" + rowindex, rs[i].NhanVienBanHang); excelOOXML.SetCellData(nameSheet, "M" + rowindex, rs[i].DoiNguBanHang); excelOOXML.SetCellData(nameSheet, "N" + rowindex, rs[i].CoBaoHiem == true ? "N" : "Y"); excelOOXML.SetCellData(nameSheet, "O" + rowindex, rs[i].KhuVucText); excelOOXML.SetCellData(nameSheet, "P" + rowindex, rs[i].GhiChu); excelOOXML.SetCellData(nameSheet, "Q" + rowindex, rs[i].MaNVLayHS); rowindex++; } } archive.Dispose(); } stream.Dispose(); } bool result = true; if (result) { newUrl = "/File/GetFile?path=" + destDirectory + fileName; return(ToResponse(true, newUrl)); } return(ToResponse(false, null)); } catch (BusinessException ex) { return(ToResponse(false, ex.Message)); } }