Exemple #1
0
        /// <summary>
        /// 获取物流信息
        /// </summary>
        /// <returns></returns>
        public HttpResponseMessage QueryLogisticsInfo()
        {
            HttpResponseMessage response = null;

            try
            {
                Dictionary <string, string> dic = null;
                using (var ms = new MemoryStream())
                {
                    HttpContext.Current.Request.GetBufferlessInputStream().CopyTo(ms);
                    if (ms.Length != 0)
                    {
                        dic = WebCommom.HttpRequestBodyConvertToObj <Dictionary <string, string> >(ms);//获取Request Body
                    }
                }
                if (dic.Count > 0)
                {
                    var orderCode    = dic["orderCode"];
                    var shipperCode  = dic["shipperCode"];
                    var logisticCode = dic["logisticCode"];
                    logisticsBll.Value.QueryLogisticsInfo(orderCode, shipperCode, logisticCode);
                }
            }
            catch (Exception ex)
            {
            }
            return(response);
        }
Exemple #2
0
        /// <summary>
        /// 删除品牌
        /// </summary>
        /// <returns></returns>
        public HttpResponseMessage DeleteBrand()
        {
            HttpResponseMessage response = null;

            try
            {
                var result = false;
                var str    = "";
                using (var ms = new MemoryStream())
                {
                    HttpContext.Current.Request.GetBufferlessInputStream().CopyTo(ms);
                    if (ms.Length != 0)
                    {
                        str = WebCommom.HttpRequestBodyConvertToStr(ms);//获取Request Body
                    }
                }

                if (!string.IsNullOrWhiteSpace(str))
                {
                    var bID = Convert.ToInt32(str);
                    result = bll.Value.DeleteBrand(bID);
                }

                response = WebCommom.GetResponse(result);
            }
            catch (Exception ex)
            {
            }
            return(response);
        }
Exemple #3
0
        /// <summary>
        /// 修改横幅
        /// </summary>
        /// <returns></returns>
        public HttpResponseMessage UpdateProduct()
        {
            HttpResponseMessage response = null;
            var result = false;

            try
            {
                Product product = null;
                using (var ms = new MemoryStream())
                {
                    HttpContext.Current.Request.GetBufferlessInputStream().CopyTo(ms);
                    if (ms.Length != 0)
                    {
                        product = WebCommom.HttpRequestBodyConvertToObj <Product>(ms);//获取转换后的Body
                    }
                }
                if (product != null)
                {
                    result = bll.Value.UpdateProduct(product);
                }
                if (result)//修改成功更新产品索引
                {
                    lucene.Value.IndexPath = indexPath;
                    lucene.Value.UpdateDocument(product, Utilities.GetPropertyName <Product>(f => f.PID), GetIndexField());
                }
            }
            catch (Exception ex)
            {
            }
            response = WebCommom.GetResponse(result);
            return(response);
        }
Exemple #4
0
        /// <summary>
        /// 删除横幅
        /// </summary>
        /// <returns></returns>
        public HttpResponseMessage DeleteProduct()
        {
            HttpResponseMessage response = null;
            var result = false;

            try
            {
                var pID = 0;
                var str = "";
                using (var ms = new MemoryStream())
                {
                    HttpContext.Current.Request.GetBufferlessInputStream().CopyTo(ms);
                    str = WebCommom.HttpRequestBodyConvertToStr(ms);//获取Request Body
                }

                if (!string.IsNullOrWhiteSpace(str))
                {
                    pID    = Convert.ToInt32(str);
                    result = bll.Value.DeleteProduct(pID);
                }
                if (result)
                {
                    lucene.Value.IndexPath = indexPath;
                    lucene.Value.DeleteDocument(Utilities.GetPropertyName <Product>(f => f.Name), pID.ToString());
                }
            }
            catch (Exception ex)
            {
            }
            response = WebCommom.GetResponse(result);
            return(response);
        }
Exemple #5
0
        /// <summary>
        /// 获取热销商品
        /// </summary>
        /// <returns></returns>
        public HttpResponseMessage GetHotProduct()
        {
            HttpResponseMessage response = null;

            try
            {
                var count = 0;
                var list  = new List <Product>();
                var str   = "";
                using (var ms = new MemoryStream())
                {
                    HttpContext.Current.Request.GetBufferlessInputStream().CopyTo(ms);
                    if (ms.Length != 0)
                    {
                        str = WebCommom.HttpRequestBodyConvertToStr(ms);//获取Request Body
                    }
                }
                if (!string.IsNullOrWhiteSpace(str))
                {
                    count = Convert.ToInt32(str);
                    list  = bll.Value.GetHotProduct(count);
                }
                else
                {
                    list = bll.Value.GetHotProduct();
                }

                response = WebCommom.GetJsonResponse(list);
            }
            catch (Exception ex)
            {
            }
            return(response);
        }
Exemple #6
0
        /// <summary>
        /// 根据商品ID获取商品
        /// </summary>
        /// <param name="pID">商品ID</param>
        /// <returns></returns>
        public HttpResponseMessage GetProductByID()
        {
            HttpResponseMessage response = null;
            var product = new Product();

            try
            {
                var str = "";
                using (var ms = new MemoryStream())
                {
                    HttpContext.Current.Request.GetBufferlessInputStream().CopyTo(ms);
                    if (ms.Length != 0)
                    {
                        str = WebCommom.HttpRequestBodyConvertToStr(ms);//获取Request Body
                    }
                }
                if (!string.IsNullOrWhiteSpace(str))
                {
                    var id = Convert.ToInt32(str);
                    product = bll.Value.GetProductByID(id);
                }
            }
            catch (Exception ex)
            {
            }
            response = WebCommom.GetJsonResponse(product);
            return(response);
        }
Exemple #7
0
        /// <summary>
        /// 添加商品到购物车
        /// </summary>
        /// <returns></returns>
        public HttpResponseMessage AddProductToShoppingCart()
        {
            HttpResponseMessage response = null;
            var result = false;

            try
            {
                Dictionary <string, int> dic = null;
                using (var ms = new MemoryStream())
                {
                    HttpContext.Current.Request.GetBufferlessInputStream().CopyTo(ms);
                    if (ms.Length != 0)
                    {
                        dic = WebCommom.HttpRequestBodyConvertToObj <Dictionary <string, int> >(ms);
                    }
                }
                if (dic.Count > 0)
                {
                    var userID    = dic["userID"];
                    var productID = dic["productID"];
                    var number    = dic["number"];
                    result = shoppingCartBll.Value.AddProductToShoppingCart(userID, productID, number);
                }
            }
            catch (Exception ex)
            {
            }
            response = WebCommom.GetResponse(result);
            return(response);
        }
Exemple #8
0
        public HttpResponseMessage GetMessageByReceiveUid()
        {
            HttpResponseMessage result = null;

            try
            {
                string str = "";
                using (var ms = new MemoryStream())
                {
                    HttpContext.Current.Request.GetBufferlessInputStream().CopyTo(ms);
                    if (ms.Length != 0)
                    {
                        str = WebCommom.HttpRequestBodyConvertToStr(ms);//获取Request Body
                    }
                }
                var ResponseArray = JsonConvert.DeserializeObject <string>(str);

                var Uid = Convert.ToInt32(ResponseArray);

                MessageTb_BLL bll = new MessageTb_BLL();


                return(WebCommom.GetJsonResponse(bll.GetMessageByReceiveUid(Uid)));
            }
            catch (Exception)
            {
            }
            return(result);
        }
Exemple #9
0
        public HttpResponseMessage ReplyMessage()
        {
            HttpResponseMessage result = null;

            try
            {
                string str = "";
                using (var ms = new MemoryStream())
                {
                    HttpContext.Current.Request.GetBufferlessInputStream().CopyTo(ms);
                    if (ms.Length != 0)
                    {
                        str = WebCommom.HttpRequestBodyConvertToStr(ms);//获取Request Body
                    }
                }

                var Item = JsonConvert.DeserializeObject <MessageTb>(str);

                MessageTb_BLL bll = new MessageTb_BLL();
                return(WebCommom.GetJsonResponse(bll.ReplyMessage(Item)));
            }
            catch (Exception)
            {
            }
            return(result);
        }
Exemple #10
0
        /// <summary>
        /// 修改品牌
        /// </summary>
        /// <returns></returns>
        public HttpResponseMessage UpdateBrand()
        {
            HttpResponseMessage response = null;

            try
            {
                Brand brand  = null;
                var   result = false;
                using (var ms = new MemoryStream())
                {
                    HttpContext.Current.Request.GetBufferlessInputStream().CopyTo(ms);
                    if (ms.Length != 0)
                    {
                        brand = WebCommom.HttpRequestBodyConvertToObj <Brand>(ms);//获取转换后的Body
                    }
                }

                if (brand != null)
                {
                    result = bll.Value.UpdateBrand(brand);
                }

                response = WebCommom.GetResponse(result);
            }
            catch (Exception ex)
            {
            }
            return(response);
        }
        public HttpResponseMessage GetUserProductConsultList()
        {
            HttpResponseMessage result = null;

            try
            {
                string str = "";
                using (var ms = new MemoryStream())
                {
                    HttpContext.Current.Request.GetBufferlessInputStream().CopyTo(ms);
                    if (ms.Length != 0)
                    {
                        str = WebCommom.HttpRequestBodyConvertToStr(ms);//获取Request Body
                    }
                }
                var Item               = JsonConvert.DeserializeObject <string[]>(str);
                int uid                = Convert.ToInt32(Item[0]);
                int pageSize           = Convert.ToInt32(Item[1]);
                int pageNumber         = Convert.ToInt32(Item[2]);
                ProductConsult_BLL bll = new ProductConsult_BLL();

                var Res = bll.GetProductConsultListByUid(uid, 0, pageSize, pageNumber);

                return(WebCommom.GetJsonResponse(Res));
            }
            catch (Exception)
            {
            }
            return(result);
        }
Exemple #12
0
        /// <summary>
        /// 添加横幅
        /// </summary>
        /// <returns></returns>
        public HttpResponseMessage AddBanner()
        {
            HttpResponseMessage response = null;

            try
            {
                Banner banner = null;
                var    result = false;
                using (var ms = new MemoryStream())
                {
                    HttpContext.Current.Request.GetBufferlessInputStream().CopyTo(ms);
                    if (ms.Length != 0)
                    {
                        banner = WebCommom.HttpRequestBodyConvertToObj <Banner>(ms);
                    }
                }
                if (banner != null)
                {
                    result = bll.Value.AddBanner(banner);
                }
                response = WebCommom.GetResponse(result);
            }
            catch (Exception ex)
            {
            }
            return(response);
        }
Exemple #13
0
        public HttpResponseMessage CreatePayOrder()
        {
            HttpResponseMessage response = null;
            PayOrder            payOrder = new PayOrder();

            try
            {
                List <Order> orders = null;
                using (var ms = new MemoryStream())
                {
                    HttpContext.Current.Request.GetBufferlessInputStream().CopyTo(ms);
                    if (ms.Length != 0)
                    {
                        var cText = WebCommom.HttpRequestBodyConvertToStr(ms);//密文
                        var pText = AES.AESDecrypt(cText, AESKey);
                        orders = JsonConvert.DeserializeObject <List <Order> >(pText);
                    }
                }
                if (orders != null)
                {
                    payOrder.Orders = orders;
                    payOrder.ID     = payOrderBll.Value.CreatePayOrder(payOrder);
                }
            }
            catch (Exception ex)
            {
            }
            var responseCText = AES.AESEncrypt(JsonConvert.SerializeObject(payOrder), AESKey);//返回密文

            response = WebCommom.GetResponse(responseCText);
            return(response);
        }
Exemple #14
0
        /// <summary>
        /// 删除购物车商品
        /// </summary>
        /// <returns></returns>
        public HttpResponseMessage DeleteShoppingCartProduct()
        {
            HttpResponseMessage response = null;

            try
            {
                var pID    = new List <int>();
                var result = shoppingCartBll.Value.DeleteShoppingCartProduct(pID);
                response = WebCommom.GetResponse(result);
            }
            catch (Exception ex)
            {
            }
            return(response);
        }
Exemple #15
0
        /// <summary>
        /// 根据商品ID获取商品
        /// </summary>
        /// <param name="pID">商品ID</param>
        /// <returns></returns>
        public HttpResponseMessage GetProduct()
        {
            HttpResponseMessage response = null;
            var products = new List <Product>();

            try
            {
                products = bll.Value.GetProduct();
            }
            catch (Exception ex)
            {
            }
            response = WebCommom.GetJsonResponse(products);
            return(response);
        }
Exemple #16
0
        /// <summary>
        /// 根据用户ID获取购物车商品
        /// </summary>
        /// <returns></returns>
        public HttpResponseMessage GetShoppingCartByUserID()
        {
            HttpResponseMessage response = null;

            try
            {
                var userID = 0;
                var list   = shoppingCartBll.Value.GetShoppingCartByUserID(userID);
                var result = JsonConvert.SerializeObject(list);
                response = WebCommom.GetJsonResponse(result);
            }
            catch (Exception ex)
            {
            }
            return(response);
        }
Exemple #17
0
        /// <summary>
        /// 添加商品评论
        /// </summary>
        /// <returns></returns>
        public HttpResponseMessage AddProductReview()
        {
            HttpResponseMessage response = null;
            var result = false;

            try
            {
                var review = WebCommom.HttpRequestBodyConvertToObj <ProductReview>(HttpContext.Current);
                result = reviewBll.Value.AddProductReview(review);
            }
            catch (Exception ex)
            {
            }
            response = WebCommom.GetResponse(result);
            return(response);
        }
Exemple #18
0
        public HttpResponseMessage GetProductReviewByProductID()
        {
            HttpResponseMessage  response = null;
            List <ProductReview> list     = null;

            try
            {
                var pID = WebCommom.HttpRequestBodyConvertToObj <int>(HttpContext.Current);
                list = reviewBll.Value.GetProductReviewByProductID(pID);
            }
            catch (Exception ex)
            {
            }
            response = WebCommom.GetResponse(list);
            return(response);
        }
Exemple #19
0
        /// <summary>
        /// 获取所有商品
        /// </summary>
        /// <returns>所有商品</returns>
        public HttpResponseMessage SearchProduct()
        {
            HttpResponseMessage  response   = null;
            PageResult <Product> pageResult = new PageResult <Product>();

            try
            {
                var      searchKey = "";
                var      pageIndex = 0;
                var      pageSize  = 0;
                string[] arr       = new string[5];
                using (var ms = new MemoryStream())
                {
                    HttpContext.Current.Request.GetBufferlessInputStream().CopyTo(ms);
                    if (ms.Length != 0)
                    {
                        arr = WebCommom.HttpRequestBodyConvertToObj <string[]>(ms);//获取Request Body
                    }
                }
                if (arr.Length > 0)
                {
                    var totalCount = 0;
                    searchKey = Convert.ToString(arr[0]);
                    pageIndex = Convert.ToInt32(arr[1]);
                    pageSize  = Convert.ToInt32(arr[2]);
                    lucene.Value.IndexPath = indexPath;
                    var products = new List <Product>();
                    if (arr.Length == 3)
                    {
                        products = lucene.Value.SearchFromIndexData <Product>(searchKey, pageIndex, pageSize, out totalCount, Utilities.GetPropertyName <Product>(f => f.Name));
                    }
                    pageResult = new PageResult <Product>
                    {
                        ResultList = products,
                        TotalCount = totalCount,
                        PageIndex  = pageSize
                    };
                }
            }
            catch (Exception ex)
            {
            }
            response = WebCommom.GetJsonResponse(pageResult);
            return(response);
        }
Exemple #20
0
        public HttpResponseMessage UpdatePayOrder()
        {
            HttpResponseMessage response = null;
            var result = false;

            try
            {
                PayOrder payOrder = new PayOrder();
                using (var ms = new MemoryStream())
                {
                    HttpContext.Current.Request.GetBufferlessInputStream().CopyTo(ms);
                    if (ms.Length != 0)
                    {
                        var cText = WebCommom.HttpRequestBodyConvertToStr(ms);//密文
                        var pText = AES.AESDecrypt(cText, AESKey);
                        payOrder = JsonConvert.DeserializeObject <PayOrder>(pText);
                    }
                }
                result = payOrderBll.Value.UdpatePayOrder(payOrder);
                #region   如果支付成功则通知店家发货(此处可改为异步处理)
                if (payOrder.TradeStatus == "")
                {
                    for (int i = 0; i < payOrder.Orders.Count; i++)
                    {
                        var storeStaff = storeStaffBll.Value.GetReceiveDeliveryStaff(payOrder.Orders[i].BuyProduct.Store.StoreID);
                        var phoneList  = new List <string>();
                        for (int j = 0; j < storeStaff.Count; j++)
                        {
                            phoneList.Add(storeStaff[j].Phone);
                        }
                        SMS sms = new SMS {
                        };
                        //  sms.ReceiveNo = phoneList;
                        //   sms.MSGContent = "";
                        CommomClass.HttpPost(GlobalDictionary.GetSysConfVal("AccountApiAddr"), JsonConvert.SerializeObject(sms));//通知店铺员工发货
                    }
                }
                #endregion
            }
            catch (Exception ex)
            {
            }
            response = WebCommom.GetResponse(result);
            return(response);
        }
Exemple #21
0
        public HttpResponseMessage GetProductByStore()
        {
            HttpResponseMessage response = null;
            List <Product>      list     = null;

            try
            {
                var storeID = WebCommom.HttpRequestBodyConvertToObj <int>(HttpContext.Current);
                if (storeID != 0)
                {
                    list = bll.Value.GetProductByStore(storeID);
                }
            }
            catch (Exception ex)
            {
            }
            response = WebCommom.GetJsonResponse(list);
            return(response);
        }
Exemple #22
0
        public HttpResponseMessage CreateOrder()
        {
            List <Order>        resultList = new List <Order>();//创建成功的订单
            HttpResponseMessage response   = null;

            try
            {
                List <Order> list = null;
                using (var ms = new MemoryStream())
                {
                    HttpContext.Current.Request.GetBufferlessInputStream().CopyTo(ms);
                    if (ms.Length != 0)
                    {
                        var cText = WebCommom.HttpRequestBodyConvertToStr(ms); //密文
                        var pText = AES.AESDecrypt(cText, AESKey);             //明文
                        list = JsonConvert.DeserializeObject <List <Order> >(pText);
                    }
                }
                if (list != null)
                {
                    //  ProductStock_Cache p = new ProductStock_Cache();
                    //   var updateResult = p.UdpateStock(0, GetUpdateProdcut(list));//修改结果
                    //   resultList = GetSuccessOrder(updateResult, list);//获取修改成功的订单
                    #region 将订单加入到MQ,订单加入MQ之后则代表创建成功
                    //if (resultList.Count > 0)
                    //{
                    //    YunXiu.Commom.MQ.MSMQ mq = new YunXiu.Commom.MQ.MSMQ();
                    //    mq.MSMQIP = "192.168.9.32";
                    //    mq.MSMQName = "OrderQueue";
                    //    mq.MSG = JsonConvert.SerializeObject(resultList);
                    //    mq.SendToMSMQ();
                    //}
                    #endregion
                }
            }
            catch (Exception ex)
            {
            }
            var responseCText = AES.AESEncrypt(JsonConvert.SerializeObject(resultList), AESKey);//结果密文
            response = WebCommom.GetResponse(responseCText);
            return(response);
        }
Exemple #23
0
        /// <summary>
        /// 根据类目获取产品
        /// </summary>
        /// <returns></returns>
        public HttpResponseMessage GetProductByCategory()
        {
            HttpResponseMessage response = null;

            try
            {
                var            count = 0;
                List <Product> list  = new List <Product>();
                var            str   = "";
                using (var ms = new MemoryStream())
                {
                    HttpContext.Current.Request.GetBufferlessInputStream().CopyTo(ms);
                    if (ms.Length != 0)
                    {
                        str = WebCommom.HttpRequestBodyConvertToStr(ms);//获取Request Body
                    }
                }
                if (!string.IsNullOrWhiteSpace(str))
                {
                    var arr    = str.Split(',');
                    var cateID = Convert.ToInt32(arr[0]);
                    if (arr.Length > 1)//Index 0是cateID,1是count
                    {
                        count = Convert.ToInt32(arr[1]);
                    }
                    var cateIDList = cateBll.Value.GetCategoryChildren(cateID);//获取cate子ID
                    if (count != 0)
                    {
                        list = bll.Value.GetProductByCate(cateIDList, count);
                    }
                    else
                    {
                        list = bll.Value.GetProductByCate(cateIDList);
                    }
                }
                response = WebCommom.GetJsonResponse(list);
            }
            catch (Exception ex)
            {
            }
            return(response);
        }
Exemple #24
0
        /// <summary>
        /// 添加商品
        /// </summary>
        /// <returns></returns>
        public HttpResponseMessage AddProduct()
        {
            HttpResponseMessage response = null;
            var result = false;

            try
            {
                Product product = null;
                var     id      = 0;//插入后返回的ID
                using (var ms = new MemoryStream())
                {
                    HttpContext.Current.Request.GetBufferlessInputStream().CopyTo(ms);
                    if (ms.Length != 0)
                    {
                        product = WebCommom.HttpRequestBodyConvertToObj <Product>(ms);
                    }
                }
                if (product != null)
                {
                    id          = bll.Value.AddProduct(product);
                    product.PID = id;
                }
                if (id != 0)
                {
                    result = true;
                }
                if (result)//更新全文索引
                {
                    lucene.Value.IndexPath = indexPath;
                    lucene.Value.CreateIndexByData <Product>(new List <Product> {
                        product
                    }, GetIndexField(), false);
                }
            }
            catch (Exception ex)
            {
            }
            response = WebCommom.GetResponse(result);
            return(response);
        }
Exemple #25
0
        public HttpResponseMessage BuyApply()
        {
            HttpResponseMessage response = null;
            var result = false;

            try
            {
                BuyApply buyApply = null;
                using (var ms = new MemoryStream())
                {
                    HttpContext.Current.Request.GetBufferlessInputStream().CopyTo(ms);
                    if (ms.Length != 0)
                    {
                        buyApply = WebCommom.HttpRequestBodyConvertToObj <BuyApply>(ms);
                    }
                }
                result = buyApplyBll.Value.CreateBuyApply(buyApply);
            }
            catch (Exception ex)
            {
            }
            response = WebCommom.GetResponse(result);
            return(response);
        }
Exemple #26
0
        /// <summary>
        /// 创建发货单
        /// </summary>
        /// <returns></returns>
        public HttpResponseMessage CreateInvoice()
        {
            HttpResponseMessage response = null;
            var result = false;

            try
            {
                Invoice invoice = null;
                using (var ms = new MemoryStream())
                {
                    HttpContext.Current.Request.GetBufferlessInputStream().CopyTo(ms);
                    if (ms.Length != 0)
                    {
                        invoice = WebCommom.HttpRequestBodyConvertToObj <Invoice>(ms);
                    }
                }
                result = invoiceBll.Value.CreateInvoice(invoice);
            }
            catch (Exception ex)
            {
            }
            response = WebCommom.GetResponse(result);
            return(response);
        }