示例#1
0
        private TOnlineBookRequestDetails BookJobMapping(string SelectedDate, int SelectedEngineerid, Call call, string RMAID, int Clientid, bool SwapClaimCollection = false)
        {
            Swap2CreditDataProvider swapdal     = new Swap2CreditDataProvider();
            SwapforCredit           swap2Credit = new SwapforCredit();

            RMARefDataProvider dal       = new RMARefDataProvider();
            RMARef             RMAresult = new RMARef();

            if (!SwapClaimCollection)
            {
                RMAresult = dal.GetPartsRMADetailsbyRMAid(RMAID, call.SaediFromId);
            }
            else
            {
                swap2Credit = swapdal.GetSWAPRMADetailsbyRMAid(RMAID, call.SaediFromId);
            }

            TOnlineBookRequestDetails request = new TOnlineBookRequestDetails();

            request.CustomerID   = Saediclient.OnlineCustomerId;
            request.CustAplID    = Saediclient.CustomeraplId;
            request.Postcode     = Saediclient.PostalCode;
            request.ApplianceCD  = Saediclient.onlinebookingSetting.ApplianceCD;
            request.MFR          = Saediclient.onlinebookingSetting.Manufacture;
            request.Model        = Saediclient.onlinebookingSetting.Model;
            request.EngineerID   = SelectedEngineerid;
            request.VisitDate    = DateTime.Parse(SelectedDate);//, "yyyy/MM/dd", CultureInfo.InvariantCulture);
            request.PolicyNumber = RMAID;
            request.ClientID     = Clientid;
            request.ClientRef    = call.ClientRef;
            if (!SwapClaimCollection)
            {
                request.ReportFault = string.Format("Sony RMA Collection {1} {0}{7} {8}{0}{2}{5}{0}From :{3}  {4}  {0}Serial No:{6}", Environment.NewLine, RMAID, RMAresult.INPUT_partNumberReceived, RMAresult.INPUT_modelID,
                                                    call.Appliance.ApplianceType, call.Appliance.Manufacturer, RMAresult.INPUT_sonNumber, RMAresult.INPUT_serialNumber, RMAresult.INPUT_PartNumber, RMAresult.Partdesc);
            }
            else
            {
                request.ReportFault = string.Format("Sony RMA Collection {1} {0}{0}{2}{5}{0}From :{3}  {4}  {0}Serial No:{6}", Environment.NewLine, RMAID, swap2Credit.INPUT_modelID,
                                                    call.Appliance.ApplianceType, call.Appliance.Manufacturer, swap2Credit.INPUT_sonNumber, swap2Credit.INPUT_serialNumber);
            }
            return(request);
        }
示例#2
0
        public List <BookOptionResult> AppointmentRequest(string RMAid, string saediFromid)
        {
            List <BookOptionResult> result     = new List <BookOptionResult>();
            RMARef                  RMAresult  = new RMARef();
            SwapforCredit           swapresult = new SwapforCredit();
            RMARefDataProvider      dal        = new RMARefDataProvider();
            Swap2CreditDataProvider swapdal    = new Swap2CreditDataProvider();

            try
            {
                RMAresult = dal.GetPartsRMADetailsbyRMAid(RMAid, saediFromid);
                ErrorHandler.LogToFile(String.Format("{0} :{1} :Starting Appointment request for {2}", saediFromid, RMAresult.ClientRef, RMAresult.rmaId));
            }
            catch
            {
                swapresult = swapdal.GetSWAPRMADetailsbyRMAid(RMAid, saediFromid);
                ErrorHandler.LogToFile(String.Format("{0} :{1} :Starting Appointment request for {2}", saediFromid, swapresult.ClientRef, swapresult.rmaId));
            }


            Saediclient = Clientdal.GetBySaediId(saediFromid);
            Saediclient.onlinebookingSetting = Clientdal.FetchOnlinebookingSetting(Saediclient.OSPRef);
            onlinebookingStting(Saediclient);

            //header.Username = Saediclient.OSPRef;
            //header.Password = Saediclient.onlinebookingSetting.SaediPassword;
            try
            {
                ErrorHandler.LogToFile(String.Format("{0} :{1} :fetching client details :customerid {2} custaplid {3}", saediFromid, RMAresult.ClientRef, Saediclient.OnlineCustomerId, Saediclient.CustomeraplId));
            }
            catch
            {
                ErrorHandler.LogToFile(String.Format("{0} :{1} :fetching client details :customerid {2} custaplid {3}", saediFromid, swapresult.ClientRef, Saediclient.OnlineCustomerId, Saediclient.CustomeraplId));
            }
            try
            {
                //Add or update engineer address
                int CustomerId = AddCustomer(Saediclient.onlinebookingSetting.OnlineBookingURL);
                if (CustomerId == 0)
                {
                    throw new Exception("Add customer Failure");
                }

                //check CustAPLid exists or not // if appln not exists add it
                if (Saediclient.CustomeraplId == 0)
                {
                    Saediclient.OnlineCustomerId = CustomerId;
                    int CustAplid = AddCustApl(Saediclient.onlinebookingSetting.OnlineBookingURL);

                    Saediclient.CustomeraplId = CustAplid;
                    Clientdal.UpdateClientCollectionBookingInfo(Saediclient);
                }
                // fetching Appointments
                if (Saediclient.CustomeraplId != 0)
                {
                    TResponseDetails appointments = FetchAppointments();

                    if (appointments.RequestSuccess)
                    {
                        foreach (var item in appointments.BookingOptionResult)
                        {
                            BookOptionResult bookitem = new BookOptionResult();
                            bookitem.Calls        = item.Calls;
                            bookitem.Description  = item.Description;
                            bookitem.EngineerID   = item.EngineerID;
                            bookitem.EngineerName = item.EngineerName;
                            bookitem.EventDate    = item.EventDate;
                            result.Add(bookitem);
                        }
                    }
                }
                return(result);
            }
            catch (Exception ex)
            {
                string error = string.Format("Error on booking Courier collection for RMA :{0} . Please do it later.", RMAid);
                return(result);
            }
        }