public JsonResult SetBookmarkForDistReceiver(int?dist_idx, int?grp_idx) { try { var bookmarkUserList = Mapper.Instance().QueryForList <BookmarkUser>("DIST.selBookmarkUser", new BookmarkUser { grp_idx = grp_idx, create_us = Convert.ToInt32(Session["USER_IDX"]) }); List <DistReceiverModel> list = new List <DistReceiverModel>(); foreach (BookmarkUser usr in bookmarkUserList) { DistReceiverModel recv = new DistReceiverModel(); recv.dist_idx = dist_idx; recv.recv_us = usr.grp_us_idx; recv.isVender = usr.us_role == 10 ? "Y" : "N"; list.Add(recv); } return(SetDistReceiver(dist_idx, list)); } catch (Exception ex) { return(Json(new ResultJsonModel { isError = true, resultMessage = ex.Message, resultDescription = ex.ToString() })); } }
public MailContent(DistMasterModel pDistMaster, UserModel pFromUserModel, DistReceiverModel pToUserModel, HttpRequestBase Request) { distMaster = pDistMaster; fromUserModel = pFromUserModel; toUserModel = pToUserModel; mailContentLink = string.Format(mailContentLink, Request.Url.Authority); }
public JsonResult SetReDistReceiver(DistReceiverModel reciverModel) { try { if (reciverModel == null) { throw new Exception(Resources.Resource.res0219);//잘못된 호출입니다 } if (reciverModel.dist_idx == null) { throw new Exception(Resources.Resource.res0219);//잘못된 호출입니다 } Mapper.Instance().BeginTransaction(); ConfigModel disuseTerm = Mapper.Instance().QueryForObject <ConfigModel>("Common.selConfig", new ConfigModel { comm_section = "DIST", comm_code = "EXPIRE_TERM" }); DateTime now = DateTime.Now; DateTime finishDate = now.AddDays(Convert.ToInt32(disuseTerm.comm_value)); int recvUpdate = Mapper.Instance().Update("DIST.udtDistReceiverFinishdate", new DistReceiverModel { dist_idx = reciverModel.dist_idx, recv_idx = reciverModel.recv_idx, recv_finish_dt = finishDate, recv_dist_st = "DS" }); if (recvUpdate <= 0) { throw new Exception(Resources.Resource.res0313);//수신자 상태를 수정하지 못했습니다 } Mapper.Instance().CommitTransaction(); return(Json("1")); } catch (Exception ex) { Mapper.Instance().RollBackTransaction(); return(Json(new ResultJsonModel { isError = true, resultMessage = ex.Message, resultDescription = ex.ToString() })); } }
public JsonResult SetChangeRecieverFinishDate(DistReceiverModel recvModel) { try { if (recvModel.recv_finish_date == "") { throw new Exception(Resources.Resource.res0220); } //"날짜가 설정되지 않았습니다." Mapper.Instance().Update("DIST.udtDistReceiverFinishdate", recvModel); return(Json(recvModel.recv_finish_date)); } catch (Exception ex) { return(Json(new ResultJsonModel { isError = true, resultMessage = ex.Message, resultDescription = ex.ToString() })); } }
public JsonResult GetDistReciverInfo(DistReceiverModel searchModel) { try { if (searchModel.dist_idx == null) { return(Json(null)); } var resList = Mapper.Instance().QueryForList <DistReceiverModel>("DIST.selDistReceiver", searchModel); return(Json(resList)); } catch (Exception ex) { return(Json(new ResultJsonModel { isError = true, resultMessage = ex.Message, resultDescription = ex.ToString() })); } }
public int UpdateRecvDistStatus(NpgsqlTransaction tran, DistReceiverModel recv) { try { if (!dbCon.IsDBConnected) { dbCon.DBConnect(); } string sQuery = "UPDATE dist_receiver SET recv_dist_st = '{0}' WHERE recv_idx = {1}"; sQuery = string.Format(sQuery, recv.recv_dist_st, recv.recv_idx); int res = dbCon.DBExecuteQuery(tran, sQuery); return(res); } catch (Exception ex) { throw ex; } }
public ActionResult DistAllFileDownload(int?dist_idx) { if (dist_idx == null) { throw new Exception(Resources.Resource.res0598);//잘못된 호출방식입니다. } DistMasterModel dist = Mapper.Instance().QueryForObject <DistMasterModel>("DIST.selDistMaster", new DistMasterModel { dist_idx = dist_idx }); DistReceiverModel recv = Mapper.Instance().QueryForObject <DistReceiverModel>("DIST.selDistReceiver", new DistReceiverModel { dist_idx = dist_idx, recv_us = Convert.ToInt32(Session["USER_IDX"]) }); if (dist.dist_st == "CR") { throw new Exception(Resources.Resource.res0328);//"해당 배포 파일은 다운로드 할 수 없습니다." } if (dist.dist_st == "DF" && recv.recv_dist_st == "DF") { throw new Exception(Resources.Resource.res0297);//배포가 만료된 파일입니다. } var distFile = Mapper.Instance().QueryForList <DistRecvFileModel>("DIST.selDistRecvFile", new DistRecvFileModel { dist_idx = dist_idx, recv_us = Convert.ToInt32(Session["USER_IDX"]) }); List <string[]> files = new List <string[]>(); foreach (DistRecvFileModel recvFile in distFile) { //System.IO.Stream fStream = null; string fileOrgName = recvFile.file_org_nm; string fileConvName = recvFile.file_conv_nm; string filePath = string.Empty; if (recvFile.is_itf == "N") { filePath = System.Configuration.ConfigurationManager.AppSettings["LocalFilePath"].ToString() + "\\" + recvFile.dist_idx; } else { filePath = System.Configuration.ConfigurationManager.AppSettings["EoFilePath"].ToString() + "\\" + recvFile.part_no; } string downloadFileFullPath = string.Empty; if (!CommonUtil.IsFile(filePath, fileConvName)) { ViewBag.Massage = Resources.Resource.res0366; // 파일이 없습니다. return(View("Common/DistFileDownload")); } if (fileConvName.ToLower().Contains(".pdf")) { PdfWatermark watermark = new PdfWatermark(); downloadFileFullPath = watermark.SetWaterMarkPdf(filePath, fileConvName, Convert.ToInt32(Session["USER_IDX"]), CommonUtil.GetRemoteIP(this.Request)); } else { downloadFileFullPath = Path.Combine(filePath, fileConvName); } files.Add(new string[] { downloadFileFullPath, recvFile.file_org_nm }); LogCtrl.SetLog(recvFile, eActionType.FileDown, this.HttpContext, "전체 다운로드 : " + dist.dist_title); } using (var memoryStream = new MemoryStream()) { using (ZipArchive ziparchive = new ZipArchive(memoryStream, ZipArchiveMode.Create, true)) { for (int i = 0; i < files.Count; i++) { if (System.IO.File.Exists(files[i][0].ToString())) { ziparchive.CreateEntryFromFile(files[i][0].ToString(), files[i][1].ToString()); } } } return(File(memoryStream.ToArray(), "application/zip", HttpUtility.UrlEncode(dist.dist_title + ".zip", System.Text.Encoding.UTF8))); } }