public static void updateCVFormatByCandidateId(uint candidateId, List<string[]> languages, List<uint> nationalities) { string sql = "update cvformat cv inner join candidates c on cv.candidateid=c.candidateid inner join cvformat_status cs on cs.cvformatid=cv.cvformatid set cv.dob=c.dob,cv.marital=c.maritalstatus,cv.nodob=c.nodob,cv.dobformat=c.dobformat " + " where cv.candidateid=?candidateid and cs.status=1"; DAO.ExecuteNonQuery(sql, new MySqlParameter("candidateid", candidateId)); sql = "select cv.cvformatid from cvformat cv inner join cvformat_Status cs on cs.cvformatid=cv.cvformatid where status=1 and cv.candidateid=?candidateid "; MySqlDataReader reader = DAO.ExecuteReader(sql, new MySqlParameter("candidateid", candidateId)); if (reader.HasRows) { int cvformatId; while (reader.Read()) { cvformatId = Convert.ToInt32(DAO.getString(reader, "cvformatid")); sql = "delete from cvformat_languages where cvformatid=?cvformatid;" + "delete from cvformat_nationality where cvformatid=?cvformatid;"; DAO.ExecuteNonQuery(sql, new MySqlParameter("cvformatid", cvformatId)); foreach (int countryid in nationalities) { insertNationality(countryid, cvformatId); } foreach (string[] language in languages) { uint candidatelanguageid = Convert.ToUInt32(language[0]); int languageid = Convert.ToInt32(language[1]); Int16 spoken = Convert.ToInt16(language[2]); Int16 written = Convert.ToInt16(language[3]); Int16 listening = Convert.ToInt16(language[4]); Int16 reading = Convert.ToInt16(language[5]); CVFormatLanguageInfo info = new CVFormatLanguageInfo(); info.CVFormatId = cvformatId; info.LanguageId = languageid; info.Spoken = spoken; info.Written = written; info.Listening = listening; info.Reading = reading; insertCVFormatLanguages(info); } } } reader.Close(); reader.Dispose(); }
public static void updateCVFormatLanguageByCandidateId(uint candidateid, uint languageid, uint spoken, uint written, uint listening, uint reading) { //string sql = "delete cl from cvformat_languages cl inner join cvformat c on cl.cvformatid=c.cvformatid inner join cvformat_status cs on cs.cvformatid=c.cvformatid where c.candidateid=?candidateid and cs.status=1;"; //DAO.ExecuteNonQuery(sql, new MySqlParameter("candidateid", candidateid)); string sql = "select cv.cvformatid from cvformat cv inner join cvformat_Status cs on cs.cvformatid=cv.cvformatid where status=1 and cv.candidateid=?candidateid "; MySqlDataReader reader = DAO.ExecuteReader(sql, new MySqlParameter("candidateid", candidateid)); if (reader.HasRows) { int cvformatId; while (reader.Read()) { cvformatId = Convert.ToInt32(DAO.getString(reader, "cvformatid")); CVFormatLanguageInfo info = new CVFormatLanguageInfo(); info.CVFormatId = cvformatId; info.LanguageId = Convert.ToInt32(languageid); info.Spoken = Convert.ToInt16(spoken); info.Written = Convert.ToInt16(written); info.Listening = Convert.ToInt16(listening); info.Reading = Convert.ToInt16(reading); insertCVFormatLanguages(info); } } reader.Close(); reader.Dispose(); }
public static void insertCVFormatLanguages(CVFormatLanguageInfo info) { string sql = "insert into cvformat_languages (cvformatid,languageid,spoken,written,listening,reading) values (?cvformatid,?languageid,?spoken,?written,?listening,?reading)"; DAO.ExecuteNonQuery(sql, new MySqlParameter("cvformatid", info.CVFormatId), new MySqlParameter("languageid", info.LanguageId), new MySqlParameter("spoken", info.Spoken), new MySqlParameter("written", info.Written), new MySqlParameter("listening", info.Listening), new MySqlParameter("reading", info.Reading)); }