private string GetSoldProducts(DateTime?start_modified, DateTime?end_modified, string approve_status, string q, string order_by, int page_no, int page_size)
        {
            string       format       = "{{\"products_get_response\":{{\"total_results\":\"{0}\",\"items\":{1}}}}}";
            ProductQuery productQuery = new ProductQuery
            {
                SortBy     = "DisplaySequence",
                SortOrder  = SortAction.Desc,
                PageIndex  = 1,
                PageSize   = 40,
                SaleStatus = ProductSaleStatus.All
            };

            if (start_modified.HasValue)
            {
                productQuery.StartDate = start_modified;
            }
            if (end_modified.HasValue)
            {
                productQuery.EndDate = end_modified;
            }
            if (!string.IsNullOrEmpty(q))
            {
                productQuery.Keywords = DataHelper.CleanSearchString(q);
            }
            if (!string.IsNullOrEmpty(approve_status))
            {
                ProductSaleStatus saleStatus = ProductSaleStatus.All;
                EnumDescription.GetEnumValue(approve_status, ref saleStatus);
                productQuery.SaleStatus = saleStatus;
            }
            DbQueryResult productsApiByQuery = new ProductApiDao().GetProductsApiByQuery(productQuery);

            return(string.Format(format, productsApiByQuery.TotalRecords, this.ConvertProductSold(productsApiByQuery.Data)));
        }
        private string GetProduct(int num_iid)
        {
            ProductApiDao      productApiDao = new ProductApiDao();
            product_item_model product       = productApiDao.GetProduct(num_iid);

            if (product == null)
            {
                return(OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Product_Not_Exists, "num_iid"));
            }
            product.props_name = productApiDao.GetProps(num_iid);
            product.skus       = productApiDao.GetSkus(num_iid);
            string format = "{{\"product_get_response\":{{\"item\":{0}}}}}";

            return(string.Format(format, JsonConvert.SerializeObject(product)));
        }
        private string lastUpdateProductQuantity(ProductQuantityParam param)
        {
            ProductApiDao      productApiDao = new ProductApiDao();
            product_item_model product       = productApiDao.GetProduct(param.num_iid);

            if (product == null)
            {
                return(OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Product_Not_Exists, "num_iid"));
            }
            if (productApiDao.UpdateProductQuantity(param.num_iid, param.sku_id, param.quantity, param.type) <= 0)
            {
                return(OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Product_UpdateeQuantity_Faild, "update_quantity"));
            }
            product.props_name = productApiDao.GetProps(param.num_iid);
            product.skus       = productApiDao.GetSkus(param.num_iid);
            string format = "{{\"product_get_response\":{{\"item\":{0}}}}}";

            return(string.Format(format, JsonConvert.SerializeObject(product)));
        }
        public string lastUpdateProductApproveStatus(int num_iid, string approve_status)
        {
            ProductApiDao      productApiDao = new ProductApiDao();
            product_item_model product       = productApiDao.GetProduct(num_iid);

            if (product == null)
            {
                return(OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Product_Not_Exists, "num_iid"));
            }
            if (productApiDao.UpdateProductApproveStatus(num_iid, approve_status) <= 0)
            {
                return(OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Product_ApproveStatus_Faild, "update_approve_status"));
            }
            product.approve_status = approve_status;
            product.props_name     = productApiDao.GetProps(num_iid);
            product.skus           = productApiDao.GetSkus(num_iid);
            string format = "{{\"product_get_response\":{{\"item\":{0}}}}}";

            return(string.Format(format, JsonConvert.SerializeObject(product)));
        }