Example #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(KryptonAccessController.SQLite.Model.InteractRelation.HolidaySOP model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into HolidaySOP(");
            strSql.Append("HolidayID,HolidayName,HolidayStartDate,HolidayEndDate,HolidayType,TimeSOPID)");
            strSql.Append(" values (");
            strSql.Append("@HolidayID,@HolidayName,@HolidayStartDate,@HolidayEndDate,@HolidayType,@TimeSOPID)");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@HolidayID",        DbType.Int32,   4),
                new SQLiteParameter("@HolidayName",      DbType.String),
                new SQLiteParameter("@HolidayStartDate", DbType.String),
                new SQLiteParameter("@HolidayEndDate",   DbType.String),
                new SQLiteParameter("@HolidayType",      DbType.Int32,   4),
                new SQLiteParameter("@TimeSOPID",        DbType.Int32, 4)
            };
            parameters[0].Value = model.HolidayID;
            parameters[1].Value = model.HolidayName;
            parameters[2].Value = model.HolidayStartDate;
            parameters[3].Value = model.HolidayEndDate;
            parameters[4].Value = model.HolidayType;
            parameters[5].Value = model.TimeSOPID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public KryptonAccessController.SQLite.Model.InteractRelation.HolidaySOP DataRowToModel(DataRow row)
 {
     KryptonAccessController.SQLite.Model.InteractRelation.HolidaySOP model = new KryptonAccessController.SQLite.Model.InteractRelation.HolidaySOP();
     if (row != null)
     {
         if (row["HolidayID"] != null && row["HolidayID"].ToString() != "")
         {
             model.HolidayID = int.Parse(row["HolidayID"].ToString());
         }
         if (row["HolidayName"] != null)
         {
             model.HolidayName = row["HolidayName"].ToString();
         }
         if (row["HolidayStartDate"] != null)
         {
             model.HolidayStartDate = row["HolidayStartDate"].ToString();
         }
         if (row["HolidayEndDate"] != null)
         {
             model.HolidayEndDate = row["HolidayEndDate"].ToString();
         }
         if (row["HolidayType"] != null && row["HolidayType"].ToString() != "")
         {
             model.HolidayType = int.Parse(row["HolidayType"].ToString());
         }
         if (row["TimeSOPID"] != null && row["TimeSOPID"].ToString() != "")
         {
             model.TimeSOPID = int.Parse(row["TimeSOPID"].ToString());
         }
     }
     return(model);
 }
Example #3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public KryptonAccessController.SQLite.Model.InteractRelation.HolidaySOP GetModel(int HolidayID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select HolidayID,HolidayName,HolidayStartDate,HolidayEndDate,HolidayType,TimeSOPID from HolidaySOP ");
            strSql.Append(" where HolidayID=@HolidayID ");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@HolidayID", DbType.Int32, 4)
            };
            parameters[0].Value = HolidayID;

            KryptonAccessController.SQLite.Model.InteractRelation.HolidaySOP model = new KryptonAccessController.SQLite.Model.InteractRelation.HolidaySOP();
            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.HolidaySOP DataRowToModel(DataRow row)
 {
     KryptonAccessController.SQLite.Model.InteractRelation.HolidaySOP model=new KryptonAccessController.SQLite.Model.InteractRelation.HolidaySOP();
     if (row != null)
     {
         if(row["HolidayID"]!=null && row["HolidayID"].ToString()!="")
         {
             model.HolidayID=int.Parse(row["HolidayID"].ToString());
         }
         if(row["HolidayName"]!=null)
         {
             model.HolidayName=row["HolidayName"].ToString();
         }
         if(row["HolidayStartDate"]!=null)
         {
             model.HolidayStartDate=row["HolidayStartDate"].ToString();
         }
         if(row["HolidayEndDate"]!=null)
         {
             model.HolidayEndDate=row["HolidayEndDate"].ToString();
         }
         if(row["HolidayType"]!=null && row["HolidayType"].ToString()!="")
         {
             model.HolidayType=int.Parse(row["HolidayType"].ToString());
         }
         if(row["TimeSOPID"]!=null && row["TimeSOPID"].ToString()!="")
         {
             model.TimeSOPID=int.Parse(row["TimeSOPID"].ToString());
         }
     }
     return model;
 }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public KryptonAccessController.SQLite.Model.InteractRelation.HolidaySOP GetModel(int HolidayID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select HolidayID,HolidayName,HolidayStartDate,HolidayEndDate,HolidayType,TimeSOPID from HolidaySOP ");
            strSql.Append(" where HolidayID=@HolidayID ");
            SQLiteParameter[] parameters = {
                    new SQLiteParameter("@HolidayID", DbType.Int32,4)			};
            parameters[0].Value = HolidayID;

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