Exemple #1
0
        public static List<OrdersListing> GetAllOrders()
        {
            //DB Connection goes here

            List<OrdersListing> _article = new List<OrdersListing>();

            // Create the Database object, using the default database service. The
            // default database service is determined through configuration.
            Database db = DatabaseFactory.CreateDatabase();

            string sqlCommand = "GetAllOrders";
            DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);

            // DataSet that will hold the returned results
            DataSet commentaryDataSet = null;

            commentaryDataSet = db.ExecuteDataSet(dbCommand);

            // Note: connection was closed by ExecuteDataSet method call

            foreach (DataRow dr in commentaryDataSet.Tables[0].Rows)
            {
                OrdersListing _portfoliolisting = new OrdersListing();
                _portfoliolisting.OrderId = Int32.Parse(dr["OrderId"].ToString());
                _portfoliolisting.UserId = dr["UserId"].ToString();
                _portfoliolisting.MonthsOfSubscription = dr["NoOfMonthsSubscriptionDesc"].ToString();
                _portfoliolisting.SubscriptionStartDate = DateTime.Parse(dr["SubscriptionStartDate"].ToString());
                _portfoliolisting.SubscriptionEndDate = DateTime.Parse(dr["SubscriptionEndDate"].ToString());
                _article.Add(_portfoliolisting);
            }

            return _article;
        }
Exemple #2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="filterData"></param>
        /// <returns></returns>
        public static List<OrdersListing> GetOrderFilterData(string filterData)
        {
            //DB Connection goes here

            List<OrdersListing> _article = new List<OrdersListing>();

            // Create the Database object, using the default database service. The
            // default database service is determined through configuration.
            Database db = DatabaseFactory.CreateDatabase();

            string sqlCommand = "GetAllOrders";
            DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);

            // Retrieve products from the specified category.
            //db.AddInParameter(dbCommand, "CategoryID", DbType.Int32, Category);

            // DataSet that will hold the returned results
            DataSet commentaryDataSet = null;

            commentaryDataSet = db.ExecuteDataSet(dbCommand);

            DataRow[] dataRow;

            dataRow = commentaryDataSet.Tables[0].Select("UserId LIKE '%" + filterData + "%'");

            // Note: connection was closed by ExecuteDataSet method call

            foreach (DataRow dr in dataRow)
            {
                OrdersListing _portfoliolisting = new OrdersListing();
                _portfoliolisting.OrderId = Int32.Parse(dr["OrderId"].ToString());
                _portfoliolisting.UserId = dr["UserId"].ToString();
                _portfoliolisting.MonthsOfSubscription = dr["MonthsOfSubscription"].ToString();
                _portfoliolisting.SubscriptionStartDate = DateTime.Parse(dr["SubscriptionStartDate"].ToString());
                _portfoliolisting.SubscriptionEndDate = DateTime.Parse(dr["SubscriptionEndDate"].ToString());
                _article.Add(_portfoliolisting);
            }

            return _article;
        }