//Добавление записи public static bool Add(Review review) { string sqlStr = "INSERT INTO VOTE (FAM,IM,OT,STREET_ID,HOME_NUM,FLAT_NUM,PASSPORT,CONTENT,DATE_INSERT) " + " VALUES('" + review.Fam + "','" + review.Im + "','" + review.Ot + "'," + review.Street_id + ",'" + review.Home_num + "','" + review.Flat_num + "','" + review.Passport + "','" + review.Content + "','now')"; return(FDBContext.Insert(sqlStr, Constants.connectionStringSites)); }
public static List <Street> AllStreets() { string sqlStringRooms = "SELECT id, trim(NAME_STREET)||' '||trim(TYPE_STREET) as NAME_STREET FROM STREETS ORDER BY NAME_STREET"; DataTable dtp = FDBContext.Select(sqlStringRooms, Constants.connectionStringSites); List <Street> Streets = new List <Street>(); if (dtp.Rows.Count != 0) { foreach (DataRow dataRow in dtp.Rows) { Streets.Add(new Street { Id = (int)dataRow["ID"], NAME_STREET = dataRow["NAME_STREET"].ToString().Trim() }); } } return(Streets); }
//Проверка на дублирование паспортных данных public static int CheckPassport(string Passport) { string sqlStr = "SELECT FAM,IM,OT FROM VOTE WHERE PASSPORT='" + Passport + "'"; return(FDBContext.Select(sqlStr, Constants.connectionStringSites).Rows.Count); }