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

            strSql.Append("update Classify_DRIVER set ");
            strSql.Append("ClassifyName=@ClassifyName,");
            strSql.Append("CreateTime=@CreateTime,");
            strSql.Append("UpdateTime=@UpdateTime,");
            strSql.Append("Description=@Description");
            strSql.Append(" where Id=@Id ");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@ClassifyName", DbType.String),
                new SQLiteParameter("@CreateTime",   DbType.String),
                new SQLiteParameter("@UpdateTime",   DbType.String),
                new SQLiteParameter("@Description",  DbType.String),
                new SQLiteParameter("@Id",           DbType.Int32, 8)
            };
            parameters[0].Value = model.ClassifyName;
            parameters[1].Value = model.CreateTime;
            parameters[2].Value = model.UpdateTime;
            parameters[3].Value = model.Description;
            parameters[4].Value = model.Id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Scada.Model.Classify_DRIVER model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Classify_DRIVER(");
            strSql.Append("Id,ClassifyName,CreateTime,UpdateTime,Description)");
            strSql.Append(" values (");
            strSql.Append("@Id,@ClassifyName,@CreateTime,@UpdateTime,@Description)");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@Id",           DbType.Int32,   8),
                new SQLiteParameter("@ClassifyName", DbType.String),
                new SQLiteParameter("@CreateTime",   DbType.String),
                new SQLiteParameter("@UpdateTime",   DbType.String),
                new SQLiteParameter("@Description",  DbType.String)
            };
            parameters[0].Value = model.Id;
            parameters[1].Value = model.ClassifyName;
            parameters[2].Value = model.CreateTime;
            parameters[3].Value = model.UpdateTime;
            parameters[4].Value = model.Description;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Scada.Model.Classify_DRIVER DataRowToModel(DataRow row)
 {
     Scada.Model.Classify_DRIVER model = new Scada.Model.Classify_DRIVER();
     if (row != null)
     {
         if (row["Id"] != null && row["Id"].ToString() != "")
         {
             model.Id = int.Parse(row["Id"].ToString());
         }
         if (row["ClassifyName"] != null)
         {
             model.ClassifyName = row["ClassifyName"].ToString();
         }
         if (row["CreateTime"] != null)
         {
             model.CreateTime = row["CreateTime"].ToString();
         }
         if (row["UpdateTime"] != null)
         {
             model.UpdateTime = row["UpdateTime"].ToString();
         }
         if (row["Description"] != null)
         {
             model.Description = row["Description"].ToString();
         }
     }
     return(model);
 }
Beispiel #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Scada.Model.Classify_DRIVER GetModel(int Id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select Id,ClassifyName,CreateTime,UpdateTime,Description from Classify_DRIVER ");
            strSql.Append(" where Id=@Id ");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@Id", DbType.Int32, 8)
            };
            parameters[0].Value = Id;

            Scada.Model.Classify_DRIVER model = new Scada.Model.Classify_DRIVER();
            DataSet ds = DbHelperSQLite.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Beispiel #5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Scada.Model.Classify_DRIVER model)
 {
     return(dal.Update(model));
 }
Beispiel #6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(Scada.Model.Classify_DRIVER model)
 {
     return(dal.Add(model));
 }