Beispiel #1
0
        //PROBAR
        public List <VehicleTypeResponse> SelectAll()
        {
            List <VehicleTypeResponse> lstTypeVehicle = new List <VehicleTypeResponse>();

            IQueryable <VehicleType> g  = db.VehicleType;
            List <VehicleType>       pa = g.ToList();

            pa.ForEach(x => {
                VehicleTypeResponse obj = new VehicleTypeResponse();
                obj.id          = x.id;
                obj.description = x.description;
                lstTypeVehicle.Add(obj);
            });



            return(lstTypeVehicle);
        }
        public async Task <VehicleTypeResponse> Create(CreateVehicleTypeRequest request)
        {
            VehicleTypeResponse      response           = new VehicleTypeResponse();
            CreateVehicleTypeCommand vehicleTypeCommand = new CreateVehicleTypeCommand
            {
                Code = request.Code,
                Name = request.Name
            };

            try
            {
                var           result     = _bus.SendCommand(vehicleTypeCommand);
                Task <object> status     = result as Task <object>;
                var           isComplete = (bool)status.Result;
                if (isComplete)
                {
                    response.Status = new ResponseModel.StatusResponse
                    {
                        Content = "Sucess",
                        OK      = true
                    };
                }
                else
                {
                    response.Status = new ResponseModel.StatusResponse
                    {
                        Content = "Error!",
                        OK      = false
                    };
                }
            }
            catch (Exception ex)
            {
                response.Status = new ResponseModel.StatusResponse
                {
                    Content = ex.Message,
                    OK      = false
                };
            }
            return(await Task.FromResult(response));
        }
        private VehicleTypeResponse ProcessCommand(VehicleTypeCommand vehicleTypeCommand)
        {
            VehicleTypeResponse response = new VehicleTypeResponse();

            try
            {
                var           result     = _bus.SendCommand(vehicleTypeCommand);
                Task <object> status     = result as Task <object>;
                var           isComplete = (bool)status.Result;
                if (isComplete)
                {
                    response.Status = new ResponseModel.StatusResponse
                    {
                        Content = "Sucess",
                        OK      = true
                    };
                }
                else
                {
                    response.Status = new ResponseModel.StatusResponse
                    {
                        Content = "Error!",
                        OK      = false
                    };
                }
            }
            catch (Exception ex)
            {
                response.Status = new ResponseModel.StatusResponse
                {
                    Content = ex.Message,
                    OK      = false
                };
            }
            return(response);
        }
Beispiel #4
0
        private void AddJobtoLimoAnyWhere()
        {
            JobWrapper jobWrapper = new JobWrapper();
            string     apiId      = ConfigurationSettings.AppSettings["apiId"];  //Your Api ID
            string     apiKey     = ConfigurationSettings.AppSettings["apiKey"]; //Your Api Key
            //LimoEntities limmoEntity = new LimoEntities();
            //Company company = limmoEntity.Companies.Where(xx=>xx.CompanyID == jobWrapper.JobDetailsObject.CompanyID ).ToList().FirstOrDefault();
            var apiService = new ApiService();

            //LimoEntities limoEntity = new LimoEntities();
            //Company company =
            //limoEntity.Companies.Where(obj => obj.CompanyID == jobWrapper.JobDetailsObject.CompanyID).
            //    FirstOrDefault();
            //string zipCode = string.Empty;
            //if (company != null)
            //    zipCode = company.ZipCode;
            //AffiliateResponse affiliateResponse =
            //    apiService.GetAffiliates(apiId, apiKey).Affiliates.Where(obj => obj.Zip == zipCode).FirstOrDefault();
            //AffliateID = affiliateResponse != null ? affiliateResponse.Id : 0;

            VehicleTypeResponse cehicleTypeResponse = apiService.GetVehicleTypes(apiId, apiKey);
            string vehicleType = cehicleTypeResponse.VehicleTypes != null &&
                                 cehicleTypeResponse.VehicleTypes.Length > 0
                                     ? cehicleTypeResponse.VehicleTypes[0].VehTypeCode
                                     : string.Empty;

            //apiService.mylimobiz.book.ApiService laApi = new com.mylimobiz.book.ApiService();
            string[] fromAddress = txtSource.Text.Trim().Split(',');
            string   fromStreet = "", fromCity = "", fromState = "", fromZIPCode = "";

            if (fromAddress.Length > 0)
            {
                if (fromAddress.Length >= 3)
                {
                    fromStreet = fromAddress[0];
                    fromCity   = fromAddress[1];
                    string[] temp = fromAddress[2].Trim().Split(' ');
                    fromState = temp[0];
                    if (temp.Length == 2)
                    {
                        fromZIPCode = temp[1];
                    }
                }
                else if (fromAddress.Length == 2)
                {
                    fromCity = fromAddress[0];
                    string[] temp = fromAddress[1].Trim().Split(' ');
                    fromState = temp[0];
                    if (temp.Length == 2)
                    {
                        fromZIPCode = temp[1];
                    }
                }
            }
            string[] toAddress = txtDistenation.Text.Trim().Split(',');
            string   toStreet = "", toCity = "", toState = "", toZIPCode = "";

            if (toAddress.Length > 0)
            {
                if (toAddress.Length >= 3)
                {
                    toStreet = toAddress[0];
                    toCity   = toAddress[1];
                    string[] temp = toAddress[2].Trim().Split(' ');
                    toState = temp[0];
                    if (temp.Length == 2)
                    {
                        toZIPCode = temp[1];
                    }
                }
                else if (toAddress.Length == 2)
                {
                    toCity = toAddress[0];
                    string[] temp = toAddress[1].Trim().Split(' ');
                    toState = temp[0];
                    if (temp.Length == 2)
                    {
                        toZIPCode = temp[1];
                    }
                }
            }
            double carSeatInsidePickupFee = 0;

            double price = 0;

            double.TryParse(txtTotalPrice.Text, out price);
            //if (jobWrapper.JobDetailsObject.IsInsidePickup)
            //    carSeatInsidePickupFee += 15;
            //if (jobWrapper.JobDetailsObject.IsCarSeatAdd)
            //    carSeatInsidePickupFee += 30;
            //carSeatInsidePickupFee += jobWrapper.JobDetailsObject.JobProcessingFees;
            Ride ride = new Ride()
            {
                RideSource  = "Limoallover",
                RideType    = "RES",
                ServiceType = JobWrapper.ServiceTypeObject.PTP.ToString(),
                // done
                VehicleType = vehicleType,
                //"SEDAN",//jobWrapper.JobDetailsObject.JobCarType.ToString(),
                PickUpDate = DateTime.Parse(txtDatepicker.Text),
                PickUpTime = ddlHour.SelectedValue + ddlMinutes.SelectedItem.Text,

                NumberOfPax = int.Parse(ddlNOPassenger.SelectedItem.Text),
                //done
                PassengerFirstName = txtFirstName.Text,
                //done
                PassengerLastName = txtLastName.Text,
                //done
                PassengerEmail = txtPassEmail.Text,
                // done
                PassengerPhone = txtPassMobile.Text,
                // done
                BillingContact = txtFirstName.Text + " " + txtLastName.Text,
                //done
                Currency = "USD",
                //done
                //RideNumber = DateTime.Now.Ticks.ToString(),
                SpecialChildSeat = "No",                 //jobWrapper.JobDetailsObject.IsCarSeatAdd ? "Toddler" : "No",
                // done

                RatesMapping = new RatesMapping()
                {
                    BaseRate =
                        new RateFixed()
                    {
                        Rate = price
                    },
                    PerHourRate = new RateMultiply()
                    {
                        RatePerUnit = 0
                    },
                    PerMileRate =
                        new RateMultiply()
                    {
                        RatePerUnit = 0, Units = 0, Total = 0
                    },
                    PerPassengerRate =
                        new RateMultiply()
                    {
                        RatePerUnit = 0, Units = 0, Total = 0
                    },
                    ExtraStops = new RateFixed()
                    {
                        Rate = 0
                    },
                    Discount2 = new RateFixed()
                    {
                        Rate = 0
                    },
                    FuelSurcharge = new RatePercentage()
                    {
                        PercentageAmount = 0
                    },
                    Gratuity = new RatePercentage()
                    {
                        PercentageAmount = 0
                    },
                    Misc1 = new RateMisc()
                    {
                        Rate = 0, RateName = "Tolls"
                    },
                    Misc2 = new RateMisc()
                    {
                        Rate = 0, RateName = "Parking"
                    },
                    Misc3 = new RateMisc()
                    {
                        Rate     = 0,
                        RateName = "Taxes"
                    },
                    Misc4 =
                        new RateMisc()
                    {
                        Rate     = carSeatInsidePickupFee,
                        RateName =
                            "ProcessingFees / CarSeat / InsidePickupFee"
                    },
                    OvertimeWaitTime = new RateFixed()
                    {
                        Rate = 0
                    },
                    STCSurcharge = new RatePercentage()
                    {
                        PercentageAmount = 0
                    },
                    Total = price
                },
                RideRouteBlock = new RoutingItem[]
                {
                    new RoutingItem()
                    {
                        RIType       = "PU",
                        LocationType = "ADDR",
                        RIAddr1      = fromStreet,
                        RICity       = fromCity,
                        RIState      = fromState,
                        RIZip        = fromZIPCode
                    },
                    new RoutingItem()
                    {
                        RIType       = "DO",
                        LocationType = "ADDR",
                        RIAddr1      = toStreet,
                        RICity       = toCity,
                        RIState      = toState,
                        RIZip        = toZIPCode
                    }
                },
                //credit card
                //CreditCardNumber = txtCardNumber.Text,
                //CCExpDate = ddlExpirationMonth.SelectedValue + "/" + ddlExpirationYear.SelectedValue,
                //CCName = txtFirstName.Text + " " + txtLastName.Text,
                //CCState = ddlState.SelectedValue,
                //CCBillingAddr = txtAdddress.Text,
                //CCZip = txtZipCode.Text //,
                //CCNotes = txtCardVerifNumber.Text
            };
            RideResponse response = apiService.ImportReservation(apiId, apiKey, ride);
        }