public void SendMail(ShapefileRequest solicitant) { MailMessage _rejectedMail = new MailMessage(); _rejectedMail.IsBodyHtml = true; try { _rejectedMail.From = new MailAddress(_UserName, "Apele Romane"); _rejectedMail.To.Add(new MailAddress(solicitant.SolicitantEmail, solicitant.SolicitantName)); _rejectedMail.Subject = "Cerere Refuzata"; #warning check templates link string _Body = System.IO.File.ReadAllText("../../Templates/Reject.html"); _Body = _Body.Replace("__REASON__", solicitant.OperatorResolution.ResolutionDetails); _rejectedMail.Body = _Body; _SmtpClient.Send(_rejectedMail); Console.WriteLine("Reject Mail send"); } catch (Exception e) { Console.WriteLine(e); } }
public void SendMail(ShapefileRequest solicitant) { MailMessage _aprovedMail = new MailMessage(); _aprovedMail.IsBodyHtml = true; try { _aprovedMail.From = new MailAddress(_UserName, "Apele Romane"); _aprovedMail.To.Add(new MailAddress(solicitant.SolicitantEmail, solicitant.SolicitantName)); _aprovedMail.Subject = "Cerere Aprobata"; #warning check templates link string _Body = System.IO.File.ReadAllText("../../Templates/Approve.html"); #warning TODO - Change LINK with "solicitant.DownloadLink.PublicId" _Body = _Body.Replace("__LINK__", "https://www.google.ro"); _aprovedMail.Body = _Body; _SmtpClient.Send(_aprovedMail); Console.WriteLine("Approve Mail send"); } catch (Exception e) { Console.WriteLine(e); } }
//First step of the flux. Validating the operator public Boolean ValidateRequest(ShapefileRequest _request) { if (_request.SolicitantName == null) { return(false); } if (_request.Locality == null) { return(false); } if (_request.CUI == null) { return(false); } if (_request.SolicitantEmail == null) { return(false); } if (_request.RequestDetails == null) { return(false); } if (_request.Layers == null) { return(false); } return(true); }
public ActionResult AddShapefileRequest(ShapefileRequest shapefileRequest) { try { if (verificaManipulariJavaScriptXSS(shapefileRequest)) { ViewBag.MessageManipulariJavaScript = "Nu sunt permise manipulari JavaScript/XSS(taguri, scripturi html)"; } if (ModelState.IsValid && !verificaManipulariJavaScriptXSS(shapefileRequest)) { if (this.IsCaptchaValid("Captcha is not valid")) { ViewBag.MessageSuccessAddSolicitant = "Solicitantul a fost adaugat cu succes!"; Common.Models.ShapefileRequest shapefileRequestBussiness = new Common.Models.ShapefileRequest(); Convertor.CopyObject(shapefileRequest, shapefileRequestBussiness); manager.StartForwardFlux(shapefileRequestBussiness); return(View("Result", shapefileRequest)); //return RedirectToAction("Index"); } ViewBag.ErrMessageCaptcha = "Codul Captcha nu este valid."; return(View("AddShapefileRequest")); } else { return(View("AddShapefileRequest")); } } catch { return(View()); } }
//vom face o metoda care verifica fiecare camp si vede daca avem manipulari javaScript(folosindu-ne de biblioteca XSS) public bool verificaManipulariJavaScriptXSS(ShapefileRequest op) { //incercam sa luam campurile fara scripturi, taguri html //daca avem manipulari javascript atunci va returna true altfel false string numeSolicitant = Sanitizer.GetSafeHtmlFragment(op.SolicitantName); string cui = Sanitizer.GetSafeHtmlFragment(op.CUI); string zonaDeInteres = Sanitizer.GetSafeHtmlFragment(op.InterestArea); string emailSolicitant = Sanitizer.GetSafeHtmlFragment(op.SolicitantEmail); string detaliiCerere = Sanitizer.GetSafeHtmlFragment(op.RequestDetails); if ((!numeSolicitant.Equals(op.SolicitantName) && (op.SolicitantName != null))) { return(true); } if (!cui.Equals(op.CUI) && (op.CUI != null)) { return(true); } if (!emailSolicitant.Equals(op.SolicitantEmail) && (op.SolicitantEmail != null)) { return(true); } if (!detaliiCerere.Equals(op.RequestDetails) && (op.RequestDetails != null)) { return(true); } if (!zonaDeInteres.Equals(op.InterestArea) && (op.InterestArea != null)) { return(true); } return(false); }
// Starts from the first form and ends at the request email. Called from the controller of the first form public void StartForwardFlux(ShapefileRequest _request) { // if (_validator.ValidateRequest(_request)) // { _efManager.RegisterRequest(_request); _mailManager.SendRequest(_request); // } }
public void SendMail(ShapefileRequest solicitant) // de primit shapefilerequest { MailMessage _requestMail = new MailMessage(); _requestMail.IsBodyHtml = true; try { _requestMail.From = new MailAddress(_UserName, "Apele Romane"); foreach (string _operator in _Operators) { _requestMail.To.Add(new MailAddress(_operator, "Operator")); } _requestMail.Subject = "Cerere"; //#warning check templates link string _Body = System.IO.File.ReadAllText("../../Templates/Request.html"); _Body = _Body.Replace("__NumeSolicitant__", solicitant.SolicitantName); _Body = _Body.Replace("__CUI__", solicitant.CUI); // _Body = _Body.Replace("__Localitate__", solicitant.Locality); _Body = _Body.Replace("__EmailSolicitant__", solicitant.SolicitantEmail); _Body = _Body.Replace("__DetaliiCerere__", solicitant.RequestDetails); //#warning replace with LINK/function/?? //_Body = _Body.Replace("__RequestLink__", "Get link function with solicitant.ShapefileRequestId"); _requestMail.Body = _Body; _SmtpClient.Send(_requestMail); Console.WriteLine("Request Mail send"); } catch (Exception e) { Console.WriteLine(e); } }
public ShapefileRequest SaveShapefileRequest(ShapefileRequest shapefileRequest) { this.ShapefileRequests.Add(shapefileRequest); this.SaveChanges(); return(shapefileRequest); }
// second step of the forward flux. Registers the request from the first form public void RegisterRequest(ShapefileRequest _request) { var db = PublicShapefileServiceContext.Instance; db.SaveShapefileRequest(_request); }
//Last step of the forward flux. Sends the request email to the operator for later aproval/rejection public void SendRequest(ShapefileRequest _request) { RequestMail forwardMail = new RequestMail(); forwardMail.SendMail(_request); }