public bool DeletePilot(pilot DeletePilot) { using (var db = new DbSimaer()) { //db.pilot.Remove(DeletePilot); //db.SaveChanges(); return(true); } }
public bool UpdatePilot(pilot UpdatePilot) { using (var db = new DbSimaer()) { db.pilot.AddOrUpdate(UpdatePilot); db.SaveChanges(); return(true); } }
private void FModificarGP_Load(object sender, EventArgs e) { numGP = 0; pilot p = new pilot(); pilots = p.llegeixPilotFitxer(); carregaComboPilots(pilots); carregaTextBox(); Botonera(); }
private void carregaTextBox() { pilot[] p = new pilot[100]; pilot p1 = new pilot(); p = p1.llegeixPilotFitxer(); // carreguem els comboBox amb la escuderia (i) TBNom.Text = p[numPilot].Nom; TBDorsal.Text = Convert.ToString(p[numPilot].Dorsal); TBNacionalitat.Text = p[numPilot].Nacionalitat; CBEscuderia.Text = p[numPilot].Esc.Nom; }
private void carregaComboBox() { pilot[] pil = new pilot[100]; pilot p1 = new pilot(); pil = p1.llegeixPilotFitxer(); // carreguem els comboBox amb la escuderia (i) TBModNomPilot.Text = pil[numPil].Nom; TBModDorsal.Text = Convert.ToString(pil[numPil].Dorsal); TBModNacionalitat.Text = pil[numPil].Nacionalitat; CBModEscuderiaPilot.Text = pil[numPil].Escu.NomEsc; }
/// <summary> /// Description: Evento edit /// </summary> private void OnEditCommandExecuted(object obj) { var row = obj as GridViewRow; pilot item = row.DataContext as pilot; if (item != null) { NewPilot newPilot = new NewPilot(true); newPilot._textMilitarCode_tex.Text = item.militar_code; newPilot._textFirstName_tex.Text = item.first_name; newPilot._textLastName_tex.Text = item.last_name; newPilot._initGrade_str = item.grade_id; newPilot.ShowDialog(); } }
private void mostrarLabels(pilot pil, String nomEs) { // Introduïm en els labels si existeix la escuderia que hem buscat if (pil == null) { MessageBox.Show("No existeix la escuderia" + nomEs, "error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { LBNomPilot.Text = pil.Nom; LBNacionalitatPilot.Text = pil.Nacionalitat; LBEscuderiaPilot.Text = pil.Escu.NomEsc; LBDorsalPilot.Text = Convert.ToString(pil.Dorsal); } }
private void BElimina_Click(object sender, EventArgs e) { if (!LBNom.Text.Equals(":")) { pilot p = new pilot(); p.eliminaPilot(LBNom.Text); // tornem les labels a la situació inicial LBEscuderia.Text = ":"; LBNom.Text = ":"; LBDorsal.Text = "(:)"; LBPais.Text = ":"; } }
private void FMostrarPilots_Load(object sender, EventArgs e) { pilot [] esc = new pilot[100]; pilot es = new pilot(); //String fitxer = "fitxer/llibres.dat"; //esc = es.llegeixFitxerEscuderia(); esc = es.llegeixPilotFitxer(); int i = 0; do { RTBMostrarPil.Text = RTBMostrarPil.Text + "Nom Pilot: " + esc[i].Nom + "\nPais : " + esc[i].Nacionalitat + "\nDorsal: " + esc[i].Dorsal + "\nEscuderia : " + esc[i].Escu.NomEsc + "\n\n"; i++; } while (esc[i] != null); }
private void BTBuscaPilot_Click(object sender, EventArgs e) { //Recogemos los datos(nom escuderia) String nomPilot; nomPilot = TBNompilot.Text; //Creamos el objeto pilot pil = new pilot(); //buscamos la escuderia pil = pil.cercarPilot(nomPilot); TBNompilot.Text = pil.Nom; mostrarLabels(pil, nomPilot); }
private void FMostraPilots_Load(object sender, EventArgs e) { pilot[] p = new pilot[100]; pilot p1 = new pilot(); p = p1.llegeixPilotFitxer(); int i = 0; do { RTText.Text = RTText.Text + "Pilot: " + p[i].Nom + " (" + p[i].Dorsal + ")" + "\nPais: " + p[i].Nacionalitat + "\nEscuderia: " + p[i].Esc.Nom + "\n\n"; i++; } while (p[i] != null); }
private Boolean comprovaDades(String dades) { // comprova si existeixen dades de pilot i d'escuderia // per obrir els formularis de pilots i de grans premis // o per no obrir-los switch (dades) { case "pilot": pilot p = new pilot(); if (p.contaPilots() > 0) { return(true); } ; break; case "escuderia": escuderia e = new escuderia(); if (e.contaEscuderies() > 0) { return(true); } break; case "gp": granPremi gp = new granPremi(); if (gp.contaGPs() > 0) { return(true); } ; break; case "mecanic": mecanic mec = new mecanic(); if (mec.contaMecanic() > 0) { return(true); } ; break; } return(false); }
/// <summary> /// Description: Valida el estudiante agregado /// </summary> private void _addButton_btn_Click(object sender, RoutedEventArgs e) { if ((_textMilitarCode_tex.Text != "") && (_textFirstName_tex.Text != "") && (_textLastName_tex.Text != "")) { pilot pilot = new pilot(); pilot.militar_code = _textMilitarCode_tex.Text; pilot.first_name = _textFirstName_tex.Text; pilot.last_name = _textLastName_tex.Text; grade grade = _comboGrade_com.SelectedItem as grade; pilot.grade_id = grade.grade_id; if (_idEdit_boo == false) { pilotLogic.CreatePilot(pilot); } else { pilotLogic.UpdatePilot(pilot); } if (SelectInstructor.instance != null) { SelectInstructor.instance.UpdateData(); } if (SelectStudent.instance != null) { SelectStudent.instance.UpdateData(); } this.Close(); } else { RadWindow.Alert(new DialogParameters { Header = "Alert", Content = "Complete all fields and press Add", OkButtonContent = "Ok", Owner = this }); } }
/// <summary> /// Description: Valida la selección de un estudiante /// </summary> private void _finishButton_btn_Click(object sender, RoutedEventArgs e) { pilot pilotSelected = _pilotGridView_rgv.SelectedItem as pilot; if (pilotSelected != null) { this.Close(); _parent_win.FinishSelect(); } else { RadWindow.Alert(new DialogParameters { Header = "Alert", Content = "Select student and press next", OkButtonContent = "Ok", Owner = this }); } }
/// <summary> /// Description: Evento delete /// </summary> private void OnDeleteCommandExecuted(object obj) { var row = obj as GridViewRow; pilot item = row.DataContext as pilot; if (item != null) { _pilotDelete_pit = item; RadWindow.Confirm(new DialogParameters { Header = "Confirm", Content = "Are you sure you want to delete a pilot?", CancelButtonContent = "Cancel", OkButtonContent = "Ok", Closed = new EventHandler <WindowClosedEventArgs>(OnConfirmDelete), Owner = Application.Current.MainWindow }); } }
/// <summary> /// Description: Valida la selección de un instructor /// </summary> private void _nextButton_btn_Click(object sender, RoutedEventArgs e) { pilot pilotSelected = _pilotGridView_rgv.SelectedItem as pilot; if (pilotSelected != null) { SelectStudent selectStudent = new SelectStudent(this); selectStudent.Show(); this.Hide(); } else { RadWindow.Alert(new DialogParameters { Header = "Alert", Content = "Select instructor and press next", OkButtonContent = "Ok", Owner = this }); } }
private void BAfegeix_Click(object sender, EventArgs e) { // creem variables String nom, pais, pilotGuanyador = CBGuanyador.Text; double premi; pilot guanyador = new pilot(); int any; // recollim les dades dels text box nom = TBNom.Text; pais = TBPais.Text; premi = Convert.ToDouble(TBPremi.Text); any = Convert.ToInt32(TBAny.Text); if (pilotGuanyador.Equals("-")) { guanyador = null; } else { guanyador = guanyador.cercarPilot(CBGuanyador.Text); } // construim l'objecte granPremi gp = new granPremi(nom, pais, premi, guanyador, any); // guardem al fitxer gp.afegeiGranPremi(); // buidem els Text Box TBNom.Text = ""; TBPais.Text = ""; TBPremi.Text = ""; TBAny.Text = ""; CBGuanyador.Text = "-"; }
private void BAfegeix_Click(object sender, EventArgs e) { // creem variables String nom, nacionalitat; int dorsal; escuderia esc = new escuderia(); // recollim les dades dels text box nom = TBNom.Text; nacionalitat = TBNacionalitat.Text; dorsal = Convert.ToInt32(TBDorsal.Text); esc = esc.CercaEscuderia(CBEscuderia.Text); // construim l'objecte pilot p = new pilot(nom, nacionalitat, esc, dorsal); // guardem al fitxer p.afegeixPersonaArxiu("fitxers/pilots.dat"); // buidem els Text Box TBNom.Text = ""; TBDorsal.Text = ""; TBNacionalitat.Text = ""; }
public bool CreatePilot(pilot InsertPilot) { return(dao.CreatePilot(InsertPilot)); }
public bool UpdatePilot(pilot UpdatePilot) { return(dao.UpdatePilot(UpdatePilot)); }
public bool DeletePilot(pilot DeletePilot) { return(dao.DeletePilot(DeletePilot)); }