Example #1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public KryptonAccessController.SQLite.Model.InteractRelation.EventICP DataRowToModel(DataRow row)
 {
     KryptonAccessController.SQLite.Model.InteractRelation.EventICP model = new KryptonAccessController.SQLite.Model.InteractRelation.EventICP();
     if (row != null)
     {
         if (row["EventICPID"] != null && row["EventICPID"].ToString() != "")
         {
             model.EventICPID = int.Parse(row["EventICPID"].ToString());
         }
         if (row["EventICPName"] != null)
         {
             model.EventICPName = row["EventICPName"].ToString();
         }
         if (row["EventICPEnable"] != null && row["EventICPEnable"].ToString() != "")
         {
             if ((row["EventICPEnable"].ToString() == "1") || (row["EventICPEnable"].ToString().ToLower() == "true"))
             {
                 model.EventICPEnable = true;
             }
             else
             {
                 model.EventICPEnable = false;
             }
         }
         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["EventCodeID"] != null && row["EventCodeID"].ToString() != "")
         {
             model.EventCodeID = int.Parse(row["EventCodeID"].ToString());
         }
         if (row["ICPID"] != null && row["ICPID"].ToString() != "")
         {
             model.ICPID = int.Parse(row["ICPID"].ToString());
         }
     }
     return(model);
 }
Example #2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(KryptonAccessController.SQLite.Model.InteractRelation.EventICP model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update EventICP set ");
            strSql.Append("EventICPName=@EventICPName,");
            strSql.Append("EventICPEnable=@EventICPEnable,");
            strSql.Append("PointType=@PointType,");
            strSql.Append("PointID=@PointID,");
            strSql.Append("EventCodeID=@EventCodeID,");
            strSql.Append("ICPID=@ICPID");
            strSql.Append(" where EventICPID=@EventICPID ");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@EventICPName",   DbType.String),
                new SQLiteParameter("@EventICPEnable", DbType.Boolean, 1),
                new SQLiteParameter("@PointType",      DbType.Int32,   4),
                new SQLiteParameter("@PointID",        DbType.Int32,   4),
                new SQLiteParameter("@EventCodeID",    DbType.Int32,   4),
                new SQLiteParameter("@ICPID",          DbType.Int32,   4),
                new SQLiteParameter("@EventICPID",     DbType.Int32, 4)
            };
            parameters[0].Value = model.EventICPName;
            parameters[1].Value = model.EventICPEnable;
            parameters[2].Value = model.PointType;
            parameters[3].Value = model.PointID;
            parameters[4].Value = model.EventCodeID;
            parameters[5].Value = model.ICPID;
            parameters[6].Value = model.EventICPID;

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

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

            strSql.Append("insert into EventICP(");
            strSql.Append("EventICPID,EventICPName,EventICPEnable,PointType,PointID,EventCodeID,ICPID)");
            strSql.Append(" values (");
            strSql.Append("@EventICPID,@EventICPName,@EventICPEnable,@PointType,@PointID,@EventCodeID,@ICPID)");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@EventICPID",     DbType.Int32,   4),
                new SQLiteParameter("@EventICPName",   DbType.String),
                new SQLiteParameter("@EventICPEnable", DbType.Boolean, 1),
                new SQLiteParameter("@PointType",      DbType.Int32,   4),
                new SQLiteParameter("@PointID",        DbType.Int32,   4),
                new SQLiteParameter("@EventCodeID",    DbType.Int32,   4),
                new SQLiteParameter("@ICPID",          DbType.Int32, 4)
            };
            parameters[0].Value = model.EventICPID;
            parameters[1].Value = model.EventICPName;
            parameters[2].Value = model.EventICPEnable;
            parameters[3].Value = model.PointType;
            parameters[4].Value = model.PointID;
            parameters[5].Value = model.EventCodeID;
            parameters[6].Value = model.ICPID;

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

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

            strSql.Append("select EventICPID,EventICPName,EventICPEnable,PointType,PointID,EventCodeID,ICPID from EventICP ");
            strSql.Append(" where EventICPID=@EventICPID ");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@EventICPID", DbType.Int32, 4)
            };
            parameters[0].Value = EventICPID;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public KryptonAccessController.SQLite.Model.InteractRelation.EventICP DataRowToModel(DataRow row)
 {
     KryptonAccessController.SQLite.Model.InteractRelation.EventICP model=new KryptonAccessController.SQLite.Model.InteractRelation.EventICP();
     if (row != null)
     {
         if(row["EventICPID"]!=null && row["EventICPID"].ToString()!="")
         {
             model.EventICPID=int.Parse(row["EventICPID"].ToString());
         }
         if(row["EventICPName"]!=null)
         {
             model.EventICPName=row["EventICPName"].ToString();
         }
         if(row["EventICPEnable"]!=null && row["EventICPEnable"].ToString()!="")
         {
             if((row["EventICPEnable"].ToString()=="1")||(row["EventICPEnable"].ToString().ToLower()=="true"))
             {
                 model.EventICPEnable=true;
             }
             else
             {
                 model.EventICPEnable=false;
             }
         }
         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["EventCodeID"]!=null && row["EventCodeID"].ToString()!="")
         {
             model.EventCodeID=int.Parse(row["EventCodeID"].ToString());
         }
         if(row["ICPID"]!=null && row["ICPID"].ToString()!="")
         {
             model.ICPID=int.Parse(row["ICPID"].ToString());
         }
     }
     return model;
 }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public KryptonAccessController.SQLite.Model.InteractRelation.EventICP GetModel(int EventICPID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select EventICPID,EventICPName,EventICPEnable,PointType,PointID,EventCodeID,ICPID from EventICP ");
            strSql.Append(" where EventICPID=@EventICPID ");
            SQLiteParameter[] parameters = {
                    new SQLiteParameter("@EventICPID", DbType.Int32,4)			};
            parameters[0].Value = EventICPID;

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