コード例 #1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public KryptonAccessController.SQLite.Model.ControllerRelation.ReaderTimeZone DataRowToModel(DataRow row)
 {
     KryptonAccessController.SQLite.Model.ControllerRelation.ReaderTimeZone model=new KryptonAccessController.SQLite.Model.ControllerRelation.ReaderTimeZone();
     if (row != null)
     {
         if(row["ReaderTimeZoneID"]!=null && row["ReaderTimeZoneID"].ToString()!="")
         {
             model.ReaderTimeZoneID=int.Parse(row["ReaderTimeZoneID"].ToString());
         }
         if(row["TimeZone1"]!=null)
         {
             model.TimeZone1=row["TimeZone1"].ToString();
         }
         if(row["OperateMode1"]!=null && row["OperateMode1"].ToString()!="")
         {
             model.OperateMode1=int.Parse(row["OperateMode1"].ToString());
         }
         if(row["TimeZone2"]!=null)
         {
             model.TimeZone2=row["TimeZone2"].ToString();
         }
         if(row["OperateMode2"]!=null && row["OperateMode2"].ToString()!="")
         {
             model.OperateMode2=int.Parse(row["OperateMode2"].ToString());
         }
         if(row["TimeZone3"]!=null)
         {
             model.TimeZone3=row["TimeZone3"].ToString();
         }
         if(row["OperateMode3"]!=null && row["OperateMode3"].ToString()!="")
         {
             model.OperateMode3=int.Parse(row["OperateMode3"].ToString());
         }
         if(row["TimeZone4"]!=null)
         {
             model.TimeZone4=row["TimeZone4"].ToString();
         }
         if(row["OperateMode4"]!=null && row["OperateMode4"].ToString()!="")
         {
             model.OperateMode4=int.Parse(row["OperateMode4"].ToString());
         }
         if(row["TimeZone5"]!=null)
         {
             model.TimeZone5=row["TimeZone5"].ToString();
         }
         if(row["OperateMode5"]!=null && row["OperateMode5"].ToString()!="")
         {
             model.OperateMode5=int.Parse(row["OperateMode5"].ToString());
         }
         if(row["TimeZone6"]!=null)
         {
             model.TimeZone6=row["TimeZone6"].ToString();
         }
         if(row["OperateMode6"]!=null && row["OperateMode6"].ToString()!="")
         {
             model.OperateMode6=int.Parse(row["OperateMode6"].ToString());
         }
     }
     return model;
 }
コード例 #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public KryptonAccessController.SQLite.Model.ControllerRelation.ReaderTimeZone GetModel(int ReaderTimeZoneID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select ReaderTimeZoneID,TimeZone1,OperateMode1,TimeZone2,OperateMode2,TimeZone3,OperateMode3,TimeZone4,OperateMode4,TimeZone5,OperateMode5,TimeZone6,OperateMode6 from ReaderTimeZone ");
            strSql.Append(" where [email protected] ");
            SQLiteParameter[] parameters = {
                    new SQLiteParameter("@ReaderTimeZoneID", DbType.Int32,4)			};
            parameters[0].Value = ReaderTimeZoneID;

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