Пример #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(KryptonAccessController.AccessDataBase.Model.ReaderHoliday model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into ReaderHoliday(");
            strSql.Append("ReaderHolidayID,ReaderID,ReaderHolidayName,ReaderHolidayType,ReaderHolidayStartDate,ReaderHolidayEndDate)");
            strSql.Append(" values (");
            strSql.Append("@ReaderHolidayID,@ReaderID,@ReaderHolidayName,@ReaderHolidayType,@ReaderHolidayStartDate,@ReaderHolidayEndDate)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ReaderHolidayID",        SqlDbType.Int,       4),
                new SqlParameter("@ReaderID",               SqlDbType.Int,       4),
                new SqlParameter("@ReaderHolidayName",      SqlDbType.NVarChar, 50),
                new SqlParameter("@ReaderHolidayType",      SqlDbType.Int,       4),
                new SqlParameter("@ReaderHolidayStartDate", SqlDbType.NVarChar, 10),
                new SqlParameter("@ReaderHolidayEndDate",   SqlDbType.NVarChar, 10)
            };
            parameters[0].Value = model.ReaderHolidayID;
            parameters[1].Value = model.ReaderID;
            parameters[2].Value = model.ReaderHolidayName;
            parameters[3].Value = model.ReaderHolidayType;
            parameters[4].Value = model.ReaderHolidayStartDate;
            parameters[5].Value = model.ReaderHolidayEndDate;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public KryptonAccessController.AccessDataBase.Model.ReaderHoliday DataRowToModel(DataRow row)
 {
     KryptonAccessController.AccessDataBase.Model.ReaderHoliday model = new KryptonAccessController.AccessDataBase.Model.ReaderHoliday();
     if (row != null)
     {
         if (row["ReaderHolidayID"] != null && row["ReaderHolidayID"].ToString() != "")
         {
             model.ReaderHolidayID = int.Parse(row["ReaderHolidayID"].ToString());
         }
         if (row["ReaderID"] != null && row["ReaderID"].ToString() != "")
         {
             model.ReaderID = int.Parse(row["ReaderID"].ToString());
         }
         if (row["ReaderHolidayName"] != null)
         {
             model.ReaderHolidayName = row["ReaderHolidayName"].ToString();
         }
         if (row["ReaderHolidayType"] != null && row["ReaderHolidayType"].ToString() != "")
         {
             model.ReaderHolidayType = int.Parse(row["ReaderHolidayType"].ToString());
         }
         if (row["ReaderHolidayStartDate"] != null)
         {
             model.ReaderHolidayStartDate = row["ReaderHolidayStartDate"].ToString();
         }
         if (row["ReaderHolidayEndDate"] != null)
         {
             model.ReaderHolidayEndDate = row["ReaderHolidayEndDate"].ToString();
         }
     }
     return(model);
 }
Пример #3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public KryptonAccessController.AccessDataBase.Model.ReaderHoliday GetModel(int ReaderHolidayID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ReaderHolidayID,ReaderID,ReaderHolidayName,ReaderHolidayType,ReaderHolidayStartDate,ReaderHolidayEndDate from ReaderHoliday ");
            strSql.Append(" where ReaderHolidayID=@ReaderHolidayID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ReaderHolidayID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ReaderHolidayID;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Пример #4
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public KryptonAccessController.AccessDataBase.Model.ReaderHoliday DataRowToModel(DataRow row)
 {
     KryptonAccessController.AccessDataBase.Model.ReaderHoliday model=new KryptonAccessController.AccessDataBase.Model.ReaderHoliday();
     if (row != null)
     {
         if(row["ReaderHolidayID"]!=null && row["ReaderHolidayID"].ToString()!="")
         {
             model.ReaderHolidayID=int.Parse(row["ReaderHolidayID"].ToString());
         }
         if(row["ReaderID"]!=null && row["ReaderID"].ToString()!="")
         {
             model.ReaderID=int.Parse(row["ReaderID"].ToString());
         }
         if(row["ReaderHolidayName"]!=null)
         {
             model.ReaderHolidayName=row["ReaderHolidayName"].ToString();
         }
         if(row["ReaderHolidayType"]!=null && row["ReaderHolidayType"].ToString()!="")
         {
             model.ReaderHolidayType=int.Parse(row["ReaderHolidayType"].ToString());
         }
         if(row["ReaderHolidayStartDate"]!=null)
         {
             model.ReaderHolidayStartDate=row["ReaderHolidayStartDate"].ToString();
         }
         if(row["ReaderHolidayEndDate"]!=null)
         {
             model.ReaderHolidayEndDate=row["ReaderHolidayEndDate"].ToString();
         }
     }
     return model;
 }
Пример #5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public KryptonAccessController.AccessDataBase.Model.ReaderHoliday GetModel(int ReaderHolidayID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 ReaderHolidayID,ReaderID,ReaderHolidayName,ReaderHolidayType,ReaderHolidayStartDate,ReaderHolidayEndDate from ReaderHoliday ");
            strSql.Append(" where ReaderHolidayID=@ReaderHolidayID ");
            SqlParameter[] parameters = {
                    new SqlParameter("@ReaderHolidayID", SqlDbType.Int,4)			};
            parameters[0].Value = ReaderHolidayID;

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