Exemplo n.º 1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public KryptonAccessController.SQLite.Model.UserRelation.TimeZone DataRowToModel(DataRow row)
 {
     KryptonAccessController.SQLite.Model.UserRelation.TimeZone model = new KryptonAccessController.SQLite.Model.UserRelation.TimeZone();
     if (row != null)
     {
         if (row["TimeZoneID"] != null && row["TimeZoneID"].ToString() != "")
         {
             model.TimeZoneID = int.Parse(row["TimeZoneID"].ToString());
         }
         if (row["STime1"] != null)
         {
             model.STime1 = row["STime1"].ToString();
         }
         if (row["ETime1"] != null)
         {
             model.ETime1 = row["ETime1"].ToString();
         }
         if (row["STime2"] != null)
         {
             model.STime2 = row["STime2"].ToString();
         }
         if (row["ETime2"] != null)
         {
             model.ETime2 = row["ETime2"].ToString();
         }
         if (row["STime3"] != null)
         {
             model.STime3 = row["STime3"].ToString();
         }
         if (row["ETime3"] != null)
         {
             model.ETime3 = row["ETime3"].ToString();
         }
         if (row["STime4"] != null)
         {
             model.STime4 = row["STime4"].ToString();
         }
         if (row["ETime4"] != null)
         {
             model.ETime4 = row["ETime4"].ToString();
         }
         if (row["STime5"] != null)
         {
             model.STime5 = row["STime5"].ToString();
         }
         if (row["ETime5"] != null)
         {
             model.ETime5 = row["ETime5"].ToString();
         }
         if (row["STime6"] != null)
         {
             model.STime6 = row["STime6"].ToString();
         }
         if (row["ETime6"] != null)
         {
             model.ETime6 = row["ETime6"].ToString();
         }
     }
     return(model);
 }
Exemplo n.º 2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(KryptonAccessController.SQLite.Model.UserRelation.TimeZone model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TimeZone set ");
            strSql.Append("STime1=@STime1,");
            strSql.Append("ETime1=@ETime1,");
            strSql.Append("STime2=@STime2,");
            strSql.Append("ETime2=@ETime2,");
            strSql.Append("STime3=@STime3,");
            strSql.Append("ETime3=@ETime3,");
            strSql.Append("STime4=@STime4,");
            strSql.Append("ETime4=@ETime4,");
            strSql.Append("STime5=@STime5,");
            strSql.Append("ETime5=@ETime5,");
            strSql.Append("STime6=@STime6,");
            strSql.Append("ETime6=@ETime6");
            strSql.Append(" where TimeZoneID=@TimeZoneID ");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@STime1",     DbType.String),
                new SQLiteParameter("@ETime1",     DbType.String),
                new SQLiteParameter("@STime2",     DbType.String),
                new SQLiteParameter("@ETime2",     DbType.String),
                new SQLiteParameter("@STime3",     DbType.String),
                new SQLiteParameter("@ETime3",     DbType.String),
                new SQLiteParameter("@STime4",     DbType.String),
                new SQLiteParameter("@ETime4",     DbType.String),
                new SQLiteParameter("@STime5",     DbType.String),
                new SQLiteParameter("@ETime5",     DbType.String),
                new SQLiteParameter("@STime6",     DbType.String),
                new SQLiteParameter("@ETime6",     DbType.String),
                new SQLiteParameter("@TimeZoneID", DbType.Int32, 4)
            };
            parameters[0].Value  = model.STime1;
            parameters[1].Value  = model.ETime1;
            parameters[2].Value  = model.STime2;
            parameters[3].Value  = model.ETime2;
            parameters[4].Value  = model.STime3;
            parameters[5].Value  = model.ETime3;
            parameters[6].Value  = model.STime4;
            parameters[7].Value  = model.ETime4;
            parameters[8].Value  = model.STime5;
            parameters[9].Value  = model.ETime5;
            parameters[10].Value = model.STime6;
            parameters[11].Value = model.ETime6;
            parameters[12].Value = model.TimeZoneID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(KryptonAccessController.SQLite.Model.UserRelation.TimeZone model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TimeZone(");
            strSql.Append("TimeZoneID,STime1,ETime1,STime2,ETime2,STime3,ETime3,STime4,ETime4,STime5,ETime5,STime6,ETime6)");
            strSql.Append(" values (");
            strSql.Append("@TimeZoneID,@STime1,@ETime1,@STime2,@ETime2,@STime3,@ETime3,@STime4,@ETime4,@STime5,@ETime5,@STime6,@ETime6)");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@TimeZoneID", DbType.Int32,   4),
                new SQLiteParameter("@STime1",     DbType.String),
                new SQLiteParameter("@ETime1",     DbType.String),
                new SQLiteParameter("@STime2",     DbType.String),
                new SQLiteParameter("@ETime2",     DbType.String),
                new SQLiteParameter("@STime3",     DbType.String),
                new SQLiteParameter("@ETime3",     DbType.String),
                new SQLiteParameter("@STime4",     DbType.String),
                new SQLiteParameter("@ETime4",     DbType.String),
                new SQLiteParameter("@STime5",     DbType.String),
                new SQLiteParameter("@ETime5",     DbType.String),
                new SQLiteParameter("@STime6",     DbType.String),
                new SQLiteParameter("@ETime6",     DbType.String)
            };
            parameters[0].Value  = model.TimeZoneID;
            parameters[1].Value  = model.STime1;
            parameters[2].Value  = model.ETime1;
            parameters[3].Value  = model.STime2;
            parameters[4].Value  = model.ETime2;
            parameters[5].Value  = model.STime3;
            parameters[6].Value  = model.ETime3;
            parameters[7].Value  = model.STime4;
            parameters[8].Value  = model.ETime4;
            parameters[9].Value  = model.STime5;
            parameters[10].Value = model.ETime5;
            parameters[11].Value = model.STime6;
            parameters[12].Value = model.ETime6;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public KryptonAccessController.SQLite.Model.UserRelation.TimeZone GetModel(int TimeZoneID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select TimeZoneID,STime1,ETime1,STime2,ETime2,STime3,ETime3,STime4,ETime4,STime5,ETime5,STime6,ETime6 from TimeZone ");
            strSql.Append(" where TimeZoneID=@TimeZoneID ");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@TimeZoneID", DbType.Int32, 4)
            };
            parameters[0].Value = TimeZoneID;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public KryptonAccessController.SQLite.Model.UserRelation.TimeZone DataRowToModel(DataRow row)
 {
     KryptonAccessController.SQLite.Model.UserRelation.TimeZone model=new KryptonAccessController.SQLite.Model.UserRelation.TimeZone();
     if (row != null)
     {
         if(row["TimeZoneID"]!=null && row["TimeZoneID"].ToString()!="")
         {
             model.TimeZoneID=int.Parse(row["TimeZoneID"].ToString());
         }
         if(row["STime1"]!=null)
         {
             model.STime1=row["STime1"].ToString();
         }
         if(row["ETime1"]!=null)
         {
             model.ETime1=row["ETime1"].ToString();
         }
         if(row["STime2"]!=null)
         {
             model.STime2=row["STime2"].ToString();
         }
         if(row["ETime2"]!=null)
         {
             model.ETime2=row["ETime2"].ToString();
         }
         if(row["STime3"]!=null)
         {
             model.STime3=row["STime3"].ToString();
         }
         if(row["ETime3"]!=null)
         {
             model.ETime3=row["ETime3"].ToString();
         }
         if(row["STime4"]!=null)
         {
             model.STime4=row["STime4"].ToString();
         }
         if(row["ETime4"]!=null)
         {
             model.ETime4=row["ETime4"].ToString();
         }
         if(row["STime5"]!=null)
         {
             model.STime5=row["STime5"].ToString();
         }
         if(row["ETime5"]!=null)
         {
             model.ETime5=row["ETime5"].ToString();
         }
         if(row["STime6"]!=null)
         {
             model.STime6=row["STime6"].ToString();
         }
         if(row["ETime6"]!=null)
         {
             model.ETime6=row["ETime6"].ToString();
         }
     }
     return model;
 }
Exemplo n.º 6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public KryptonAccessController.SQLite.Model.UserRelation.TimeZone GetModel(int TimeZoneID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select TimeZoneID,STime1,ETime1,STime2,ETime2,STime3,ETime3,STime4,ETime4,STime5,ETime5,STime6,ETime6 from TimeZone ");
            strSql.Append(" where TimeZoneID=@TimeZoneID ");
            SQLiteParameter[] parameters = {
                    new SQLiteParameter("@TimeZoneID", DbType.Int32,4)			};
            parameters[0].Value = TimeZoneID;

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