Exemple #1
0
        // GET: Home/LeadInfo/5
        public ActionResult LeadInfo(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            var formData = _db.Leads.Where(t => t.Id == id).FirstOrDefault();

            var currentLanguageId = CultureHelper.GetCurrentLanguageId(Request.Cookies["_culture"]);


            ViewBag.message= TempData["message"];
            ViewBag.SMSmessage = TempData["SMSmessage"];
            var leadVm = new LeadViewModel()
            {
                Name = formData.Name,
                Email = formData.Email,
                Address = formData.Address,
                Status = (LeadStatusEnum)formData.Status,
                Phone_Number = formData.Phone_Number,
                Notes = formData.Notes,
                Created_Date = formData.Created_Date,
                AssigneeId=formData.AssigneeId,
                AssigneeName = LanguageFallbackHelper.GetUserProfile((formData.UserProfile?.Id??0), currentLanguageId)?.FullName,
                CampaignId = formData.CampaignId,
                CampaignName = LanguageFallbackHelper.GetCampaigns(formData.Campaign.Id, currentLanguageId).Name
            };
            ViewBag.Lead_ID = id;
            return View(leadVm);
        }
Exemple #2
0
 public ActionResult GetSearchLeads(string searchData)
 {
     LeadViewModel objviewmodel = new LeadViewModel();
     JavaScriptSerializer json_serializer = new JavaScriptSerializer();
     json_serializer.MaxJsonLength = int.MaxValue;
     object[] objData = (object[])json_serializer.DeserializeObject(searchData);
     foreach (Dictionary<string, object> item in objData)
     {
         string salesManager = string.Empty;
         if (item.ContainsKey("SalesManager"))
         {
             salesManager = Convert.ToString(item["SalesManager"]);
         }
         else
         {
             var userDetails = (CustomerLoginDetail)Session["UserSession"];
             salesManager = userDetails.LoginId;
         }
             objviewmodel.lstsALES_TblLeads = SLR.GetSearchedLeads(Convert.ToString(item["MobileNo"]), Convert.ToString(item["BusinessName"]), 
             Convert.ToString(item["DtFrom"]), Convert.ToString(item["DtTo"]), Convert.ToString(item["LeadStatus"]), 
             Convert.ToString(item["ContactType"]), Convert.ToString(item["MeetingType"]), Convert.ToString(item["City"]),
             Convert.ToString(item["BillingPartner"]), salesManager);
     }
     
     return PartialView("_SearchLeadListing", objviewmodel);
 }
Exemple #3
0
 public ActionResult TransferLead(int[] LeadId, string SaleManagerId)
 {
     var userDetails = (CustomerLoginDetail)Session["UserSession"];
     LeadViewModel objviewmodel = new LeadViewModel();
     bool result = SLR.LeadTransfer(LeadId, SaleManagerId, userDetails.LoginId);
     return PartialView("_LeadTransferList", objviewmodel);
 }
Exemple #4
0
        public ActionResult SubmitLead(LeadViewModel model)
        {
            /* //TODO: 6. Call the WebAPI service here & pass results to UI
             * //Post: api/home
             * [HttpPost]
             * public string Post([FromBody] postModelData obj)
             * {
             * string myObj = "Success";
             * return myObj.ToString();
             * }
             *
             * //Get: api
             * [HttpGet]
             * public string Get(int id)
             * {
             * string myObj = ""
             *  return myObj.toString();
             * }*/



            LeadViewModel result = new LeadViewModel()
            {
                Results = new LeadResultViewModel()
                {
                    LeadId       = new Random().Next(),
                    IsSuccessful = true,
                    Message      = "Thank you for submitting your details"
                }
            };

            return(View("Index", result));
        }
Exemple #5
0
 public ActionResult LeadInfo(LeadViewModel lead)
 {
     try
     {
         // TODO: Add update logic here
         var leadData = _db.Leads.Find(lead.Id);
         if (leadData != null)
         {
             leadData.Name = lead.Name;
             leadData.Phone_Number = lead.Phone_Number;
             leadData.Email = lead.Email;
             leadData.Address = lead.Address;
             leadData.Notes = lead.Notes;
             leadData.Status = (int)lead.Status;
             leadData.AssigneeId = lead.AssigneeId;
             leadData.CampaignId = lead.CampaignId;
             _db.SaveChanges();
             TempData["message"] = "The lead has been Updated";
         }
         return RedirectToAction("LeadInfo", new {id= lead.Id});
     }
     catch (Exception ex)
     {
         LogHelper.LogException(User.Identity.Name, ex, "Error While editing Lead (Post)");
         return null;
     }
 }
Exemple #6
0
        /// <summary>
        /// Convert LeadViewModel to Lead object
        /// </summary>
        /// <param name="leadViewModel"></param>
        /// <returns></returns>
        public static Lead LeadViewModelToLead(LeadViewModel leadViewModel)
        {
            var lead = new Lead();

            lead.PodioItemID       = leadViewModel.PodioItemID;
            lead.Company           = leadViewModel.Company;
            lead.ExpectedValue     = leadViewModel.ExpectedValue;
            lead.ProbabilityOfSale = leadViewModel.ProbabilityOfSale;
            lead.Status            = new Tuple <int, string>(leadViewModel.Status, "");
            lead.NextFollowUp      = leadViewModel.NextFollowUp;
            lead.StreetAddress     = leadViewModel.StreetAddress;
            lead.City    = leadViewModel.City;
            lead.State   = leadViewModel.State;
            lead.Zip     = leadViewModel.Zip;
            lead.Country = leadViewModel.Country;

            if (leadViewModel.LeadContacts != null && leadViewModel.LeadContacts.Any())
            {
                lead.Contacts = leadViewModel.LeadContacts.ToDictionary(k => k.Value, v => v.Value.ToString());
            }

            if (leadViewModel.LeadOwners != null && leadViewModel.LeadOwners.Any())
            {
                lead.LeadOwners = leadViewModel.LeadOwners.ToDictionary(k => k.Value, v => v.Value.ToString());
            }

            return(lead);
        }
Exemple #7
0
        public ActionResult AddLead(string leadId)
        {
            LeadViewModel objviewmodel = new LeadViewModel();
            SALES_tblLeads objData = new SALES_tblLeads();
            if (!string.IsNullOrEmpty(leadId))
            {
                objviewmodel.lstBillingPartner = CR.GetBillingPartner();
                objviewmodel.lstcategory = CR.GetRetailCategory();
                objviewmodel.lstStates = CR.GetStates();
                objviewmodel.lstCity = CR.GetCity();
                objData = SLR.GetsalesLeadByLeadId(Convert.ToInt32(leadId));
                objData.FollowupDate = objData.FollowupDate.Value.Date;
                objData.Comments = "";
                objviewmodel.sALES_TblLeads = objData;
            }
            else
            {
                objviewmodel.lstBillingPartner = CR.GetBillingPartner();
                objviewmodel.lstcategory = CR.GetRetailCategory();
                objviewmodel.lstStates = CR.GetStates();
                objviewmodel.lstCity = CR.GetCity();
                objviewmodel.sALES_TblLeads = objData;
            }

            return View(objviewmodel);
        }
        public ActionResult MeetingMatrix()
        {
            var           userDetails  = (CustomerLoginDetail)Session["UserSession"];
            LeadViewModel objviewmodel = new LeadViewModel();

            objviewmodel.lstSalesManager = SLR.GetSalesManager();
            return(View(objviewmodel));
        }
Exemple #9
0
        public async Task <ActionResult> SubmitLead(LeadViewModel model)
        {
            //TODO: 6. Call the WebAPI service here & pass results to UI
            var result = await HttpPost(model);

            model.Results = result;

            return(View("Index", model));
        }
Exemple #10
0
        public async Task <ActionResult> Create(LeadViewModel lead)
        {
            ApplicationUser user = await UserManager.FindByIdAsync(User.Identity.GetUserId());

            var Lead = new LeadViewModel
            {
                Id           = lead.Id,
                Salutation   = lead.Salutation,
                FirstName    = lead.FirstName,
                LastName     = lead.LastName,
                Company      = lead.Company,
                Street       = lead.Street,
                City         = lead.City,
                State        = lead.State,
                PostalCode   = lead.PostalCode,
                Phone        = lead.Phone,
                MobilePhone  = lead.MobilePhone,
                Fax          = lead.Fax,
                Email        = lead.Email,
                Status       = lead.Status,
                CreatedDate  = lead.CreatedDate,
                Description  = lead.Description,
                UserEmail__c = user.Email
            };

            String id = String.Empty;

            try
            {
                id = (await SalesforceService.MakeAuthenticatedClientRequestAsync(
                          async(client) =>
                {
                    return(await client.CreateAsync("Lead", Lead));
                }
                          )).ToString();
            }
            catch (Exception e)
            {
                this.ViewBag.OperationName    = "Create Salesforce Lead";
                this.ViewBag.AuthorizationUrl = SalesforceOAuthRedirectHandler.GetAuthorizationUrl(this.Request.Url.ToString());
                this.ViewBag.ErrorMessage     = e.Message;
            }
            if (this.ViewBag.ErrorMessage == "AuthorizationRequired")
            {
                return(Redirect(this.ViewBag.AuthorizationUrl));
            }
            if (this.ViewBag.ErrorMessage == null)
            {
                return(RedirectToAction("Index"));
            }
            else
            {
                return(View(lead));
            }
        }
Exemple #11
0
 public ActionResult Modify(int id, LeadViewModel viewmodel)
 {
     if (ModelState.IsValid)
     {
         viewmodel.LeadID = id;
         OperationContext.ServiceSession.EM_LeadsService.Update(viewmodel.ToPOCO(), "LeadID", "FirstName", "LastName", "EmailAddress", "IsValid", "Unsubscribed");
         OperationContext.ServiceSession.SaveChange();
         return(OperationContext.SendAjaxMessage(AjaxMessageStatus.OperationSuccess, "", "", null));
     }
     return(OperationContext.SendAjaxMessage(AjaxMessageStatus.OperationFailed, "Please enable javascript in the browser", "", null));
 }
Exemple #12
0
        public async void WhenYouGetByIdDb_ReturnsCorrectViewModel()
        {
            var lead = new LeadViewModel();

            this.leadsMock.GetReturn = lead;

            var resultLead = await this.leadsService.Get(Guid.NewGuid()).ConfigureAwait(false);

            Assert.Equal(resultLead, lead);
            Assert.True(this.leadsMock.IsGetByIdCalled);
        }
Exemple #13
0
        public ActionResult LeadTransfer()
        {
            var userDetails = (CustomerLoginDetail)Session["UserSession"];
            LeadViewModel objviewmodel = new LeadViewModel();
            objviewmodel.lstsALES_TblLeads = SLR.GetSalesLeads(userDetails);
            objviewmodel.lstCity = CR.GetCity();
            objviewmodel.lstBillingPartner = CR.GetBillingPartner();
            objviewmodel.lstSalesManager = SLR.GetSalesManager();
            return View(objviewmodel);

        }
Exemple #14
0
        // GET: Leads
        public ActionResult Index()
        {
            var leads     = db.Leads.Include(l => l.Contact).Include(l => l.Employee).ToList();
            var ViewModel = new LeadViewModel()
            {
                LeadList = leads,
                Lead     = new Lead(),
                //Employee=new Employee()
            };

            return(View());
        }
Exemple #15
0
        public HttpResponseMessage CreateLead(
            [FromBody] LeadViewModel model)
        {
            var phone = model.Phones.FirstOrDefault();

            phone.Type = Enums.PhoneType.HomePhone;

            if (ModelState.IsValid)
            {
                // Set IsSaved = false mean that the lead comes from POST request and need to be edited/converted
                Lead lead = Mapper.Map <LeadViewModel, Lead>(model);
                lead.IsConverted = false;
                lead.IsSaved     = false;

                if (_unitOfWork.LeadsRepository.FindBy(l => l.Email == lead.Email) == null)
                {
                    _unitOfWork.LeadsRepository.Create(lead);
                    _unitOfWork.Save();

                    // havent work yet
                    //_hubContext.Clients.All.onResetPopUp();
                    //
                    //var connection = new HubConnection("");
                    //var mapResult = Mapper.Map<PopUpViewModel>(lead);
                    //
                    //IHubProxy myHub = connection.CreateHubProxy("phoneHub");
                    //connection.Start().Wait();
                    //myHub.("onResetPopUp", mapResult);

                    model.Id = lead.Id;

                    if (!string.IsNullOrEmpty(model.Message))
                    {
                        EmailViewModel email = new EmailViewModel
                        {
                            To          = "*****@*****.**",
                            Subject     = "Lead Registered",
                            Body        = model.Message,
                            WasReceived = true
                        };

                        new Task(() => { _emailService.SendEmail(email, model); }).Start();
                    }

                    return(Request.CreateResponse(HttpStatusCode.OK, new { status = "success", message = "Lead created succesfully!" }));
                }
                else
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, new { status = "error", message = "Lead already exists!" }));
                }
            }
            return(Request.CreateResponse(HttpStatusCode.OK, new { status = "error", message = "Lead information is invalid!" }));
        }
Exemple #16
0
 public ActionResult Add(LeadViewModel viewModel)
 {
     if (ModelState.IsValid)
     {
         OperationContext.ServiceSession.EM_LeadsService.Add(viewModel.ToPOCO());
         OperationContext.ServiceSession.SaveChange();
         return(OperationContext.SendAjaxMessage(AjaxMessageStatus.OperationSuccess, "", "", null));
     }
     else
     {
         return(OperationContext.SendAjaxMessage(AjaxMessageStatus.OperationFailed, "Please enable javascript in browser.", "", null));
     }
 }
Exemple #17
0
        public ActionResult Index(string id, int?page, string order)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(RedirectToAction("Index", new { id = "New" }));
            }

            string message = (string)TempData["StatusMessage"];

            ViewBag.message = message;

            var campaigns = (List <Campaign>)TempData["SelectedCampaigns"];

            TempData.Keep("SelectedCampaigns");

            var tags = (List <Tag>)TempData["SelectedTags"];

            TempData.Keep("SelectedCampaigns");

            var options = new LeadFilterOptions()
            {
                Order                           = string.IsNullOrEmpty(order) ? string.Empty : order.ToLower(),
                Campaigns                       = campaigns != null?campaigns.ToList <object>() : null,
                                           Tags = tags != null?tags.ToList <object>() : null
            };

            ViewBag.order = order;

            var model = new LeadViewModel();

            model.LeadType           = (LeadType)Enum.Parse(typeof(CrumbCRM.LeadType), id, true);
            model.TotalNew           = _leadService.GetAll(options).Where(x => x.Status.HasValue && x.Status.Value == LeadType.New).Count();
            model.TotalEmailed       = _leadService.GetAll(options).Where(x => x.Status.HasValue && x.Status.Value == LeadType.Emailed).Count();
            model.TotalNoAnswer      = _leadService.GetAll(options).Where(x => x.Status.HasValue && x.Status.Value == LeadType.NoAnswer).Count();
            model.TotalNotInterested = _leadService.GetAll(options).Where(x => x.Status.HasValue && x.Status.Value == LeadType.NotInterested).Count();
            model.TotalCallback      = _leadService.GetAll(options).Where(x => x.Status.HasValue && x.Status.Value == LeadType.Callback).Count();
            model.TotalDoNotContact  = _leadService.GetAll(options).Where(x => x.Status.HasValue && x.Status.Value == LeadType.DoNotContact).Count();

            ViewData.SelectListEnumViewData <NoteActionType>("ActionType", true);

            int pageNo     = page ?? 1;
            int total      = _leadService.Total(options);
            int totalPages = System.Convert.ToInt32(Math.Ceiling((decimal)total / (decimal)10));

            if (totalPages > pageNo)
            {
                ViewBag.Next = (pageNo + 1);
            }

            return(View("Index", model));
        }
        public ActionResult SalesMatrix()
        {
            List <SalesMatrix>    lstsalesmatrix = new List <SalesMatrix>();
            List <SelectListItem> MonthList      = new List <SelectListItem>();
            int month = DateTime.Now.Month;

            int count = 1;

            for (int i = 1; i <= 12; i++)
            {
                //MonthList.Add(new SelectListItem
                //{
                //    Text = "Select Month",
                //    Value = "0"
                //});
                MonthList.Add(new SelectListItem
                {
                    Text  = Convert.ToString(DateTime.Now.AddMonths(i).ToString("MMM")),
                    Value = Convert.ToString(DateTime.Now.AddMonths(i).Month)
                });
                count++;
            }
            List <SelectListItem> YearList = new List <SelectListItem>();
            int year = DateTime.Now.Year;

            YearList.Add(new SelectListItem
            {
                Text  = Convert.ToString(DateTime.Now.AddYears(1).Year.ToString()),
                Value = Convert.ToString(year + 1)
            });
            for (int i = 0; i <= 10; i++)
            {
                YearList.Add(new SelectListItem
                {
                    Text  = Convert.ToString(DateTime.Now.AddYears(-i).Year.ToString()),
                    Value = Convert.ToString(year - i)
                });
            }

            var           userDetails  = (CustomerLoginDetail)Session["UserSession"];
            LeadViewModel objviewmodel = new LeadViewModel();

            objviewmodel.lstSalesManager = SLR.GetSalesManager();
            ViewBag.MonthList            = MonthList;
            ViewBag.YearList             = YearList;
            // lstsalesmatrix = LRR.GetSalesMatrix("btd",0,0,"");
            // objviewmodel.lstsalesMatrices = lstsalesmatrix;
            return(View(objviewmodel));
            // return PartialView("_SalesMatrixListing", lstsalesmatrix);
        }
 public IActionResult Contact(LeadViewModel contact)
 {
     if (contact is null)
     {
         throw new ArgumentNullException(nameof(contact));
     }
     if (!ModelState.IsValid)
     {
         return(View());
     }
     _db.Leads.Add(contact);
     _db.SaveChanges();
     return(View());
 }
Exemple #20
0
        // GET: Leads/Details/5
        public ActionResult Details(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            LeadViewModel lead = Mapper.Map <LeadViewModel>(_leadService.Get(id.Value));

            if (lead == null)
            {
                return(HttpNotFound());
            }
            return(View(lead));
        }
Exemple #21
0
        private static async Task <LeadResultViewModel> HttpPost(LeadViewModel lead)
        {
            HttpResponseMessage responseMessage;

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri("http://localhost:8099");
                responseMessage    = await client.PostAsJsonAsync("api/Lead", lead);

                responseMessage.EnsureSuccessStatusCode();
            }

            return(await responseMessage.Content.ReadAsAsync <LeadResultViewModel>());
        }
Exemple #22
0
        public async void WhenYouGetByIdDb_ReturnsSubAreaAsWell()
        {
            var lead = new LeadViewModel();

            this.leadsMock.GetReturn = lead;
            var subArea = new SubAreaViewModel();

            this.subAreasMock.GetByIdReturn = subArea;

            var resultLead = await this.leadsService.Get(Guid.NewGuid()).ConfigureAwait(false);

            Assert.Equal(subArea, lead.SubArea);
            Assert.True(this.subAreasMock.IsGetByIdCalled);
        }
 public IActionResult Add(LeadViewModel model)
 {
     if (ModelState.IsValid)
     {
         _repository.AddLead(Mapper.Map <Lead>(model));
         //_repository
         ViewBag.Message = "Saved Record: " + model.Name;
         ModelState.Clear();
     }
     else
     {
         ViewBag.Message = "Model didn't validate";
     }
     return(View());
 }
Exemple #24
0
        public async Task <ActionResult> Edit(int id)
        {
            ViewBag.message = TempData["message"];
            ViewBag.error   = TempData["error"];

            var lead  = new Lead();
            var model = new LeadViewModel();

            try
            {
                var getLeadToEditTask = lead.GetLead(id);

                var getSpaceContactsTask = lead.GetSpaceContacts();
                var getSpaceUsersTask    = lead.GetUsers();
                var getStatusesTask      = lead.GetAllStatuses();

                await System.Threading.Tasks.Task.WhenAll(getSpaceContactsTask, getSpaceUsersTask, getStatusesTask, getLeadToEditTask);

                var leadToEdit = getLeadToEditTask.Result;

                IEnumerable <int> selectedLeadContacts = leadToEdit.Contacts != null?leadToEdit.Contacts.Select(x => x.Key) : null;

                IEnumerable <int> selectedLeadOwners = leadToEdit.LeadOwners != null?leadToEdit.LeadOwners.Select(x => x.Key) : null;

                int selectedStatus = leadToEdit.Status.Item1;

                model.PodioItemID       = leadToEdit.PodioItemID;
                model.Company           = leadToEdit.Company;
                model.ExpectedValue     = leadToEdit.ExpectedValue;
                model.ProbabilityOfSale = leadToEdit.ProbabilityOfSale;
                model.NextFollowUp      = leadToEdit.NextFollowUp;
                model.StreetAddress     = leadToEdit.StreetAddress;
                model.City    = leadToEdit.City;
                model.Zip     = leadToEdit.Zip;
                model.State   = leadToEdit.State;
                model.Country = leadToEdit.Country;

                model.LeadContactsOptions = new SelectList(getSpaceContactsTask.Result, "ProfileId", "Name");
                model.LeadOwnersOptions   = new SelectList(getSpaceUsersTask.Result, "ProfileId", "Name");
                model.StatusOptions       = new SelectList(getStatusesTask.Result, "Key", "Value");
            }
            catch (PodioException ex)
            {
                ViewBag.error = ex.Error.ErrorDescription;
            }

            return(View(model));
        }
Exemple #25
0
 public ActionResult Edit(LeadViewModel lead)
 {
     if (ModelState.IsValid)
     {
         var entity = Mapper.Map <Lead>(lead);
         _leadService.Update(entity);
         return(RedirectToAction("Index"));
     }
     ViewBag.CountryId    = new SelectList(_countryService.GetAll(), "Id", "Name", lead.CountryId);
     ViewBag.CityId       = new SelectList(_cityService.GetAllByCountryId(lead.CountryId ?? Guid.NewGuid()), "Id", "Name", lead.CityId);
     ViewBag.RegionId     = new SelectList(_regionService.GetAllByCityId(lead.CityId ?? Guid.NewGuid()), "Id", "Name", lead.RegionId);
     ViewBag.LeadSourceId = new SelectList(_leadSourceService.GetAll(), "Id", "Name", lead.LeadSourceId);
     ViewBag.LeadStatusId = new SelectList(_leadStatusService.GetAll(), "Id", "Name", lead.LeadStatusId);
     ViewBag.SectorId     = new SelectList(_sectorService.GetAll(), "Id", "Name", lead.SectorId);
     return(View(lead));
 }
        public async Task <ActionResult> AddLead([CustomizeValidator(Interceptor = typeof(API.Middleware.ValidatorInterceptor))] LeadViewModel lead)
        {
            var getLeadQuery = new GetContactByNameQuery(lead.Contact.Name);

            if (await Mediator.Send(getLeadQuery) != null)
            {
                return(BadRequest("This name is already taken."));
            }

            var  loggedUserQuery = new LoggedUserQuery();
            User user            = await Mediator.Send(loggedUserQuery);

            var addLeadCommand = new AddLeadCommand(user, lead.Contact.Name, lead.Contact.Company, lead.Contact.PhoneNumber, lead.Contact.Email, lead.Contact.Notes, lead.Contact.Source);
            await Mediator.Send(addLeadCommand);

            return(NoContent());
        }
        public async Task <ActionResult> SubmitLead(LeadViewModel model)
        {
            try
            {
                //TODO: 6. Call the WebAPI service here & pass results to UI

                string apiUrl = "http://localhost:8099/api/lead/submit";

                string sessionID = HttpContext.Session.SessionID;

                LeadResponse apiResponse = new LeadResponse();

                using (HttpClient client = new HttpClient())
                {
                    client.BaseAddress = new Uri(apiUrl);
                    client.DefaultRequestHeaders.Accept.Clear();
                    client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));

                    HttpResponseMessage response = await client.PostAsync <LeadViewModel>(apiUrl, model, new JsonMediaTypeFormatter());

                    if (response.IsSuccessStatusCode)
                    {
                        var data = await response.Content.ReadAsStringAsync();

                        apiResponse = Newtonsoft.Json.JsonConvert.DeserializeObject <LeadResponse>(data);
                    }
                }

                LeadViewModel result = new LeadViewModel()
                {
                    Results = new LeadResultViewModel()
                    {
                        LeadId       = new Random().Next(),
                        IsSuccessful = true,

                        Message = String.Join("", apiResponse.Messages)
                    }
                };

                return(View("Index", result));
            }
            catch (Exception ex)
            {
                return(View("Index", ex.Message));
            }
        }
Exemple #28
0
        public ActionResult AddSalesLead(LeadViewModel objData)
        {
            int LeadId = 0;
            try
            {
                objData.lstBillingPartner = CR.GetBillingPartner();
                objData.lstcategory = CR.GetRetailCategory();
                objData.lstStates = CR.GetStates();
                objData.lstCity = CR.GetCity();
                var userDetails = (CustomerLoginDetail)Session["UserSession"];

                if(objData.sALES_TblLeads.LeadId == 0)
                {
                    var exist = SLR.isMobileNoExist(objData.sALES_TblLeads.MobileNo);
                    if(exist)
                    {
                        ViewData["Status"] = "exist";
                        return View("AddLead", objData);
                    }
                }
                objData.sALES_TblLeads.AddedDate = DateTime.Now;
                objData.sALES_TblLeads.AddedBy = userDetails.LoginId;
                objData.sALES_TblLeads.AssignedLead = userDetails.LoginId;
                var meetingType = objData.sALES_TblLeads.MeetingType;
                LeadId = SLR.AddSalesLead(objData.sALES_TblLeads);
                if (meetingType == "salesdone")
                {
                    string url = ConfigurationManager.AppSettings["BOTSURL"].ToString();
                    //string url = "https://blueocktopus.in/bots?LoginID=" + userDetails.LoginId + "&LeadId=" + objData.sALES_TblLeads.LeadId + "";
                    url = url+"?LoginID=" + userDetails.LoginId + "";
                    ViewData["LeadId"] = LeadId;
                    ViewData["URL"] = url;
                }

            }
            catch (Exception ex)
            {
                newexception.AddException(ex, "");
                TempData["error"] = "Error Occured";
                // return View("AddLead");
            }
            ViewData["Status"] = LeadId;
            return View("AddLead", objData);

        }
Exemple #29
0
        public async Task <ActionResult> Create(LeadViewModel leadViewModel)
        {
            Lead lead = Lead.LeadViewModelToLead(leadViewModel);

            try
            {
                int itemId = await lead.CreateLead(lead);

                if (itemId != default(int))
                {
                    TempData["message"] = "New lead added succesfully";
                }
            }
            catch (PodioException ex)
            {
                ViewBag.error = ex.Error.ErrorDescription;
            }

            return(RedirectToAction("Index"));
        }
Exemple #30
0
        // GET: Leads/Edit/5
        public ActionResult Edit(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            LeadViewModel lead = Mapper.Map <LeadViewModel>(_leadService.Get(id.Value));

            if (lead == null)
            {
                return(HttpNotFound());
            }
            ViewBag.CountryId    = new SelectList(_countryService.GetAll(), "Id", "Name", lead.CountryId);
            ViewBag.CityId       = new SelectList(_cityService.GetAllByCountryId(lead.CountryId ?? Guid.NewGuid()), "Id", "Name", lead.CityId);
            ViewBag.RegionId     = new SelectList(_regionService.GetAllByCityId(lead.CityId ?? Guid.NewGuid()), "Id", "Name", lead.RegionId);
            ViewBag.LeadSourceId = new SelectList(_leadSourceService.GetAll(), "Id", "Name", lead.LeadSourceId);
            ViewBag.LeadStatusId = new SelectList(_leadStatusService.GetAll(), "Id", "Name", lead.LeadStatusId);
            ViewBag.SectorId     = new SelectList(_sectorService.GetAll(), "Id", "Name", lead.SectorId);
            return(View(lead));
        }