public JsonResult GetCustcompaniesList() { var LoginUser = Convert.ToInt32(Session["LoginUser"]); LeadDAL leadObj = new LeadDAL(); List <CustCompanyVM> lstCompanies = new List <CustCompanyVM>(); lstCompanies = leadObj.GetCompanies(LoginUser); return(Json(new { data = lstCompanies }, JsonRequestBehavior.AllowGet)); }
private void UpdateLeadStatus(int leadId) { try { LeadDAL db = new LeadDAL(); Lead_Master lm = new Lead_Master(); lm = db.GetLeadList().Where(x => x.Id == leadId).FirstOrDefault(); lm.Status = "Won"; db.AddLeadDetails(lm); } catch (Exception ex) { throw; } }
internal void ProcessLeadInfo(LeadInfo leadInfo, ref ReturnInfo mRetInfo) { string leadid = string.Empty; string leadStatus = string.Empty; string leadSource = string.Empty; DateTime createdOn = DateTime.Now; DateTime modifiedOn = DateTime.Now; DateTime reactivateOn = DateTime.Now; //Need to get from dynamic entity Dictionary <string, string> attributes = new Dictionary <string, string>(); try { attributes.Add(LeadConstants.AttrEmail, leadInfo.Email); DynamicEntity de = LeadDAL.SelectLead(service, attributes); if (de == null) { attributes.Clear(); attributes.Add(LeadConstants.AttrMobile, leadInfo.MobilePhone); attributes.Add(LeadConstants.AttrFirstName, leadInfo.Firstname); de = LeadDAL.SelectLead(service, attributes); if (de == null) { //Create New Lead and exit //to write //RC 1 mRetInfo.ReturnCode = 1; return; } } //Get the existing lead status foreach (Property p in de.Properties) { if (p.Name == LeadConstants.AttrLeadID) { leadid = CrmHelper.GetSourceValue(p.GetType().Name, p); } if (p.Name == LeadConstants.AttrLeadStatus) { leadStatus = CrmHelper.GetSourceValue(p.GetType().Name, p); } else if (p.Name == LeadConstants.AttrLeadSource) { leadSource = CrmHelper.GetSourceValue(p.GetType().Name, p); } else if (p.Name == LeadConstants.AttrCreatedOn) { createdOn = Convert.ToDateTime(CrmHelper.GetSourceValue(p.GetType().Name, p)); } else if (p.Name == LeadConstants.AttrModifiedOn) { modifiedOn = Convert.ToDateTime(CrmHelper.GetSourceValue(p.GetType().Name, p)); } //else if (p.Name == LeadConstants.AttrReactivateOn) //{ // reactivateOn = Convert.ToDateTime(CrmHelper.GetSourceValue(p.GetType().Name, p)); //} } Guid _leadid = new Guid(leadid); mRetInfo.LeadID = _leadid.ToString(); //UpdateOnly = False if (!leadInfo.UpdateOnly) { if (leadStatus.ToLower() == LeadConstants.StatusOpen) { if (leadSource == LeadConstants.AdminUpload) { //Send Email //need info //RC 3 mRetInfo.ReturnCode = 3; } else { //RC 2 mRetInfo.ReturnCode = 2; } //Create a Note <LeadDetails> LeadDAL.AddNoteToLead(service, _leadid, leadInfo.LeadDetails); } else { //Reactivate Lead and update info. LeadDAL.ReactivateLead(service, metaDataService, leadInfo, _leadid, de); LeadDAL.AddNoteToLead(service, _leadid, leadInfo.LeadDetails); //RC 4 mRetInfo.ReturnCode = 4; } } else { if (leadStatus.ToLower() == LeadConstants.StatusOpen) { if ((createdOn == leadInfo.CreateOn) || (reactivateOn == leadInfo.CreateOn)) { //update refferal name, lead source, enquiry source, campaign source //RC 5 mRetInfo.ReturnCode = 5; } else { //RC 7 mRetInfo.ReturnCode = 7; } //Create a Note <LeadDetails> LeadDAL.AddNoteToLead(service, _leadid, leadInfo.LeadDetails); } else { if (modifiedOn == leadInfo.CreateOn) { //RC 6 mRetInfo.ReturnCode = 6; } else { //RC 8 mRetInfo.ReturnCode = 8; } } } } catch (Exception ex) { mRetInfo.ErrorMessage = ex.Message; } }
public async Task <ActionResult> SaveSalesPackageSubscriptionAsync(SalesPackageSubscription subs) { bool result = false; LeadDAL l = new LeadDAL(); CustomerDataStore c = new CustomerDataStore(); var lst = l.GetLeadByid(subs.LeadId); //string strPassword = "******"; string strPassword = "******"; string strEncrypted = (Helpers.Encrypt(strPassword)); string strDecrypted = (Helpers.Decrypt(strEncrypted)); try { subs.CreatedDate = DateTime.Now; CustWiseAccessDataStore DAL = new CustWiseAccessDataStore(); CustomerDataStore Check = new CustomerDataStore(); SubscriptionDAL Obj = new SubscriptionDAL(); if (ModelState.IsValid) { if (Check.CheckCustomerCount(lst.CorpEmail, strEncrypted) == 0) { SA_Customer Customer = new SA_Customer(); Customer.MenuId = subs.Id.ToString(); Customer.Email = lst.CorpEmail; Customer.Phone = lst.Phone; Customer.UserPassword = strEncrypted; Customer.Role = "Customer"; Customer.ProfileImage = ""; Customer.Fname = lst.Name; Customer.Lname = ""; c.AddCustomer(Customer); subs.UserId = Customer.id; result = await Obj.AddSalesPackageTrial(subs); DAL.AddCustWiseAccess(subs.MenuId, Customer.id); DAL.AddCustProduct(subs.ProductId, Customer.id, subs.MenuId); string EmailBody = SubscriptionDAL.GetHtml("PackageWelcome.html"); //EmailBody = EmailBody.Replace("@Name@", Customer.Fname + " " + Customer.Lname); EmailBody = EmailBody.Replace("@Pass@", "1234"); EmailBody = EmailBody.Replace("@Email@", Customer.Email); //EmailBody = EmailBody.Replace("@SiteRoot@", CommonUtility.SitePath); //EmailBody = EmailBody.Replace("@URL@", CommonUtility.SitePath); SubscriptionDAL.SendMail("Chem Analyst", "info@chemanalyst", Customer.Email, "Package Activation", EmailBody, "*****@*****.**"); UpdateLeadStatus(subs.LeadId); } else { var custId = c.GetCustomerList().Where(w => w.Email == lst.CorpEmail).FirstOrDefault().id; subs.UserId = custId; result = await Obj.AddSalesPackageTrial(subs); DAL.AddCustWiseAccess(subs.MenuId, custId); DAL.AddCustProduct(subs.ProductId, custId, subs.MenuId); return(Json(new { result = "One more package added successfully.", JsonRequestBehavior.AllowGet })); } } } catch (Exception ex) { } return(Json(new { result = "Data Added Successfully", JsonRequestBehavior.AllowGet })); }