public ActionResult Close(Job job) { bool closed = false; using (var tran = RepositoryFactory.StartTransaction()) { closed = RepositoryFactory.Action<JobAction>().CloseJob(job.Id); tran.Commit(); } if (closed) { return View("CloseOk"); } return new HttpNotFoundResult(); }
/// <summary> /// Sends the notification email. /// </summary> /// <param name="job">The job.</param> private bool SendNotificationEmail(Job job) { string mailTemplate = RenderPartialViewToString("SendMail", job); var match = Regex.Match(mailTemplate, "<email>(.*)</email>", RegexOptions.Singleline); var mailText = match.Groups[1].Value; // send email to creator return SendEmail(job.Email, "[jobs.preweb.sk] Potvrdenie registracie", mailText); }
public ActionResult Create(Job job) { if (job.Properties == null) { job.Properties = new PropertyInfo[] {}; } if (Request.Form["AddProperty"] != null) { var propertyList = job.Properties.ToList(); propertyList.Add(new PropertyInfo()); job.Properties = propertyList.ToArray(); } else if (GetRemoveItemIndex() >= 0) { var removeItemIndex = GetRemoveItemIndex(); var propertyList = job.Properties.ToList(); RemoveFromModelState(removeItemIndex, propertyList.Count); propertyList.RemoveAt(removeItemIndex); job.Properties = propertyList.ToArray(); } else if (ModelState.IsValid) { using (var tran = RepositoryFactory.StartTransaction()) { job.JobType = JobTypeEnum.People; RepositoryFactory.Action<JobAction>().Create(job); tran.Commit(); } if (SendNotificationEmail(job)) { return ViewWithAjax("SendOk"); } return ViewWithAjax("SendFail"); } return ViewWithAjax(job); }
private bool SendContactEmail(ContactModel contact, Job job) { string mailTemplate = RenderPartialViewToString("ContactMail", contact); var match = Regex.Match(mailTemplate, "<email>(.*)</email>", RegexOptions.Singleline); var mailText = match.Groups[1].Value; // send email to creator return SendEmail(job.Email, "[jobs.preweb.sk] Odpoved od " + contact.Email, mailText); }
/// <summary> /// URL: /People/Create /// </summary> /// <returns>Action result.</returns> public ActionResult Create() { var job = new Job { Properties = new PropertyInfo[] {} }; return ViewWithAjax(job); }