Exemplo n.º 1
0
        public static Weekly GetWeeklyByWeeklyId(int weeklyId)
        {
            Database  db         = DatabaseFactory.CreateDatabase("SPARInsightManagement");
            string    sqlCommand = "GetWeeklyByWeeklyId";
            DbCommand dbCommand  = db.GetStoredProcCommand(sqlCommand);

            db.AddInParameter(dbCommand, "@WeeklyId", DbType.Int32, weeklyId);
            db.AddOutParameter(dbCommand, "@Description", DbType.String, 50);
            db.ExecuteNonQuery(dbCommand);
            Weekly weekly = new Weekly();

            weekly.WeeklyId    = weeklyId;
            weekly.Description = db.GetParameterValue(dbCommand, "Description").ToString();
            return(weekly);
        }
Exemplo n.º 2
0
        public static List <Weekly> GetWeeklyList()
        {
            List <Weekly> list = new List <Weekly>();

            Database  db         = DatabaseFactory.CreateDatabase("SPARInsightManagement");
            string    sqlCommand = "GetWeeklyList";
            DbCommand dbCommand  = db.GetStoredProcCommand(sqlCommand);

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    Weekly weekly = new Weekly();
                    weekly.WeeklyId    = Convert.ToInt32(dataReader["WeeklyId"]);
                    weekly.Description = dataReader["Description"].ToString();
                    list.Add(weekly);
                }
            }
            return(list);
        }