private void cmdEdycja_Click(object sender, EventArgs e) { Car car = null; try { car = (Car)dgwTransactions.CurrentRow.DataBoundItem; } catch { Message.Position(); return; } CarsFrm cars = new CarsFrm(CarsFrm.TYPE.EDIT); cars.CAR = car; cars.ShowDialog(); if (cars.CANCEL) return; CustomerDatabase.UpdateCar(car.ID, cars.CID, cars.MARKA, cars.MODEL, cars.POJEMNOSC, cars.TYP, cars.ROK_PRODUKCJI, cars.REJESTRACJA, cars.VIN, cars.OPIS, cars.SILNIK, cars.BADANIE, -1, -1, cars.DATA_PRZYJECIA, cars.DATA_WYDANIA, -1); LoadCar(car.ID, -1, "", "", "", "", "", "", "", "","",""); Message.InfoMessage("Dane pojazdu zostały zapisane"); }
private void cmdFaktura_Click(object sender, EventArgs e) { Car car = null; try { car = (Car)dgwTransactions.CurrentRow.DataBoundItem; } catch { Message.Position(); return; } CarsFrm cars = new CarsFrm(CarsFrm.TYPE.PRINT); cars.CAR = car; cars.ShowDialog(); if (cars.CANCEL) return; Drukuj.PrintCar(car); }
private void cmdSzukaj_Click(object sender, EventArgs e) { CarsFrm findCar = new CarsFrm(CarsFrm.TYPE.FIND); findCar.ShowDialog(); if (findCar.CANCEL) return; LoadCar(-1, findCar.CID, findCar.MARKA, findCar.MODEL, findCar.POJEMNOSC, findCar.TYP, findCar.ROK_PRODUKCJI, findCar.REJESTRACJA, findCar.VIN, findCar.SILNIK,"",""); }
private void cmdPodglad_Click(object sender, EventArgs e) { Car car = null; try { car = (Car)dgwTransactions.CurrentRow.DataBoundItem; } catch { Message.Position(); return; } CarsFrm cars = new CarsFrm(CarsFrm.TYPE.VIEW); cars.CAR = car; cars.ShowDialog(); }
private void cmdNowy_Click(object sender, EventArgs e) { CarsFrm NewCar = new CarsFrm(CarsFrm.TYPE.NEW); NewCar.ShowDialog(); if (NewCar.CANCEL) return; int id = CustomerDatabase.NewCar(NewCar.CID, NewCar.MARKA, NewCar.MODEL, NewCar.POJEMNOSC, NewCar.TYP, NewCar.ROK_PRODUKCJI, NewCar.REJESTRACJA, NewCar.VIN, NewCar.OPIS, NewCar.SILNIK, NewCar.BADANIE, -1, -1, NewCar.DATA_PRZYJECIA, NewCar.DATA_WYDANIA, 0); LoadCar(id, -1, "", "", "", "", "", "", "", "","",""); Message.InfoMessage("Nowy pojazd został dodany do bazy"); }
private void cmsCarSearch_Click(object sender, EventArgs e) { if (CID < 0) { Message.ErrorMessage("Proszę wybrać kontrahenta"); return; } CarsFrm CarFind = new CarsFrm(CarsFrm.TYPE.FIND_BY); CarFind.CID = CID; CarFind.ShowDialog(); if (CarFind.CANCEL) return; List<Car> cars = CustomerDatabase.GetCars(-1, CID, CarFind.MARKA, CarFind.MODEL, CarFind.POJEMNOSC, CarFind.TYP, CarFind.ROK_PRODUKCJI, CarFind.REJESTRACJA, CarFind.VIN, CarFind.SILNIK, "",""); if (cars == null) { Message.NotFound(); return; } cbxCar.ValueMember = ""; cbxCar.DisplayMember = ""; cbxCar.DataSource = null; cbxCar.DataSource = cars; cbxCar.DisplayMember = "SAMOCHOD"; cbxCar.ValueMember = "ID"; Settings.ShowDropDownList(ref cbxCar); }
private void cmdCarAdd_Click(object sender, EventArgs e) { if (CID < 0) { Message.ErrorMessage("Proszę wybrać kontrahenta"); return; } CarsFrm NewCar = new CarsFrm(CarsFrm.TYPE.NEW_BY); NewCar.CID = CID; NewCar.ShowDialog(); if (NewCar.CANCEL) return; int id = CustomerDatabase.NewCar(CID, NewCar.MARKA, NewCar.MODEL, NewCar.POJEMNOSC, NewCar.TYP, NewCar.ROK_PRODUKCJI, NewCar.REJESTRACJA, NewCar.VIN, NewCar.OPIS, NewCar.SILNIK, NewCar.BADANIE, -1, -1, NewCar.DATA_PRZYJECIA, NewCar.DATA_WYDANIA, -1); LoadCar(id); Message.InfoMessage("Nowy pojazd został dodany do bazy"); }
private void cbxCar_SelectedIndexChanged(object sender, EventArgs e) { if (cbxCar.DisplayMember == "" || cbxCar.ValueMember == "") return; Car car = (Car)cbxCar.SelectedItem; CarsFrm cars = new CarsFrm(CarsFrm.TYPE.UPDATE); cars.CAR = car; cars.ShowDialog(); if (cars.CANCEL) return; CustomerDatabase.UpdateCar(car.ID, cars.CID, cars.MARKA, cars.MODEL, cars.POJEMNOSC, cars.TYP, cars.ROK_PRODUKCJI, cars.REJESTRACJA, cars.VIN, cars.OPIS, cars.SILNIK, cars.BADANIE, -1, -1, cars.DATA_PRZYJECIA, cars.DATA_WYDANIA, -1); CARID = int.Parse(cbxCar.SelectedValue.ToString()); cbxCar.BackColor = Color.White; }