Exemplo n.º 1
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int result = 0;

            int.TryParse(context.Request.Params["id"], out result);
            if (result > 0)
            {
                int num3;
                int num4;
                PointExChangeInfo info = PointExChangeHelper.Get(result);
                int    gradeId         = MemberProcessor.GetCurrentMember().GradeId;
                string str             = context.Request.Params["sort"];
                if (string.IsNullOrWhiteSpace(str))
                {
                    str = "ProductId";
                }
                string str2 = context.Request.Params["order"];
                if (string.IsNullOrWhiteSpace(str2))
                {
                    str2 = "asc";
                }
                if (!int.TryParse(context.Request.Params["page"], out num3))
                {
                    num3 = 1;
                }
                if (!int.TryParse(context.Request.Params["size"], out num4))
                {
                    num4 = 10;
                }
                bool flag = false;
                foreach (string str3 in info.MemberGrades.Split(new char[] { ',' }))
                {
                    if ((int.Parse(str3) == gradeId) || (str3 == "0"))
                    {
                        flag = true;
                    }
                }
                if ((flag && (info.BeginDate <= DateTime.Now)) && (info.EndDate >= DateTime.Now))
                {
                    int       num5;
                    DataTable table = PointExChangeHelper.GetProducts(result, num3, num4, out num5, str, str2);
                    foreach (DataRow row in table.Rows)
                    {
                        if (row["ProductNumber"].ToString() == "0")
                        {
                            int num6 = 0;
                            int.TryParse(row["ProductId"].ToString(), out num6);
                            ProductInfo product = ProductBrowser.GetProduct(MemberProcessor.GetCurrentMember(), num6);
                            if ((product != null) && (product.SaleStatus == ProductSaleStatus.OnSale))
                            {
                                row["ProductNumber"] = product.Stock.ToString();
                            }
                        }
                    }
                    string s = JsonConvert.SerializeObject(table, Formatting.Indented);
                    context.Response.Write(s);
                }
            }
        }
Exemplo n.º 2
0
 public void ProcessRequest(HttpContext context)
 {
     context.Response.ContentType = "text/plain";
     int result = 0;
     int.TryParse(context.Request.Params["id"], out result);
     if (result > 0)
     {
         int num2;
         int num3;
         PointExChangeInfo info = PointExChangeHelper.Get(result);
         string str = context.Request.Params["sort"];
         if (string.IsNullOrWhiteSpace(str))
         {
             str = "ProductId";
         }
         string str2 = context.Request.Params["order"];
         if (string.IsNullOrWhiteSpace(str2))
         {
             str2 = "asc";
         }
         if (!int.TryParse(context.Request.Params["page"], out num2))
         {
             num2 = 1;
         }
         if (!int.TryParse(context.Request.Params["size"], out num3))
         {
             num3 = 10;
         }
         if ((info.BeginDate <= DateTime.Now) && (info.EndDate >= DateTime.Now))
         {
             int num4;
             DataTable table = PointExChangeHelper.GetProducts(result, num2, num3, out num4, str, str2);
             foreach (DataRow row in table.Rows)
             {
                 if (row["ProductNumber"].ToString() == "0")
                 {
                     int num5 = 0;
                     int.TryParse(row["ProductId"].ToString(), out num5);
                     ProductInfo product = ProductBrowser.GetProduct(MemberProcessor.GetCurrentMember(), num5);
                     if ((product != null) && (product.SaleStatus == ProductSaleStatus.OnSale))
                     {
                         row["ProductNumber"] = product.Stock.ToString();
                     }
                 }
                 else
                 {
                     int num6 = 0;
                     int.TryParse(row["ProductId"].ToString(), out num6);
                     int num7 = 0;
                     int.TryParse(row["ProductNumber"].ToString(), out num7);
                     int productExchangedCount = PointExChangeHelper.GetProductExchangedCount(result, num6);
                     int num9 = ((num7 - productExchangedCount) >= 0) ? (num7 - productExchangedCount) : 0;
                     row["ProductNumber"] = num9;
                 }
             }
             string s = JsonConvert.SerializeObject(table, Formatting.Indented);
             context.Response.Write(s);
         }
     }
 }
Exemplo n.º 3
0
 private void BindProducts(int eId)
 {
     if (this.exchangeId != 0)
     {
         string  text      = this.txt_name.Text;
         string  val       = this.txt_minPrice.Text;
         string  str3      = this.txt_maxPrice.Text;
         decimal?nullable  = null;
         decimal?nullable2 = null;
         decimal i         = 0M;
         if (!this.bDecimal(val, ref i))
         {
             nullable = null;
         }
         else
         {
             nullable = new decimal?(i);
         }
         if (!this.bDecimal(str3, ref i))
         {
             nullable2 = null;
         }
         else
         {
             nullable2 = new decimal?(i);
         }
         ProductQuery entity = new ProductQuery {
             Keywords    = text,
             ProductCode = "",
             CategoryId  = null,
             PageSize    = this.pager.PageSize,
             PageIndex   = this.pager.PageIndex,
             SortOrder   = SortAction.Desc,
             SortBy      = "DisplaySequence",
             StartDate   = null,
             BrandId     = null,
             EndDate     = null,
             TypeId      = null,
             SaleStatus  = this.status,
             minPrice    = nullable,
             maxPrice    = nullable2,
             selectQuery = string.Format(" ProductId  in (  select ProductId from Hishop_PointExChange_Products where exChangeId={0})", this.exchangeId)
         };
         Globals.EntityCoding(entity, true);
         DbQueryResult products = ProductHelper.GetProducts(entity);
         DataTable     data     = (DataTable)products.Data;
         data.Columns.Add("ProductNumber");
         data.Columns.Add("PointNumber");
         data.Columns.Add("eachMaxNumber");
         data.Columns.Add("status");
         data.Columns.Add("seledStatus");
         data.Columns.Add("canSelStatus");
         data.Columns.Add("canChkStatus");
         DataTable table2 = PointExChangeHelper.GetProducts(this.exchangeId);
         if ((data != null) && (data.Rows.Count > 0))
         {
             for (int j = data.Rows.Count - 1; j >= 0; j--)
             {
                 DataRow[] rowArray = table2.Select(" productId='" + data.Rows[j]["ProductId"].ToString() + "'");
                 if (rowArray.Length > 0)
                 {
                     data.Rows[j]["ProductNumber"] = rowArray[0]["ProductNumber"];
                     data.Rows[j]["PointNumber"]   = rowArray[0]["PointNumber"];
                     data.Rows[j]["eachMaxNumber"] = rowArray[0]["eachMaxNumber"];
                     data.Rows[j]["status"]        = rowArray[0]["status"];
                 }
                 else
                 {
                     data.Rows.RemoveAt(j);
                 }
             }
         }
         if (table2 != null)
         {
             if ((data.Rows.Count > 0) && (table2.Rows.Count > 0))
             {
                 for (int k = 0; k < data.Rows.Count; k++)
                 {
                     int num4 = int.Parse(data.Rows[k]["ProductId"].ToString());
                     if (table2.Select(string.Format("ProductId={0}", num4)).Length > 0)
                     {
                         data.Rows[k]["seledStatus"]  = "''";
                         data.Rows[k]["canSelStatus"] = "none";
                         data.Rows[k]["canChkStatus"] = "disabled";
                     }
                     else
                     {
                         data.Rows[k]["seledStatus"]  = "none";
                         data.Rows[k]["canSelStatus"] = "''";
                         data.Rows[k]["canChkStatus"] = string.Empty;
                     }
                 }
             }
             else if (data.Rows.Count > 0)
             {
                 for (int m = 0; m < data.Rows.Count; m++)
                 {
                     data.Rows[m]["seledStatus"]  = "none";
                     data.Rows[m]["canSelStatus"] = "''";
                     data.Rows[m]["canChkStatus"] = string.Empty;
                 }
             }
         }
         this.grdProducts.DataSource = products.Data;
         this.grdProducts.DataBind();
         this.pager.TotalRecords  = products.TotalRecords;
         this.lbSelectNumber.Text = (table2 != null) ? table2.Rows.Count.ToString() : "0";
         this.setInSaleAndStock();
     }
 }
Exemplo n.º 4
0
        private void BindProducts(int exchangeId)
        {
            if (exchangeId == 0)
            {
                return;
            }
            string  text     = this.txt_name.Text;
            string  text2    = this.txt_minPrice.Text;
            string  text3    = this.txt_maxPrice.Text;
            decimal?minPrice = null;
            decimal?maxPrice = null;
            decimal value    = 0m;

            if (!this.bDecimal(text2, ref value))
            {
                minPrice = null;
            }
            else
            {
                minPrice = new decimal?(value);
            }
            if (!this.bDecimal(text3, ref value))
            {
                maxPrice = null;
            }
            else
            {
                maxPrice = new decimal?(value);
            }
            ProductQuery productQuery = new ProductQuery
            {
                Keywords      = text,
                ProductCode   = "",
                CategoryId    = null,
                PageSize      = this.pager.PageSize,
                PageIndex     = this.pager.PageIndex,
                SortOrder     = SortAction.Desc,
                SortBy        = "DisplaySequence",
                StartDate     = null,
                BrandId       = null,
                EndDate       = null,
                TypeId        = null,
                SaleStatus    = this.status,
                minPrice      = minPrice,
                maxPrice      = maxPrice,
                TwoSaleStatus = "OnStock"
            };

            Globals.EntityCoding(productQuery, true);
            DbQueryResult products = ProductHelper.GetProducts(productQuery);

            System.Data.DataTable dataTable = (System.Data.DataTable)products.Data;
            System.Data.DataTable products2 = PointExChangeHelper.GetProducts(this.eId);
            dataTable.Columns.Add("ProductNumber");
            dataTable.Columns.Add("PointNumber");
            dataTable.Columns.Add("eachMaxNumber");
            dataTable.Columns.Add("seledStatus");
            dataTable.Columns.Add("canSelStatus");
            dataTable.Columns.Add("canChkStatus");
            if (dataTable != null && dataTable.Rows.Count > 0)
            {
                for (int i = 0; i < dataTable.Rows.Count; i++)
                {
                    dataTable.Rows[i]["ProductNumber"] = 0;
                    dataTable.Rows[i]["PointNumber"]   = 0;
                    dataTable.Rows[i]["eachMaxNumber"] = 0;
                }
            }
            if (products2 != null)
            {
                if (dataTable.Rows.Count > 0 && products2.Rows.Count > 0)
                {
                    for (int j = 0; j < dataTable.Rows.Count; j++)
                    {
                        int num = int.Parse(dataTable.Rows[j]["ProductId"].ToString());
                        if (products2.Select(string.Format("ProductId={0}", num)).Length > 0)
                        {
                            dataTable.Rows[j]["seledStatus"]  = "''";
                            dataTable.Rows[j]["canSelStatus"] = "none";
                            dataTable.Rows[j]["canChkStatus"] = "disabled";
                            PointExchangeProductInfo productInfo = PointExChangeHelper.GetProductInfo(exchangeId, num);
                            if (productInfo != null)
                            {
                                dataTable.Rows[j]["ProductNumber"] = productInfo.ProductNumber.ToString();
                                dataTable.Rows[j]["PointNumber"]   = productInfo.PointNumber.ToString();
                                dataTable.Rows[j]["eachMaxNumber"] = productInfo.EachMaxNumber.ToString();
                            }
                        }
                        else
                        {
                            dataTable.Rows[j]["seledStatus"]  = "none";
                            dataTable.Rows[j]["canSelStatus"] = "''";
                            dataTable.Rows[j]["canChkStatus"] = string.Empty;
                        }
                    }
                }
                else if (dataTable.Rows.Count > 0)
                {
                    for (int k = 0; k < dataTable.Rows.Count; k++)
                    {
                        dataTable.Rows[k]["seledStatus"]  = "none";
                        dataTable.Rows[k]["canSelStatus"] = "''";
                        dataTable.Rows[k]["canChkStatus"] = string.Empty;
                    }
                }
            }
            this.grdProducts.DataSource = products.Data;
            this.grdProducts.DataBind();
            this.pager.TotalRecords  = products.TotalRecords;
            this.lbwareNumber.Text   = products.TotalRecords.ToString();
            this.lbSelectNumber.Text = ((products2 != null) ? products2.Rows.Count.ToString() : "0");
            this.setInSale();
        }
Exemplo n.º 5
0
        public void ProcessRequest(System.Web.HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int num = 0;

            int.TryParse(context.Request.Params["id"], out num);
            if (num > 0)
            {
                PointExChangeInfo pointExChangeInfo = PointExChangeHelper.Get(num);
                string            text = context.Request.Params["sort"];
                if (string.IsNullOrWhiteSpace(text))
                {
                    text = "ProductId";
                }
                string text2 = context.Request.Params["order"];
                if (string.IsNullOrWhiteSpace(text2))
                {
                    text2 = "asc";
                }
                int pageNumber;
                if (!int.TryParse(context.Request.Params["page"], out pageNumber))
                {
                    pageNumber = 1;
                }
                int maxNum;
                if (!int.TryParse(context.Request.Params["size"], out maxNum))
                {
                    maxNum = 10;
                }
                if (pointExChangeInfo.BeginDate <= System.DateTime.Now && pointExChangeInfo.EndDate >= System.DateTime.Now)
                {
                    int num2;
                    System.Data.DataTable products = PointExChangeHelper.GetProducts(num, pageNumber, maxNum, out num2, text, text2);
                    foreach (System.Data.DataRow dataRow in products.Rows)
                    {
                        if (dataRow["ProductNumber"].ToString() == "0")
                        {
                            int productId = 0;
                            int.TryParse(dataRow["ProductId"].ToString(), out productId);
                            ProductInfo product = ProductBrowser.GetProduct(MemberProcessor.GetCurrentMember(), productId);
                            if (product != null && product.SaleStatus == ProductSaleStatus.OnSale)
                            {
                                dataRow["ProductNumber"] = product.Stock.ToString();
                            }
                        }
                        else
                        {
                            int productId2 = 0;
                            int.TryParse(dataRow["ProductId"].ToString(), out productId2);
                            int num3 = 0;
                            int.TryParse(dataRow["ProductNumber"].ToString(), out num3);
                            int productExchangedCount = PointExChangeHelper.GetProductExchangedCount(num, productId2);
                            int num4 = (num3 - productExchangedCount >= 0) ? (num3 - productExchangedCount) : 0;
                            dataRow["ProductNumber"] = num4;
                        }
                    }
                    string s = JsonConvert.SerializeObject(products, Formatting.Indented);
                    context.Response.Write(s);
                }
            }
        }