Ejemplo n.º 1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(XHD.Model.crm_shop_askprice model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into crm_shop_askprice(");
            strSql.Append("Id,askprice_content,user_id,user_uid,user_name,user_askprice_date,BeSeats_id,BeSeats_empcode,BeSeats,ishandle,handle_remark,handle_person_id,handle_person_name,handle_date)");
            strSql.Append(" values (");
            strSql.Append("@Id,@askprice_content,@user_id,@user_uid,@user_name,@user_askprice_date,@BeSeats_id,@BeSeats_empcode,@BeSeats,@ishandle,@handle_remark,@handle_person_id,@handle_person_name,@handle_date)");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@Id",                 MySqlDbType.Int32,      11),
                new MySqlParameter("@askprice_content",   MySqlDbType.Text),
                new MySqlParameter("@user_id",            MySqlDbType.Int32,      11),
                new MySqlParameter("@user_uid",           MySqlDbType.VarChar,    60),
                new MySqlParameter("@user_name",          MySqlDbType.VarChar,    60),
                new MySqlParameter("@user_askprice_date", MySqlDbType.DateTime),
                new MySqlParameter("@BeSeats_id",         MySqlDbType.Int32,      11),
                new MySqlParameter("@BeSeats_empcode",    MySqlDbType.VarChar,   100),
                new MySqlParameter("@BeSeats",            MySqlDbType.VarChar,   250),
                new MySqlParameter("@ishandle",           MySqlDbType.Int16,       2),
                new MySqlParameter("@handle_remark",      MySqlDbType.VarChar,   255),
                new MySqlParameter("@handle_person_id",   MySqlDbType.Int32,      11),
                new MySqlParameter("@handle_person_name", MySqlDbType.VarChar,    20),
                new MySqlParameter("@handle_date",        MySqlDbType.DateTime)
            };
            parameters[0].Value  = model.Id;
            parameters[1].Value  = model.askprice_content;
            parameters[2].Value  = model.user_id;
            parameters[3].Value  = model.user_uid;
            parameters[4].Value  = model.user_name;
            parameters[5].Value  = model.user_askprice_date;
            parameters[6].Value  = model.BeSeats_id;
            parameters[7].Value  = model.BeSeats_empcode;
            parameters[8].Value  = model.BeSeats;
            parameters[9].Value  = model.ishandle;
            parameters[10].Value = model.handle_remark;
            parameters[11].Value = model.handle_person_id;
            parameters[12].Value = model.handle_person_name;
            parameters[13].Value = model.handle_date;

            int rows = DbHelperMySQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public XHD.Model.crm_shop_askprice GetModel(int Id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select Id,askprice_content,user_id,user_uid,user_name,user_askprice_date,BeSeats_id,BeSeats_empcode,BeSeats,ishandle,handle_remark,handle_person_id,handle_person_name,handle_date from crm_shop_askprice ");
            strSql.Append(" where Id=@Id ");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@Id", MySqlDbType.Int32, 11)
            };
            parameters[0].Value = Id;

            XHD.Model.crm_shop_askprice model = new XHD.Model.crm_shop_askprice();
            DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public XHD.Model.crm_shop_askprice DataRowToModel(DataRow row)
 {
     XHD.Model.crm_shop_askprice model = new XHD.Model.crm_shop_askprice();
     if (row != null)
     {
         if (row["Id"] != null && row["Id"].ToString() != "")
         {
             model.Id = int.Parse(row["Id"].ToString());
         }
         if (row["askprice_content"] != null)
         {
             model.askprice_content = row["askprice_content"].ToString();
         }
         if (row["user_id"] != null && row["user_id"].ToString() != "")
         {
             model.user_id = int.Parse(row["user_id"].ToString());
         }
         if (row["user_uid"] != null)
         {
             model.user_uid = row["user_uid"].ToString();
         }
         if (row["user_name"] != null)
         {
             model.user_name = row["user_name"].ToString();
         }
         if (row["user_askprice_date"] != null && row["user_askprice_date"].ToString() != "")
         {
             model.user_askprice_date = DateTime.Parse(row["user_askprice_date"].ToString());
         }
         if (row["BeSeats_id"] != null && row["BeSeats_id"].ToString() != "")
         {
             model.BeSeats_id = int.Parse(row["BeSeats_id"].ToString());
         }
         if (row["BeSeats_empcode"] != null)
         {
             model.BeSeats_empcode = row["BeSeats_empcode"].ToString();
         }
         if (row["BeSeats"] != null)
         {
             model.BeSeats = row["BeSeats"].ToString();
         }
         if (row["ishandle"] != null && row["ishandle"].ToString() != "")
         {
             model.ishandle = int.Parse(row["ishandle"].ToString());
         }
         if (row["handle_remark"] != null)
         {
             model.handle_remark = row["handle_remark"].ToString();
         }
         if (row["handle_person_id"] != null && row["handle_person_id"].ToString() != "")
         {
             model.handle_person_id = int.Parse(row["handle_person_id"].ToString());
         }
         if (row["handle_person_name"] != null)
         {
             model.handle_person_name = row["handle_person_name"].ToString();
         }
         if (row["handle_date"] != null && row["handle_date"].ToString() != "")
         {
             model.handle_date = DateTime.Parse(row["handle_date"].ToString());
         }
     }
     return(model);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(XHD.Model.crm_shop_askprice model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update crm_shop_askprice set ");
            strSql.Append("askprice_content=@askprice_content,");
            strSql.Append("user_id=@user_id,");
            strSql.Append("user_uid=@user_uid,");
            strSql.Append("user_name=@user_name,");
            strSql.Append("user_askprice_date=@user_askprice_date,");
            strSql.Append("BeSeats_id=@BeSeats_id,");
            strSql.Append("BeSeats_empcode=@BeSeats_empcode,");
            strSql.Append("BeSeats=@BeSeats,");
            strSql.Append("ishandle=@ishandle,");
            strSql.Append("handle_remark=@handle_remark,");
            strSql.Append("handle_person_id=@handle_person_id,");
            strSql.Append("handle_person_name=@handle_person_name,");
            strSql.Append("handle_date=@handle_date");
            strSql.Append(" where Id=@Id ");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@askprice_content",   MySqlDbType.Text),
                new MySqlParameter("@user_id",            MySqlDbType.Int32,      11),
                new MySqlParameter("@user_uid",           MySqlDbType.VarChar,    60),
                new MySqlParameter("@user_name",          MySqlDbType.VarChar,    60),
                new MySqlParameter("@user_askprice_date", MySqlDbType.DateTime),
                new MySqlParameter("@BeSeats_id",         MySqlDbType.Int32,      11),
                new MySqlParameter("@BeSeats_empcode",    MySqlDbType.VarChar,   100),
                new MySqlParameter("@BeSeats",            MySqlDbType.VarChar,   250),
                new MySqlParameter("@ishandle",           MySqlDbType.Int16,       2),
                new MySqlParameter("@handle_remark",      MySqlDbType.VarChar,   255),
                new MySqlParameter("@handle_person_id",   MySqlDbType.Int32,      11),
                new MySqlParameter("@handle_person_name", MySqlDbType.VarChar,    20),
                new MySqlParameter("@handle_date",        MySqlDbType.DateTime),
                new MySqlParameter("@Id",                 MySqlDbType.Int32, 11)
            };
            parameters[0].Value  = model.askprice_content;
            parameters[1].Value  = model.user_id;
            parameters[2].Value  = model.user_uid;
            parameters[3].Value  = model.user_name;
            parameters[4].Value  = model.user_askprice_date;
            parameters[5].Value  = model.BeSeats_id;
            parameters[6].Value  = model.BeSeats_empcode;
            parameters[7].Value  = model.BeSeats;
            parameters[8].Value  = model.ishandle;
            parameters[9].Value  = model.handle_remark;
            parameters[10].Value = model.handle_person_id;
            parameters[11].Value = model.handle_person_name;
            parameters[12].Value = model.handle_date;
            parameters[13].Value = model.Id;

            int rows = DbHelperMySQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }