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

            strSql.Append("update EventSOP set ");
            strSql.Append("EventSOPGName=@EventSOPGName,");
            strSql.Append("EventSOPGEnable=@EventSOPGEnable,");
            strSql.Append("PointType=@PointType,");
            strSql.Append("PointID=@PointID,");
            strSql.Append("EventCodeID=@EventCodeID,");
            strSql.Append("SOPID=@SOPID");
            strSql.Append(" where EventSOPGID=@EventSOPGID ");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@EventSOPGName",   DbType.String),
                new SQLiteParameter("@EventSOPGEnable", DbType.Boolean, 1),
                new SQLiteParameter("@PointType",       DbType.Int32,   4),
                new SQLiteParameter("@PointID",         DbType.Int32,   4),
                new SQLiteParameter("@EventCodeID",     DbType.Int32,   4),
                new SQLiteParameter("@SOPID",           DbType.Int32,   4),
                new SQLiteParameter("@EventSOPGID",     DbType.Int32, 4)
            };
            parameters[0].Value = model.EventSOPGName;
            parameters[1].Value = model.EventSOPGEnable;
            parameters[2].Value = model.PointType;
            parameters[3].Value = model.PointID;
            parameters[4].Value = model.EventCodeID;
            parameters[5].Value = model.SOPID;
            parameters[6].Value = model.EventSOPGID;

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

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

            strSql.Append("select EventSOPGID,EventSOPGName,EventSOPGEnable,PointType,PointID,EventCodeID,SOPID from EventSOP ");
            strSql.Append(" where EventSOPGID=@EventSOPGID ");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@EventSOPGID", DbType.Int32, 4)
            };
            parameters[0].Value = EventSOPGID;

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

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