private string get_rest_name()
        {

            int rest_id;
            Restaurant rest = new Restaurant();
            DataTable dt = new DataTable();
            dt = bll.select_rest_ID_by_ord_ID(common.ord.ID);
            rest_id = int.Parse(dt.Rows[0]["restaurant_ID"].ToString());
            //name = order.restaurant_ID;
            rest = r_bll.Select_restaurant(rest_id);
            return rest.rest_name;
        }
示例#2
0
 //根据餐厅ID修改餐厅信息
 public int Update_restaurant(Restaurant rest, int ID)
 {
     String sql = "update rest_information set rest_name=@rest_name,rest_district=@rest_district,rest_password=@rest_password,rest_telephone=@rest_telephone,rest_homephone=@rest_homephone,rest_question=@rest_question,rest_answer=@rest_answer,rest_description=@rest_description,rest_service=@rest_service,rest_privilege=@rest_privilege,rest_location=@rest_location,begin_date=@begin_date,end_date=@end_date,rest_state=@rest_state where ID=@ID";
     SqlParameter[] param =
     {
         new SqlParameter("@rest_name",SqlDbType.VarChar),
         new SqlParameter("@rest_district",SqlDbType.VarChar),
         new SqlParameter("@rest_password",SqlDbType.VarChar),
         new SqlParameter("@rest_telephone",SqlDbType.VarChar),
         new SqlParameter("@rest_homephone",SqlDbType.VarChar),
         new SqlParameter("@rest_question",SqlDbType.VarChar),
         new SqlParameter("@rest_answer",SqlDbType.VarChar),
         new SqlParameter("@rest_description",SqlDbType.VarChar),
         new SqlParameter("@rest_service",SqlDbType.Int),
         new SqlParameter("@rest_privilege",SqlDbType.Int),
         new SqlParameter("@rest_location",SqlDbType.VarChar),
         new SqlParameter("@begin_date",SqlDbType.DateTime),
         new SqlParameter("@end_date",SqlDbType.DateTime),
         new SqlParameter("@rest_state",SqlDbType.Int),
         new SqlParameter("@ID",SqlDbType.Int)
     };
     param[0].Value = rest.rest_name;
     param[1].Value = rest.rest_district;
     param[2].Value = rest.rest_password;
     param[3].Value = rest.rest_telephone;
     param[4].Value = rest.rest_homephone;
     param[5].Value = rest.rest_question;
     param[6].Value = rest.rest_answer;
     param[7].Value = rest.rest_description;
     param[8].Value = rest.rest_service;
     param[9].Value = rest.rest_privilege;
     param[10].Value = rest.rest_location;
     param[11].Value = rest.begin_date;
     param[12].Value = rest.end_date;
     param[13].Value = rest.rest_state;
     param[14].Value = ID;
     return SqlHelper.ExecuteQuery(sql, param);
 }
示例#3
0
 //加入餐馆函数
 public int Add_restaurant(Restaurant rest)
 {
     String sql = "insert into rest_information values(@rest_name,@rest_district,@rest_password,@rest_telephone,@rest_homephone,@rest_question,@rest_answer,@rest_description,@rest_service,@rest_privilege,@rest_location,@begin_date,@end_date,@rest_state)";
     SqlParameter[] param =
     {
         new SqlParameter("@rest_name",SqlDbType.VarChar),
         new SqlParameter("@rest_district",SqlDbType.VarChar),
         new SqlParameter("@rest_password",SqlDbType.VarChar),
         new SqlParameter("@rest_telephone",SqlDbType.VarChar),
         new SqlParameter("@rest_homephone",SqlDbType.VarChar),
         new SqlParameter("@rest_question",SqlDbType.VarChar),
         new SqlParameter("@rest_answer",SqlDbType.VarChar),
         new SqlParameter("@rest_description",SqlDbType.VarChar),
         new SqlParameter("@rest_service",SqlDbType.Int),
         new SqlParameter("@rest_privilege",SqlDbType.Int),
         new SqlParameter("@rest_location",SqlDbType.VarChar),
         new SqlParameter("@begin_date",SqlDbType.DateTime),
         new SqlParameter("@end_date",SqlDbType.DateTime),
         new SqlParameter("@rest_state",SqlDbType.Int),
     };
     param[0].Value = rest.rest_name;
     param[1].Value = rest.rest_district;
     param[2].Value = rest.rest_password;
     param[3].Value = rest.rest_telephone;
     param[4].Value = rest.rest_homephone;
     param[5].Value = rest.rest_question;
     param[6].Value = rest.rest_answer;
     param[7].Value = rest.rest_description;
     param[8].Value = rest.rest_service;
     param[9].Value = rest.rest_privilege;
     param[10].Value = rest.rest_location;
     param[11].Value = rest.begin_date;
     param[12].Value = rest.end_date;
     param[13].Value = rest.rest_state;
     return SqlHelper.ExecuteQuery(sql, param);
 }
示例#4
0
 //根据ID号查询餐厅信息
 public Restaurant select_restaurant(int ID)
 {
     String sql = "select * from rest_information where ID=@ID";
     SqlParameter[] param =
     {
         new SqlParameter("@ID",SqlDbType.Int)
     };
     param[0].Value = ID;
     Restaurant rest = new Restaurant();
     DataTable dt = SqlHelper.ExecuteSelect(sql, param);
     foreach (DataRow dr in dt.Rows)
     {
         rest = DataRowToRestaurant(dr);
     }
     return rest;
 }
示例#5
0
 //根据手机账号查询餐厅信息返回数据表
 public DataTable select_restaurant_by_telephone_dt(string rest_telephone)
 {
     String sql = "select * from rest_information where rest_telephone=@rest_telephone";
     SqlParameter[] param =
     {
         new SqlParameter("@rest_telephone",SqlDbType.VarChar)
     };
     param[0].Value = rest_telephone;
     Restaurant rest = new Restaurant();
     DataTable dt = SqlHelper.ExecuteSelect(sql, param);
     return dt;
 }
示例#6
0
 //查找餐厅表前3项
 public List<Restaurant> select_top_restaurant()
 {
     String sql = "select top 3 * from rest_information";
     List<Restaurant> rests = new List<Restaurant>();
     Restaurant rest = new Restaurant();
     DataTable dt = SqlHelper.Execute_Select(sql);
     foreach (DataRow dr in dt.Rows)
     {
         rest = DataRowToRestaurant(dr);
         rests.Add(rest);
     }
     return rests;
 }
示例#7
0
 //根据ID号查询餐厅信息返回数据表
 public DataTable select_restaurant_dt(int ID)
 {
     String sql = "select * from rest_information where ID=@ID";
     SqlParameter[] param =
     {
         new SqlParameter("@ID",SqlDbType.Int)
     };
     param[0].Value = ID;
     Restaurant rest = new Restaurant();
     DataTable dt = SqlHelper.ExecuteSelect(sql, param);
     return dt;
 }
示例#8
0
 //餐厅数据行转化为restaurant实例
 public Restaurant DataRowToRestaurant(DataRow dr)
 {
     Restaurant rest = new Restaurant();
     rest.ID = (int)dr["ID"];
     rest.rest_name = dr["rest_name"].ToString();
     rest.rest_district = dr["rest_district"].ToString();
     rest.rest_password = dr["rest_password"].ToString();
     rest.rest_telephone = dr["rest_telephone"].ToString();
     rest.rest_homephone = dr["rest_homephone"].ToString();
     rest.rest_question = dr["rest_question"].ToString();
     rest.rest_answer = dr["rest_answer"].ToString();
     rest.rest_description = dr["rest_description"].ToString();
     rest.rest_service = (int)dr["rest_service"];
     rest.rest_privilege = (int)dr["rest_privilege"];
     rest.rest_location = dr["rest_location"].ToString();
     rest.begin_date = DateTime.Parse(dr["begin_date"].ToString());
     rest.end_date = DateTime.Parse(dr["end_date"].ToString());
     rest.rest_state = (int)dr["rest_state"];
     return rest;
 }
示例#9
0
 public bool Update_restaurant(Restaurant rest, int ID)
 {
     return dal.Update_restaurant(rest, ID) > 0;
 }
示例#10
0
 public bool Add_restaurant(Restaurant rest)
 {
     return dal.Add_restaurant(rest) > 0;
 }