Beispiel #1
0
        /// <summary>
        /// Set job info into session
        /// </summary>
        /// <param name="model"></param>
        public void SetJobInfo(BookRepair_JobModel model)
        {
            var product  = new ProductService(_dataContext);
            var prodInfo = new Product_InfoModel();
            var book     = _bookStateHolder.Load();

            // fill model for product info
            prodInfo.ItemNumber        = product.GetModelNumber();
            prodInfo.Description       = product.GetModelDescr();
            prodInfo.ModelBrand        = product.GetModelBrand();
            prodInfo.OriginalCondition = model.ItemCondition;
            prodInfo.SerialNumber      = model.SerialNumber;
            prodInfo.TransactionInfo   = model.TransNumber;
            prodInfo.DateOfPurchase    = model.DateOfPurchase ?? DateTime.Now;
            prodInfo.Additionalfields  = model.AdditionalFields;
            // save product info in session
            product.SetGeneralProductInfoInSession(prodInfo);

            book.DateOfPurchase = model.DateOfPurchase;
            book.StoreNumber    = model.StoreNumber;
            book.TillNumber     = model.TillNumber;

            book.Type                 = model.SelectedType;
            book.FaultDescr           = model.FaultDescr;
            book.DateOfPurchaseString = model.DateOfPurchaseString;
            book.EngineerId           = model.EngineerId;
            book.FieldsForInspection  = model.AdditionalFields;
            book.AppointmentDate      = model.AppointmentDate;
            book.StoreCollection      = model.StoreCollection;
            book.Slotid               = model.Slotid;
            _bookStateHolder.UpdateFrom(book);
        }
Beispiel #2
0
        /// <summary>
        /// Update product info
        /// </summary>
        /// <param name="prodInfoModel">Product model</param>
        public void UpdateProductInfo(Product_InfoModel prodInfoModel)
        {
            if (prodInfoModel.DateOfPurchase.Year < 1900)
            {
                prodInfoModel.DateOfPurchase = new DateTime(1900, 1, 1);
            }

            // TODO validate
            _reporsitory.UpdateProductInfo(new UpdateProductInfoCommand
            {
                CustaplId         = prodInfoModel.CustaplId,
                DateOfPurchase    = prodInfoModel.DateOfPurchase,
                Description       = prodInfoModel.Description,
                DiaryId           = prodInfoModel.DiaryId,
                ItemNumber        = prodInfoModel.ItemNumber,
                ModelId           = prodInfoModel.ModelId,
                OriginalCondition = prodInfoModel.OriginalCondition,
                SerialNumber      = prodInfoModel.SerialNumber,
                TransactionInfo   = prodInfoModel.TransactionInfo
            });

            // Add log record in ServiceUsage
            var job = new JobService(_dataContext);
            var Log = new Log(_dataContext);

            Log.Database.Job.Add.Updated(job.GetJobIdFromSession());
        }
Beispiel #3
0
        public void SetGeneralProductInfoInSession(Product_InfoModel model)
        {
            var prod = _productStateHolder.Load();

            prod.ModelNumber       = model.ItemNumber;
            prod.ModelDescription  = model.Description;
            prod.OriginalCondition = model.OriginalCondition;
            prod.SerialNumber      = model.SerialNumber;
            prod.TransactionNumber = model.TransactionInfo;
            prod.DateOfPurchase    = model.DateOfPurchase;
            prod.Brand             = model.Brand;
            prod.ModelBrand        = model.ModelBrand;
            _productStateHolder.UpdateFrom(prod);
        }
Beispiel #4
0
        public ActionResult UpdateProductInfo(Product_InfoModel prodInfoModel)
        {
            if (!ModelState.IsValid)
            {
                var errorResult = ModelState
                                  .Where(x => x.Value.Errors.Count > 0)
                                  .Select(x => new { MemberNames = x.Key, ErrorMessage = x.Value.Errors.ElementAt(0).ErrorMessage })
                                  .ToList();

                return(Json(errorResult));
            }

            else
            {
                _product.UpdateProductInfo(prodInfoModel);
                _jobService.AddNote("Change product info");
                return(new EmptyResult());
            }
        }
Beispiel #5
0
        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));
        }
Beispiel #6
0
        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));
        }
Beispiel #7
0
        /// <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));
            }
        }