public void EditPotential(Potential potentialToEdit) { potentialRepository.Update(potentialToEdit); SavePotential(); }
public ActionResult ConvertLead(ConvertLeadFormModel convertlead) { try { // Get Lead Lead lead = leadService.GetLead(convertlead.LeadID); // Creation of Account Account account = new Account() { AccountName = convertlead.AccountName, WebSite = lead.WebSite, Email = lead.Email, Phone = lead.Phone, Fax = lead.Fax, BillingAddress = lead.Street, BillingCity = lead.City, BillingState = lead.State, BillingCountry = lead.Country, BillingPoBox = lead.POBox, AssignedTo = convertlead.AssignedTo, CreatedOn = DateTime.Now, ModifiedOn = DateTime.Now, CreatedBy = Session["UserID"].ToString(), ModifiedBy = Session["UserID"].ToString(), AssignedToUserGroup = "user" }; accountService.CreateAccount(account); // Creation of Contact Contact contact = new Contact() { FirstName = lead.FirstName, LastName = lead.LastName, LeadSource = lead.LeadSource, HomePhone = lead.Phone, Email = lead.Email, OfficePhone = lead.Phone, Fax = lead.Fax, MailingStreet = lead.Street, MailingCity = lead.City, MailingState = lead.State, MailingCountry = lead.Country, MailingPostalCode = lead.POBox, AssignedTo = convertlead.AssignedTo, CreatedOn = DateTime.Now, ModifiedOn = DateTime.Now, CreatedBy = Session["UserID"].ToString(), ModifiedBy = Session["UserID"].ToString(), AssignedToUserGroup = "user" }; contactService.CreateContact(contact); // Creation of Potential if (!(convertlead.DoNotPotentialCreate)) { Potential potential = new Potential() { LeadSource = lead.LeadSource, PotentialName = convertlead.PotentialName, ExpectedCloseDate = convertlead.PotentialCloseDate, Amount = convertlead.PotentialAmount.ToString(), SalesStage = ((SalesStageEnum)convertlead.PotentialSalesStage).ToString(), AssignedTo = convertlead.AssignedTo, CreatedOn = DateTime.Now, ModifiedOn = DateTime.Now, CreatedBy = Session["UserID"].ToString(), ModifiedBy = Session["UserID"].ToString(), AssignedToUserGroup = "user" }; potentialService.CreatePotential(potential); return RedirectToAction("List", "Potential"); } return RedirectToAction("List", "Account"); } catch (Exception ex) { ViewBag.successMessage = ""; ViewBag.errorMessage = string.Format("Error in Convert Lead Save : {0}", ex.Message); } return View("ConvertLead", convertlead); }
public void CreatePotential(Potential potential) { potentialRepository.Add(potential); SavePotential(); }