Пример #1
0
        public ArrayList RetrieveList(string userid)
        {
            try
            {
                int            iuserid      = Common.SafeIntParse(userid);
                SqlParameter[] spParameters = new SqlParameter[1];
                spParameters[0] = new SqlParameter("@" + UParameter.UserId, userid);

                ArrayList     arrayList = new ArrayList();
                DataAccess    data      = new DataAccess(AccessType.User);
                SqlDataReader reader    = data.GetSqlDataReader(StoredProcedure.RetrieveListByUser, spParameters);
                while (reader.Read())
                {
                    UList ulist = new UList();
                    ulist.ListId         = reader[UParameter.ListId].ToString();
                    ulist.BookName       = reader[UParameter.BookName].ToString();
                    ulist.AuthorNames    = reader[UParameter.AuthorNames].ToString();
                    ulist.Edition        = reader[UParameter.Edition].ToString();
                    ulist.ISBN           = reader[UParameter.ISBN].ToString();
                    ulist.EAN            = reader[UParameter.EAN].ToString();
                    ulist.Condition      = reader[UParameter.Condition].ToString();
                    ulist.Price          = reader[UParameter.Price].ToString();
                    ulist.Area           = reader[UParameter.Area].ToString();
                    ulist.NumberOfOffers = reader[UParameter.NumberOfOffers].ToString();
                    ulist.TimePosted     = reader[UParameter.TimePosted].ToString();
                    arrayList.Add(ulist);
                }
                return(arrayList);
            }
            catch (Exception ex)
            {
                Log.LogError(MethodInfo.GetCurrentMethod().Name, ex.Message + ex.StackTrace);
            }
            return(null);
        }
Пример #2
0
        public ArrayList RetrieveSearch(string searchBy, string keywords, string area, string price, string time, string sortBy)
        {
            try
            {
                int            iprice       = Common.SafeIntParse(price);
                SqlParameter[] spParameters = new SqlParameter[6];
                spParameters[0] = new SqlParameter("@" + UParameter.SearchType, searchBy);
                spParameters[1] = new SqlParameter("@" + UParameter.Keywords, keywords);
                spParameters[2] = new SqlParameter("@" + UParameter.Area, area);
                spParameters[3] = new SqlParameter("@" + UParameter.Price, iprice);
                spParameters[4] = new SqlParameter("@" + UParameter.EarliestTimeListed, time);
                spParameters[5] = new SqlParameter("@" + UParameter.SortBy, sortBy);

                ArrayList     arrayList = new ArrayList();
                DataAccess    data      = new DataAccess(AccessType.Visitor);
                SqlDataReader reader    = data.GetSqlDataReader(StoredProcedure.RetrieveSearch, spParameters);
                while (reader.Read())
                {
                    UList ulist = new UList();
                    ulist.ListId         = reader[UParameter.ListId].ToString();
                    ulist.BookName       = reader[UParameter.BookName].ToString();
                    ulist.AuthorNames    = reader[UParameter.AuthorNames].ToString();
                    ulist.Edition        = reader[UParameter.Edition].ToString();
                    ulist.ISBN           = reader[UParameter.ISBN].ToString();
                    ulist.EAN            = reader[UParameter.EAN].ToString();
                    ulist.Condition      = reader[UParameter.Condition].ToString();
                    ulist.Price          = reader[UParameter.Price].ToString();
                    ulist.Area           = reader[UParameter.Area].ToString();
                    ulist.NumberOfOffers = reader[UParameter.NumberOfOffers].ToString();
                    ulist.TimePosted     = reader[UParameter.TimePosted].ToString();
                    arrayList.Add(ulist);
                }
                return(arrayList);
            }
            catch (Exception ex)
            {
                Log.LogError(MethodInfo.GetCurrentMethod().Name, ex.Message + ex.StackTrace);
            }
            return(null);
        }