Example #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(KryptonAccessController.SQLite.Model.InteractRelation.InterControlProgram model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update InterControlProgram set ");
            strSql.Append("ICPName=@ICPName,");
            strSql.Append("ICPWaitTimeLength=@ICPWaitTimeLength,");
            strSql.Append("DesControllerInfoInLANID=@DesControllerInfoInLANID,");
            strSql.Append("PointType=@PointType,");
            strSql.Append("PointID=@PointID,");
            strSql.Append("PointState=@PointState,");
            strSql.Append("OutPutLength=@OutPutLength");
            strSql.Append(" where ICPID=@ICPID ");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@ICPName",                  DbType.String),
                new SQLiteParameter("@ICPWaitTimeLength",        DbType.Int32,   4),
                new SQLiteParameter("@DesControllerInfoInLANID", DbType.Int32,   4),
                new SQLiteParameter("@PointType",                DbType.Int32,   4),
                new SQLiteParameter("@PointID",                  DbType.Int32,   4),
                new SQLiteParameter("@PointState",               DbType.Int32,   4),
                new SQLiteParameter("@OutPutLength",             DbType.Int32,   4),
                new SQLiteParameter("@ICPID",                    DbType.Int32, 4)
            };
            parameters[0].Value = model.ICPName;
            parameters[1].Value = model.ICPWaitTimeLength;
            parameters[2].Value = model.DesControllerInfoInLANID;
            parameters[3].Value = model.PointType;
            parameters[4].Value = model.PointID;
            parameters[5].Value = model.PointState;
            parameters[6].Value = model.OutPutLength;
            parameters[7].Value = model.ICPID;

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

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

            strSql.Append("insert into InterControlProgram(");
            strSql.Append("ICPID,ICPName,ICPWaitTimeLength,DesControllerInfoInLANID,PointType,PointID,PointState,OutPutLength)");
            strSql.Append(" values (");
            strSql.Append("@ICPID,@ICPName,@ICPWaitTimeLength,@DesControllerInfoInLANID,@PointType,@PointID,@PointState,@OutPutLength)");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@ICPID",                    DbType.Int32,   4),
                new SQLiteParameter("@ICPName",                  DbType.String),
                new SQLiteParameter("@ICPWaitTimeLength",        DbType.Int32,   4),
                new SQLiteParameter("@DesControllerInfoInLANID", DbType.Int32,   4),
                new SQLiteParameter("@PointType",                DbType.Int32,   4),
                new SQLiteParameter("@PointID",                  DbType.Int32,   4),
                new SQLiteParameter("@PointState",               DbType.Int32,   4),
                new SQLiteParameter("@OutPutLength",             DbType.Int32, 4)
            };
            parameters[0].Value = model.ICPID;
            parameters[1].Value = model.ICPName;
            parameters[2].Value = model.ICPWaitTimeLength;
            parameters[3].Value = model.DesControllerInfoInLANID;
            parameters[4].Value = model.PointType;
            parameters[5].Value = model.PointID;
            parameters[6].Value = model.PointState;
            parameters[7].Value = model.OutPutLength;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public KryptonAccessController.SQLite.Model.InteractRelation.InterControlProgram DataRowToModel(DataRow row)
 {
     KryptonAccessController.SQLite.Model.InteractRelation.InterControlProgram model=new KryptonAccessController.SQLite.Model.InteractRelation.InterControlProgram();
     if (row != null)
     {
         if(row["ICPID"]!=null && row["ICPID"].ToString()!="")
         {
             model.ICPID=int.Parse(row["ICPID"].ToString());
         }
         if(row["ICPName"]!=null)
         {
             model.ICPName=row["ICPName"].ToString();
         }
         if(row["ICPWaitTimeLength"]!=null && row["ICPWaitTimeLength"].ToString()!="")
         {
             model.ICPWaitTimeLength=int.Parse(row["ICPWaitTimeLength"].ToString());
         }
         if(row["DesControllerInfoInLANID"]!=null && row["DesControllerInfoInLANID"].ToString()!="")
         {
             model.DesControllerInfoInLANID=int.Parse(row["DesControllerInfoInLANID"].ToString());
         }
         if(row["PointType"]!=null && row["PointType"].ToString()!="")
         {
             model.PointType=int.Parse(row["PointType"].ToString());
         }
         if(row["PointID"]!=null && row["PointID"].ToString()!="")
         {
             model.PointID=int.Parse(row["PointID"].ToString());
         }
         if(row["PointState"]!=null && row["PointState"].ToString()!="")
         {
             model.PointState=int.Parse(row["PointState"].ToString());
         }
         if(row["OutPutLength"]!=null && row["OutPutLength"].ToString()!="")
         {
             model.OutPutLength=int.Parse(row["OutPutLength"].ToString());
         }
     }
     return model;
 }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public KryptonAccessController.SQLite.Model.InteractRelation.InterControlProgram GetModel(int ICPID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select ICPID,ICPName,ICPWaitTimeLength,DesControllerInfoInLANID,PointType,PointID,PointState,OutPutLength from InterControlProgram ");
            strSql.Append(" where ICPID=@ICPID ");
            SQLiteParameter[] parameters = {
                    new SQLiteParameter("@ICPID", DbType.Int32,4)			};
            parameters[0].Value = ICPID;

            KryptonAccessController.SQLite.Model.InteractRelation.InterControlProgram model=new KryptonAccessController.SQLite.Model.InteractRelation.InterControlProgram();
            DataSet ds=DbHelperSQLite.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }
Example #5
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public KryptonAccessController.SQLite.Model.InteractRelation.InterControlProgram DataRowToModel(DataRow row)
 {
     KryptonAccessController.SQLite.Model.InteractRelation.InterControlProgram model = new KryptonAccessController.SQLite.Model.InteractRelation.InterControlProgram();
     if (row != null)
     {
         if (row["ICPID"] != null && row["ICPID"].ToString() != "")
         {
             model.ICPID = int.Parse(row["ICPID"].ToString());
         }
         if (row["ICPName"] != null)
         {
             model.ICPName = row["ICPName"].ToString();
         }
         if (row["ICPWaitTimeLength"] != null && row["ICPWaitTimeLength"].ToString() != "")
         {
             model.ICPWaitTimeLength = int.Parse(row["ICPWaitTimeLength"].ToString());
         }
         if (row["DesControllerInfoInLANID"] != null && row["DesControllerInfoInLANID"].ToString() != "")
         {
             model.DesControllerInfoInLANID = int.Parse(row["DesControllerInfoInLANID"].ToString());
         }
         if (row["PointType"] != null && row["PointType"].ToString() != "")
         {
             model.PointType = int.Parse(row["PointType"].ToString());
         }
         if (row["PointID"] != null && row["PointID"].ToString() != "")
         {
             model.PointID = int.Parse(row["PointID"].ToString());
         }
         if (row["PointState"] != null && row["PointState"].ToString() != "")
         {
             model.PointState = int.Parse(row["PointState"].ToString());
         }
         if (row["OutPutLength"] != null && row["OutPutLength"].ToString() != "")
         {
             model.OutPutLength = int.Parse(row["OutPutLength"].ToString());
         }
     }
     return(model);
 }
Example #6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public KryptonAccessController.SQLite.Model.InteractRelation.InterControlProgram GetModel(int ICPID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ICPID,ICPName,ICPWaitTimeLength,DesControllerInfoInLANID,PointType,PointID,PointState,OutPutLength from InterControlProgram ");
            strSql.Append(" where ICPID=@ICPID ");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@ICPID", DbType.Int32, 4)
            };
            parameters[0].Value = ICPID;

            KryptonAccessController.SQLite.Model.InteractRelation.InterControlProgram model = new KryptonAccessController.SQLite.Model.InteractRelation.InterControlProgram();
            DataSet ds = DbHelperSQLite.Query(strSql.ToString(), parameters);

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