Пример #1
0
        public List <U_I_Q> GetQuantityTraditionalUsers_More(string cluster)
        {
            List <U_I_Q> list = new List <U_I_Q>();
            U_I_Q        item;
            Dictionary <string, object> parameters = new Dictionary <string, object>();

            parameters.Add("@cluster", cluster);
            string        sql = "SELECT MetaItemID, QAV from [RS].[QTY_PAR_CLUSTER] WHERE ClusterID = @cluster";
            SqlDataReader dr  = executeReader(sql, parameters);

            while (dr.Read())
            {
                item            = new U_I_Q();
                item.MetaItemID = dr[0].ToString();
                item.QTY        = Convert.ToDouble(dr[1]);
                if (item.QTY < 0)
                {
                    item.QTY = 1;
                }

                list.Add(item);
            }
            dr.Close();
            return(list);
        }
Пример #2
0
        public List <Recommendation_Meta_Item> GetAllQuantity(List <Recommendation_Meta_Item> list)
        {
            List <U_I_Q> lstSubCate = new List <U_I_Q>();
            List <U_I_Q> lstcate    = new List <U_I_Q>();
            U_I_Q        item;

            string        sql = "SELECT U_SubCategoryID, MetaItemID, QAV FROM [RS].[QTY_PAR_SUBCATEGORY]";
            SqlDataReader dr  = executeReader(sql);

            while (dr.Read())
            {
                item            = new U_I_Q();
                item.UserID     = dr[0].ToString();
                item.MetaItemID = dr[1].ToString();
                item.QTY        = Convert.ToDouble(dr[2]);
                lstSubCate.Add(item);
            }
            dr.Close();

            dr = executeReader("SELECT U_CategoryID, MetaItemID, QAV FROM [RS].[QTY_PAR_CATEGORY]");
            while (dr.Read())
            {
                item            = new U_I_Q();
                item.UserID     = dr[0].ToString();
                item.MetaItemID = dr[1].ToString();
                item.QTY        = Convert.ToDouble(dr[2]);
                lstcate.Add(item);
            }
            dr.Close();

            foreach (Recommendation_Meta_Item R in list)
            {
                dr = executeReader("Select UserID, U_SubcategoryID From [RS].[User_TBL] Where U_SubCategoryID = '" + R.UserID + "'");
                dr.Read(); string Ucate = dr[1].ToString();
                dr.Close();
                bool Check = false;
                for (int j = 0; j < lstSubCate.Count; j++)
                {
                    if (lstSubCate[j].UserID.Equals(Ucate))
                    {
                        R.Quantity = lstSubCate[j].QTY;
                        Check      = true;
                        break;
                    }
                }
                //if Sub rong
                if (!Check)
                {
                    dr = executeReader("Select UserID, U_categoryID From [RS].[User_TBL] Where UserID = '" + R.UserID + "'");
                    dr.Read(); string USub = dr[1].ToString();
                    dr.Close();

                    for (int j = 0; j < lstcate.Count; j++)
                    {
                        if (lstcate[j].UserID.Equals(USub))
                        {
                            R.Quantity = lstcate[j].QTY;
                            break;
                        }
                    }
                }
            }
            return(list);
        }