Example #1
0
 public Truck(bool i_isCooled, float i_cargoVolume, VehicleInformation i_vehicleInformation, string i_wheelManufacturer) : base(i_vehicleInformation)
 {
     m_isCooled            = i_isCooled;
     m_cargoVolume         = i_cargoVolume;
     m_wheelInformation    = new WheelInformation(28, 12, i_wheelManufacturer);
     base.WheelInformation = m_wheelInformation;
 }
Example #2
0
        private void _mediator_IDScanned(object sender, GarageAssignment assignment, VehicleInformation information)
        {
            if (assignment == null || information == null)
            {
                System.Diagnostics.Debug.WriteLine("Database record retrieval failed!");
                _mediator.ClearID();
                return;
            }

            _scanned = assignment;
            vehicleInformationUI.Items.Clear();
            vehicleInformationUI.Items.AddRange(new object[]
            {
                assignment, information
            });

            Invoke((MethodInvoker)(() =>
            {
                rescanUI.Enabled = true;
                processVehicleUI.Enabled = true;
                vehicleProcessStatusUI.Items.Add($"Scanned: {assignment.ID}");
            }));

            _mediator.Request();
        }
Example #3
0
        // private string m_wheelManufacturer;

        public Car(eColor i_color, eCarNumberOfDoors i_numberOfDoors, VehicleInformation i_vehicleInformation, string i_wheelManufacturer) : base(i_vehicleInformation)
        {
            m_wheelInformation    = new WheelInformation(32, 4, i_wheelManufacturer);
            base.WheelInformation = m_wheelInformation;
            m_numberOfDoors       = i_numberOfDoors;
            m_color = i_color;
        }
 public ScheduleVehicle IsScheduleBooked(VehicleInformation vehicle, DateTime selectedDate, string shift)
 {
     try
     {
         SqlConnectionObj.Open();
         string query = string.Format("SELECT * FROM ScheduleVehicle WHERE VehicleRegNo='{0}' AND Date='{1}' AND Shift='{2}'", vehicle.RegNo, selectedDate, shift);
         SqlCommandObj.CommandText = query;
         SqlDataReader reader = SqlCommandObj.ExecuteReader();
         while (reader.Read())
         {
             ScheduleVehicle vehicleSchedule = new ScheduleVehicle();
             vehicleSchedule.Vehicle.RegNo = reader[0].ToString();
             vehicleSchedule.SelectedDate  = (DateTime)reader[1];
             vehicleSchedule.SelectShift   = reader[2].ToString();
             vehicleSchedule.BookedBy      = reader[3].ToString();
             vehicleSchedule.Address       = reader[4].ToString();
             return(vehicleSchedule);
         }
     }
     catch (Exception exceptionObj)
     {
         throw new Exception("Exception occured! In Schedule Booking.", exceptionObj);
     }
     finally
     {
         if (SqlConnectionObj != null && SqlConnectionObj.State == ConnectionState.Open)
         {
             SqlConnectionObj.Close();
         }
     }
     return(null);
 }
Example #5
0
        public void Insert(int i_vehicleType, VehicleInformation i_vehicleInformation, Dictionary <string, Object> i_specificInformation)
        {
            string  licenseNumber = i_vehicleInformation.LicenseNumber;
            Vehicle vehicle       = CreateVehicle.CreateNewVehicle((CreateVehicle.eVehicleType)i_vehicleType, i_vehicleInformation, i_specificInformation);

            m_currentGarageVehicles.Add(licenseNumber, vehicle);
        }
Example #6
0
        public VehicleInformation getVehicleInformationFromVin(string m_Vin, string m_manufacturerModelCode, string m_trimName, double m_wheelBase, string[] m_manufacturerOptionCodes, string[] m_equipmentDescriptions, string[] m_secondaryequipmentDescriptions, string m_exteriorColorName, string m_interiorColorName, int[] m_reducingStyleIds, ReturnParameters m_returnparameters)
        {
            VehicleInformationFromVinRequest m_Vifver = new VehicleInformationFromVinRequest();

            m_Vifver.accountInfo                    = this.getAccountInfo();
            m_Vifver.vin                            = m_Vin;
            m_Vifver.manufacturerModelCode          = m_manufacturerModelCode;
            m_Vifver.trimName                       = m_trimName;
            m_Vifver.wheelBase                      = m_wheelBase;
            m_Vifver.manufacturerModelCode          = m_manufacturerModelCode;
            m_Vifver.equipmentDescriptions          = m_equipmentDescriptions;
            m_Vifver.secondaryEquipmentDescriptions = m_secondaryequipmentDescriptions;
            m_Vifver.exteriorColorName              = m_exteriorColorName;
            m_Vifver.interiorColorName              = m_interiorColorName;
            m_Vifver.reducingStyleIds               = m_reducingStyleIds;
            m_Vifver.returnParameters               = m_returnparameters;

            VehicleInformation temp = vinService.getVehicleInformationFromVin(m_Vifver);

            if (temp != null)
            {
                if (temp.responseStatus.responseCode.Equals(ResponseCode.Successful))
                {
                    return(temp);
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }
Example #7
0
        static void Main(string[] args)
        {
            HttpClient client = new HttpClient();

            client.BaseAddress = new Uri("http://localhost:52935/");
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

            Random   rand      = new Random();
            DateTime tempDate  = DateTime.Now;
            int      vehicleId = 5;

            HttpResponseMessage response = client.GetAsync("api/vehicles/" + vehicleId).Result;
            VehicleInformation  vehicle  = response.Content.ReadAsAsync <VehicleInformation>().Result;

            for (int i = 0; i < 6; i++)
            {
                tempDate = tempDate.AddDays(-1);
                LastKm lastKm = new LastKm();
                lastKm.Date      = tempDate;
                lastKm.vehicleId = vehicleId;
                lastKm.Km        = rand.Next(5000, 9000);

                response = client.PostAsJsonAsync("api/lastKms", lastKm).Result;

                if (response.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    Console.WriteLine("added: " + (i + 1));
                }
            }

            Console.ReadKey();
        }
Example #8
0
 public Motorcycle(eLicense i_license, int i_engineVolume, VehicleInformation i_vehicleInformation, string i_wheelManufacturer) : base(i_vehicleInformation)
 {
     m_license             = i_license;
     m_engineVolume        = i_engineVolume;
     m_wheelInformation    = new WheelInformation(32, 2, i_wheelManufacturer);
     base.WheelInformation = m_wheelInformation;
 }
        public async Task <IActionResult> Edit(int id, [Bind("VehicleId,VehicleNo,SeatCapacity,VehicleTypeId,RouteId,UserId")] VehicleInformation vehicleInformation)
        {
            if (id != vehicleInformation.VehicleId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(vehicleInformation);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!VehicleInformationExists(vehicleInformation.VehicleId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["RouteId"]       = new SelectList(_context.Routes, "RouteId", "RouteId", vehicleInformation.RouteId);
            ViewData["VehicleTypeId"] = new SelectList(_context.VehicleTypes, "VehicleTypeId", "VehicleTypeId", vehicleInformation.VehicleTypeId);
            return(View(vehicleInformation));
        }
        private void Save_Click(object sender, EventArgs e)
        {
            VehicleScheduleManager vehicleScheduleManager = new VehicleScheduleManager();
            string             message;
            VehicleInformation selectedVehicleInformation = (VehicleInformation)selectVehicleComboBox.SelectedItem;
            DateTime           selectedDateTime           = selectDateCalender.SelectionRange.Start;

            if (bookedByTextBox.Text != string.Empty && addressTextBox.Text != string.Empty && selectedVehicleInformation != null && selectedDateTime != null && shiftComboBox.SelectedItem != null)
            {
                try
                {
                    vehicleScheduleManager.GetVehicleSchedule(selectedVehicleInformation, selectedDateTime, shiftComboBox.SelectedItem.ToString(), bookedByTextBox.Text, addressTextBox.Text, out message);
                    MessageBox.Show(message);
                    this.Close();
                }
                catch (Exception exceptionObj)
                {
                    MessageBox.Show("Exception occured in VehicleScheduleUI: " + exceptionObj.Message);
                }
            }
            else
            {
                MessageBox.Show("Fillup all! ");
            }
        }
Example #11
0
        public List <VehicleInformation> GetAllVehicle()
        {
            List <VehicleInformation> allVehicles = new List <VehicleInformation>();

            try
            {
                SqlConnectionObj.Open();
                string query = string.Format("select * from VehicleInformation");
                SqlCommandObj.CommandText = query;
                SqlDataReader reader = SqlCommandObj.ExecuteReader();
                while (reader.Read())
                {
                    VehicleInformation aVehicleInformation = new VehicleInformation();
                    aVehicleInformation.RegNo    = reader[0].ToString();
                    aVehicleInformation.EngineNo = reader[1].ToString();
                    allVehicles.Add(aVehicleInformation);
                }
            }
            catch (Exception exceptionObj)
            {
                throw new Exception("Vehicle inforamtion number can not be loaded.", exceptionObj);
            }
            finally
            {
                if (SqlConnectionObj != null && SqlConnectionObj.State == ConnectionState.Open)
                {
                    SqlConnectionObj.Close();
                }
            }
            return(allVehicles);
        }
Example #12
0
        public IEnumerable <Car> GetCars(VehicleInformation information)
        {
            List <Car> cars = new List <Car>();

            using (SqlConnection connection = new SqlConnection(_connectionString))
            {
                SqlCommand command = buildSQLCommand(information);
                command.Connection = connection;

                try
                {
                    connection.Open();

                    using (SqlDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            cars.Add(BuildCar(reader));
                        }
                    }
                }
                catch
                {
                    throw new CustomException("Database access exception");
                }
            }

            return(cars);
        }
Example #13
0
        public List <SchedulesOfAVehicle> GetSchedulesOfASingleVehicle(VehicleInformation vehicle)
        {
            List <SchedulesOfAVehicle> schedulesOfAVehicle = new List <SchedulesOfAVehicle>();

            try
            {
                SqlConnectionObj.Open();
                string query = string.Format("SELECT Date,Shift FROM ScheduleVehicle WHERE VehicleRegNo='{0}'", vehicle.RegNo);
                SqlCommandObj.CommandText = query;
                SqlDataReader reader = SqlCommandObj.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        SchedulesOfAVehicle singleScheduleOfAVehicle = new SchedulesOfAVehicle();
                        singleScheduleOfAVehicle.DateTime = (DateTime)reader[0];
                        singleScheduleOfAVehicle.Shift    = reader[1].ToString();
                        schedulesOfAVehicle.Add(singleScheduleOfAVehicle);
                    }
                    return(schedulesOfAVehicle);
                }
            }
            catch (Exception exceptionObj)
            {
                throw new Exception("Exception Occured in GetScheduleOfASingleVehicle method!!!", exceptionObj);
            }
            finally
            {
                if (SqlConnectionObj != null && SqlConnectionObj.State == ConnectionState.Open)
                {
                    SqlConnectionObj.Close();
                }
            }
            return(null);
        }
Example #14
0
        public IHttpActionResult GetLastKms(int id)
        {
            List <LastKm>      lastKms = lastKmService.GetVehicleKms(id).Where(x => x.Date < DateTime.Now.AddMonths(1)).ToList();
            VehicleInformation vehicle = vehicleService.Get(id);

            List <string> vehicleNames = new List <string>();
            List <int>    rentCount    = new List <int>();
            List <string> bgColors     = new List <string>();

            foreach (LastKm lastKm in lastKms)
            {
                vehicleNames.Add(lastKm.Date.Value.ToShortDateString());
                rentCount.Add(lastKm.Km);

                if (lastKm.Km > vehicle.DailyLimitKm)
                {
                    bgColors.Add("rgba(231, 13, 13, 0.4)");
                }
                else
                {
                    bgColors.Add("rgba(191, 240, 142, 0.4)");
                }
            }

            return(Ok(new { label = vehicleNames.ToArray(), data = rentCount.ToArray(), bgColor = bgColors.ToArray(), title = "Son 30 günde yapılan günlük km" }));
        }
 protected AnalyticModelSettingsFetchingFactoryBase(
     ErrorCallbackDelegate errorCallback,
     VehicleInformation vehicleInformation)
 {
     this.errorCallback      = errorCallback;
     this.vehicleInformation = vehicleInformation;
 }
Example #16
0
        public InvoiceModel Invoice(int tc)
        {
            Customer customer = customerService.GetList().SingleOrDefault(x => x.TCNumber == tc);

            if (customer == null)
            {
                return(null);
            }

            InvoiceModel             invoiceModel = new InvoiceModel();
            List <Rentalinformation> rents        = rentService.GetAll().Where(x => x.CustomerID == customer.Id).ToList();

            invoiceModel.customer       = customer;
            invoiceModel.Rents          = rents.Count;
            invoiceModel.RentedDays     = rents.Sum(x => x.HowManyDays);
            invoiceModel.Spent          = rents.Sum(x => x.Payment);
            invoiceModel.RentedVehicles = new List <VehicleInformation>();

            foreach (Rentalinformation rent in rents)
            {
                VehicleInformation vehicle = vehicleService.Get(rent.VehicleID);
                invoiceModel.RentedVehicles.Add(vehicle);
            }

            return(invoiceModel);
        }
Example #17
0
        public ActionResult Index(int vehicleId)
        {
            HttpResponseMessage response = client.GetAsync("api/vehicles/" + vehicleId).Result;
            VehicleInformation  vehicle  = response.Content.ReadAsAsync <VehicleInformation>().Result;

            return(View(vehicle));
        }
        public ActionResult Create([Bind(Include = "VehicleInformationId,VehicleCompany,ApplicationUserId,VehicleName,VehicleColor,VehicleModel,VehicleRate,VehicleBodyNumber,VehicleEngineNumber,VehicleNumber,VehicleWarranty,VehicleDescription,VehicleStatus")] VehicleInformation vehicleInformation)
        {
            if (ModelState.IsValid)
            {
                vehicleInformation.RegistrationDate = DateTime.Now.Date;
                List <VehicleImages> fileDetails = new List <VehicleImages>();
                for (int i = 0; i < Request.Files.Count; i++)
                {
                    var file = Request.Files[i];

                    if (file != null && file.ContentLength > 0)
                    {
                        var           fileName   = Path.GetFileName(file.FileName);
                        VehicleImages fileDetail = new VehicleImages()
                        {
                            FileName  = fileName,
                            Extension = Path.GetExtension(fileName),
                            Id        = Guid.NewGuid()
                        };
                        fileDetails.Add(fileDetail);

                        var path = Path.Combine(Server.MapPath("~/Data/"), fileDetail.Id + fileDetail.Extension);
                        file.SaveAs(path);
                    }
                }

                vehicleInformation.VehicleImages     = fileDetails;
                vehicleInformation.ApplicationUserId = User.Identity.GetUserId();
                db.VehicleInformations.Add(vehicleInformation);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.ApplicationUserId = new SelectList(db.Users, "Id", "Name", vehicleInformation.ApplicationUserId);
            return(View(vehicleInformation));
        }
        public async Task <IActionResult> SaveVehicleWithImage(GDViewModel model)
        {
            try
            {
                var user = await _userManager.FindByNameAsync(model.userName);

                string        gdNumber      = RandomString(6);
                GDInformation gDInformation = new GDInformation
                {
                    ApplicationUserId = user.Id,
                    gdFor             = "Own",
                    gdDate            = DateTime.Now,
                    gdNumber          = gdNumber,
                    gDTypeId          = model.gdTypeId,
                    productTypeId     = 1,
                    //documentTypeId = model.documentTypeId == 0 ? null : model.documentTypeId,
                    //documentDescription = model.documentDescription,
                    statusId = 1
                };

                int gdId = await lostAndFoundService.SaveGDInformation(gDInformation);

                VehicleInformation vehicleInformation = new VehicleInformation
                {
                    gDInformationId = gdId,
                    vehicleTypeId   = model.vehicleTypeId,
                    vehicleBrandId  = model.vehicleBrandId,
                    vehicleRegNo    = model.regNoFirstPart + " " + model.regNoSecondPart + " " + model.regNoThiredPart,
                    regNoFirstPart  = model.regNoFirstPart,
                    regNoSecondPart = model.regNoSecondPart,
                    regNoThiredPart = model.regNoThiredPart,
                    //madeBy = model.madeBy,
                    //madeIn = model.madeIn,
                    //modelNo = model.modelNo,
                    //mfcDate = model.mfcDate,
                    engineNo = model.engineNo,
                    //chasisNo = model.chasisNo,
                    //ccNo = model.ccNo,
                    vehicleModelNo = model.modelNo
                };

                int vchid = await lostAndFoundService.SaveVehicleInformation(vehicleInformation);

                AttachmentInformation attachment = new AttachmentInformation
                {
                    gDInformationId = gdId,
                    encodedImage    = model.encodedImage,
                    fileSubject     = model.vehicleDescription
                };

                int imageId = await lostAndFoundService.SaveAttachmentInformation(attachment);

                return(Ok(gdId));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #20
0
 public AnalyticModelSettingsFetchingFactoryElectricSystem(
     VehicleInformation vehicleInformation,
     AnalyticModelSettingsFetchedCallback callback,
     ErrorCallbackDelegate errorCallback)
     : base(errorCallback, vehicleInformation)
 {
     this.callback = callback;
 }
Example #21
0
 public FitterStartupUndervoltage(VehicleInformation info)
 {
     if (info == null)
     {
         throw new ArgumentNullException("info");
     }
     this.info = info;
 }
        public ActionResult Delete(int id)
        {
            VehicleInformation vehicleInformation = _db.VehicleInformations.Find(id);

            _db.VehicleInformations.Remove(vehicleInformation);
            _db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 private void ProcessDataset(PsaDataset dataset,
                             VehicleInformation info)
 {
     foreach (PsaTrace trace in dataset.Traces)
     {
         ProcessTrace(trace, info);
     }
 }
Example #24
0
 public FitterInjectionTimeStartupPeak(VehicleInformation info)
 {
     if (info == null)
     {
         throw new ArgumentNullException("info");
     }
     this.info = info;
 }
 public AnalyticModelFactoryPetrolEngineIgnition(VehicleInformation vehicleInformation,
                                                 AnalyticModelFactoryFinishedCallback callback)
     : base(callback)
 {
     settingsFetcher =
         new AnalyticModelSettingsFetchingFactoryPetrolEngineIgnition(
             vehicleInformation, SettingsFetched, SettingsFetchFailed);
 }
Example #26
0
 public FitterFactory(VehicleInformation info)
 {
     if (info == null)
     {
         throw new ArgumentNullException("info");
     }
     this.info = info;
 }
        public ActionResult DeleteConfirmed(int id)
        {
            VehicleInformation vehicleInformation = db.VehicleInformations.Find(id);

            ViewBag.Images = vehicleInformation.VehicleImages;
            db.VehicleInformations.Remove(vehicleInformation);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #28
0
 public AnalyticModelFactoryCommonRail(
     VehicleInformation vehicleInformation,
     AnalyticModelFactoryFinishedCallback callback)
     : base(callback)
 {
     settingsFetcher =
         new AnalyticModelSettingsFetchingFactoryCommonRail(
             vehicleInformation, SettingsFetched, SettingsFetchFailed);
 }
        public static VehicleInformation FromDtoToDomainObject(
            VehicleInformationDto source)
        {
            VehicleInformation target = new VehicleInformation(source.Vin);

            target.Engine       = EngineAssembler.FromDtoToObject(source.Engine);
            target.VehicleModel = source.VehicleModel;
            return(target);
        }
Example #30
0
        public VehicleInformation Recognize()
        {
            VehicleInformation result = new VehicleInformation(vin);

            result.Engine         = RecognizeEngine();
            result.VehicleModel   = RecognizeVehicleModel();
            result.ProductionYear = RecognizeProductionYear();
            return(result);
        }
Example #31
0
 protected override void OnClick(EventArgs e)
 {
     VehicleInformation form = new VehicleInformation(this);
     form.ShowDialog();
 }