//Send email inform new email public void sendEmailNewSuggest(string recieverEmail, string cc, CipfSuggestion info) { try { using (MailMessage mail = new MailMessage()) { //mail.From = new MailAddress("*****@*****.**"); mail.From = new MailAddress("*****@*****.**"); mail.To.Add(recieverEmail); mail.CC.Add(cc); //mail.CC.Add("hvho"); mail.Subject = "Continuous improvement _ New Suggestion"; mail.Body = "<span style=\"font-size:13px;font-family:Helvetica,Arial,sans-serif;\">Dear Sir,</p></br>" + "<span style=\"font-size:13px;font-family:Helvetica,Arial,sans-serif;\">There is a new suggestion to improve our company. Here is link to access your task:</span></br>" + "</br><a style=\"text-decoration:none;font-size:13px;font-family:Helvetica,Arial,sans-serif;color:#0275d8;border-radius:5px;padding:6px 12px 6px 12px;border:1px solid #0071c5;display:inline-block\"" + " href=\"172.22.0.21:8384/myapproval\">Click Here</a></br><hr>" + "<span class=\"small\" style=\"text-decoration-line:underline\"><b>Details:</b></span>" + "<span style=\"font-size:13px;font-family:Helvetica,Arial,sans-serif;\">This is suggested by " + info.OwnerSuggestion + "_" + info.OwnerCode + ".</span></br>" + "</br>" + "<div class=\"row p-0 m - 0\">" + "<span class=\"small\" style=\"text-decoration-line:underline\"><b>Current Status:</b></span>" + "</div>" + "<div class=\"row p-0 m-0\">" + "<span class=\"small\" style=\"font-weight:bold\">" + info.CurrentStatus + "</span>" + "</div>" + "<br />" + "<div class=\"row p-0 m-0\">" + "<span class=\"small\" style=\"text-decoration-line:underline;font-style:oblique\"><b>Suggestion:</b></span>" + "</div>" + "<div class=\"row p-0 m-0\">" + "<span class=\"small\" style=\"font-style:oblique\">" + info.SuggestionAction + "</span>" + "</div>" + "<br /><hr>" + "</br><span style=\"color:#868e96; font-size:10px\">This is an auto-generated message. Please DO NOT reply.</span></br>"; mail.IsBodyHtml = true; //using (SmtpClient smtp = new SmtpClient("smtp.gmail.com", 25)) using (SmtpClient smtp = new SmtpClient("mailgw01", 25)) { //smtp.Credentials = new System.Net.NetworkCredential("*****@*****.**", "Pf1234567"); //smtp.Credentials = new System.Net.NetworkCredential("*****@*****.**", "Pf1234567"); //smtp.EnableSsl = true; //smtp.DeliveryMethod = SmtpDeliveryMethod.Network; //smtp.UseDefaultCredentials = false; smtp.Send(mail); } } } catch (Exception) { throw; } }
//send email approve new suggest public void sendEmailApprovalSuggestion(string recieverEmail, string cc, CipfSuggestion info) { try { using (MailMessage mail = new MailMessage()) { //mail.From = new MailAddress("*****@*****.**"); mail.From = new MailAddress("*****@*****.**"); mail.To.Add(recieverEmail); mail.CC.Add(cc); //mail.CC.Add("hvho"); mail.Subject = "Continuous improvement _ Suggestion are aprroved"; mail.Body = "<span style=\"font-size:13px;font-family:Helvetica,Arial,sans-serif;\">Dear,</p></br>" + "<span style=\"font-size:13px;font-family:Helvetica,Arial,sans-serif;\">" + info.OwnerSuggestion + "_" + info.OwnerCode + "'s new suggestion have been approved.</span></br>" + "</br><hr>" + "<span class=\"small\" style=\"text-decoration-line:underline\"><b>Details:</b></span>" + "<span style=\"font-size:13px;font-family:Helvetica,Arial,sans-serif;\">This is suggested by " + info.OwnerSuggestion + "_" + info.OwnerCode + ".</span></br>" + "</br>" + "<div class=\"row p-0 m - 0\">" + "<span class=\"small\" style=\"text-decoration-line:underline\"><b>Current Status:</b></span>" + "</div>" + "<div class=\"row p-0 m-0\">" + "<span class=\"small\" style=\"font-weight:bold\">" + info.CurrentStatus + "</span>" + "</div>" + "<br />" + "<div class=\"row p-0 m-0\">" + "<span class=\"small\" style=\"text-decoration-line:underline;font-style:oblique\"><b>Suggestion:</b></span>" + "</div>" + "<div class=\"row p-0 m-0\">" + "<span class=\"small\" style=\"font-style:oblique\">" + info.SuggestionAction + "</span>" + "</div>" + "<hr>" + "</br><span style=\"color:#868e96; font-size:10px\">This is an auto-generated message. Please DO NOT reply.</span></br>"; mail.IsBodyHtml = true; //using (SmtpClient smtp = new SmtpClient("smtp.gmail.com", 25)) using (SmtpClient smtp = new SmtpClient("mailgw01", 25)) { //smtp.Credentials = new System.Net.NetworkCredential("*****@*****.**", "Pf1234567"); //smtp.Credentials = new System.Net.NetworkCredential("*****@*****.**", "Pf1234567"); //smtp.EnableSsl = true; //smtp.DeliveryMethod = SmtpDeliveryMethod.Network; //smtp.UseDefaultCredentials = false; smtp.Send(mail); } } } catch (Exception) { throw; } }
public async Task <CipfSuggestion> AddNewSuggestion(CipfSuggestion suggestion) { DateTime dtSubmit = DateTime.Now; //string Id = (dtSubmit.ToLongTimeString()+dtSubmit.ToShortDateString()+ suggestion.OwnerCode).Replace(" ", "").Replace("-", "").Replace("/", "").Replace(".", "").Replace(":",""); suggestion.SuggestionId = suggestion.SuggestionId; suggestion.SubmitDate = dtSubmit; suggestion.ApproveDt = new DateTime(1900, 1, 1); suggestion.AssignDt = new DateTime(1900, 1, 1); suggestion.PlanFinishActionDt = new DateTime(1900, 1, 1); suggestion.Status = "Đăng ký mới"; suggestion.IndicatorOfStatus = 1; _context.CipfSuggestion.Add(suggestion); await _context.SaveChangesAsync(); return(await Task.FromResult(suggestion)); }
//Edit new topic public async Task <bool> UpdateData(CipfSuggestion cipf) { var ExistingSuggestion = _context.CipfSuggestion.Where(x => x.Id == cipf.Id).FirstOrDefault(); if (ExistingSuggestion != null) { ExistingSuggestion.DeptRecSug = cipf.DeptRecSug; ExistingSuggestion.ExpectedBenefit = cipf.ExpectedBenefit; ExistingSuggestion.Email = cipf.Email; ExistingSuggestion.SuggestionAction = cipf.SuggestionAction; ExistingSuggestion.CurrentStatus = cipf.CurrentStatus; ExistingSuggestion.SubmitDate = DateTime.Now; await _context.SaveChangesAsync(); } else { return(await Task.FromResult(false)); } return(await Task.FromResult(true)); }