public ActionResult SPAM(Guid ID) { Lead dbLead = new Lead(); dbLead = reposetory.GetLead(ID); if (dbLead == null) return RedirectToAction("Index"); dbLead.Status = LeadStatus.SPAM; if (reposetory.Save(dbLead)) { ViewBag.FormSucces = true; } return RedirectToAction("Index"); }
public ActionResult Edit(Guid? ID) { Lead lead; if (ID == null) { lead = new Lead(); } else { lead = reposetory.GetLead((Guid)ID); if (lead == null) return RedirectToAction("Index"); } List<AssociationListModel> tmp = reposetory.GetAssociationList(); ViewBag.Attach = new SelectList(tmp, "AssociationID", "Name"); return View(lead); }
private static void WriteLeadLogFile(Lead lead) { WriteLeadLogFile(lead.FirstName + "," + lead.FamilyName + "," + lead.Address + "," + lead.City + "," + lead.Zip + "," + lead.Mobile + "," + lead.Phone + "," + lead.Email + "," + lead.AssociationID + "," + DateTime.Now.ToString() + "\r\n" ); }
public ActionResult BlivNatteravn(TrialFormModel result) { Initiate(); if (ModelState.IsValid) { Lead lead = new Lead(); lead.FirstName = result.FirstName; lead.FamilyName = result.LastName; lead.Zip = result.Zip; lead.Email = result.Email; lead.Phone = result.Phone; lead.AssociationID = Basedata.AssociationID; lead.Created = DateTime.Now; lead.Lastchanged = DateTime.Now; if (lead.Zip.Length != 0 & lead.Zip.Length < 2) { lead.Zip += "_"; } WriteLeadLogFile(lead); using (var db = new NRDbContext()) { db.Entry(lead).State = EntityState.Added; try { db.SaveChanges(); } catch (Exception e) { LogFile.Write(e, "Save file"); return PartialView("_BlivNatteravnError", result); } } return PartialView("_BlivNatteravnSucces", result); } return PartialView("_BlivNatteravn", result); }
public ActionResult Edit (Lead lead) { Lead dbLead = new Lead(); if (lead.LeadID != Guid.Empty) { dbLead = reposetory.GetLead(lead.LeadID); if (dbLead == null) return RedirectToAction("Index"); } if (ModelState.IsValid) { LeadStatus oldStatus = dbLead.Status; dbLead.FirstName = lead.FirstName; dbLead.FamilyName = lead.FamilyName; dbLead.Status = lead.Status; dbLead.AssociationID = lead.AssociationID == Guid.Empty ? null : lead.AssociationID; dbLead.Address = lead.Address; dbLead.City = lead.City; dbLead.Zip = lead.Zip; dbLead.Phone = lead.Phone; dbLead.Mobile = lead.Mobile; dbLead.Email = lead.Email; dbLead.Age = lead.Age; dbLead.Comments = lead.Comments; dbLead.RequestUpdateMail = false; if (reposetory.Save(dbLead)) { if ((oldStatus == LeadStatus.New | oldStatus == LeadStatus.Acknowledge | oldStatus == LeadStatus.Clarification | lead.LeadID == Guid.Empty) & dbLead.Status == LeadStatus.Assigned & dbLead.AssociationID != null) { string to = string.Empty; List<string> cc = new List<string>(); AccessModel Access = reposetory.GetAccess((Guid)dbLead.AssociationID); BoardModelView Board = reposetory.GetBoardView((Guid)dbLead.AssociationID); to = string.Format("{0} <{1}>", Board.Chairmann.FullName, Board.Chairmann.Email); foreach (PersonAccess M in Access.Form) { if (M.Secretary) { NRMembership p = reposetory.GetMembership(M.FunctionID); //cc += string.Format("{0},", p.Person.Email); cc.Add(string.Format("{0} <{1}>", p.Person.FullName, p.Person.Email)); } else if (M.Planner) { NRMembership p = reposetory.GetMembership(M.FunctionID); //cc += string.Format("{0},", p.Person.Email); cc.Add(string.Format("{0} <{1}>", p.Person.FullName, p.Person.Email)); } } var mail = new LeadAssign { to = to, cc = cc, lead = dbLead }; //return new EmailViewResult(mail); mail.Send(); } lead.LeadID = dbLead.LeadID; ModelState.Clear(); ViewBag.FormSucces = true; } } List<AssociationListModel> tmp = reposetory.GetAssociationList(); //.RemoveAll(item => CU.Memberships.ToList().Exists(p => p.Association.AssociationID == item.AssociationID)); ViewBag.Attach = new SelectList(tmp, "AssociationID", "Name"); return View(lead); }
public ActionResult StatusUpdateRequest(Guid ID) { Lead dbLead = new Lead(); dbLead = reposetory.GetLead(ID); if (dbLead == null) return null; if (dbLead.AssociationID == null) return null; dbLead.RequestUpdateMail = true; if (reposetory.Save(dbLead)) { if (dbLead.AssociationID != null) { string to = string.Empty; List<string> cc = new List<string>(); AccessModel Access = reposetory.GetAccess((Guid)dbLead.AssociationID); BoardModelView Board = reposetory.GetBoardView((Guid)dbLead.AssociationID); to = string.Format("{0} <{1}>", Board.Chairmann.FullName, Board.Chairmann.Email); foreach (PersonAccess M in Access.Form) { if (M.Secretary) { NRMembership p = reposetory.GetMembership(M.FunctionID); //cc += string.Format("{0},", p.Person.Email); cc.Add(string.Format("{0} <{1}>", p.Person.FullName, p.Person.Email)); } else if (M.Planner) { NRMembership p = reposetory.GetMembership(M.FunctionID); //cc += string.Format("{0},", p.Person.Email); cc.Add(string.Format("{0} <{1}>", p.Person.FullName, p.Person.Email)); } } var mail = new LeadRequestUpdate { to = to, cc = cc, lead = dbLead }; //return new EmailViewResult(mail); mail.Send(); } ViewBag.FormSucces = true; } return RedirectToAction("Index"); }
public ActionResult CreatePerson(Guid ID) { Lead dbLead = new Lead(); dbLead = reposetory.GetLead(ID); if (dbLead == null) return RedirectToAction("Index"); NRMembership CU = new NR.Models.NRMembership { Association = reposetory.GetAssociation(CurrentProfile.AssociationID), SignupDate = DateTime.Now, Type = PersonType.Active, Person = new Person { Country = Country.DK, FirstName = dbLead.FirstName, FamilyName = dbLead.FamilyName, Address = dbLead.Address, Zip = dbLead.Zip, City = dbLead.City, Phone = dbLead.Phone, Mobile = dbLead.Mobile } }; return View("../People/edit", CU); }
public ActionResult StatusUpdate(Guid ID, LeadStatus Status) { Lead dbLead = new Lead(); dbLead = reposetory.GetLead(ID); if (dbLead == null) return null; LeadStatus Oldstatus = dbLead.Status; dbLead.Status = Status; dbLead.RequestUpdateMail = false; if (reposetory.Save(dbLead)) { if (Oldstatus != LeadStatus.Succes & dbLead.Status == LeadStatus.Succes) { TempData["Create"] = true; TempData["ID"] = dbLead.LeadID; } else { ViewBag.FormSucces = true; } } return RedirectToAction("Index"); }