Exemplo n.º 1
0
        /// <summary>
        /// filter free spares service
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        private ProductDetailsModel FilterFreeSparesService(ProductDetailsModel model)
        {
            model.ProductServices.FreeSparesService.ServiceImageSrc = "/Content/Icons/FreeSpares.PNG";
            model.ProductServices.FreeSparesService.ServiceName     = "Free Spares";
            // model.ProductServices.FreeSparesService.Model = "";
            if (model.ProductServices.FreeSparesService.ServiceFlag)
            {
                var func = new Functions();
                //filtering free spares
                if (model.ProductServices.FreeSparesService.ServiceEngineerName != null &&
                    model.ProductServices.FreeSparesService.ServiceEngineerName.ToUpper().Equals("CLICK SPARES"))
                {
                    var _store = new StoreService(_dataContext);
                    var _user  = new UserService(_dataContext);

                    bool   Iscallcenter = _store.IsCallCenter();
                    string UserId       = _user.GetUserId();
                    string Storeid      = Iscallcenter? "500":_store.GetStoreId().ToString();
                    model.ProductServices.FreeSparesService.ServiceUrlText = Settings.Default.FreeSparesUrl.Replace("{CatalogueNum}", model.ItemCode).Replace("{empId}", UserId
                                                                                                                                                              ).Replace("{storeId}", Storeid);
                }

                if (model.PartAvailable)
                {
                    model.ProductServices.FreeSparesService.ServiceText = func.BuildLinkHtmlString("btn-argos", "Order",
                                                                                                   model.ProductServices
                                                                                                   .FreeSparesService
                                                                                                   .ServiceUrlText,
                                                                                                   true);
                }
                else
                {
                    model.ProductServices.FreeSparesService.ServiceText = func.BuildLinkHtmlString(
                        "btn-argos-disabled", "Order", "#");
                    model.ProductServices.FreeSparesService.ServiceUrlText = string.Empty;
                }
            }
            return(model);
        }
Exemplo n.º 2
0
        public void UpdateCustomer(BookRepair_CustomerModel model)
        {
            // method for customer update
            var user  = new UserService(_dataContext);
            var store = new StoreService(_dataContext);
            var cust  = new CustomerService(_dataContext);
            var func  = new FunctionsController();

            model.Forename = func.UppercaseFirst(model.Forename);
            model.Surname  = func.UppercaseFirst(model.Surname);

            // Save in database
            var customerId = _reporsitory.UpdateCustomer(model, cust.GetCustomerIdFromSession(), store.GetStoreId(), user.GetUserId());

            // Fill class by info
            cust.SetGeneralCustomerInfoIntoSession(new Customer_InfoModel
            {
                Address1      = model.HouseNumber + " " + model.Addr1 + "," + model.Organization,
                Address2      = model.Addr2,
                Address3      = model.Addr3,
                CustomerName  = model.Forename + " " + model.Surname,
                PostCode      = model.Postcode,
                CustomerId    = customerId,
                ContactMethod = model.ContactMethod
            });
            // Update session holder
            //_bookStateHolder.UpdateFrom(_bookState);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Save job into database
        /// </summary>
        /// <returns></returns>
        public int SaveJob()
        {
            var book = _bookStateHolder.Load();
            //if(book.AppointmentDate!="")

            var cust       = new CustomerService(_dataContext);
            var prod       = new ProductService(_dataContext);
            var user       = new UserService(_dataContext);
            var store      = new StoreService(_dataContext);
            var job        = new BookRepair_JobModel();
            var quest      = new QuestionService(_dataContext);
            var jobService = new JobService(_dataContext);

            var prodInfo    = prod.GetGeneralInfoFromSession();
            var repairAgent = GetAgentRepairInfo();

            job.DateOfPurchase  = book.DateOfPurchase;
            job.SerialNumber    = prodInfo.SerialNumber;
            job.ItemCondition   = prodInfo.OriginalCondition;
            job.DateOfPurchase  = prodInfo.DateOfPurchase;
            job.StoreNumber     = book.StoreNumber;
            job.TillNumber      = book.TillNumber;
            job.TransNumber     = prodInfo.TransactionInfo;
            job.SelectedType    = book.Type;
            job.FaultDescr      = book.FaultDescr + " \n" + quest.GetAnswersFromSession();
            job.UserID          = user.GetUserId();
            job.EngineerId      = book.EngineerId;
            job.AppointmentDate = book.AppointmentDate;
            job.StoreCollection = book.StoreCollection;
            SetAcceptJobFlag(false);
            int custId   = cust.GetCustomerIdFromSession();
            var customer = cust.GetCustomerInfo();
            int Jobid    = _reporsitory.UpdateJob(job, custId, prod.GetModelId(), (DateTime)prod.GetTimeBookRepairClick(), book.ServiceId, store.GetStoreId());

            if (!string.IsNullOrEmpty(repairAgent.BookingUrl))
            {
                OnlineBookingService     onlineBookingService = new OnlineBookingService();
                OnlineBookRequestDetails model = new OnlineBookRequestDetails();
                // model.InjectFrom(ProductService.SessionInfo);
                model.ServiceID            = Jobid;
                model.CustomerTitle        = customer.TitleName;
                model.CustomerForename     = customer.Forename;
                model.CustomerSurname      = customer.Surname;
                model.CustomerStreet       = customer.Addr1;
                model.CustomerPostcode     = customer.Postcode;
                model.CustomerAddressTown  = customer.Town;
                model.CustomerWorkTelNo    = customer.LandlineTel;
                model.CustomerMobileNo     = customer.MobileTel;
                model.CustomerEmailAddress = customer.Email;
                model.SupplyDat            = prodInfo.DateOfPurchase.ToString("yyyy-MM-dd");
                //model.CustAplID = prodInfo.CustaplId;
                model.ApplianceCD = "";
                //model.Model = prodInfo.ItemNumber;
                //model.AltCode = prodInfo.ItemCode;
                // cast online booking - skyline  Argos Cat No (MODEL) should go into Skyline ProductCode field
//Argos Brand Model (ALTCODE)  should go into Skyline ModelNo field

                model.Model   = prodInfo.ItemCode;
                model.AltCode = prodInfo.ItemNumber;
                model.SNO     = job.SerialNumber;
                model.MFR     = prodInfo.ModelBrand;

                //model.PolicyNumber =prodInfo.p
                model.ReportFault = job.FaultDescr;
                model.ClientID    = store.GetStoreId();
                model.StatusID    = 4;

                //  model.VisitDate = DateTime.Parse(job.AppointmentDate);
                //  model.EngineerID = job.EngineerId.Value;
                model.SlotID = book.Slotid;
                //   model.CallType = job.StoreCollection ? "1 Store Collection" : "2 In Home Repair";//repairAgent.InHomeAvailable?"1 Store Collection":( job.StoreCollection ? "1 Store Collection" : "2 In Home Repair");
                model.CallType = !repairAgent.InHomeAvailable ? "1 Store Collection":(job.StoreCollection ? "1 Store Collection" : "2 In Home Repair");
                var response = onlineBookingService.BookJob(model);
                Log.File.ErrorFormat("Error {0}: {1}. ", response.ErrorMsg, response.BookSuccessfully);



                if (response.BookSuccessfully)
                {
                    _reporsitory.UpdateJobClientRef(Jobid, response.ServiceID);

                    HttpContext.Current.Session["ClientRef"] = response.ServiceID;
                }
                else
                {
                    book.OnlineBookingFailed = true;
                }
            }
            if (book.FieldsForInspection != null && book.FieldsForInspection.Count > 0)
            {
                InspectionRepository ins = new InspectionRepository(_dataContext);
                book.FieldsForInspection.ForEach(s => s.ServiceId = Jobid);
                ins.SaveSpecificInspection(book.FieldsForInspection);
            }
            return(Jobid);
        }