コード例 #1
0
ファイル: DBHelper.cs プロジェクト: zhouhengda/cheeperFilm
 internal static void SaveCinema(Cinema cinema)
 {
     string sql = "insert into city (city_id,sub_area_name,cinema_name,url) values(?city_id,?sub_area_name,?cinema_name,?url)";
     using(MySqlConnection conn = GetDBConnection())
     {
         conn.Execute(sql, new object[] {
             new {
                 city_id=cinema.City.Id,
                 sub_area_name=cinema.SubAreaName,
                 cinema_name=cinema.Name,
                 url=cinema.Url
             }
         });
     }
 }
コード例 #2
0
ファイル: DBHelper.cs プロジェクト: zhouhengda/cheeperFilm
 internal static bool IsCinemasExisted(Cinema cinema)
 {
     string sql = "select id from cinema where city_id=?city_id and sub_area_name=?sub_area_name and cinema_name=?cinema_name";
     using(MySqlConnection conn = GetDBConnection())
     {
         var ids = conn.Query(sql, new { city_id=cinema.City.Id, sub_area_name =cinema.SubAreaName, cinema_name =cinema.Name});
         if (ids.Count() > 0)
             return true;
         else
             return false;
     }
 }