public List <Pastor> getPastor() { req = "SELECT * FROM fgm_pastor WHERE matriculePastor in(SELECT mleTransferedpastor FROM fgm_pastor_transfer WHERE codeStationTransfer ='" + this.churchCode + "', and statusTransfer ='Encours')"; cmd = new MySqlCommand(req, DBConnection.con); MySqlDataReader dr = cmd.ExecuteReader(); List <Pastor> pastors = new List <Pastor>(); while (dr.Read()) { Pastor pst = new Pastor(); pst.setMatricule(dr["matriculePastor"].ToString()); pst.setName(dr["pastorName"].ToString()); pst.setSurname(dr["pastorSurname"].ToString()); pst.setDateOfBirth(dr["pastorBirthdayDate"].ToString()); pst.setPastorPlaceOfBirth(dr["birthdayPlace"].ToString()); pst.setPastorFotherName(dr["pastorFatherName"].ToString()); pst.setPastorMotherName(dr["pastorMotherName"].ToString()); pst.setGender(dr["pastorSexe"].ToString()); pst.setTels(dr["pastorPhone"].ToString()); pst.setEmail(dr["pastorEmail"].ToString()); pst.setConversionDate(dr["dateConversion"].ToString()); pst.setProfessionBeforeBibleschool(dr["workBeforeBibleSchool"].ToString()); pst.setRankProbation(dr["rankProbation"].ToString()); pst.setAreaOfCall(dr["areaOfCalling"].ToString()); pst.setNumberYearInArea(Convert.ToInt32(dr["nberYearArea"])); pst.setNumberYearDistrict(Convert.ToInt32(dr["nbreYearDistrict"])); pst.setMartialStatus(dr["martialSituation"].ToString()); pst.setCountry(dr["nationality"].ToString()); pst.setPastorAdresse(dr["pastorAdresse"].ToString()); pst.setPicture(dr["photoProfil"].ToString()); pst.setRaisonIndisp(dr["raisonIndispoMissionnaire"].ToString()); pst.setIsActif(Convert.ToInt32(dr["isActif"])); pst.setIsDelete(Convert.ToInt32(dr["isDelete"])); pst.setId(Convert.ToInt32(dr["id"])); pastors.Add(pst); } dr.Close(); return(pastors); }
public static Pastor getPastorByCode(string mlePastor) { string req = "SELECT * FROM fgm_pastor WHERE matriculePastor = '" + mlePastor + "'"; cmd = new MySqlCommand(req, DBConnection.con); dr = cmd.ExecuteReader(); Pastor pst = new Pastor(); while (dr.Read()) { pst.setMatricule(dr["matriculePastor"].ToString()); pst.setName(dr["pastorName"].ToString()); pst.setSurname(dr["pastorSurname"].ToString()); pst.setDateOfBirth(dr["pastorBirthdayDate"].ToString()); pst.setPastorPlaceOfBirth(dr["birthdayPlace"].ToString()); pst.setPastorFotherName(dr["pastorFatherName"].ToString()); pst.setPastorMotherName(dr["pastorMotherName"].ToString()); pst.setGender(dr["pastorSexe"].ToString()); pst.setTels(dr["pastorPhone"].ToString()); pst.setEmail(dr["pastorEmail"].ToString()); pst.setConversionDate(dr["dateConversion"].ToString()); pst.setProfessionBeforeBibleschool(dr["workBeforeBibleSchool"].ToString()); pst.setRankProbation(dr["rankProbation"].ToString()); pst.setAreaOfCall(dr["areaOfCalling"].ToString()); pst.setNumberYearInArea(Convert.ToInt32(dr["nberYearArea"])); pst.setNumberYearDistrict(Convert.ToInt32(dr["nbreYearDistrict"])); pst.setMartialStatus(dr["martialSituation"].ToString()); pst.setCountry(dr["nationality"].ToString()); pst.setPastorAdresse(dr["pastorAdresse"].ToString()); pst.setPicture(dr["photoProfil"].ToString()); pst.setRaisonIndisp(dr["raisonIndispoMissionnaire"].ToString()); pst.setIsActif(Convert.ToInt32(dr["isActif"])); pst.setIsDelete(Convert.ToInt32(dr["isDelete"])); pst.setId(Convert.ToInt32(dr["id"])); } dr.Close(); return(pst); }