Пример #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(WK.Model.bus_pickup_times model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update bus_pickup_times set ");
            strSql.Append("pickup_address_id=@pickup_address_id,");
            strSql.Append("pickup_time=@pickup_time,");
            strSql.Append("eat_type=@eat_type,");
            strSql.Append("pickup_start_time=@pickup_start_time,");
            strSql.Append("pickup_end_time=@pickup_end_time,");
            strSql.Append("is_delete=@is_delete,");
            strSql.Append("remark=@remark,");
            strSql.Append("create_by=@create_by,");
            strSql.Append("create_date=@create_date,");
            strSql.Append("update_by=@update_by,");
            strSql.Append("update_date=@update_date");
            strSql.Append(" where id=@id");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@pickup_address_id", MySqlDbType.Int32,      11),
                new MySqlParameter("@pickup_time",       MySqlDbType.Int32,      11),
                new MySqlParameter("@eat_type",          MySqlDbType.Int32,      11),
                new MySqlParameter("@pickup_start_time", MySqlDbType.Time),
                new MySqlParameter("@pickup_end_time",   MySqlDbType.Time),
                new MySqlParameter("@is_delete",         MySqlDbType.Int32,      11),
                new MySqlParameter("@remark",            MySqlDbType.VarChar,   500),
                new MySqlParameter("@create_by",         MySqlDbType.Int32,      11),
                new MySqlParameter("@create_date",       MySqlDbType.DateTime),
                new MySqlParameter("@update_by",         MySqlDbType.Int32,      11),
                new MySqlParameter("@update_date",       MySqlDbType.DateTime),
                new MySqlParameter("@id",                MySqlDbType.Int32, 11)
            };
            parameters[0].Value  = model.pickup_address_id;
            parameters[1].Value  = model.pickup_time;
            parameters[2].Value  = model.eat_type;
            parameters[3].Value  = model.pickup_start_time;
            parameters[4].Value  = model.pickup_end_time;
            parameters[5].Value  = model.is_delete;
            parameters[6].Value  = model.remark;
            parameters[7].Value  = model.create_by;
            parameters[8].Value  = model.create_date;
            parameters[9].Value  = model.update_by;
            parameters[10].Value = model.update_date;
            parameters[11].Value = model.id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public WK.Model.bus_pickup_times DataRowToModel(DataRow row)
 {
     WK.Model.bus_pickup_times model = new WK.Model.bus_pickup_times();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["pickup_address_id"] != null && row["pickup_address_id"].ToString() != "")
         {
             model.pickup_address_id = int.Parse(row["pickup_address_id"].ToString());
         }
         if (row["pickup_time"] != null && row["pickup_time"].ToString() != "")
         {
             model.pickup_time = int.Parse(row["pickup_time"].ToString());
         }
         if (row["eat_type"] != null && row["eat_type"].ToString() != "")
         {
             model.eat_type = int.Parse(row["eat_type"].ToString());
         }
         if (row["pickup_start_time"] != null && row["pickup_start_time"].ToString() != "")
         {
             model.pickup_start_time = TimeSpan.Parse(row["pickup_start_time"].ToString());
         }
         if (row["pickup_end_time"] != null && row["pickup_end_time"].ToString() != "")
         {
             model.pickup_end_time = TimeSpan.Parse(row["pickup_end_time"].ToString());
         }
         if (row["is_delete"] != null && row["is_delete"].ToString() != "")
         {
             model.is_delete = int.Parse(row["is_delete"].ToString());
         }
         if (row["remark"] != null)
         {
             model.remark = row["remark"].ToString();
         }
         if (row["create_by"] != null && row["create_by"].ToString() != "")
         {
             model.create_by = int.Parse(row["create_by"].ToString());
         }
         if (row["create_date"] != null && row["create_date"].ToString() != "")
         {
             model.create_date = DateTime.Parse(row["create_date"].ToString());
         }
         if (row["update_by"] != null && row["update_by"].ToString() != "")
         {
             model.update_by = int.Parse(row["update_by"].ToString());
         }
         if (row["update_date"] != null && row["update_date"].ToString() != "")
         {
             model.update_date = DateTime.Parse(row["update_date"].ToString());
         }
     }
     return(model);
 }
Пример #3
0
        private string deletePickupTimes(HttpContext context)
        {
            ReturnInfo returnInfo = new ReturnInfo();

            returnInfo.isSuccess = false;
            WK.BLL.bus_pickup_times bll = new WK.BLL.bus_pickup_times();
            int id = int.Parse(context.Request.Params["id"]);

            if (id > 0)
            {
                WK.Model.bus_pickup_times model = bll.GetModel(id);
                model.is_delete      = 1;
                returnInfo.isSuccess = bll.Update(model);
            }

            return(Newtonsoft.Json.JsonConvert.SerializeObject(returnInfo));
        }
Пример #4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(WK.Model.bus_pickup_times model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into bus_pickup_times(");
            strSql.Append("pickup_address_id,pickup_time,eat_type,pickup_start_time,pickup_end_time,is_delete,remark,create_by,create_date,update_by,update_date)");
            strSql.Append(" values (");
            strSql.Append("@pickup_address_id,@pickup_time,@eat_type,@pickup_start_time,@pickup_end_time,@is_delete,@remark,@create_by,@create_date,@update_by,@update_date)");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@pickup_address_id", MySqlDbType.Int32,      11),
                new MySqlParameter("@pickup_time",       MySqlDbType.Int32,      11),
                new MySqlParameter("@eat_type",          MySqlDbType.Int32,      11),
                new MySqlParameter("@pickup_start_time", MySqlDbType.Time),
                new MySqlParameter("@pickup_end_time",   MySqlDbType.Time),
                new MySqlParameter("@is_delete",         MySqlDbType.Int32,      11),
                new MySqlParameter("@remark",            MySqlDbType.VarChar,   500),
                new MySqlParameter("@create_by",         MySqlDbType.Int32,      11),
                new MySqlParameter("@create_date",       MySqlDbType.DateTime),
                new MySqlParameter("@update_by",         MySqlDbType.Int32,      11),
                new MySqlParameter("@update_date",       MySqlDbType.DateTime)
            };
            parameters[0].Value  = model.pickup_address_id;
            parameters[1].Value  = model.pickup_time;
            parameters[2].Value  = model.eat_type;
            parameters[3].Value  = model.pickup_start_time;
            parameters[4].Value  = model.pickup_end_time;
            parameters[5].Value  = model.is_delete;
            parameters[6].Value  = model.remark;
            parameters[7].Value  = model.create_by;
            parameters[8].Value  = model.create_date;
            parameters[9].Value  = model.update_by;
            parameters[10].Value = model.update_date;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public WK.Model.bus_pickup_times GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select id,pickup_address_id,pickup_time,eat_type,pickup_start_time,pickup_end_time,is_delete,remark,create_by,create_date,update_by,update_date from bus_pickup_times ");
            strSql.Append(" where id=@id");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@id", MySqlDbType.Int32)
            };
            parameters[0].Value = id;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }