public void Init(ClientVehicle cv) { //MapCenter = new Location(RadianToDegree(cv.Telemetry.LatitudeGPS.Value), RadianToDegree(cv.Telemetry.LongitudeGPS.Value)); InitMapCenter(0, 0); if (cv.Telemetry.LatitudeGPS == null || cv.Telemetry.LongitudeGPS == null) { Zoom = 7; } Points = new ObservableCollection <MapPoint>(); if (cv.Telemetry.LatitudeGPS != null && cv.Telemetry.LongitudeGPS != null) { Points.Add( new MapPoint { Name = cv.Vehicle.Name, Location = new Location(RadianToDegree(cv.Telemetry.LatitudeGPS.Value), RadianToDegree(cv.Telemetry.LongitudeGPS.Value)) }); } else { Points.Add( new MapPoint { Name = cv.Vehicle.Name, Location = null }); } ArcSector = new ArcSector(); ArcSector.SetAngle(0, 0, CircleWidth); }
protected void Page_Load(object sender, EventArgs e) { if (Application["username"] == null) { Response.Redirect("/Login"); } if (!IsPostBack) { usernumber = Convert.ToInt32(Application["UserNumber"].ToString()); ClientVehicle cv = new ClientVehicle(); VehicleDDL.DataValueField = "Client_Vehicle_Number"; VehicleDDL.DataTextField = "Vehicle"; VehicleDDL.DataSource = db.BindDropdown(cv.SearchClientVehicles(usernumber), "GVehicle_Model", "Client_Vehicle_Number"); VehicleDDL.DataBind(); db.LoadClientVehicles(usernumber); foreach (ClientVehicle ClientV in ClientVehicleBindingList.ClientVehicleList) { if (ClientV.ClientVehicleNumber == Convert.ToInt32(VehicleDDL.SelectedValue)) { txtName.Text = ClientV.ClientVehicleName; txtColour.Text = ClientV.ClientVehicleColour; txtLicensePlate.Text = ClientV.RegistrationNumber; clientVehicleNumber = ClientV.ClientVehicleNumber; break; } } //Client Vehicle Products ClientVehicle cvProducts = new ClientVehicle(); gvwStudents.DataSource = db.SearchQuery(cvProducts.SearchClientVehicleProducts(clientVehicleNumber), "ProductTable"); gvwStudents.DataMember = "ProductTable"; gvwStudents.DataBind(); } }
protected void Unnamed_Click(object sender, EventArgs e) { ClientVehicle updateCV = new ClientVehicle(); updateCV.UpdateClientVehicle(Convert.ToInt32(VehicleDDL.SelectedItem.Value), txtLicensePlate.Text, txtColour.Text, txtName.Text); Label lblMasterStatus = (Label)Master.FindControl("message"); lblMasterStatus.Visible = true; lblMasterStatus.Text = "Vehicle Details Successfully Updated"; }
protected void Unnamed_Click1(object sender, EventArgs e) { ClientVehicle deleteCV = new ClientVehicle(); deleteCV.DeleteClientVehicle(Convert.ToInt32(VehicleDDL.SelectedItem.Value)); Response.Redirect(Request.RawUrl); Label lblMasterStatus = (Label)Master.FindControl("message"); lblMasterStatus.Visible = true; lblMasterStatus.Text = "Vehicle Successfully Removed"; }
protected void VehicleDDL_SelectedIndexChanged(object sender, EventArgs e) { DBConnection db = new DBConnection(); ClientVehicle ClientV = new ClientVehicle(); DateDDL.DataTextField = "Project_StartDateTime"; DateDDL.DataValueField = "Project_Number"; DateDDL.DataSource = db.BindDropdown("SELECT Project.Project_Number, Project.Project_StartDateTime, Project.Project_TotalCost FROM Project WHERE Client_Vehicle_Number = " + VehicleDDL.SelectedItem.Value, "Project_StartDateTime", "Project_Number"); DateDDL.DataBind(); DateDDL.Items.Insert(0, ""); }
private void addVehicleToGarage() { showAvailableVehicles(); VehiclesFactory.eVehicleType vehicleType = selectVehicleType(); Client client = getClientInformation(); ArgumentConsumersContainer vehicleArgumentsContainer = VehiclesFactory.GetVehicleArguments(vehicleType); fillVehicleArguments(vehicleArgumentsContainer, vehicleType); Vehicle vehicleToAdd = VehiclesFactory.GetVehicle(vehicleType, vehicleArgumentsContainer); ClientVehicle clientVehicle = new ClientVehicle(client, vehicleToAdd, ClientVehicle.eClientVehicleStatus.InRepair); bool didCarEnterTheGarage = r_Garage.AddVehicleToGarage(clientVehicle); printMessageToConsole( didCarEnterTheGarage == true ? eMessageToPrint.CarHasEnteredTheGarage : eMessageToPrint.CarIsAlreadyInTheGarage); }
public Task <YakkenClientVehicleMapping> GetClientVehicleData(Guid clientId, UserQuotationRequestDto req) { YakkenClientVehicleMapping result = new YakkenClientVehicleMapping(); // Fetch the client's vehicle data from yaqeen using their vehicle sequence number var vehicleInfoResponse = yakeenService.GetVehicleBySquNo(req.VehicleId); // On request failure if (!vehicleInfoResponse.IsSuccess) { result = new YakkenClientVehicleMapping() { IsSuccess = false, StatusCode = 723, ResponseMessage = localizer["YakkenInsuredResponseGlobalErrMsg"], ValidationErrors = new List <ValidationError>() { new ValidationError { Name = "VehicleId", Description = "الرجاء التحقق من الرقم المتسلسل للمركبة , تعزر الاتصال بمزود المعلومات الوطني" } } }; return(Task.FromResult(result)); } // Construct a 'ClientVehicle' object for the client with their fetched vehicle data ClientVehicle clientVehicle = mapper.Map <YakeenVehicleInfo, ClientVehicle>(vehicleInfoResponse.Data); clientVehicle.ClientId = clientId; clientVehicle.IsVehicleModified = req.IsVehicleOwnerTransfer; clientVehicle.VehicleRepairMethodId = req.VehicleRepairMethodId; clientVehicle.VehicleUseId = req.VehicleUseId; clientVehicle.VehicleTransmissionTypeId = req.VehicleTransmissionTypeId; clientVehicle.VehicleModificationDetails = req.VehicleModificationDetails; clientVehicle.VehicleSpecifications = req.VehicleSpecifications != null?string.Join(",", req.VehicleSpecifications.Select(p => p.VehicleSpecificationId).ToList()) : null; clientVehicle.VehicleIdTypeId = req.VehicleIdTypeId; result = new YakkenClientVehicleMapping() { ClientVehicle = clientVehicle, IsSuccess = true, StatusCode = 200, ResponseMessage = "Successfully" }; return(Task.FromResult(result)); }
/// <summary> /// Sets the vehicle /// </summary> /// <param name="vehicleId"></param> public override void SetVehicle(SimVehicleId vehicleId) { if (vehicleId != null) { this.ClientVehicle = new ClientVehicle(); this.ClientVehicle.VehicleId = vehicleId; Console.WriteLine(DateTime.Now.ToString() + ": Registered Vehicle with Vehicle Id: " + vehicleId.ToString()); } else { if (this.ClientVehicle != null) { Console.WriteLine(DateTime.Now.ToString() + ": Deregistered Vehicle with Vehicle Id: " + this.ClientVehicle.VehicleId.ToString()); } this.ClientVehicle = null; } }
protected void Page_Load(object sender, EventArgs e) { if (Application["username"] == null) { Response.Redirect("/Login"); } if(!IsPostBack) { usernumber = Convert.ToInt32(Application["UserNumber"]); VehicleDDL.Items.Clear(); DBConnection db = new DBConnection(); ClientVehicle cv = new ClientVehicle(); VehicleDDL.DataTextField = "Vehicle"; VehicleDDL.DataValueField = "Client_Vehicle_Number"; VehicleDDL.DataSource = db.BindDropdown(cv.SearchClientVehicles(usernumber), "GVehicle_Model", "Client_Vehicle_Number"); VehicleDDL.DataBind(); VehicleDDL.Items.Insert(0, ""); } }
public MainViewModel(VehicleService vs, VehicleListener vl, MapViewModel mp, TelemetryListener tl, CommandService cs, MissionService ms, RouteService rs, VehicleCommand vc) { Mapper.Initialize(cfg => { cfg.CreateMap <ServiceTelemetryDTO, ClientTelemetry>(); }); logger.LogInfoMessage("Main window initialized"); MapViewModel = mp; _vehicleService = vs; _commandService = cs; _missionService = ms; _routeService = rs; _vehicleCommand = vc; try { ClientVehicle = new ClientVehicle(); ClientVehicle.Vehicle = vs.GetVehicleByName(Settings.Default.UgcsDroneProfileName); ClientVehicle.Telemetry.Vehicle = ClientVehicle.Vehicle; var subscription = new ObjectModificationSubscription(); subscription.ObjectId = ClientVehicle.Vehicle.Id; subscription.ObjectType = "Vehicle"; _commandService.TryAcquireLock(ClientVehicle.Vehicle.Id); tl.AddVehicleIdTolistener(ClientVehicle.Vehicle.Id, TelemetryCallBack); vl.SubscribeVehicle(subscription, (e) => { //Subscribe vehicle changes }); MapViewModel.Init(ClientVehicle); NotifyOfPropertyChange(() => MissionName); NotifyOfPropertyChange(() => RouteName); NotifyOfPropertyChange(() => VehicleName); } catch (Exception e) { MessageBox.Show(e.Message); Application.Current.Shutdown(); } }
protected void Unnamed_Click(object sender, EventArgs e) { string manufacturer = autoComplete.Text; string model = DDLModel.Text; string year = DDLYear.Text; string engineSize = DDLEngineSize1.Text; //Fuel Type string fuelType = DDLFuelType.Text; if (fuelType == "Diesel") fuelType = "D"; else if (fuelType == "Petrol") fuelType = "P"; //Model Number string modelNumber = string.Concat(manufacturer, model, year, fuelType, engineSize); //Usernumber is retrieved from the initiating of the form string regNumber = VehicleLicensePlate.Text; string colour = VehicleColour.Text; string name = CustomName.Text; ClientVehicle newCV = new ClientVehicle(modelNumber, manufacturer, model, Convert.ToInt32(year), Convert.ToChar(fuelType), Convert.ToInt32(engineSize), true, 0, Convert.ToInt32(Application["UserNumber"]), regNumber, colour, name); Label lblMasterStatus = (Label)Master.FindControl("message"); lblMasterStatus.Visible = true; lblMasterStatus.Text = "Vehicle Successfully Added"; }
protected void Unnamed_Click(object sender, EventArgs e) { //Still need to remove white space and capitalise reg number string manufacturer = autoComplete.Text; string model = ModelDDL.Text; string year = YearDDL.Text; string engineSize = EngineSizeDDL.Text; //Fuel Type string fuelType = FuelTypeDDL.Text; if (fuelType == "Diesel") fuelType = "D"; else if (fuelType == "Petrol") fuelType = "P"; //Model Number string modelNumber = string.Concat(manufacturer, model, year, fuelType, engineSize); //Usernumber is retrieved from the initiating of the form string regNumber = License.Text; //Unregistered Client THEREFORE Usernumber = 1 ClientVehicle newCV = new ClientVehicle(modelNumber, manufacturer, model, Convert.ToInt32(year), Convert.ToChar(fuelType), Convert.ToInt32(engineSize), true, 0, 1, regNumber, "", ""); Label lblMasterStatus = (Label)Master.FindControl("message"); lblMasterStatus.Visible = true; lblMasterStatus.Text = newCV.InsertNewClientVehicle(newCV); DBConnection db = new DBConnection(); db.LoadClientVehicles(1); int clientVehicleNum = 0; foreach (ClientVehicle cv in ClientVehicleBindingList.ClientVehicleList) { if (cv.ModelNumber == modelNumber) { clientVehicleNum = cv.ClientVehicleNumber; } } Application.Contents.Remove("ClientUN"); Application.Contents.Remove("ProjectRequest"); Application.Contents.Remove("ClientVehicleNum"); Application.Contents.Remove("FName"); Application.Contents.Remove("SName"); Application.Contents.Remove("ContactNum"); Application["ClientUN"] = "1"; Application["ProjectRequest"] = "0"; Application["ClientVehicleNum"] = clientVehicleNum; Application["FName"] = txtName.Text; Application["SName"] = txtSurname.Text; Application["ContactNum"] = txtContactNumber.Text; Response.Redirect("./ConfirmDate"); }
protected void gvwStudents_SelectedIndexChanged(object sender, EventArgs e) { foreach (GridViewRow srow in gvwStudents.Rows) { if (srow.RowIndex == gvwStudents.SelectedIndex) { srow.BackColor = System.Drawing.ColorTranslator.FromHtml("#A1DCF2"); srow.ForeColor = System.Drawing.Color.Black; } else { srow.BackColor = System.Drawing.Color.Transparent; srow.ForeColor = System.Drawing.Color.White; } } int rowIndex = gvwStudents.SelectedIndex; usernumber = userNumbersList[rowIndex]; cvNumbersList.Clear(); List<ClientVehicles> lstClients = new List<ClientVehicles>(); foreach (Client c in ClientBindingList.MyClientList) { if (usernumber == c.UserNumber) { ClientVehicle cv = new ClientVehicle(); cv.LoadClientVehicles(usernumber); foreach (ClientVehicle inCV in ClientVehicleBindingList.ClientVehicleList) { cvNumbersList.Add(inCV.ClientVehicleNumber); lstClients.Add(new ClientVehicles() { GenericVehicleManufacturer = inCV.GenericVehicleManufacturer, GenericVehicleModel = inCV.GenericVehicleModel, RegistrationNumber = inCV.RegistrationNumber }); GridView1.DataSource = lstClients; GridView1.DataBind(); } } } Application.Contents.Remove("ClientUN"); Application["ClientUN"] = usernumber; Session["lstClients"] = cvNumbersList; }
protected void VehicleDDL_SelectedIndexChanged(object sender, EventArgs e) { usernumber = Convert.ToInt32(Application["UserNumber"].ToString()); gvwStudents.DataSource = null; gvwStudents.DataBind(); txtName.Text = ""; txtColour.Text = ""; txtLicensePlate.Text = ""; db.LoadClientVehicles(usernumber); foreach (ClientVehicle ClientV in ClientVehicleBindingList.ClientVehicleList) { if (ClientV.ClientVehicleNumber == Convert.ToInt32(VehicleDDL.SelectedValue)) { txtName.Text = ClientV.ClientVehicleName; txtColour.Text = ClientV.ClientVehicleColour; txtLicensePlate.Text = ClientV.RegistrationNumber; clientVehicleNumber = ClientV.ClientVehicleNumber; break; } } //Client Vehicle Products ClientVehicle cvProducts = new ClientVehicle(); gvwStudents.DataSource = db.SearchQuery(cvProducts.SearchClientVehicleProducts(clientVehicleNumber), "ProductTable"); gvwStudents.DataMember = "ProductTable"; gvwStudents.DataBind(); }