private void button2_Click(object sender, EventArgs e) { pastorTransfer transfer = new pastorTransfer(); transfer.setChurchTo(new Church()); transfer.getChurchTo().setCode(cmb_churchTo.Text.Split('-')[0]); transfer.setPastor(new Pastor()); transfer.getPastor().setMatricule(cmb_churchPastor.Text.Split('-')[0]); transfer.setStartDate(dtp_dateEffet.Value.ToString("yyyy-MM-dd")); transfer.setTransferDate(dtp_dateOfTransfer.Value.ToString("yyyy-MM-dd")); transfer.setStatusTransfer("Encours"); transfer.setOccupationPosition(cmb_pastorPosition.Text); if (transfer.doTransfer()) { MessageBox.Show("Opération effectué avec succes !!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); PastorFormTransfer_Load(sender, e); } }
// Update methode public bool Update() { if (this.isExist()) { req = "UPDATE fgm_pastor SET pastorName = '" + this.name + "', pastorSurname = '" + this.surname + "', pastorBirthdayDate = '" + this.dateOfBirth + "', birthdayPlace = '" + this.pastorPlaceOfBirth + "', pastorFatherName = '" + this.pastorFotherName + "', pastorMotherName = '" + this.pastorMotherName + "', pastorSexe = '" + this.gender + "', pastorPhone = '" + this.tels + "', pastorEmail = '" + this.email + "', dateConversion = '" + this.conversionDate + "', workBeforeBibleSchool = '" + this.professionBeforeBibleschool + "', rankProbation = '" + this.rankProbation + "',areaOfCall = '" + this.areaOfCall + "',nberYearArea = " + this.numberYearInArea + ", nbreYearDistrict =" + this.numberYearDistrict + ", martialSituation ='" + this.martialStatus + "',nationality = '" + this.country + "',pastorAdresse ='" + this.pastorAdresse + "',photoProfil'" + this.picture + "',isActif =" + this.isActif + ",raisonIndispoMissionnaire ='" + this.raisonIndisp + "',isDelete = " + this.isDelete + ", id=" + this.id + ")"; MySqlCommand cmd = new MySqlCommand(req, DBConnection.con); cmd.ExecuteNonQuery(); pastorTransfer defaultTransfert = new pastorTransfer(); defaultTransfert.setPastor(this); //defaultTransfert.setChurchTo(appFunctions.getChurchByCode()) return(true); } return(false); }