Exemplo n.º 1
0
        public BZAgentProductViewModel GetCategoryProductDetail(string apiKey, int Stateid, int Districtid, int CatId, int SubCatId, int PackageID = 0)
        {
            BZAgentProductViewModel _catProList = new BZAgentProductViewModel();

            if (apiKey == ConfigurationManager.AppSettings["reasonkey"])
            {
                try
                {
                    _catProList = _agentbal.GetCategoryProductDetail(Stateid, Districtid, CatId, SubCatId, PackageID);
                }
                catch (Exception ex)
                {
                    LogBal.ErrorLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message, 0);
                }
            }
            return(_catProList);
        }
Exemplo n.º 2
0
        public BZAgentProductViewModel GetCategoryProductDetail(int StateId, int DistrictId, int CatId, int SubCatId, int PackageID = 0)
        {
            DataSet ds = _Apdal.GetCategoryProductDetail(StateId, DistrictId, CatId, SubCatId, PackageID);

            BZAgentProductViewModel _catProList = new BZAgentProductViewModel();

            //if (ds != null && ds.Tables[0] != null)
            //{
            //    if (ds.Tables[0].Rows.Count > 0)
            //    {
            //        List<ProductPopularDetail> _popularList = new List<ProductPopularDetail>();
            //        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            //        {
            //            ProductPopularDetail _popular = new ProductPopularDetail();
            //            _popular.ProductId = Convert.ToInt32(ds.Tables[0].Rows[i]["ProductId"].ToString());
            //            _popular.ProductName = ds.Tables[0].Rows[i]["ProductName"].ToString();
            //            _popularList.Add(_popular);
            //        }
            //        _catProList._PopularProductList = _popularList;
            //    }
            //}

            /*
             * productId	PackageId	ProductName	TechNameID	TechnicalName	Amount	ourprice
             * unitname	SubCategoryId	SubCategoryName	categoryId	categoryName	CompanyId	OrganisationName	dealerId
             */
            if (ds != null && ds.Tables[0] != null)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    List <BZProductDescription> _prodList = new List <BZProductDescription>();
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        BZProductDescription _product = new BZProductDescription();
                        _product.PackageId   = Convert.ToInt32(ds.Tables[0].Rows[i]["PackageId"].ToString());
                        _product.PackageName = ds.Tables[0].Rows[i]["Amount"].ToString() + " " + ds.Tables[0].Rows[i]["unitname"].ToString();

                        _product.CategoryId    = Convert.ToInt32(ds.Tables[0].Rows[i]["categoryId"].ToString());
                        _product.SubCategoryId = Convert.ToInt32(ds.Tables[0].Rows[i]["SubCategoryId"].ToString());
                        _product.BrandID       = Convert.ToInt32(ds.Tables[0].Rows[i]["BrandID"].ToString());
                        _product.ProductId     = Convert.ToInt32(ds.Tables[0].Rows[i]["productId"].ToString());
                        _product.ProductName   = ds.Tables[0].Rows[i]["ProductName"].ToString();
                        _product.DistrictId    = Convert.ToInt32(ds.Tables[0].Rows[i]["DistrictID"].ToString());
                        _product.DistrictName  = ds.Tables[0].Rows[i]["DistrictName"].ToString();
                        _product.Company       = ds.Tables[0].Rows[i]["OrganisationName"].ToString();
                        _product.TechnicalName = ds.Tables[0].Rows[i]["TechnicalName"].ToString();
                        _product.CompanyId     = Convert.ToInt32(ds.Tables[0].Rows[i]["CompanyID"].ToString());
                        _product.Price         = Convert.ToDecimal(ds.Tables[0].Rows[i]["ourprice"].ToString());
                        _product.DealerId      = Convert.ToInt32(ds.Tables[0].Rows[i]["dealerId"].ToString());
                        _product.DealerName    = ds.Tables[0].Rows[i]["DealerName"].ToString();
                        _product.IsTrending    = Convert.ToInt32(ds.Tables[0].Rows[i]["IsTrendingProduct"].ToString());
                        _prodList.Add(_product);
                    }
                    _catProList._productList = _prodList;
                }
            }



            return(_catProList);
        }