Beispiel #1
0
        public bool UpdateVehicleAuditStatus(Guid carId, int status)
        {
            VehicleAuditInfoModel appeal = DalVehicleTypeCertificationAuditLog.GetVehicleAuthAppeal(carId);

            using (var client = new VehicleClient())
            {
                var response = client.UpdateVehicleTypeCertificationStatus(new VehicleTypeCertificationRequest()
                {
                    CarId               = carId,
                    Status              = status,
                    CarNo               = appeal?.CarNumber,
                    Channel             = appeal?.Channel,
                    EngineNo            = appeal?.EngineNo,
                    Vehicle_license_img = appeal?.ImageUrl,
                    User_IdCard_img     = appeal?.IdCardUrl,
                    VinCode             = appeal?.VinCode,
                    Registrationtime    = appeal?.car_Registrationtime
                });
                if (response.Success && status > 0)
                {
                    using (var db = Tuhu.Component.Common.DbHelper.CreateDefaultDbHelper())
                    {
                        DalVehicleTypeCertificationAuditLog.UpdateVehicleAuditStatus(db, carId, status);
                    }
                }
                return(response.Success);
            }
        }
Beispiel #2
0
 private void RefreshCache(List <string> tids)
 {
     using (var client = new VehicleClient())
     {
         client.GetWheelAdapterConfigByTids(tids, true);
     }
 }
    static void Main(string[] args)
    {
        VehicleFactory honda       = new HondaFactory();
        VehicleClient  hondaclient = new VehicleClient(honda, "Regular");

        Console.WriteLine("******* Honda **********");
        Console.WriteLine(hondaclient.GetBikeName());
        Console.WriteLine(hondaclient.GetScooterName());

        hondaclient = new VehicleClient(honda, "Sports");
        Console.WriteLine(hondaclient.GetBikeName());
        Console.WriteLine(hondaclient.GetScooterName());

        VehicleFactory hero       = new HeroFactory();
        VehicleClient  heroclient = new VehicleClient(hero, "Regular");

        Console.WriteLine("******* Hero **********");
        Console.WriteLine(heroclient.GetBikeName());
        Console.WriteLine(heroclient.GetScooterName());

        heroclient = new VehicleClient(hero, "Sports");
        Console.WriteLine(heroclient.GetBikeName());
        Console.WriteLine(heroclient.GetScooterName());

        Console.ReadKey();
    }
Beispiel #4
0
        static void Main(string[] args)
        {
            VehicleFactory honda = new HondaFactory();

            VehicleClient hondaclient = new VehicleClient(honda, "Regular");

            Console.WriteLine("******* Honda **********");
            Console.WriteLine(hondaclient.GetBikeName());
            Console.WriteLine(hondaclient.GetScooterName());

            hondaclient = new VehicleClient(honda, "Sports");
            Console.WriteLine(hondaclient.GetBikeName());
            Console.WriteLine(hondaclient.GetScooterName());

            hondaclient = new VehicleClient(honda, "Regular");
            Console.WriteLine(hondaclient.GetCar());

            VehicleFactory suzuki       = new SuzukiFactory();
            VehicleClient  suzukiClient = new VehicleClient(suzuki, "Regular");

            Console.WriteLine("******* Suzuki **********");
            Console.WriteLine(suzukiClient.GetBikeName());
            Console.WriteLine(suzukiClient.GetScooterName());

            suzukiClient = new VehicleClient(suzuki, "Sports");
            Console.WriteLine(suzukiClient.GetBikeName());
            Console.WriteLine(suzukiClient.GetScooterName());

            suzukiClient = new VehicleClient(honda, "Regular");
            Console.WriteLine(suzukiClient.GetCar());

            Console.ReadKey();
        }
        protected void ButtonCancel_Click(object sender, EventArgs e)
        {
            int    bookingId = Convert.ToInt32(TextBoxBookingID.Text);
            var    client    = new VehicleClient();
            string data      = client.CancelBooking(bookingId);

            LabelCancel.Text = data;
        }
Beispiel #6
0
        public void Test1()
        {
            VehicleFactory honda       = new HondaFactory();
            VehicleClient  hondaclient = new VehicleClient(honda, "Regular");
            string         actual      = hondaclient.GetBikeName();
            string         expected    = "Regular Bike- Name";

            Assert.Equal(expected, actual);
        }
Beispiel #7
0
        public static async Task <string> AddVehicle(VehicleClient vehicle)//400
        {
            var resp = await Client.PostAsync(BaseUrl + "vehicles", new StringContent(JsonSerializer.Serialize(vehicle), Encoding.UTF8, "application/json"));

            if (resp.StatusCode == HttpStatusCode.BadRequest)
            {
                throw new ArgumentException("This vehicle is already on parking or invalid body");
            }
            return("This vehicle was successfully added:" + await resp.Content.ReadAsStringAsync());
        }
Beispiel #8
0
 /// <summary>
 /// 获取所有品牌
 /// </summary>
 /// <returns></returns>
 public ActionResult GetAllBrand()
 {
     using (var client = new VehicleClient())
     {
         var queryParam = new VehicleQueryCategoryParam();
         var result     = client.GetVehicleInfoList(queryParam, VehicleQueryCategoryEnum.None);
         result.ThrowIfException(true);
         return(Json(new { data = result.Result.ToList() }, JsonRequestBehavior.AllowGet));
     }
 }
Beispiel #9
0
        public static async Task <string> AddVehicle(VehicleClient vehicle)//400
        {
            var resp = await Client.SendAsync(new HttpRequestMessage(HttpMethod.Post, BaseUrl +
                                                                     $"vehicles?id={vehicle.Id}&vehicleType={vehicle.VehicleType}&balance={vehicle.Balance}"));

            if (resp.StatusCode == HttpStatusCode.BadRequest)
            {
                throw new ArgumentException("This vehicle is already on parking or invalid body");
            }
            return("This vehicle was successfully added:" + await resp.Content.ReadAsStringAsync());
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["AdminUser"] != null)
            {
                LabelSession.Text = Session["AdminUser"].ToString();
            }

            var client    = new VehicleClient();
            int totalCars = client.GetTotalNumberOfCar();

            LabelAvailableCars.Text = Convert.ToString(totalCars);
            int totalCarOnRent = client.GetTotalNumberOfCarOnRent();

            LabelTotalCarOnRent.Text = Convert.ToString(totalCarOnRent);
        }
Beispiel #11
0
        protected void ButtonRegister_Click(object sender, EventArgs e)
        {
            var client = new VehicleClient();

            var carModel = new CarModel
            {
                Make      = TextBoxMake.Text,
                Model     = TextBoxModel.Text,
                RegNumber = TextBoxRegNumber.Text
            };
            string str = client.InsertCar(carModel);

            LabelMessage.Text     = str;
            TextBoxMake.Text      = "";
            TextBoxModel.Text     = "";
            TextBoxRegNumber.Text = "";
        }
 public ActionResult VehicleTest(string parm, string host, int port)
 {
     try
     {
         using (var client = new VehicleClient())
         {
             client.Endpoint.Address = GetUThost(client.Endpoint.Address, host, port);
             var result = client.GetAllUserVehicles(new Guid(parm));
             result.ThrowIfException();
             return(Json(result.Success ? new { Status = 1, Message = "成功" } : new { Status = 0, Message = result.Exception + result.ErrorMessage }));
         }
     }
     catch (Exception ex)
     {
         return(Json(new { Status = 0, Message = ex.Message + ex.InnerException }));
     }
 }
Beispiel #13
0
        public static IEnumerable <string> GetTidsByVIN(string vin)
        {
            var result = null as IEnumerable <string>;

            vin = vin?.Replace(" ", "");
            if (!string.IsNullOrEmpty(vin))
            {
                using (var client = new VehicleClient())
                {
                    var serviceResult = client.GetTidsByVIN(vin, "setting");
                    serviceResult.ThrowIfException(true);
                    var resultModel = serviceResult.Result;
                    result = resultModel.Data;
                }
            }
            return(result ?? new List <string>());
        }
        protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            var client = new VanServiceClient();

            if (DropDownList1.SelectedValue == "Van")
            {
                GridView1.DataSource = client.AvailableVan();
                GridView1.DataBind();
            }
            var client1 = new VehicleClient();

            if (DropDownList1.SelectedValue == "Car")
            {
                GridView1.DataSource = client1.AvailableCars();
                GridView1.DataBind();
            }
        }
Beispiel #15
0
        public static bool InsertHubURL(bool isFull = false)
        {
            List <string>       HubUrlList = new List <string>();
            List <VehicleBrand> vehicles   = new List <VehicleBrand>();

            using (var vehicleclient = new VehicleClient())
            {
                var response = vehicleclient.GetAllVehicles();
                if (response != null && response.Result != null)
                {
                    vehicles = response.Result.ToList();
                }
            }
            List <string> hubUrlList = new List <string>();

            if (vehicles != null && vehicles.Any())
            {
                foreach (var vehicle in vehicles)
                {
                    List <string> sizes = new List <string>();
                    List <string> tires = vehicle.Tires.Split(';').ToList();
                    if (tires.Any())
                    {
                        foreach (var tire in tires.Where(q => !string.IsNullOrWhiteSpace(q)))
                        {
                            int i = tire.IndexOf('R');
                            if (i >= 0)
                            {
                                string size = tire.Substring(i + 1);
                                if (!sizes.Contains(size))
                                {
                                    sizes.Add(size);
                                    HubUrlList.Add(string.Format("http://item.tuhu.cn/hub/1/r{0}-v{1}.html", size, vehicle.VehicleId.Replace("-", "_")));
                                    HubUrlList.Add(string.Format("http://item.tuhu.cn/hub/1/r{0}-v{1}.html#Products", size, vehicle.VehicleId.Replace("-", "_")));
                                    HubUrlList.Add(string.Format("http://item.tuhu.cn/hub/1/r{0}-v{1}-o1.html#Products", size, vehicle.VehicleId.Replace("-", "_")));
                                    HubUrlList.Add(string.Format("http://item.tuhu.cn/hub/1/r{0}-v{1}-o3.html#Products", size, vehicle.VehicleId.Replace("-", "_")));
                                }
                            }
                        }
                    }
                }
            }
            WeeklySitemapJob.Logger.Info("有" + HubUrlList.Count() + "需要导入库");
            return(InsertURLToDB(HubUrlList, "HubList"));
        }
Beispiel #16
0
        public static List <string> GetTireBrandURLs(bool isFull = false)
        {
            List <string>       tireUrlList = new List <string>();
            List <VehicleBrand> vehicles    = new List <VehicleBrand>();

            using (var vehicleclient = new VehicleClient())
            {
                var response = vehicleclient.GetAllVehicles();
                if (response != null && response.Result != null)
                {
                    vehicles = response.Result.ToList();
                }
            }
            IEnumerable <TireInfo> TireBrandInfos = BaseDataDAL.GetTireInfo(isFull);

            WeeklySitemapJob.Logger.Info("有" + TireBrandInfos.Count() + "个品牌适配轮胎");
            if (vehicles != null && vehicles.Any())
            {
                foreach (var vehicle in vehicles.Where(q => q != null))
                {
                    foreach (var tiresize in hotTiresizes)
                    {
                        foreach (var brand in TireBrandInfos.Where(q => q != null))
                        {
                            // var count = BaseDataDAL.GetTireCount(vehicle.VehicleID, tiresize);
                            // int pagecount = count % 20 > 0 ? count / 20 + 1 : count / 20;

                            string w = tiresize.Substring(0, tiresize.IndexOf('/'));
                            string a = tiresize.Substring(tiresize.IndexOf('/') + 1, tiresize.IndexOf('R') - tiresize.IndexOf('/') - 1);
                            string r = tiresize.Substring(tiresize.IndexOf('R') + 1);
                            tireUrlList.Add(string.Format("https://item.tuhu.cn/Tires/1/au1-b{0}-a{1}-r{2}-w{3}-v{4}.html", brand.BrandID, a, r, w, vehicle.VehicleId.Replace("-", "_")));
                            tireUrlList.Add(string.Format("https://item.tuhu.cn/Tires/1/au1-b{0}-a{1}-r{2}-w{3}-v{4}.html#Products", brand.BrandID, a, r, w, vehicle.VehicleId.Replace("-", "_")));
                            tireUrlList.Add(string.Format("https://item.tuhu.cn/Tires/1/au1-b{0}-a{1}-r{2}-w{3}-v{4}-o1.html", brand.BrandID, a, r, w, vehicle.VehicleId.Replace("-", "_")));
                            tireUrlList.Add(string.Format("https://item.tuhu.cn/Tires/1/au1-b{0}-a{1}-r{2}-w{3}-v{4}-o3.html", brand.BrandID, a, r, w, vehicle.VehicleId.Replace("-", "_")));
                            tireUrlList.Add(string.Format("https://item.tuhu.cn/Tires/1/au1-b{0}-a{1}-r{2}-w{3}-v{4}-o6.html", brand.BrandID, a, r, w, vehicle.VehicleId.Replace("-", "_")));
                            tireUrlList.Add(string.Format("https://item.tuhu.cn/Tires/1/au1-b{0}-a{1}-r{2}-w{3}-v{4}-o1.html#Products", brand.BrandID, a, r, w, vehicle.VehicleId.Replace("-", "_")));
                            tireUrlList.Add(string.Format("https://item.tuhu.cn/Tires/1/au1-b{0}-a{1}-r{2}-w{3}-v{4}-o3.html#Products", brand.BrandID, a, r, w, vehicle.VehicleId.Replace("-", "_")));
                            tireUrlList.Add(string.Format("https://item.tuhu.cn/Tires/1/au1-b{0}-a{1}-r{2}-w{3}-v{4}-o6.html#Products", brand.BrandID, a, r, w, vehicle.VehicleId.Replace("-", "_")));
                        }
                    }
                }
            }
            return(tireUrlList);
        }
        /// <summary>
        /// 根据品牌获取二级车型
        /// </summary>
        /// <param name="para"></param>
        /// <param name="queryEnum"></param>
        /// <returns></returns>
        public static IEnumerable <VehicleBrand> GetVehicleInfoList(VehicleQueryCategoryParam para, VehicleQueryCategoryEnum queryEnum)
        {
            IEnumerable <VehicleBrand> result = null;

            try
            {
                using (var client = new VehicleClient())
                {
                    var serviceResult = client.GetVehicleInfoList(para, queryEnum);
                    serviceResult.ThrowIfException(true);
                    result = serviceResult.Result;
                }
            }
            catch (Exception ex)
            {
                logger.Error($"GetVehicleInfoList ->{para} -> {queryEnum}", ex);
            }
            return(result);
        }
Beispiel #18
0
        public static bool InsertTireBrandURL(bool isFull = false)
        {
            List <string>       tireUrlList = new List <string>();
            List <VehicleBrand> vehicles    = new List <VehicleBrand>();

            using (var vehicleclient = new VehicleClient())
            {
                var response = vehicleclient.GetAllVehicles();
                if (response != null && response.Result != null)
                {
                    vehicles = response.Result.ToList();
                }
            }
            IEnumerable <TireInfo> TireBrandInfos = BaseDataDAL.GetTireInfo(isFull);

            if (vehicles != null && vehicles.Any())
            {
                foreach (var vehicle in vehicles.Where(q => q != null))
                {
                    foreach (var tiresize in hotTiresizes)
                    {
                        foreach (var brand in TireBrandInfos.Where(q => q != null))
                        {
                            // var count = BaseDataDAL.GetTireCount(vehicle.VehicleID, tiresize);
                            // int pagecount = count % 20 > 0 ? count / 20 + 1 : count / 20;

                            string w = tiresize.Substring(0, tiresize.IndexOf('/'));
                            string a = tiresize.Substring(tiresize.IndexOf('/') + 1, tiresize.IndexOf('R') - tiresize.IndexOf('/') - 1);
                            string r = tiresize.Substring(tiresize.IndexOf('R') + 1);
                            tireUrlList.Add(string.Format("http://item.tuhu.cn/Tires/1/b{0}-a{1}-r{2}-w{3}-v{4}.html?oe=", brand.BrandID, a, r, w, vehicle.VehicleId.Replace("-", "_")));
                            tireUrlList.Add(string.Format("http://item.tuhu.cn/Tires/1/b{0}-a{1}-r{2}-w{3}-v{4}.html?oe=#Products", brand.BrandID, a, r, w, vehicle.VehicleId.Replace("-", "_")));
                            tireUrlList.Add(string.Format("http://item.tuhu.cn/Tires/1/b{0}-a{1}-r{2}-w{3}-v{4}-o1.html?oe=#Products", brand.BrandID, a, r, w, vehicle.VehicleId.Replace("-", "_")));
                            tireUrlList.Add(string.Format("http://item.tuhu.cn/Tires/1/b{0}-a{1}-r{2}-w{3}-v{4}-o3.html?oe=#Products", brand.BrandID, a, r, w, vehicle.VehicleId.Replace("-", "_")));
                            tireUrlList.Add(string.Format("http://item.tuhu.cn/Tires/1/b{0}-a{1}-r{2}-w{3}-v{4}-o6.html?oe=#Products", brand.BrandID, a, r, w, vehicle.VehicleId.Replace("-", "_")));
                        }
                        //  tireUrlList.Add(string.Format("http://www.tuhu.cn/spages/Battery.aspx?pid={0}&n={1}&pl={2}", vehicle.VehicleID, i, vehicle.PaiLiang));
                    }
                }
            }
            WeeklySitemapJob.Logger.Info("有" + tireUrlList.Count() + "需要导入库");
            return(InsertURLToDB(tireUrlList, "TireBrandList"));
        }
        protected void ButtonRegister_Click(object sender, EventArgs e)
        {
            var client = new VehicleClient();


            var car = new CarModel
            {
                Make        = TextBoxMake.Text,
                Model       = TextBoxModel.Text,
                RegNumber   = TextBoxRegNumber.Text,
                DailyRent   = Convert.ToDecimal(TextBoxDailyRent.Text),
                Description = TextBoxDescription.Text,
                Isavailable = Convert.ToBoolean(TextBoxIsavailable.Text)
            };
            string returnMessage = client.InsertCar(car);

            LabelMessage.Text       = returnMessage;
            TextBoxMake.Text        = "";
            TextBoxModel.Text       = "";
            TextBoxRegNumber.Text   = "";
            TextBoxDailyRent.Text   = "";
            TextBoxDescription.Text = "";
            TextBoxIsavailable.Text = "";
        }
Beispiel #20
0
        static void MainMethod()
        {
            string number = Console.ReadLine();

            try
            {
                switch (number)
                {
                case "1":
                    Console.WriteLine($"Current balance is {ParkingServiceHTTPMethods.GetParkingHttp("balance").Result}\n");
                    break;

                case "2":
                    Console.WriteLine($"The capacity of the parking is {ParkingServiceHTTPMethods.GetParkingHttp("capacity").Result}\n");
                    break;

                case "3":
                    Console.WriteLine($"Amount free place of parking is {ParkingServiceHTTPMethods.GetParkingHttp("freePlaces").Result}");
                    break;

                case "4":
                    Console.WriteLine($"The history of transactions for current period is {GetNormalStringOfTransactions()}");
                    break;

                case "5":
                    ReadOnlyCollection <VehicleClient> clients = new ReadOnlyCollection <VehicleClient>(ParkingServiceHTTPMethods.GetVehicles().Result);
                    for (int i = 0; i < clients.Count; i++)
                    {
                        Console.Write(clients[i].Id + " with balance " + clients[i].Balance + "\n");
                    }
                    break;

                case "6":
                    Console.WriteLine("Enter transport id, type" +
                                      "(1 - Bus, 2 - PassengerCar, 3 - Truck and 4 - Motorcycle) and how much money you give");
                    string        id      = Console.ReadLine();
                    int           type    = Convert.ToInt32(Console.ReadLine());
                    decimal       money   = Convert.ToDecimal(Console.ReadLine());
                    VehicleClient vehicle = new VehicleClient(id, type, money);
                    string        rez     = ParkingServiceHTTPMethods.AddVehicle(vehicle).Result;
                    Console.WriteLine($"{rez}\n");
                    break;

                case "7":
                    Console.WriteLine("Enter the id of transport you want to remove:");
                    string idRemove = Console.ReadLine();
                    string rezRev   = ParkingServiceHTTPMethods.RemoveVehicle(idRemove).Result;
                    Console.WriteLine(rezRev + "\n");
                    break;

                case "8":
                    Console.WriteLine("Enter sum and id of transport:");
                    decimal       sum      = Convert.ToDecimal(Console.ReadLine());
                    string        ids      = Console.ReadLine();
                    VehicleClient rezTopUp = ParkingServiceHTTPMethods.TopUpVehicle(ids, sum).Result;
                    Console.WriteLine($"Now {rezTopUp.Id} is staying on parking with balance {rezTopUp.Balance}\n");
                    break;

                case "9":
                    Console.WriteLine("Enter the id of transport:");
                    string        IdTr   = Console.ReadLine();
                    VehicleClient rezGet = ParkingServiceHTTPMethods.GetVehicleById(IdTr).Result;
                    Console.WriteLine($"Vehicle with id {rezGet.Id} with balance {rezGet.Balance} is staying now on the parking\n");
                    break;

                case "10":
                    Console.WriteLine(ParkingServiceHTTPMethods.GetAllTransactions().Result);
                    break;

                case "11":
                    Console.Clear();
                    break;

                case "12":
                    Environment.Exit(0);
                    break;

                default:
                    Console.WriteLine("Entered incorrect number, try again");
                    break;
                }
            }
            catch (ArgumentException ex)
            {
                Console.WriteLine($"Mistake:{ex.Message}");
            }

            catch (InvalidOperationException ex)
            {
                Console.WriteLine($"Mistake:{ex.Message}");
            }
            catch (FormatException ex)
            {
                Console.WriteLine($"Mistake:{ex.Message}");
            }
            catch (AggregateException ex)
            {
                Console.WriteLine(ex.Message);
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Mistake:{ex.Message}");
            }
            finally
            {
                DisplayMainMessage();
                MainMethod();
            }
        }