Ejemplo n.º 1
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public bool Update(Model.EsDay model)
        {
            int rowsAffected;

            IDataParameter[] parameters =
            {
                new SqlParameter("@Id",           SqlDbType.BigInt,     8),
                new SqlParameter("@StatId",       SqlDbType.Int,        4),
                new SqlParameter("@TP",           SqlDbType.Float,      8),
                new SqlParameter("@DB",           SqlDbType.Float,      8),
                new SqlParameter("@UpdateTime",   SqlDbType.DateTime),
                new SqlParameter("@DataStatus",   SqlDbType.Char,       1),
                new SqlParameter("@ValidDataNum", SqlDbType.Int,        4),
                new SqlParameter("@DevId",        SqlDbType.Int,        4),
                new SqlParameter("@Country",      SqlDbType.VarChar,   20),
                new SqlParameter("@Pm25",         SqlDbType.Float,      8),
                new SqlParameter("@Pm100",        SqlDbType.Float, 8)
            };
            parameters[0].Value  = model.Id;
            parameters[1].Value  = model.StatId;
            parameters[2].Value  = model.Tp;
            parameters[3].Value  = model.Db;
            parameters[4].Value  = model.UpdateTime;
            parameters[5].Value  = model.DataStatus;
            parameters[6].Value  = model.ValidDataNum;
            parameters[7].Value  = model.DevId;
            parameters[8].Value  = model.Country;
            parameters[9].Value  = model.Pm25;
            parameters[10].Value = model.Pm100;

            DbHelperSql.RunProcedure("T_ESDay_Update", parameters, out rowsAffected);
            return(rowsAffected > 0);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.EsDay DataRowToModel(DataRow row)
        {
            var model = new Model.EsDay();

            if (row != null)
            {
                if (row["Id"] != null && row["Id"].ToString() != "")
                {
                    model.Id = long.Parse(row["Id"].ToString());
                }
                if (row["StatId"] != null && row["StatId"].ToString() != "")
                {
                    model.StatId = int.Parse(row["StatId"].ToString());
                }
                if (row["TP"] != null && row["TP"].ToString() != "")
                {
                    model.Tp = double.Parse(row["TP"].ToString());
                }
                if (row["DB"] != null && row["DB"].ToString() != "")
                {
                    model.Db = double.Parse(row["DB"].ToString());
                }
                if (row["UpdateTime"] != null && row["UpdateTime"].ToString() != "")
                {
                    model.UpdateTime = DateTime.Parse(row["UpdateTime"].ToString());
                }
                if (row["DataStatus"] != null)
                {
                    model.DataStatus = row["DataStatus"].ToString();
                }
                if (row["ValidDataNum"] != null && row["ValidDataNum"].ToString() != "")
                {
                    model.ValidDataNum = int.Parse(row["ValidDataNum"].ToString());
                }
                if (row["DevId"] != null && row["DevId"].ToString() != "")
                {
                    model.DevId = int.Parse(row["DevId"].ToString());
                }
                if (row["Country"] != null)
                {
                    model.Country = row["Country"].ToString();
                }
                if (row["PM25"] != null)
                {
                    model.Pm25 = double.Parse(row["PM25"].ToString());
                }
                if (row["PM100"] != null)
                {
                    model.Pm100 = double.Parse(row["PM100"].ToString());
                }
            }
            return(model);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Model.EsDay model)
 {
     return(_dal.Update(model));
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public long  Add(Model.EsDay model)
 {
     return(_dal.Add(model));
 }