public ActionResult Run([Bind(Include = "ID")] Channel channel) { Channel c = db.Channels.Find(channel.ID); c.Instantrun = !c.Instantrun; db.Entry(c).State = EntityState.Modified; db.SaveChanges2noDate(); return(RedirectToAction("Index")); }
public static void SendAlertPfizerLink() { PCMSDBContext db = new PCMSDBContext(); SmtpClient client = initClient(); MailMessage message = initMail(Status.SettingType.PfizerLinkAlert); message.Subject = "[PCMS] 화이자링크 신청이 등록되었습니다."; string template = File.ReadAllText(System.Web.Hosting.HostingEnvironment.MapPath("~/Template/PfizerLinkEmail.html")); IEnumerable <Privacy> pLinks = db.Privacies.Where(p => !string.IsNullOrEmpty(p.LINK_RESERVATION) && !p.LINK_ALERTED); foreach (Privacy p in pLinks) { try { message.Body = Engine.Razor.RunCompile(template, Guid.NewGuid().ToString(), typeof(Privacy), p); db.Userlogs.Add(new Userlog { useremail = message.To.ToString(), reqtype = @"Email", url = message.Subject, parameters = message.Body }); client.Send(message); p.LINK_ALERTED = true; db.Entry(p).State = System.Data.Entity.EntityState.Modified; } catch (Exception e) { log.Error(e); } } message.Dispose(); db.SaveChanges(); }
public ActionResult ReSend(SendChannel channel, string nkeys) { string temp = Regex.Replace(nkeys, @"\D", " "); string[] nums = temp.Split(' '); foreach (string k in nums) { if (string.IsNullOrEmpty(k)) { continue; } List <Privacy> plist = db.Privacies.Where(p => p.NucleusKey.Equals(k)).ToList(); foreach (Privacy pp in plist) { pp.SENDCHANEL &= ~channel; if (channel == SendChannel.PFORCERX) { pp.SENDCHANEL &= ~SendChannel.PFORCERX_INVALID; pp.SENDCHANEL &= ~SendChannel.PFORCERX_ONEKEY_DUP; } db.Entry(pp).State = System.Data.Entity.EntityState.Modified; } db.SaveChanges(); } return(RedirectToAction("ReSend"));; }
public JsonResult DecideRequest(int id, int action, string message) { Approval approval = db.Approvals.Find(id); if (approval == null) { return(Json(new { result = false })); } Privacy p = db.Privacies.Find(approval.privacyId); if (action == 1) { if (!CommonUtil.checkEmail(p.EMAIL) && !CommonUtil.checkMobile(p.MOBILE)) { return(Json(new { result = false, msg = @"일부 데이터가 적합하지 않습니다. 승인할 수 없습니다.[이메일,핸드폰]" })); } if (string.IsNullOrEmpty(p.CONSENT.CONSENT_SOURCE)) { return(Json(new { result = false, msg = @"일부 데이터가 적합하지 않습니다. 승인할 수 없습니다.[동의서채널]" })); } approval.status = ApprovalStatus.Approved; } else if (action == 2) { approval.status = ApprovalStatus.Rejected; } if (!string.IsNullOrEmpty(message)) { approval.message = message; } db.Entry(approval).State = EntityState.Modified; db.SaveChanges(); if (!string.IsNullOrEmpty(p.LINK_RESERVATION) && approval.status == ApprovalStatus.Approved) { SMTPHelper.SendAlertPfizerLink(p); } if (approval.status == ApprovalStatus.Approved) { SMTPHelper.SendAlertApproved(p); } else if (approval.status == ApprovalStatus.Rejected) { SMTPHelper.SendAlertRejected(p); } return(Json(new { result = true })); }
public ActionResult Edit([Bind(Include = "ID,name,ftpname,status,createdate,modifieddate")] Collection collection) { if (ModelState.IsValid) { db.Entry(collection).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(collection)); }
public ActionResult Edit(Setting setting) { if (ModelState.IsValid) { db.Entry(setting).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(setting)); }
public ActionResult Edit([Bind(Include = "ID,title,contents")] Agreement agreement) { if (ModelState.IsValid) { Agreement a = db.Agreements.Find(agreement.ID); a.title = agreement.title; a.contents = agreement.contents; db.Entry(a).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(agreement)); }
public ActionResult Edit([Bind(Include = "ID,name,createdate,creator,modifieddate,modifier")] AccessRoles accessRoles) { if (ModelState.IsValid) { string currentuser = !string.IsNullOrEmpty(User?.Identity?.Name) ? User.Identity.Name.ToUpper() : "Anonymous"; currentuser = currentuser.Substring(currentuser.IndexOf('\\') + 1).Replace("\\", "").ToUpper(); accessRoles.modifier = currentuser; accessRoles.modifieddate = DateTime.UtcNow; db.Entry(accessRoles).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(accessRoles)); }
public ActionResult Edit([Bind(Include = "ID,pathID,roleID")] AccessAuthorities accessAuthorities) { if (accessAuthorities.pathID > 0 && accessAuthorities.roleID > 0 && accessAuthorities.ID > 0) { string currentuser = !string.IsNullOrEmpty(User?.Identity?.Name) ? User.Identity.Name.ToUpper() : "Anonymous"; currentuser = currentuser.Substring(currentuser.IndexOf('\\') + 1).Replace("\\", "").ToUpper(); accessAuthorities.modifier = currentuser; accessAuthorities.modifieddate = DateTime.UtcNow; db.Entry(accessAuthorities).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(accessAuthorities)); }
protected void ChannelStatus(Channel channel, ActionStatus status) { using (System.Data.Entity.DbContextTransaction dbTran = upsertContext.Database.BeginTransaction()) { try { Channel c = upsertContext.Channels.Find(channel.ID); c.action = status; upsertContext.Entry(c).State = EntityState.Modified; upsertContext.SaveChanges(); dbTran.Commit(); } catch (Exception e) { log.Error(e); dbTran.Rollback(); } dbTran.Dispose(); } }
public void TaskApi() { // 네트워크드라이브 연결 NetworkDriveHelper.Connect(); //CommonUtil.LogWrite("Start PcmsTask"); //CommonUtil.LogWrite("connection string" + System.Configuration.ConfigurationManager.ConnectionStrings["PUBLISH"].ConnectionString); // 디비 연결 PCMSDBContext db = new PCMSDBContext(); string curHour = DateTime.UtcNow.ToString("HH"); //CommonUtil.LogWrite("현재시간:" + curHour); List <Channel> channels = new List <Channel>(); try { channels = db.Channels.ToList(); } #pragma warning disable CS0168 // The variable 'e' is declared but never used catch (Exception e) { #pragma warning restore CS0168 // The variable 'e' is declared but never used //CommonUtil.LogWrite(e.Message); } //CommonUtil.LogWrite("Channel Count:" + channels.Count()); foreach (Channel c in channels) { //CommonUtil.LogWrite("Channel:"+c.name + "=" + c.type); // 사용여부 if (c.usage == false && !c.Instantrun) { continue; } // 입력 시간 -> UTC 화 int athour = c.athour - 9 < 0 ? c.athour - 9 + 24: c.athour - 9; if (string.Format("{0:D2}", athour) != curHour && !c.Instantrun) { continue; } if (!c.Instantrun) { //CommonUtil.LogWrite("Time Trigger"); // 최근실행 내역 비교 var bs = db.Batches.Where(b => b.name == c.name && b.bound == c.bound); if (bs.Count() > 0) { Batch lastrun = bs.OrderByDescending(b => b.ID).First(); string cur = DateTime.UtcNow.ToString("yyyyMMddHH"); string old = lastrun.createdate.ToString("yyyyMMddHH"); if (cur == old) { continue; } } } else { //CommonUtil.LogWrite("Instant Run"); c.Instantrun = false; db.Entry(c).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } // 실행 if (c.name == @"ODSM" && c.bound == BoundType.Inbound) { ODSMInbound bound = new ODSMInbound(c); bound.Execute(); } else if (c.name == @"N360" && c.bound == BoundType.Outbound) { N360Outbound bound = new N360Outbound(c); bound.Execute(); } else if (c.name == @"PforceRX" && c.bound == BoundType.Inbound) { PforceRXInbound bound = new PforceRXInbound(c); bound.Execute(); } else if (c.name == @"PforceRX" && c.bound == BoundType.Outbound) { PforceRXOutbound bound = new PforceRXOutbound(c); bound.Execute(); } else if (c.name == @"MMS" && c.bound == BoundType.Inbound) { MMSInbound bound = new MMSInbound(c); bound.Execute(); } } // for channel // 삭제/만료 설정 추가 try { if (db.Settings.Where(s => s.type == SettingType.ExpiredBatch).Count() < 1) { Setting s = new Setting(); s.name = @"만료배치"; s.type = SettingType.ExpiredBatch; s.value = @"N"; db.Settings.Add(s); db.SaveChanges(); } if (db.Settings.Where(s => s.type == SettingType.RemoveBatch).Count() < 1) { Setting s = new Setting(); s.name = @"삭제배치"; s.type = SettingType.RemoveBatch; s.value = @"N"; db.Settings.Add(s); db.SaveChanges(); } #pragma warning disable CS0168 // The variable 'e' is declared but never used } catch (Exception e) { #pragma warning restore CS0168 // The variable 'e' is declared but never used } // 삭제처리 if (curHour == "00") { Setting ss = db.Settings.Where(s => s.type == SettingType.RemoveBatch).First(); if (ss.value != @"N") { DeleteTask dt = new DeleteTask(); dt.Execute(); } } // 기간 만료 하기 if (curHour == "00") { Setting ss = db.Settings.Where(s => s.type == SettingType.ExpiredBatch).First(); if (ss.value != @"N") { ExpirationTask et = new ExpirationTask(); et.Execute(); } } NetworkDriveHelper.Disconnect(); //CommonUtil.LogWrite("PcmsTask End."); }