protected void btn_ConfirmarEdicao_Click(object sender, EventArgs e) { string vei_id = lbl_id.Text; Veiculo vei = new Veiculo(); vei.Vei_ano = Convert.ToInt32(ddl_ano.SelectedItem.ToString()); vei.Vei_placa = txt_placa.Text; vei.Vei_tipo = rbl_tipoVeiculo.SelectedValue.ToString(); vei.Mod_marca = txt_marca.Text; vei.Mod_modelo = txt_modelo.Text; vei.Vei_assentos = Convert.ToInt32(txt_qntAssentos.Text); if (VehicleDB.insertModelo(vei) == 0) { vei.Mod_id = (VehicleDB.selectModelo(vei)); if (VehicleDB.updateVeiculo(vei, vei_id) == 0) { Response.Redirect(Request.RawUrl); } else { // Algo deu errado } } else { //Algo deu errado } }
protected void Page_Init(object sender, EventArgs e) { if (Session["id"] == null && Session["empresa"] == null) { Response.Redirect("../ToVisitor/Index.aspx?er=0"); } DataSet ds = VehicleDB.selectVeiculo2(Convert.ToInt32(Session["id"])); string ltl_status = ""; foreach (DataRow dr in ds.Tables[0].Rows) { Literal top = new Literal(); Literal bottom = new Literal(); ltl_status += " <div class='container col-xl-3 col-lg-4 col-md-6 col-sm-12 mb-4'>"; top.Text = ltl_status; ltl_status = ""; LinkButton veiculo = new LinkButton();; veiculo.Text = "<div class='container'><div class='card bg-light border-dark auxiliar'><div class='card-body'><img src = '../../img/1498585513-sprinter-415-van-15-1-k42e--b-.jpg' /> </div > <div class='card-footer text-center'> <p><h4>" + dr["vei_placa"] + "<h4> </p> </div> </div> </div>"; veiculo.Click += new System.EventHandler(this.carroEsse_Click); veiculo.ID = "V" + dr["vei_id"].ToString(); ltl_status += "</div>"; bottom.Text = ltl_status; ltl_status = ""; phl_vehicle.Controls.Add(top); phl_vehicle.Controls.Add(veiculo); phl_vehicle.Controls.Add(bottom); } }
static void Main(string[] args) { Console.WriteLine("Forza Horizon 4 Telemetry Server"); Console.WriteLine("developed by digital - https://dgtl.dev"); Console.WriteLine(); Console.Write("Port (9909): "); try { string portEntry = Console.ReadLine(); if (portEntry != "") { int.TryParse(portEntry, out port); } } catch (Exception e) { Console.WriteLine($"Error: {e.ToString()}"); } // load vehicles from file VehicleDB.LoadVehicles(); // run the app - this will run forever until force stopped server = new TelemetryServer(port); server.Start(); // Wait for keypress to close Console.Read(); VehicleDB.SaveVehiclesToFile(); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { cbl_acessorios.Items.Clear();; cbl_acessorios.Items.Add(new ListItem("Placeholder")); DataSet ds = VehicleDB.selectAllAcessories(); cbl_acessorios.DataSource = ds; cbl_acessorios.DataTextField = "ace_nome"; cbl_acessorios.DataValueField = "ace_nome"; cbl_acessorios.DataBind(); cbl_acessorios.Items.Remove("Placeholder"); // cbl_acessorios.Items.Add(new ListItem("Televisão")); // cbl_acessorios.Items.Add(new ListItem("Rádio")); // cbl_acessorios.Items.Add(new ListItem("Bluetooth")); // cbl_acessorios.Items.Add(new ListItem("Wi - Fi")); // cbl_acessorios.Items.Add(new ListItem("Frigobar")); // cbl_acessorios.Items.Add(new ListItem("Som")); // cbl_acessorios.Items.Add(new ListItem("DVD")); // cbl_acessorios.Items.Add(new ListItem("Poltrona Leito")); } }
private int getTotalDuplicateCount() { using (Connection sqlConn = new Connection(SQLiteBoostDB.GetDBPath())) { VehicleDB vdb = new VehicleDB(sqlConn); List <DuplicateCheck> vehiclesToCheck = new List <DuplicateCheck>(); foreach (UploadDealerVehiclesList dealerVehicles in listDealerVehicles) { foreach (int id in dealerVehicles.VehicleIDs) { Vehicle vehicle = vdb.GetVehicle(id); vehiclesToCheck.Add(new DuplicateCheck() { DealershipID = dealerVehicles.DealershipID, StockNumber = vehicle.StockNumber, VIN = vehicle.VIN }); } } if (vehiclesToCheck.Count > 0) { return(uploader.GetTotalDuplicatesFound(vehiclesToCheck)); } } return(0); }
private Vehicle LoadVehicleFromDatabase() { Vehicle v = new Vehicle(); using (Connection sqlConn = new Connection(SQLiteBoostDB.GetDBPath())) v = new VehicleDB(sqlConn).GetVehicle(vehicleid); return(v); }
private void LoadVehicles() { List <VehicleWithImages> listOfVehicles = new List <VehicleWithImages> (); using (Connection sqlConn = new Connection(SQLiteBoostDB.GetDBPath())) listOfVehicles = new VehicleDB(sqlConn).GetVehicleList(selectedDealershipID, true); tvChangeVehicles.Delegate = new TableViewDelegate(this, listOfVehicles); tvChangeVehicles.DataSource = new TableViewDataSource(this, listOfVehicles); tvChangeVehicles.ReloadData(); }
void OnButtonOpenDatabase(object sender, RoutedEventArgs e) { try { this.IsEnabled = false; Task.Factory.StartNew(() => { vds = new VehicleDB(); vdam = new VehicleDBTableAdapters.TableAdapterManager(); sqlconn = new SqlConnection(Properties.Settings.Default.Vehicle_Scanner_DatabaseConnectionString); sqlconn.Open(); vdam.Connection = sqlconn; vdam.TextTableAdapter = new VehicleDBTableAdapters.TextTableAdapter(); vdam.TextTableAdapter.Connection = sqlconn; vdam.TroubleCodeTableAdapter = new VehicleDBTableAdapters.TroubleCodeTableAdapter(); vdam.TroubleCodeTableAdapter.Connection = sqlconn; vdam.LiveDataTableAdapter = new VehicleDBTableAdapters.LiveDataTableAdapter(); vdam.LiveDataTableAdapter.Connection = sqlconn; vdam.CommandTableAdapter = new VehicleDBTableAdapters.CommandTableAdapter(); vdam.CommandTableAdapter.Connection = sqlconn; vdam.TextTableAdapter.Fill(vds.Text); vdam.TroubleCodeTableAdapter.Fill(vds.TroubleCode); vdam.LiveDataTableAdapter.Fill(vds.LiveData); vdam.CommandTableAdapter.Fill(vds.Command); }).ContinueWith((t) => { Dispatcher.BeginInvoke((Action)(() => { this.IsEnabled = true; if (t.IsFaulted) { MessageBox.Show(t.Exception.InnerException.Message); } else { textDG.ItemsSource = vds.Text.DefaultView; troubleCodeDG.ItemsSource = vds.TroubleCode.DefaultView; liveDataDG.ItemsSource = vds.LiveData.DefaultView; commandDG.ItemsSource = vds.Command.DefaultView; } })); }); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public IActionResult ApplyMB(Vehicle v) { if (ModelState.IsValid) { // Add to database VehicleDB.Apply(v); // Alert successs ViewData["Success"] = "Registration was successful!"; return(View()); } return(View()); }
public override void ViewDidLoad() { base.ViewDidLoad(); Controls.RestrictRotation(true); SQLiteBoostDB.CheckAndCreateDatabase(); this.View.BackgroundColor = UIColor.FromPatternImage(UIImage.FromBundle("bg.jpg")); labelSelectedDealer = GetLabel("No Dealer Selected"); UIScrollView scrollView = new UIScrollView(new CoreGraphics.CGRect(this.View.Bounds.X, 60f, this.View.Bounds.Width, this.View.Bounds.Height)); scrollView.AddSubview(new EditGroup(GetDealershipGroup()).View); scrollView.AddSubview(new EditGroup(GetButtons()).View); nfloat ypos = 0f; foreach (UIView view in scrollView.Subviews) { view.Frame = new CoreGraphics.CGRect(view.Bounds.X + 5f, ypos + 10f, this.View.Bounds.Width - 10f, view.Bounds.Height); ypos += view.Bounds.Height + 10f; } //makes height of scroller the total ypos of groups + 60 for the top bar + 10 for margin at bottom scrollView.ContentSize = new CoreGraphics.CGSize(scrollView.Bounds.Width, ypos + 60f + 10f); this.View.AddSubview(scrollView); assetsRequireDownload = getAssetsRequired(); if (assetsRequireDownload) { showAssetsDialog(); } bool dealershipWarningShown = (bool)NSUserDefaults.StandardUserDefaults.BoolForKey("DealershipWarningShown"); if (!dealershipWarningShown) { List <Vehicle> listAllVehicles = new List <Vehicle>(); using (Connection sqlConn = new Connection(SQLiteBoostDB.GetDBPath())) listAllVehicles = new VehicleDB(sqlConn).GetAllVehicles(); if (listAllVehicles.Count(v => v.DealershipID == null || v.DealershipID == 0) > 0) { Controls.OkDialog("Vehicles Without Dealership", "Boost IT has recently changed so that you must select a dealership before creating a vehicle. You have vehicles that were created without a dealership assigned to them on your device. You will not be able to upload these vehicles until you go into \"Change a Vehicle\" and select a dealer for each vehicle.\n\n Vehicles not assigned to a dealership will be marked with \"(**)\" on the \"Change a Vehicle\" page.", delegate { NSUserDefaults.StandardUserDefaults.SetBool(true, "DealershipWarningShown"); }); } } }
public IActionResult Apply(IFormCollection data) { Vehicle v = new Vehicle() { FullName = data["full-name"], Make = data["make"], Model = data["model"], Year = Convert.ToInt32(data["year"]), Miles = Convert.ToInt32(data["miles"]) }; VehicleDB.Apply(v); ViewData["Success"] = "Registration was successful!"; //ADD TO DATABASE HERE!!!! return(View()); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Caravan car = (Caravan)Session["cadastro"]; endereco[] enderecos = (endereco[])Session["auxiliar"]; Proposta pro = (Proposta)Session["cadastro2"]; ltl_tituloCaravana.Text = " " + car.Car_titulo; ltl_descricaoCaravana.Text = " " + car.Car_descricao; ltl_veiculo.Text = VehicleDB.selectVeiculoPlaca(Convert.ToInt32(pro.Vei_id)); ltl_motorista.Text = DriverDB.selectDriverNome(Convert.ToInt32(pro.Mot_id)); ltl_frete.Text = "R$ " + pro.Pro_valor.ToString() + ",00"; int i = car.Car_privacidade; if (i == 0) { ltl_tipoCaravana.Text = " Caravana Publica"; } else if (i == 1) { ltl_tipoCaravana.Text = " Caravana Privada"; } ltl_datSaida.Text = " " + car.HoraDeSaída.ToShortDateString(); ltl_datDest.Text = " " + car.HoraDeChegada.ToShortDateString(); ltl_endDest.Text = " " + enderecos[0].End_cidade; ltl_endDest.Text += ", " + enderecos[0].End_uf + "<br/>"; ltl_endDest.Text += " " + enderecos[0].End_rua; ltl_endDest.Text += ", " + enderecos[0].End_bairro; ltl_endSaida.Text = " " + enderecos[1].End_cidade; ltl_endSaida.Text += ", " + enderecos[1].End_uf + "<br/>"; ltl_endSaida.Text += " " + enderecos[1].End_rua; ltl_endSaida.Text += ", " + enderecos[1].End_bairro; string[] categoria = car.Car_categoria.Split(';'); ltl_categoria.Text = " " + categoria[0]; if (categoria.Length > 1) { ltl_categoria.Text += " e " + categoria[1]; } } }
protected void Page_Load(object sender, EventArgs e) { string aux = Session["auxiliar"].ToString(); aux = Regex.Replace(aux, @"[\d-]", string.Empty);; ltl_auxiliar.Text = "<h2>Proposta para: " + aux + "</h2>"; Proposta pro = (Proposta)Session["cadastro"]; lblVeiculo.Text = VehicleDB.selectVeiculoPlaca(Convert.ToInt32(pro.Vei_id)); string auxN = DriverDB.selectDriverNome(pro.Mot_id); var names = auxN.Split(' '); lbl_motorista.Text = names[0]; lblValor.Text = "R$ " + pro.Pro_valor.ToString() + ",00"; }
private void CreateVehicleClick() { int selectedDealershipID = (int)NSUserDefaults.StandardUserDefaults.IntForKey("SelectedDealershipID"); if (assetsRequireDownload) { showAssetsDialog(); } else if (selectedDealershipID <= 0) { Controls.OkDialog("No Dealer Selected", "You must select a dealer before you can create a vehicle.", null); } else { int vehicleId = 0; using (Connection sqlConn = new Connection(SQLiteBoostDB.GetDBPath())) vehicleId = new VehicleDB(sqlConn).AddVehicle(selectedDealershipID); this.NavigationController.PushViewController(new CreateVehicle(vehicleId), true); } }
public IActionResult Index() { var model = new DeviceViewModel() { //Devices = DeviceDB.GetInstance().GetAllDevices(userObj), TerminalProtocols = TerminalProtocolDB.GetInstance().GetAllTerminalProtocols(), Gateways = GatewayDB.GetInstance().GetAllGateways(), DeviceMontageTypes = DeviceMontageTypeDB.GetInstance().GetAllDeviceMontageTypes(), RefTelemetryTypes = RefTelemetryTypeDB.GetInstance().GetAllRefTelemetryTypes(), ServiceTypes = ServiceTypeDB.GetInstance().GetAllServiceTypes(), TerminalTypes = TerminalTypeDB.GetInstance().GetAllTerminalTypes(), UsingStatus = UsingStatusDB.GetInstance().GetAllUsingStatuses(), Vehicles = VehicleDB.GetInstance().GetAllVehicles(), WocheckerFlags = WocheckerFlagDB.GetInstance().GetAllWocheckerFlags(), Companies = CompanyDB.GetInstance().GetAllCompaniesForAdminPanel(userObj), Messagings = MessagingDB.GetInstance().GetAllMessagings(), CompanyTypes = CompanyTypeDB.GetInstance().GetAllCompanyTypes() }; return(View(model)); }
void editar_Click(object sender, EventArgs e) { Button button = (Button)sender; string buttonId = button.ID; buttonId = Regex.Replace(buttonId, "[^0-9.]", ""); lbl_id.Text = buttonId; DataSet ds = VehicleDB.selectVeiculo3(Convert.ToInt32(buttonId)); foreach (DataRow dr in ds.Tables[0].Rows) { txt_placa.Text = dr["vei_placa"].ToString(); string ano = dr["vei_ano"].ToString(); ano = ano.Substring(ano.Length - 2); ddl_ano.SelectedValue = ano; rbl_tipoVeiculo.SelectedValue = dr["vei_tipo"].ToString(); txt_marca.Text = dr["mod_marca"].ToString(); txt_modelo.Text = dr["mod_nome"].ToString(); txt_qntAssentos.Text = dr["vei_assentos"].ToString(); } Page.ClientScript.RegisterStartupScript(this.GetType(), "script", "<script>$('#loginModal').modal('show');</script>", false); }
protected void excluir_Click(object sender, EventArgs e) { Button button = (Button)sender; string buttonId = button.ID; buttonId = Regex.Replace(buttonId, "[^0-9.]", ""); if (VehicleDB.deleteVeiculo_Acessorio_Relation(buttonId) == 0) { if (VehicleDB.deleteVeiculo(buttonId) == 0) { // Foi deletado Response.Redirect(Request.RawUrl); } else { // Aconteceu um erro } } else { // Aconteceu um erro } }
protected void btnConfirmar_Click(object sender, EventArgs e) { Veiculo vei = (Veiculo)Session["cadastro"]; string[] acessorios = vei.Acessorio.ToString().Split(';'); if (VehicleDB.insertModelo(vei) == 0) { int id = VehicleDB.selectModelo(vei); int aux = 0; int id2 = 0; Boolean nothingWrong = true; if (id != -1) { if (VehicleDB.insertVeiculo(vei, id) == 0) { id = VehicleDB.selectVeiculo(vei); if (id != -1) { for (int i = 0; i < acessorios.Length; i++) { aux = VehicleDB.existAcessorio(acessorios[i]); if (aux == 0) { if (VehicleDB.insertAcessorio(acessorios[i]) == 0) { id2 = VehicleDB.selectAcessorio(acessorios[i]); if (VehicleDB.insertVeiculo_Acessorio(id, id2) == 0) { } else { //Algo deu errado nothingWrong = false; } } else { // Algo deu errado nothingWrong = false; break; } } else if (aux == -1) { // Algo deu errado nothingWrong = false; break; } else { id2 = VehicleDB.selectAcessorio(acessorios[i]); if (VehicleDB.insertVeiculo_Acessorio(id, id2) == 0) { } else { //Algo deu errado nothingWrong = false; } } } if (nothingWrong == true) { ltl_status.Text = "<script type='text/javascript'> swal('Sucesso!', 'Você cadastrou um veículo', 'success')"; ltl_status.Text += ".then((value) => {window.location.replace('Vehicles.aspx')}); </script> "; } else { // Deu tudo errado! } } else { // Algo deu errado } } else { // Algo deu errado } } else { // Algo deu errado } } else { // Algo deu errado } }
private void PrintData() { // Print car ID and name (if it exists) Console.WriteLine($"ID: {LastUpdate.CarOrdinal}\t{VehicleDB.GetVehicle(LastUpdate.CarOrdinal).ToString()} [ {LastUpdate.CarClass.ToString()} | {LastUpdate.CarPI} ]"); }
protected void Page_Init(object sender, EventArgs e) { DataSet ds = VehicleDB.selectVeiculo2(Convert.ToInt32(Session["id"])); string ltl_status = ""; foreach (DataRow dr in ds.Tables[0].Rows) { Literal top = new Literal(); Literal bottom = new Literal(); ltl_status = "<div class='col-md-4 col-12 mt-3'>"; ltl_status += "<div class='card'>"; ltl_status += "<div class='card-header text-center pt-2 pb-1 '>"; ltl_status += "<h5 class ='text-center'>"; ltl_status += dr["vei_placa"].ToString(); ltl_status += "</h5>"; ltl_status += "</div>"; ltl_status += "<div class='row'>"; ltl_status += "<div class='col-12 rx-2'>"; ltl_status += "<img src='" + dr["foto"].ToString() + "' Class='w-100 border border-light rounded'>"; ltl_status += "</div>"; ltl_status += "<div class='col-md-12 pt-2'>"; ltl_status += "<div class='card-block btn-more'>"; ltl_status += "<div class='ml-1 text-center'>"; ltl_status += "<div class='mb-2'>"; ltl_status += "<div>"; ltl_status += "<strong>Ano:</strong>"; ltl_status += "<asp:Literal runat='server'>" + dr["vei_ano"].ToString() + "</asp:Literal>"; ltl_status += "</div>"; ltl_status += "<div>"; ltl_status += "<strong>Tipo: </strong>"; string aux = dr["vei_tipo"].ToString(); if (aux == "O") { aux = "Ônibus"; } else if (aux == "M") { aux = "Micro - Ônibus"; } else if (aux == "V") { aux = "Van"; } ltl_status += "<asp:Literal runat='server'>" + aux + "</asp:Literal>"; ltl_status += "</div>"; ltl_status += "</div>"; ltl_status += "<div>"; ltl_status += "<strong>Marca:</strong>"; ltl_status += "<asp:Literal runat='server'>" + dr["mod_marca"].ToString() + "</asp:Literal>"; ltl_status += "</div>"; ltl_status += "<div>"; ltl_status += "<strong>Modelo: </strong>"; ltl_status += "<asp:Literal runat='server'>" + dr["mod_nome"].ToString() + "</asp:Literal>"; ltl_status += "</div>"; ltl_status += "<div class='mt-2'>"; ltl_status += "<strong>Quantidade de Assentos: </strong>"; ltl_status += "<asp:Literal runat='server'>" + dr["vei_assentos"].ToString() + "</asp:Literal>"; ltl_status += "</div>"; ltl_status += "</div>"; ltl_status += "<div class='col-12 mb-1 mt-5 mt-auto'>"; ltl_status += "<div class='row'>"; ltl_status += "<div class='col-2'>"; ltl_status += "<div class='btn-group dropright'>"; ltl_status += "<button class='btn btn-secondary dropdown-toggle' data-toggle='dropdown' aria-haspopup='true' aria-expanded='false' style='padding-bottom:10px;background-color:#ffcc00;border: 1px solid transparent;'>"; ltl_status += "<i class='fa fa-cog fa-lg pt-2'></i>"; ltl_status += "</button>"; ltl_status += "<div class='dropdown-menu' style='background-color:#ffcc00;'>"; top.Text = ltl_status; ltl_status = " "; Button btn_editar = new Button(); btn_editar.Text = "Editar Veículo"; btn_editar.ID = "E" + dr["vei_id"].ToString(); btn_editar.CssClass = "dropdown-item m"; btn_editar.Click += new System.EventHandler(this.editar_Click); Button btn_excluir = new Button(); btn_excluir.Text = "Excluir Veículo"; btn_excluir.ID = "D" + dr["vei_id"].ToString(); btn_excluir.CssClass = "dropdown-item m"; btn_excluir.Click += new System.EventHandler(this.excluir_Click); ltl_status += "</div>"; ltl_status += "</div>"; ltl_status += "</div>"; ltl_status += "<div class='col-md-9 col-10 '>"; ltl_status += "<label class='genric-btn info w-100 btn-more mt-1'> Livre</label>"; ltl_status += "</div>"; ltl_status += "</div>"; ltl_status += "</div>"; ltl_status += "</div>"; ltl_status += "</div>"; ltl_status += "</div>"; ltl_status += "</div>"; ltl_status += "</div>"; bottom.Text = ltl_status; plh_status.Controls.Add(top); plh_status.Controls.Add(btn_editar); plh_status.Controls.Add(btn_excluir); plh_status.Controls.Add(bottom); } if (ltl_status == "") { Literal none = new Literal(); ltl_status = ""; ltl_status += " <div class='col - 12'>"; ltl_status += " <h5 class='text-center'>Não há veiculos cadastrados</h5>"; ltl_status += "</div>"; none.Text = ltl_status; plh_status.Controls.Add(none); } }
private void StartUpload() { //prepare all images to upload List <ImageForUpload> listOfImagesToUpload = prepareImagesForUpload(); if (stopEvent.WaitOne(0)) { return; } //prepare counters and progress bar int totalVehicleCount = GetTotalVehicles(); maxValue = CalculateMaxProgressValue(listOfImagesToUpload); //calculate max value for total progress (total kB of images) //this.InvokeOnMainThread(delegate { pbTotal.Max = (int)maxValue; }); using (Connection sqlConn = new Connection(SQLiteBoostDB.GetDBPath())) { //initialize vars VehicleDB vdb = new VehicleDB(sqlConn); VehicleFeaturesDB vfdb = new VehicleFeaturesDB(sqlConn); DamageDB ddb = new DamageDB(sqlConn); TireDB tdb = new TireDB(sqlConn); PaintDB pdb = new PaintDB(sqlConn); int vehCounter = 0; foreach (UploadDealerVehiclesList dealerVehicles in listDealerVehicles) { mobileUploadID = 0; PauseUpload(); uploader.GetMobileUploadID(userId, dealerVehicles.DealershipID); pauseEvent.WaitOne(Timeout.Infinite); if (stopEvent.WaitOne(0)) { return; } if (mobileUploadID <= 0) { Upload_Failed("Unable to retrieve a valid upload key."); return; } foreach (int vehicleId in dealerVehicles.VehicleIDs) { pauseEvent.WaitOne(Timeout.Infinite); if (stopEvent.WaitOne(0)) { return; } //initialize variables for next vehicle skipVehicle = false; mobileVehicleId = 0; dupeResponse = null; vehCounter++; Vehicle vehicle = vdb.GetVehicle(vehicleId); //reset progress for images and set the vehicle counter this.InvokeOnMainThread(delegate { nbUpload.TopItem.Title = "Uploading Vehicle " + vehCounter + "/" + totalVehicleCount; }); //check if vehicle already exists if (!overwriteAll && (!string.IsNullOrEmpty(vehicle.StockNumber) || !string.IsNullOrEmpty(vehicle.VIN))) { PauseUpload(); uploader.GetDuplicateData(dealerVehicles.DealershipID, vehicle.StockNumber, vehicle.VIN); pauseEvent.WaitOne(Timeout.Infinite); if (stopEvent.WaitOne(0)) { return; } if (dupeResponse != null && dupeResponse.TotalDuplicates > 0) { CheckSkipVehicle(dupeResponse); //wait until the user responds pauseEvent.WaitOne(Timeout.Infinite); if (skipVehicle) { continue; } } } //Upload vehicle data PauseUpload(); uploader.UploadVehicleData(mobileUploadID, vehicle); //wait for upload of data to complete pauseEvent.WaitOne(Timeout.Infinite); if (stopEvent.WaitOne(0)) { return; } if (skipVehicle || mobileVehicleId <= 0) { continue; } //update the progress for the vehicle data upload updateTotalProgress(10240); //upload feature data PauseUpload(); uploader.UploadFeatureData(mobileVehicleId, vfdb.GetSelectedFeatures(vehicle.ID)); //wait for upload of features to complete pauseEvent.WaitOne(Timeout.Infinite); if (stopEvent.WaitOne(0)) { return; } if (skipVehicle) { continue; } //update the progress for the features data upload updateTotalProgress(10240); //damages PauseUpload(); uploader.UploadDamageData(mobileVehicleId, ddb.GetDamageList(vehicle.ID)); pauseEvent.WaitOne(Timeout.Infinite); //wait for upload of damages to complete if (stopEvent.WaitOne(0)) { return; } if (skipVehicle) { continue; } updateTotalProgress(10240); //add damage progress //paint PauseUpload(); uploader.UploadPaintData(mobileVehicleId, pdb.GetPaintList(vehicle.ID)); pauseEvent.WaitOne(Timeout.Infinite); //wait for upload of paint to complete if (stopEvent.WaitOne(0)) { return; } if (skipVehicle) { continue; } updateTotalProgress(10240); //add paint progress //tires PauseUpload(); uploader.UploadTireData(mobileVehicleId, tdb.GetTireList(vehicle.ID)); pauseEvent.WaitOne(Timeout.Infinite); //wait for upload of tires to complete if (stopEvent.WaitOne(0)) { return; } if (skipVehicle) { continue; } updateTotalProgress(10240); //add tire progress //loop images to upload if (listOfImagesToUpload != null && listOfImagesToUpload.Count > 0) { List <ImageForUpload> listOfImagesForVehicle = listOfImagesToUpload.Where(i => i.vehicleId == vehicleId && i.dealershipId == dealerVehicles.DealershipID).ToList(); int imgCounter = 0; foreach (ImageForUpload img in listOfImagesForVehicle) { pauseEvent.WaitOne(Timeout.Infinite); if (stopEvent.WaitOne(0)) { return; } //initialize image variables imgCounter++; currentFileSize = (int)img.fileSize; this.InvokeOnMainThread(delegate { pbCurrentVehicle.Progress = 0f; //pbIVtotal.Max = (int)img.fileSize; maxImageSize = (int)img.fileSize; lblCurrentVehicle.Text = "Uploading image " + imgCounter + " of " + listOfImagesForVehicle.Count() + " for this vehicle."; }); if (img.damageId > 0) { pauseEvent.Reset(); //don't want to pause the "uploader" object, only local - don't use "PauseUpload()" uploader.UploadDamageFile(mobileUploadID, mobileVehicleId, img.damageId, File.ReadAllBytes(img.filePath)); pauseEvent.WaitOne(Timeout.Infinite); if (stopEvent.WaitOne(0)) { return; } if (skipVehicle) { break; } continue; } pauseEvent.Reset(); //don't want to pause the "uploader" object, only local - don't use "PauseUpload()" uploader.UploadFile(mobileUploadID, mobileVehicleId, img.fileNumber, File.ReadAllBytes(img.filePath)); pauseEvent.WaitOne(Timeout.Infinite); if (stopEvent.WaitOne(0)) { return; } if (skipVehicle) { break; } //insert image to database PauseUpload(); uploader.UploadImageData(mobileVehicleId, img.fileNumber); pauseEvent.WaitOne(Timeout.Infinite); if (stopEvent.WaitOne(0)) { return; } if (skipVehicle) { break; } //update the progress for the image update updateTotalProgress(10240); } } if (stopEvent.WaitOne(0)) //check if the upload has been cancelled before committing data { return; } if (skipVehicle) //check if the vehicle is skipped { continue; } //commit vehicle PauseUpload(); uploader.CommitVehicle(mobileVehicleId); pauseEvent.WaitOne(Timeout.Infinite); if (stopEvent.WaitOne(0)) { return; } if (skipVehicle) { continue; } //Delete the vehicle from the device vdb.DeleteVehicle(vehicle.ID); //update the progress for the commit updateTotalProgress(10240); } } } if (!stopEvent.WaitOne(0)) { Upload_Complete(); } }