Exemple #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(YueYePlat.Model.regionalparkmanage model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update regionalparkmanage set ");
            strSql.Append("DeliveryId=@DeliveryId,");
            strSql.Append("Longitude=@Longitude,");
            strSql.Append("Latitude=@Latitude,");
            strSql.Append("ParkingTime=@ParkingTime");
            strSql.Append(" where Id=@Id");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@DeliveryId",  MySqlDbType.VarChar,   16),
                new MySqlParameter("@Longitude",   MySqlDbType.Double),
                new MySqlParameter("@Latitude",    MySqlDbType.Double),
                new MySqlParameter("@ParkingTime", MySqlDbType.DateTime),
                new MySqlParameter("@Id",          MySqlDbType.Int32, 11)
            };
            parameters[0].Value = model.DeliveryId;
            parameters[1].Value = model.Longitude;
            parameters[2].Value = model.Latitude;
            parameters[3].Value = model.ParkingTime;
            parameters[4].Value = model.Id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public YueYePlat.Model.regionalparkmanage DataRowToModel(DataRow row)
 {
     YueYePlat.Model.regionalparkmanage model = new YueYePlat.Model.regionalparkmanage();
     if (row != null)
     {
         if (row["Id"] != null && row["Id"].ToString() != "")
         {
             model.Id = int.Parse(row["Id"].ToString());
         }
         if (row["DeliveryId"] != null)
         {
             model.DeliveryId = row["DeliveryId"].ToString();
         }
         if (row["Longitude"] != null && row["Longitude"].ToString() != "")
         {
             model.Longitude = Double.Parse(row["Longitude"].ToString());
         }
         if (row["Latitude"] != null && row["Latitude"].ToString() != "")
         {
             model.Latitude = Double.Parse(row["Latitude"].ToString());
         }
         //model.Longitude=row["Longitude"].ToString();
         //model.Latitude=row["Latitude"].ToString();
         if (row["ParkingTime"] != null && row["ParkingTime"].ToString() != "")
         {
             model.ParkingTime = DateTime.Parse(row["ParkingTime"].ToString());
         }
     }
     return(model);
 }
Exemple #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(YueYePlat.Model.regionalparkmanage model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into regionalparkmanage(");
            strSql.Append("DeliveryId,Longitude,Latitude,ParkingTime)");
            strSql.Append(" values (");
            strSql.Append("@DeliveryId,@Longitude,@Latitude,@ParkingTime)");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@DeliveryId",  MySqlDbType.VarChar, 16),
                new MySqlParameter("@Longitude",   MySqlDbType.Double),
                new MySqlParameter("@Latitude",    MySqlDbType.Double),
                new MySqlParameter("@ParkingTime", MySqlDbType.DateTime)
            };
            parameters[0].Value = model.DeliveryId;
            parameters[1].Value = model.Longitude;
            parameters[2].Value = model.Latitude;
            parameters[3].Value = model.ParkingTime;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public YueYePlat.Model.regionalparkmanage GetModel(int Id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select Id,DeliveryId,Longitude,Latitude,ParkingTime from regionalparkmanage ");
            strSql.Append(" where Id=@Id");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@Id", MySqlDbType.Int32)
            };
            parameters[0].Value = Id;

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

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