public ActionResult DPAVerificationflow(string error) { CustomerModel Custmodel = new CustomerModel(); Custmodel.InjectFrom(customerService.SessionInfo); CustCheckWorkFlowModel flowmodel = new CustCheckWorkFlowModel(); flowmodel.SelectedCustAplId = BookService.SessionInfo.SelectedCustAplid; ViewBag.SelectedApplianceId = flowmodel.SelectedCustAplId; if (DPAservice.SessionInfo.custCheckWorkFlow.Count == 0) { flowmodel.custCheckWorkFlow = DPAservice.GetCustCheckWorkFlow(storeService.StoreId); } else { flowmodel.custCheckWorkFlow = DPAservice.SessionInfo.custCheckWorkFlow; } foreach (var item in DPAservice.SessionInfo.ProdInfo) { Product_InfoModel prodinfo = new Product_InfoModel(); prodinfo.InjectFrom(item); prodinfo.CustaplId = item.CustAplId; flowmodel.ProdInfo.Add(prodinfo); } flowmodel.CurrentFlowQOrderID = DPAservice.SessionInfo.CurrentFlowQOrderID == 0 ? 2 : DPAservice.SessionInfo.CurrentFlowQOrderID; flowmodel.customerModel = Custmodel; DPAservice.SessionInfo.InjectFrom(flowmodel); DPAservice.SessionInfo.custCheckWorkFlow.InjectFrom(flowmodel.custCheckWorkFlow); if (flowmodel.SelectedCustAplId != 0 && BookService.SessionInfo.SelectedCustAplid != 0) { // var itemToRemove = flowmodel.ProdInfo.FindAll(x => x.CustaplId != flowmodel.SelectedCustAplId).OfType<Product_InfoModel>().ToList(); flowmodel.ProdInfo.RemoveAll(x => x.CustaplId != flowmodel.SelectedCustAplId); } if (error != "") { ViewBag.Error = error; } return(View(flowmodel)); }
public ActionResult DPAVerification(CustCheckWorkFlowModel model, string comments, string SubmitClick) { CustomerModel Custmodel = new CustomerModel(); Custmodel.InjectFrom(customerService.SessionInfo); model.customerModel.InjectFrom(Custmodel); BookService.SessionInfo.SelectedCustAplid = model.SelectedCustAplId; var DPAsessionmodel = DPAservice.SessionInfo.custCheckWorkFlow; model.custCheckWorkFlow = (DPAsessionmodel); foreach (var item in DPAservice.SessionInfo.ProdInfo) { Product_InfoModel prodinfo = new Product_InfoModel(); prodinfo.InjectFrom(item); prodinfo.CustaplId = item.CustAplId; prodinfo.ApplianceSelected = (prodinfo.CustaplId == model.SelectedCustAplId); model.customerModel.ProductInfoModel.Add(prodinfo); } var currentWF = model.custCheckWorkFlow.Where(y => y.FlowQOrderID == DPAservice.SessionInfo.CurrentFlowQOrderID); var v = currentWF.Select(x => x.FieldName).First(); string CurrentInputFieldName = string.IsNullOrEmpty(currentWF.Select(x => x.FieldName).First()) ? string.Empty: currentWF.Select(x => x.FieldName).First().Trim().ToUpper(); if (comments != string.Empty && CurrentInputFieldName.Length > 0 && CurrentInputFieldName == "CUSTOMERNOTES") { // NeedCustomerNote = true; comments = DateTime.Now.ToString() + " Main account holder granted the permission ." + comments; onlineBookingService.AddCustomerNote(Custmodel.CustomerId, storeService.UserId, comments); // BookService.CreateCustomer(Custmodel,comments);//todo: } if (SubmitClick == "YES") { if (!model.customerModel.ProductInfoModel.Exists(x => x.ApplianceSelected) && ((currentWF.First().FieldName == null) ? "N/A" :currentWF.First().FieldName.ToUpper()) == "APPLIANCE") { // model.CurrentFlowQOrderID ViewBag.Error = "Please select Appliance. If you dont find the appliance information, please select NO."; int?nextflowid = currentWF.Select(x => x.FlowQNoOrderID).First(); ViewBag.DPASuccess = !nextflowid.HasValue; } else { int?nextflowid = currentWF.Select(x => x.FlowQYesOrderID).First(); if (nextflowid.HasValue) { model.CurrentFlowQOrderID = nextflowid.Value; } ViewBag.DPASuccess = !nextflowid.HasValue; } } else if (SubmitClick == "OK") { string page = currentWF.Select(x => x.FlowQYesPage).First(); string comment = currentWF.Select(x => x.Message).First(); DPAFail(DPAservice.SessionInfo.CurrentFlowQOrderID, comment); //ViewBag.DPASuccess ViewBag.returnUrl = "/Home/Index"; } else if (SubmitClick == "NO") { int?nextflowid = currentWF.Select(x => x.FlowQNoOrderID).First(); if (nextflowid.HasValue) { model.CurrentFlowQOrderID = nextflowid.Value; } ViewBag.DPASuccess = !nextflowid.HasValue; } else { int?nextflowid = currentWF.Select(x => x.FlowQNoOrderID).First(); model.CurrentFlowQOrderID = DPAservice.SessionInfo.CurrentFlowQOrderID; ViewBag.DPASuccess = !nextflowid.HasValue; } DPAservice.SessionInfo.CurrentFlowQOrderID = model.CurrentFlowQOrderID; return(View(model)); }
/// <summary> /// Get customer info /// </summary> /// <returns></returns> public CustomerModel GetCustomerInfo(int customerId) { try { // var res = new CustomerModel(); // Get customer info var model = Repository.GetCustomerInfo(customerId) ?? new CustomerModel(); var country = string.IsNullOrEmpty(model.Country) ? StoreCountry : model.Country; model.TitleList = GetTitlesList(model.Title); model.ContactMethodList = GetContactMethodList(model.ContactMethod.ToString()); model.CountryList = GetCountryList(country); model.FailureRepairReasonsList = GetFailureRepairReasons(); var ClientList = storeRepository.ClientList(); model.ClientName = ClientList.Where(x => x.StoreId == int.Parse(model.ClientId)).FirstOrDefault().StoreName; var CustomerProduct = CLC_GetCustomerProductsbyCustomerid(customerId); // GetCustomerProducts(customerId); List <Product_InfoModel> Productinfos = new List <Product_InfoModel>(); foreach (CustAplModel item in CustomerProduct) { Product_InfoModel prodModel = new Product_InfoModel(); prodModel.InjectFrom(item); prodModel.DateOfPurchase = item.DateOfPurchase; prodModel.CONTRACTSTART = item.CONTRACTSTART; prodModel.CONTRACTEXPIRES = item.CONTRACTEXPIRES; prodModel.PolicyNumber = item.PolicyNumber; prodModel.RegNo = item.RegNo; prodModel.Brand = item.Brand; AddressDetails address = new AddressDetails(); address.InjectFrom(item); prodModel.addressDetails = address; Productinfos.Add(prodModel); } // Productinfos.InjectFrom(CustomerProduct); model.ProductInfoModel = Productinfos; //var result = new ClientConnect.ViewModels.Job.JobDetailsModel(); // var JobNotes = RepositoryJob.GetJobNotesForShop(customerId); // foreach (var item in model.ProductInfoModel) // { // //item.JobNotes = RepositoryJob.GetJobDetailsByCustomerAppliance(item.serviceId); // item. ServiceDetails = RepositoryJob.GetJobDetailsByCustomerAppliance(item.serviceId); // // model.JobDetails = RepositoryJob.GetJobDetailsByCustomerAppliance(item.serviceId);//Job_NoteDto // item.JobNotes = JobNotes.Select(noteDto => //new NoteRecordModelShop() //{ // ServiceId=noteDto.ServiceId, // DateTime = noteDto.DateTime, // From = noteDto.From, // Notes = noteDto.Notes //}).ToList(); // item.noteModelDetails.AllPageofNotes = item.JobNotes.ToPagedList(1, 20); // item.noteModelDetails.NotesModel = item.JobNotes; // // item.JobNotes.ToPagedList(page ?? 1, 20); // //res.JobDetails = RepositoryJob.GetJobDetailsByCustomerAppliance(item.serviceId).ToList();//Job_NoteDto // // item.JobNotes = RepositoryJob.GetJobDetailsByCustomerAppliance(item.ServiceDetails.ServiceId); // } // res = model; //model.NotesModel = Repository.getCustomerNotes(customerId); return(model); } catch (Exception e) { throw new HttpException(500, string.Format("Error in method. Method:{0}. Error:{1}", "GetCustomerInfo", e.Message)); } }