예제 #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(KryptonAccessController.SQLite.Model.InteractRelation.InterLock model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into InterLock(");
            strSql.Append("InterLockID,InterLockEnable,ControlerInfoInLANID1,DoorUnitID1,ControlerInfoInLANID2,DoorUnitID2)");
            strSql.Append(" values (");
            strSql.Append("@InterLockID,@InterLockEnable,@ControlerInfoInLANID1,@DoorUnitID1,@ControlerInfoInLANID2,@DoorUnitID2)");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@InterLockID",           DbType.Int32,   4),
                new SQLiteParameter("@InterLockEnable",       DbType.Boolean, 1),
                new SQLiteParameter("@ControlerInfoInLANID1", DbType.Int32,   4),
                new SQLiteParameter("@DoorUnitID1",           DbType.Int32,   4),
                new SQLiteParameter("@ControlerInfoInLANID2", DbType.Int32,   4),
                new SQLiteParameter("@DoorUnitID2",           DbType.Int32, 4)
            };
            parameters[0].Value = model.InterLockID;
            parameters[1].Value = model.InterLockEnable;
            parameters[2].Value = model.ControlerInfoInLANID1;
            parameters[3].Value = model.DoorUnitID1;
            parameters[4].Value = model.ControlerInfoInLANID2;
            parameters[5].Value = model.DoorUnitID2;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public KryptonAccessController.SQLite.Model.InteractRelation.InterLock DataRowToModel(DataRow row)
 {
     KryptonAccessController.SQLite.Model.InteractRelation.InterLock model = new KryptonAccessController.SQLite.Model.InteractRelation.InterLock();
     if (row != null)
     {
         if (row["InterLockID"] != null && row["InterLockID"].ToString() != "")
         {
             model.InterLockID = int.Parse(row["InterLockID"].ToString());
         }
         if (row["InterLockEnable"] != null && row["InterLockEnable"].ToString() != "")
         {
             if ((row["InterLockEnable"].ToString() == "1") || (row["InterLockEnable"].ToString().ToLower() == "true"))
             {
                 model.InterLockEnable = true;
             }
             else
             {
                 model.InterLockEnable = false;
             }
         }
         if (row["ControlerInfoInLANID1"] != null && row["ControlerInfoInLANID1"].ToString() != "")
         {
             model.ControlerInfoInLANID1 = int.Parse(row["ControlerInfoInLANID1"].ToString());
         }
         if (row["DoorUnitID1"] != null && row["DoorUnitID1"].ToString() != "")
         {
             model.DoorUnitID1 = int.Parse(row["DoorUnitID1"].ToString());
         }
         if (row["ControlerInfoInLANID2"] != null && row["ControlerInfoInLANID2"].ToString() != "")
         {
             model.ControlerInfoInLANID2 = int.Parse(row["ControlerInfoInLANID2"].ToString());
         }
         if (row["DoorUnitID2"] != null && row["DoorUnitID2"].ToString() != "")
         {
             model.DoorUnitID2 = int.Parse(row["DoorUnitID2"].ToString());
         }
     }
     return(model);
 }
예제 #3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(KryptonAccessController.SQLite.Model.InteractRelation.InterLock model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update InterLock set ");
            strSql.Append("InterLockEnable=@InterLockEnable,");
            strSql.Append("ControlerInfoInLANID1=@ControlerInfoInLANID1,");
            strSql.Append("DoorUnitID1=@DoorUnitID1,");
            strSql.Append("ControlerInfoInLANID2=@ControlerInfoInLANID2,");
            strSql.Append("DoorUnitID2=@DoorUnitID2");
            strSql.Append(" where InterLockID=@InterLockID ");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@InterLockEnable",       DbType.Boolean, 1),
                new SQLiteParameter("@ControlerInfoInLANID1", DbType.Int32,   4),
                new SQLiteParameter("@DoorUnitID1",           DbType.Int32,   4),
                new SQLiteParameter("@ControlerInfoInLANID2", DbType.Int32,   4),
                new SQLiteParameter("@DoorUnitID2",           DbType.Int32,   4),
                new SQLiteParameter("@InterLockID",           DbType.Int32, 4)
            };
            parameters[0].Value = model.InterLockEnable;
            parameters[1].Value = model.ControlerInfoInLANID1;
            parameters[2].Value = model.DoorUnitID1;
            parameters[3].Value = model.ControlerInfoInLANID2;
            parameters[4].Value = model.DoorUnitID2;
            parameters[5].Value = model.InterLockID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public KryptonAccessController.SQLite.Model.InteractRelation.InterLock GetModel(int InterLockID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select InterLockID,InterLockEnable,ControlerInfoInLANID1,DoorUnitID1,ControlerInfoInLANID2,DoorUnitID2 from InterLock ");
            strSql.Append(" where InterLockID=@InterLockID ");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@InterLockID", DbType.Int32, 4)
            };
            parameters[0].Value = InterLockID;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
예제 #5
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public KryptonAccessController.SQLite.Model.InteractRelation.InterLock DataRowToModel(DataRow row)
 {
     KryptonAccessController.SQLite.Model.InteractRelation.InterLock model=new KryptonAccessController.SQLite.Model.InteractRelation.InterLock();
     if (row != null)
     {
         if(row["InterLockID"]!=null && row["InterLockID"].ToString()!="")
         {
             model.InterLockID=int.Parse(row["InterLockID"].ToString());
         }
         if(row["InterLockEnable"]!=null && row["InterLockEnable"].ToString()!="")
         {
             if((row["InterLockEnable"].ToString()=="1")||(row["InterLockEnable"].ToString().ToLower()=="true"))
             {
                 model.InterLockEnable=true;
             }
             else
             {
                 model.InterLockEnable=false;
             }
         }
         if(row["ControlerInfoInLANID1"]!=null && row["ControlerInfoInLANID1"].ToString()!="")
         {
             model.ControlerInfoInLANID1=int.Parse(row["ControlerInfoInLANID1"].ToString());
         }
         if(row["DoorUnitID1"]!=null && row["DoorUnitID1"].ToString()!="")
         {
             model.DoorUnitID1=int.Parse(row["DoorUnitID1"].ToString());
         }
         if(row["ControlerInfoInLANID2"]!=null && row["ControlerInfoInLANID2"].ToString()!="")
         {
             model.ControlerInfoInLANID2=int.Parse(row["ControlerInfoInLANID2"].ToString());
         }
         if(row["DoorUnitID2"]!=null && row["DoorUnitID2"].ToString()!="")
         {
             model.DoorUnitID2=int.Parse(row["DoorUnitID2"].ToString());
         }
     }
     return model;
 }
예제 #6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public KryptonAccessController.SQLite.Model.InteractRelation.InterLock GetModel(int InterLockID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select InterLockID,InterLockEnable,ControlerInfoInLANID1,DoorUnitID1,ControlerInfoInLANID2,DoorUnitID2 from InterLock ");
            strSql.Append(" where InterLockID=@InterLockID ");
            SQLiteParameter[] parameters = {
                    new SQLiteParameter("@InterLockID", DbType.Int32,4)			};
            parameters[0].Value = InterLockID;

            KryptonAccessController.SQLite.Model.InteractRelation.InterLock model=new KryptonAccessController.SQLite.Model.InteractRelation.InterLock();
            DataSet ds=DbHelperSQLite.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }