Esempio n. 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(KryptonAccessController.AccessDataBase.Model.EventInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update EventInfo set ");
            strSql.Append("ControllerID=@ControllerID,");
            strSql.Append("PointType=@PointType,");
            strSql.Append("PointID=@PointID,");
            strSql.Append("CardID=@CardID,");
            strSql.Append("EventCodeID=@EventCodeID,");
            strSql.Append("EventDateTime=@EventDateTime");
            strSql.Append(" where EventID=@EventID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ControllerID",  SqlDbType.Int,       4),
                new SqlParameter("@PointType",     SqlDbType.Int,       4),
                new SqlParameter("@PointID",       SqlDbType.Int,       4),
                new SqlParameter("@CardID",        SqlDbType.NVarChar, 10),
                new SqlParameter("@EventCodeID",   SqlDbType.Int,       4),
                new SqlParameter("@EventDateTime", SqlDbType.NVarChar, 10),
                new SqlParameter("@EventID",       SqlDbType.Int, 4)
            };
            parameters[0].Value = model.ControllerID;
            parameters[1].Value = model.PointType;
            parameters[2].Value = model.PointID;
            parameters[3].Value = model.CardID;
            parameters[4].Value = model.EventCodeID;
            parameters[5].Value = model.EventDateTime;
            parameters[6].Value = model.EventID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(KryptonAccessController.AccessDataBase.Model.EventInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into EventInfo(");
            strSql.Append("EventID,ControllerID,PointType,PointID,CardID,EventCodeID,EventDateTime)");
            strSql.Append(" values (");
            strSql.Append("@EventID,@ControllerID,@PointType,@PointID,@CardID,@EventCodeID,@EventDateTime)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@EventID",       SqlDbType.Int,       4),
                new SqlParameter("@ControllerID",  SqlDbType.Int,       4),
                new SqlParameter("@PointType",     SqlDbType.Int,       4),
                new SqlParameter("@PointID",       SqlDbType.Int,       4),
                new SqlParameter("@CardID",        SqlDbType.NVarChar, 10),
                new SqlParameter("@EventCodeID",   SqlDbType.Int,       4),
                new SqlParameter("@EventDateTime", SqlDbType.NVarChar, 10)
            };
            parameters[0].Value = model.EventID;
            parameters[1].Value = model.ControllerID;
            parameters[2].Value = model.PointType;
            parameters[3].Value = model.PointID;
            parameters[4].Value = model.CardID;
            parameters[5].Value = model.EventCodeID;
            parameters[6].Value = model.EventDateTime;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public KryptonAccessController.AccessDataBase.Model.EventInfo DataRowToModel(DataRow row)
 {
     KryptonAccessController.AccessDataBase.Model.EventInfo model = new KryptonAccessController.AccessDataBase.Model.EventInfo();
     if (row != null)
     {
         if (row["EventID"] != null && row["EventID"].ToString() != "")
         {
             model.EventID = int.Parse(row["EventID"].ToString());
         }
         if (row["ControllerID"] != null && row["ControllerID"].ToString() != "")
         {
             model.ControllerID = int.Parse(row["ControllerID"].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["CardID"] != null)
         {
             model.CardID = row["CardID"].ToString();
         }
         if (row["EventCodeID"] != null && row["EventCodeID"].ToString() != "")
         {
             model.EventCodeID = int.Parse(row["EventCodeID"].ToString());
         }
         if (row["EventDateTime"] != null)
         {
             model.EventDateTime = row["EventDateTime"].ToString();
         }
     }
     return(model);
 }
Esempio n. 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public KryptonAccessController.AccessDataBase.Model.EventInfo GetModel(int EventID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 EventID,ControllerID,PointType,PointID,CardID,EventCodeID,EventDateTime from EventInfo ");
            strSql.Append(" where EventID=@EventID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@EventID", SqlDbType.Int, 4)
            };
            parameters[0].Value = EventID;

            KryptonAccessController.AccessDataBase.Model.EventInfo model = new KryptonAccessController.AccessDataBase.Model.EventInfo();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Esempio n. 5
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public KryptonAccessController.AccessDataBase.Model.EventInfo DataRowToModel(DataRow row)
 {
     KryptonAccessController.AccessDataBase.Model.EventInfo model=new KryptonAccessController.AccessDataBase.Model.EventInfo();
     if (row != null)
     {
         if(row["EventID"]!=null && row["EventID"].ToString()!="")
         {
             model.EventID=int.Parse(row["EventID"].ToString());
         }
         if(row["ControllerID"]!=null && row["ControllerID"].ToString()!="")
         {
             model.ControllerID=int.Parse(row["ControllerID"].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["CardID"]!=null)
         {
             model.CardID=row["CardID"].ToString();
         }
         if(row["EventCodeID"]!=null && row["EventCodeID"].ToString()!="")
         {
             model.EventCodeID=int.Parse(row["EventCodeID"].ToString());
         }
         if(row["EventDateTime"]!=null)
         {
             model.EventDateTime=row["EventDateTime"].ToString();
         }
     }
     return model;
 }
Esempio n. 6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public KryptonAccessController.AccessDataBase.Model.EventInfo GetModel(int EventID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 EventID,ControllerID,PointType,PointID,CardID,EventCodeID,EventDateTime from EventInfo ");
            strSql.Append(" where EventID=@EventID ");
            SqlParameter[] parameters = {
                    new SqlParameter("@EventID", SqlDbType.Int,4)			};
            parameters[0].Value = EventID;

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