示例#1
0
文件: OrderHelper.cs 项目: zwkjgs/XKD
        public static bool MondifyAddress(OrderInfo order)
        {
            ManagerHelper.CheckPrivilege(Privilege.EditOrders);
            bool result;

            if (order.CheckAction(OrderActions.MASTER_SELLER_MODIFY_DELIVER_ADDRESS))
            {
                bool flag = new OrderDao().UpdateOrder(order, null);
                if (flag)
                {
                    EventLogs.WriteOperationLog(Privilege.EditOrders, string.Format(CultureInfo.InvariantCulture, "修改了订单“{0}”的收货地址", new object[]
                    {
                        order.OrderId
                    }));
                }
                result = flag;
            }
            else
            {
                result = false;
            }
            return(result);
        }
示例#2
0
        public static bool UpdateMemberGrade(MemberGradeInfo memberGrade)
        {
            bool result;

            if (null == memberGrade)
            {
                result = false;
            }
            else
            {
                Globals.EntityCoding(memberGrade, true);
                bool flag;
                if (flag = MemberProvider.Instance().UpdateMemberGrade(memberGrade))
                {
                    EventLogs.WriteOperationLog(Privilege.EditMemberGrade, string.Format(CultureInfo.InvariantCulture, "修改了编号为 “{0}” 的会员等级", new object[]
                    {
                        memberGrade.GradeId
                    }));
                }
                result = flag;
            }
            return(result);
        }
示例#3
0
文件: OrderHelper.cs 项目: zwkjgs/XKD
        public static bool UpdateOrderPaymentType(OrderInfo order)
        {
            ManagerHelper.CheckPrivilege(Privilege.EditOrders);
            bool result;

            if (order.CheckAction(OrderActions.MASTER_SELLER_MODIFY_PAYMENT_MODE))
            {
                bool flag = new OrderDao().UpdateOrder(order, null);
                if (flag)
                {
                    EventLogs.WriteOperationLog(Privilege.EditOrders, string.Format(CultureInfo.InvariantCulture, "修改了订单“{0}”的支付方式", new object[]
                    {
                        order.OrderId
                    }));
                }
                result = flag;
            }
            else
            {
                result = false;
            }
            return(result);
        }
示例#4
0
        public static bool CreateMemberGrade(MemberGradeInfo memberGrade)
        {
            bool result;

            if (null == memberGrade)
            {
                result = false;
            }
            else
            {
                Globals.EntityCoding(memberGrade, true);
                bool flag = new MemberGradeDao().CreateMemberGrade(memberGrade);
                if (flag)
                {
                    EventLogs.WriteOperationLog(Privilege.AddMemberGrade, string.Format(CultureInfo.InvariantCulture, "添加了名为 “{0}” 的会员等级", new object[]
                    {
                        memberGrade.Name
                    }));
                }
                result = flag;
            }
            return(result);
        }
示例#5
0
        public static int DeleteProduct(string productIds, bool isDeleteImage)
        {
            ManagerHelper.CheckPrivilege(Privilege.DeleteProducts);
            if (string.IsNullOrEmpty(productIds))
            {
                return(0);
            }
            string[]    strArray = productIds.Split(new char[] { ',' });
            IList <int> list     = new List <int>();

            foreach (string str in strArray)
            {
                list.Add(int.Parse(str));
            }
            IList <ProductInfo> products = new ProductDao().GetProducts(list);
            int num = new ProductDao().DeleteProduct(productIds);

            if (num > 0)
            {
                EventLogs.WriteOperationLog(Privilege.DeleteProducts, string.Format(CultureInfo.InvariantCulture, "删除了 “{0}” 件商品", new object[] { list.Count }));
                if (!isDeleteImage)
                {
                    return(num);
                }
                foreach (ProductInfo info in products)
                {
                    try
                    {
                        DeleteProductImage(info);
                    }
                    catch
                    {
                    }
                }
            }
            return(num);
        }
        public static int AddStore(StoreManagementInfo supplierInfo)
        {
            int result;

            if (supplierInfo == null)
            {
                result = 0;
            }
            else
            {
                StoreManagementDao SupplierDao = new StoreManagementDao();
                Globals.EntityCoding(supplierInfo, true);
                int num = SupplierDao.AddStore(supplierInfo);
                if (num > 0)
                {
                    EventLogs.WriteOperationLog(Privilege.StoreAdd, string.Format(CultureInfo.InvariantCulture, "创建了一个新的门店:”{0}”", new object[]
                    {
                        supplierInfo.StoreName
                    }));
                }
                result = num;
            }
            return(result);
        }
        public static bool UpdateStore(StoreManagementInfo supplierInfo)
        {
            bool result;

            if (supplierInfo == null)
            {
                result = false;
            }
            else
            {
                StoreManagementDao SupplierDao = new StoreManagementDao();
                Globals.EntityCoding(supplierInfo, true);
                bool flag = SupplierDao.UpdateStore(supplierInfo);
                if (flag)
                {
                    EventLogs.WriteOperationLog(Privilege.SupplierEdit, string.Format(CultureInfo.InvariantCulture, "修改了编号为”{0}”的门店", new object[]
                    {
                        supplierInfo.StoreId
                    }));
                }
                result = flag;
            }
            return(result);
        }
示例#8
0
        public static bool AddBalance(BalanceDetailInfo balanceDetails, decimal money)
        {
            bool result;

            if (null == balanceDetails)
            {
                result = false;
            }
            else
            {
                bool flag;
                if (flag = MemberProvider.Instance().InsertBalanceDetail(balanceDetails))
                {
                    Users.ClearUserCache(Users.GetUser(balanceDetails.UserId));
                }
                EventLogs.WriteOperationLog(Privilege.MemberAccount, string.Format(CultureInfo.InvariantCulture, "给会员\"{0}\"添加预付款\"{1}\"", new object[]
                {
                    balanceDetails.UserName,
                    money
                }));
                result = flag;
            }
            return(result);
        }
        public static bool UpdateProductType(ProductTypeInfo productType)
        {
            if (productType == null)
            {
                return(false);
            }
            ProductTypeDao productTypeDao = new ProductTypeDao();

            Globals.EntityCoding(productType, true);
            bool flag = productTypeDao.Update(productType, null);

            if (flag)
            {
                if (productTypeDao.DeleteProductTypeBrands(productType.TypeId))
                {
                    productTypeDao.AddProductTypeBrands(productType.TypeId, productType.Brands);
                }
                EventLogs.WriteOperationLog(Privilege.EditProductType, string.Format(CultureInfo.InvariantCulture, "修改了编号为”{0}”的商品类型", new object[1]
                {
                    productType.TypeId
                }), false);
            }
            return(flag);
        }
示例#10
0
        public static CategoryActionStatus AddCategory(CategoryInfo category)
        {
            CategoryActionStatus result;

            if (null == category)
            {
                result = CategoryActionStatus.UnknowError;
            }
            else
            {
                Globals.EntityCoding(category, true);
                int num = new CategoryDao().CreateCategory(category);
                if (num > 0)
                {
                    EventLogs.WriteOperationLog(Privilege.AddProductCategory, string.Format(CultureInfo.InvariantCulture, "创建了一个新的店铺分类:”{0}”", new object[]
                    {
                        category.Name
                    }));
                    HiCache.Remove("DataCache-Categories");
                }
                result = CategoryActionStatus.Success;
            }
            return(result);
        }
示例#11
0
        public static bool SendGoods(OrderInfo order)
        {
            ManagerHelper.CheckPrivilege(Privilege.OrderSendGoods);
            bool result = false;

            if (order.CheckAction(OrderActions.SELLER_SEND_GOODS))
            {
                order.OrderStatus = OrderStatus.SellerAlreadySent;
                if (result = (SalesProvider.Instance().SendGoods(order) > 0))
                {
                    if (order.Gateway.ToLower() == "hishop.plugins.payment.podrequest")
                    {
                        SalesProvider.Instance().UpdatePayOrderStock(order.OrderId);
                        SalesProvider.Instance().UpdateProductSaleCounts(order.LineItems);
                        OrderHelper.UpdateUserAccount(order);
                    }
                    EventLogs.WriteOperationLog(Privilege.OrderSendGoods, string.Format(CultureInfo.InvariantCulture, "发货编号为\"{0}\"的订单", new object[]
                    {
                        order.OrderId
                    }));
                }
            }
            return(result);
        }
示例#12
0
        public static int AddProductType(ProductTypeInfo productType)
        {
            if (productType == null)
            {
                return(0);
            }
            ProductTypeDao productTypeDao = new ProductTypeDao();

            Globals.EntityCoding(productType, true);
            int num = (int)productTypeDao.Add(productType, null);

            if (num > 0)
            {
                if (productType.Brands.Count > 0)
                {
                    productTypeDao.AddProductTypeBrands(num, productType.Brands);
                }
                EventLogs.WriteOperationLog(Privilege.AddProductType, string.Format(CultureInfo.InvariantCulture, "创建了一个新的商品类型:”{0}”", new object[1]
                {
                    productType.TypeName
                }), false);
            }
            return(num);
        }
示例#13
0
        public static bool CheckPurchaseReturn(string purchaseOrderId, string Operator, decimal refundMoney, string adminRemark, int refundType, bool accept)
        {
            ManagerHelper.CheckPrivilege(Privilege.PurchaseOrderReturnsApply);
            PurchaseOrderInfo purchaseOrder = SalesHelper.GetPurchaseOrder(purchaseOrderId);
            bool result;

            if (purchaseOrder.PurchaseStatus != OrderStatus.ApplyForReturns)
            {
                result = false;
            }
            else
            {
                bool flag;
                if (flag = SalesProvider.Instance().CheckPurchaseReturn(purchaseOrderId, Operator, refundMoney, adminRemark, refundType, accept))
                {
                    EventLogs.WriteOperationLog(Privilege.PurchaseorderRefund, string.Format(CultureInfo.InvariantCulture, "对编号为\"{0}\"的采购单退货", new object[]
                    {
                        purchaseOrderId
                    }));
                }
                result = flag;
            }
            return(result);
        }
示例#14
0
        public static CategoryActionStatus UpdateCategory(CategoryInfo category)
        {
            CategoryActionStatus result;

            if (null == category)
            {
                result = CategoryActionStatus.UnknowError;
            }
            else
            {
                Globals.EntityCoding(category, true);
                CategoryActionStatus categoryActionStatus = new CategoryDao().UpdateCategory(category);
                if (categoryActionStatus == CategoryActionStatus.Success)
                {
                    EventLogs.WriteOperationLog(Privilege.EditProductCategory, string.Format(CultureInfo.InvariantCulture, "修改了编号为 “{0}” 的商品分类", new object[]
                    {
                        category.CategoryId
                    }));
                    HiCache.Remove("DataCache-Categories");
                }
                result = categoryActionStatus;
            }
            return(result);
        }
示例#15
0
        public static ProductActionStatus UpdateProduct(ProductInfo product, Dictionary <string, SKUItem> skus, Dictionary <int, IList <int> > attrs, IList <int> tagIds)
        {
            if (product == null)
            {
                return(ProductActionStatus.UnknowError);
            }
            Globals.EntityCoding(product, true);
            int decimalLength = SettingsManager.GetMasterSettings(true).DecimalLength;

            if (product.MarketPrice.HasValue)
            {
                product.MarketPrice = new decimal?(Math.Round(product.MarketPrice.Value, decimalLength));
            }
            ProductActionStatus unknowError = ProductActionStatus.UnknowError;

            using (DbConnection connection = DatabaseFactory.CreateDatabase().CreateConnection())
            {
                connection.Open();
                DbTransaction dbTran = connection.BeginTransaction();
                try
                {
                    ProductDao dao = new ProductDao();
                    if (!dao.UpdateProduct(product, dbTran))
                    {
                        dbTran.Rollback();
                        return(ProductActionStatus.DuplicateSKU);
                    }
                    if (!dao.DeleteProductSKUS(product.ProductId, dbTran))
                    {
                        dbTran.Rollback();
                        return(ProductActionStatus.SKUError);
                    }
                    if (((skus != null) && (skus.Count > 0)) && !dao.AddProductSKUs(product.ProductId, skus, dbTran))
                    {
                        dbTran.Rollback();
                        return(ProductActionStatus.SKUError);
                    }
                    if (!dao.AddProductAttributes(product.ProductId, attrs, dbTran))
                    {
                        dbTran.Rollback();
                        return(ProductActionStatus.AttributeError);
                    }
                    if (!new TagDao().DeleteProductTags(product.ProductId, dbTran))
                    {
                        dbTran.Rollback();
                        return(ProductActionStatus.ProductTagEroor);
                    }
                    if ((tagIds.Count > 0) && !new TagDao().AddProductTags(product.ProductId, tagIds, dbTran))
                    {
                        dbTran.Rollback();
                        return(ProductActionStatus.ProductTagEroor);
                    }
                    dbTran.Commit();
                    unknowError = ProductActionStatus.Success;
                }
                catch (Exception)
                {
                    dbTran.Rollback();
                }
                finally
                {
                    connection.Close();
                }
            }
            if (unknowError == ProductActionStatus.Success)
            {
                EventLogs.WriteOperationLog(Privilege.EditProducts, string.Format(CultureInfo.InvariantCulture, "修改了编号为 “{0}” 的商品", new object[] { product.ProductId }));
            }
            return(unknowError);
        }
示例#16
0
        private void btnCreateReport_Click(object sender, System.EventArgs e)
        {
            DbQueryResult balanceDetailsNoPage = MemberHelper.GetBalanceDetailsNoPage(new BalanceDetailQuery
            {
                FromDate  = this.dateStart,
                ToDate    = this.dateEnd,
                SortBy    = "TradeDate",
                SortOrder = SortAction.Desc,
                UserName  = this.userName
            });
            string text = string.Empty;

            text += "用户名";
            text += ",交易时间";
            text += ",业务摘要";
            text += ",转入金额";
            text += ",转出金额";
            text += ",当前余额\r\n";
            foreach (System.Data.DataRow dataRow in ((System.Data.DataTable)balanceDetailsNoPage.Data).Rows)
            {
                string str = string.Empty;
                switch (System.Convert.ToInt32(dataRow["TradeType"]))
                {
                case 1:
                    str = "自助充值";
                    break;

                case 2:
                    str = "后台加款";
                    break;

                case 3:
                    str = "消费";
                    break;

                case 4:
                    str = "提现";
                    break;

                case 5:
                    str = "订单退款";
                    break;

                default:
                    str = "其他";
                    break;
                }
                text += dataRow["UserName"];
                text  = text + "," + dataRow["TradeDate"];
                text  = text + "," + str;
                text  = text + "," + dataRow["Income"];
                text  = text + "," + dataRow["Expenses"];
                object obj = text;
                text = string.Concat(new object[]
                {
                    obj,
                    ",",
                    dataRow["Balance"],
                    "\r\n"
                });
            }
            this.Page.Response.Clear();
            this.Page.Response.Buffer  = false;
            this.Page.Response.Charset = "GB2312";
            //this.Page.Response.AppendHeader("Content-Disposition", "attachment;filename=BalanceDetailsStatistics.csv");
            if (!(this.calendarStart.SelectedDate.HasValue && this.calendarEnd.SelectedDate.HasValue))
            {
                this.Page.Response.AppendHeader("Content-Disposition", "attachment;filename=会员预付款报表.csv");
            }
            else
            {
                this.Page.Response.AppendHeader("Content-Disposition", "attachment;filename=会员预付款报表_" + this.dateStart.Value.ToString("yyyyMMdd") + "-" + this.dateEnd.Value.ToString("yyyyMMdd") + ".csv");
            }
            this.Page.Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
            this.Page.Response.ContentType     = "application/octet-stream";
            this.Page.EnableViewState          = false;
            this.Page.Response.Write(text);

            EventLogs.WriteOperationLog(Privilege.MemberAccount, string.Format(CultureInfo.InvariantCulture, "用户{0},会员为{1}生成预付款信息报告成功", new object[]
            {
                this.User.Identity.Name,
                this.userName
            }));

            this.Page.Response.End();
        }
        private void btnCreateReport_Click(object sender, System.EventArgs e)
        {
            ManagerHelper.CheckPrivilege(Privilege.ReconciOrdersDetailsExcel);
            string startDate = this.calendarStart.SelectedDate.ToString();
            string EndSdate  = this.calendarEnd.SelectedDate.ToString();

            if (string.IsNullOrEmpty(startDate) || string.IsNullOrEmpty(EndSdate))
            {
                this.ShowMsg("起止时间不能为空!", false);
                return;
            }

            System.TimeSpan ND   = Convert.ToDateTime(EndSdate) - Convert.ToDateTime(startDate);
            double          mday = ND.Days;

            if (mday > 31)
            {
                this.ShowMsg("查询起止时间不能大于31天!", false);
                return;
            }
            //获取搜索所有数据 PageIndex=0 为获取所有数据
            DbQueryResult ExpressFeeDetails = MemberHelper.GetReconciliationExpressFeeDetails(new ReconciliationExpressFeeQuery
            {
                BeginTime = !this.dateStart.HasValue ? "" : this.dateStart.Value.ToString("yyyy-MM-dd HH:mm:ss"),
                EndTime   = !this.dateEnd.HasValue ? "" : (this.dateEnd.Value.ToString("yyyy-MM-dd") + " 23:59:59"),
                PageIndex = 0,
                PageSize  = 0,
                Supplier  = int.Parse(string.IsNullOrWhiteSpace(this.sysupperId) ? "0" : this.sysupperId)
            });
            DataTable dtResult = (DataTable)ExpressFeeDetails.Data;

            if (dtResult == null || dtResult.Rows.Count == 0)
            {
                this.ShowMsg("没有数据!", false);
                return;
            }
            foreach (DataColumn cl in dtResult.Columns)
            {
                if (cl.ColumnName == "OrderId")
                {
                    cl.ColumnName = "子订单编号";
                }
                else if (cl.ColumnName == "SupplierName")
                {
                    cl.ColumnName = "供应商";
                }
                else if (cl.ColumnName == "SourceOrderId")
                {
                    cl.ColumnName = "订单号";
                }
                else if (cl.ColumnName == "TradingTime")
                {
                    cl.ColumnName = "交易时间";
                }
                else if (cl.ColumnName == "ExpressCompanyName")
                {
                    cl.ColumnName = "快递公司";
                }
                else if (cl.ColumnName == "ShipOrderNumber")
                {
                    cl.ColumnName = "快递单号";
                }
                else if (cl.ColumnName.ToLower().Trim() == "shippingdate")
                {
                    cl.ColumnName = "发货时间";
                }
                else if (cl.ColumnName.ToLower().Trim() == "adjustedfreight")
                {
                    cl.ColumnName = "快递费用";
                }
            }
            MemoryStream ms = NPOIExcelHelper.ExportToExcel(dtResult, "快递费用报表明细");


            this.Page.Response.Clear();
            this.Page.Response.Buffer  = false;
            this.Page.Response.Charset = "GB2312";
            //this.Page.Response.AppendHeader("Content-Disposition", "attachment;filename=ReconciliationOrdersDetailed.xlsx");

            if (!(this.calendarStart.SelectedDate.HasValue && this.calendarEnd.SelectedDate.HasValue))
            {
                this.Page.Response.AppendHeader("Content-Disposition", "attachment;filename=快递费用报表明细.xlsx");
            }
            else
            {
                this.Page.Response.AppendHeader("Content-Disposition", "attachment;filename=快递费用报表明细_" + this.dateStart.Value.ToString("yyyyMMdd") + "-" + this.dateEnd.Value.ToString("yyyyMMdd") + ".xlsx");
            }
            this.Page.Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
            this.Page.Response.ContentType     = "application/octet-stream";
            this.Page.EnableViewState          = false;
            this.Page.Response.BinaryWrite(ms.ToArray());
            ms.Dispose();
            ms.Close();
            EventLogs.WriteOperationLog(Privilege.ReconciOrdersDetailsExcel, string.Format(CultureInfo.InvariantCulture, "用户{0}生成对快递费用明细报告成功", new object[]
            {
                this.User.Identity.Name
            }));

            this.Page.Response.End();
        }
示例#18
0
        private void btnCreateReport_Click(object sender, System.EventArgs e)
        {
            ManagerHelper.CheckPrivilege(Privilege.ReconciOrdersExcel);
            string startDate = this.calendarStart.SelectedDate.ToString();
            string EndSdate  = this.calendarEnd.SelectedDate.ToString();

            if (string.IsNullOrEmpty(startDate) || string.IsNullOrEmpty(EndSdate))
            {
                this.ShowMsg("起止时间不能为空!", false);
                return;
            }

            System.TimeSpan ND   = Convert.ToDateTime(EndSdate) - Convert.ToDateTime(startDate);
            double          mday = ND.Days;

            if (mday > 31)
            {
                this.ShowMsg("查询起止时间不能大于31天!", false);
                return;
            }
            DbQueryResult balanceDetailsNoPage = MemberHelper.ExportReconciliationOrders(new ReconciliationOrdersQuery
            {
                StartDate = this.dateStart,
                EndDate   = this.dateEnd,
                SortBy    = "TradingTime",
                SortOrder = SortAction.Desc,
            });
            DataTable dtResult = (DataTable)balanceDetailsNoPage.Data;

            if (dtResult == null || dtResult.Rows.Count == 0)
            {
                this.ShowMsg("没有数据!", false);
                return;
            }
            MemoryStream ms = NPOIExcelHelper.ExportToExcel(dtResult, "对账单");


            this.Page.Response.Clear();
            this.Page.Response.Buffer  = false;
            this.Page.Response.Charset = "GB2312";
            //this.Page.Response.AppendHeader("Content-Disposition", "attachment;filename=ReconciliationOrders.xlsx");
            if (!(this.calendarStart.SelectedDate.HasValue && this.calendarEnd.SelectedDate.HasValue))
            {
                this.Page.Response.AppendHeader("Content-Disposition", "attachment;filename=对账订单报表.xlsx");
            }
            else
            {
                this.Page.Response.AppendHeader("Content-Disposition", "attachment;filename=对账订单报表_" + this.dateStart.Value.ToString("yyyyMMdd") + "-" + this.dateEnd.Value.ToString("yyyyMMdd") + ".xlsx");
            }
            this.Page.Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
            this.Page.Response.ContentType     = "application/octet-stream";
            this.Page.EnableViewState          = false;
            this.Page.Response.BinaryWrite(ms.ToArray());
            ms.Dispose();
            ms.Close();
            EventLogs.WriteOperationLog(Privilege.ReconciOrdersExcel, string.Format(CultureInfo.InvariantCulture, "用户{0}生成的对账订单报告成功", new object[]
            {
                this.User.Identity.Name
            }));
            this.Page.Response.End();

            StringBuilder sbstr = new StringBuilder();

            string orderid = string.Empty;

            string text = string.Empty;

            sbstr.Append("付款日期");
            sbstr.Append(",订单号");
            sbstr.Append(",实际金额");
            sbstr.Append(",收款金额");
            sbstr.Append(",退款金额");
            sbstr.Append(",买家昵称");
            sbstr.Append(",拍单时间");
            sbstr.Append(",付款时间");
            sbstr.Append(",商品总金额");
            sbstr.Append(",订单金额");
            sbstr.Append(",优惠金额");
            sbstr.Append(",运费");
            sbstr.Append(",税额");
            sbstr.Append(",优惠券");
            sbstr.Append(",现金劵");
            sbstr.Append(",货到付款服务费");
            sbstr.Append(",订单备注");
            sbstr.Append(",买家留言");
            sbstr.Append(",收货地址");
            sbstr.Append(",收货人名称");
            sbstr.Append(",收货国家");
            sbstr.Append(",州/省");
            sbstr.Append(",城市");
            sbstr.Append(",区");
            sbstr.Append(",邮编");
            sbstr.Append(",联系电话");
            sbstr.Append(",手机");
            sbstr.Append(",买家选择物流");
            sbstr.Append(",最晚发货时间");
            sbstr.Append(",海外订单");
            sbstr.Append(",是否货到付款");
            sbstr.Append(",订单状态");
            sbstr.Append(",发货快递单号");
            sbstr.Append(",快递公司");
            sbstr.Append(",货主Id");
            sbstr.Append(",货主名称\r\n");
            foreach (System.Data.DataRow dataRow in ((System.Data.DataTable)balanceDetailsNoPage.Data).Rows)
            {
                sbstr.Append(dataRow["TradingTime"]);
                sbstr.AppendFormat(",\"\t{0}\"", dataRow["OrderId"]);
                sbstr.AppendFormat(",{0}", dataRow["ActualAmount"]);
                sbstr.AppendFormat(",{0}", dataRow["TotalAmount"]);
                sbstr.AppendFormat(",{0}", dataRow["RefundAmount"]);
                sbstr.AppendFormat(",{0}", dataRow["RealName"]);
                sbstr.AppendFormat(",{0}", dataRow["OrderDate"]);
                sbstr.AppendFormat(",{0}", dataRow["PayDate"]);
                sbstr.AppendFormat(",{0}", dataRow["Amount"]);
                sbstr.AppendFormat(",{0}", dataRow["OrderTotal"]);
                sbstr.AppendFormat(",{0}", dataRow["DiscountAmount"]);
                sbstr.AppendFormat(",{0}", dataRow["AdjustedFreight"]);
                sbstr.AppendFormat(",{0}", dataRow["Tax"]);
                sbstr.AppendFormat(",{0}", dataRow["CouponValue"]);
                sbstr.AppendFormat(",{0}", dataRow["VoucherValue"]);
                sbstr.AppendFormat(",{0}", dataRow["PayCharge"]);

                sbstr.AppendFormat(",\"{0}\"", dataRow["ManagerRemark"]);
                sbstr.AppendFormat(",\"{0}\"", dataRow["Remark"]);
                sbstr.AppendFormat(",\"{0}\"", dataRow["Address"]);
                sbstr.AppendFormat(",\"{0}\"", dataRow["ShipTo"]);
                sbstr.AppendFormat(",\"{0}\"", dataRow["Country"]);
                sbstr.AppendFormat(",\"{0}\"", dataRow["Province"]);
                sbstr.AppendFormat(",\"{0}\"", dataRow["City"]);
                sbstr.AppendFormat(",\"{0}\"", dataRow["Area"]);
                sbstr.AppendFormat(",\"\t{0}\"", dataRow["ZipCode"]);
                sbstr.AppendFormat(",\"\t{0}\"", dataRow["TelPhone"]);
                sbstr.AppendFormat(",\"\t{0}\"", dataRow["CellPhone"]);



                sbstr.AppendFormat(",\"{0}\"", dataRow["ModeName"]);
                sbstr.AppendFormat(",\"{0}\"", dataRow["LatestDelivery"]);
                sbstr.AppendFormat(",\"{0}\"", dataRow["OverseasOrders"]);
                sbstr.AppendFormat(",\"{0}\"", dataRow["CashDelivery"]);
                sbstr.AppendFormat(",\"{0}\"", dataRow["OrderStatus"]);
                sbstr.AppendFormat(",\"\t{0}\"", dataRow["ShipOrderNumber"]);
                sbstr.AppendFormat(",\"{0}\"", dataRow["ExpressCompanyName"]);
                sbstr.AppendFormat(",{0}", dataRow["ownerId"]);
                sbstr.AppendFormat(",\"{0}\"", dataRow["ownername"]);
                sbstr.Append("\r\n");
            }
            this.Page.Response.Clear();
            this.Page.Response.Buffer  = false;
            this.Page.Response.Charset = "GB2312";
            //this.Page.Response.AppendHeader("Content-Disposition", "attachment;filename=ReconciliationOrders.csv");
            if (!(this.calendarStart.SelectedDate.HasValue && this.calendarEnd.SelectedDate.HasValue))
            {
                this.Page.Response.AppendHeader("Content-Disposition", "attachment;filename=对账订单报表.csv");
            }
            else
            {
                this.Page.Response.AppendHeader("Content-Disposition", "attachment;filename=对账订单报表_" + this.dateStart.Value.ToString("yyyyMMdd") + "-" + this.dateEnd.Value.ToString("yyyyMMdd") + ".csv");
            }
            this.Page.Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
            this.Page.Response.ContentType     = "application/octet-stream";
            this.Page.EnableViewState          = false;
            this.Page.Response.Write(sbstr.ToString());
            this.Page.Response.End();
        }
示例#19
0
        private void btnCreateReport_Click(object sender, System.EventArgs e)
        {
            this.LoadParameters();
            DbQueryResult countDownList = PromoteHelper.ExprtAdOrderInfoList(new GroupBuyQuery
            {
                OrderId   = this.OrderId,
                starttime = this.StartTime.ToString(),
                endtime   = this.EndTime.ToString(),
                keyword   = this.KeyWord,
                PageIndex = this.pager.PageIndex,
                PageSize  = this.pager.PageSize,
                SortBy    = "Ordertime",
                SortOrder = SortAction.Desc
            });
            DataTable dtResult = (DataTable)countDownList.Data;

            if (dtResult == null || dtResult.Rows.Count == 0)
            {
                this.ShowMsg("没有数据!", false);
                return;
            }
            foreach (DataColumn cl in dtResult.Columns)
            {
                switch (cl.ColumnName.ToLower())
                {
                case "orderno":
                    cl.ColumnName = "订单号";
                    break;

                case "ordertotal":
                    cl.ColumnName = "订单总金额";
                    break;

                case "productname":
                    cl.ColumnName = "商品名称";
                    break;

                case "barcode":
                    cl.ColumnName = "商品条码";
                    break;

                case "sku":
                    cl.ColumnName = "Sku编码";
                    break;

                case "itemadjustedprice":
                    cl.ColumnName = "商品单价";
                    break;

                case "orderstatus":
                    cl.ColumnName = "订单状态";
                    break;

                case "paymenttype":
                    cl.ColumnName = "支付类型";
                    break;

                case "paymentstatus":
                    cl.ColumnName = "付款状态";
                    break;

                case "ordertime":
                    cl.ColumnName = "订单创建时间";
                    break;

                case "updatedate":
                    cl.ColumnName = "订单修改时间";
                    break;
                }
            }
            MemoryStream ms = NPOIExcelHelper.ExportToExcel(dtResult, "广告订单");

            this.Page.Response.Clear();
            this.Page.Response.Buffer  = false;
            this.Page.Response.Charset = "GB2312";

            this.Page.Response.AppendHeader("Content-Disposition", "attachment;filename=广告订单.xlsx");

            this.Page.Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
            this.Page.Response.ContentType     = "application/octet-stream";
            this.Page.EnableViewState          = false;
            this.Page.Response.BinaryWrite(ms.ToArray());
            ms.Dispose();
            ms.Close();
            EventLogs.WriteOperationLog(Privilege.ReconciOrdersDetailsExcel, string.Format(CultureInfo.InvariantCulture, "用户{0}广告订单导出明细成功", new object[]
            {
                this.User.Identity.Name
            }));

            this.Page.Response.End();
        }
示例#20
0
        public static bool DealBalanceDrawRequestById(int Id, bool agree, ref string sError, string reason = "")
        {
            bool       flag       = false;
            BalanceDao balanceDao = new BalanceDao();
            SupplierBalanceDrawRequestInfo supplierBalanceDrawRequestInfo = balanceDao.Get <SupplierBalanceDrawRequestInfo>(Id);

            if (supplierBalanceDrawRequestInfo == null)
            {
                return(false);
            }
            SupplierInfo supplierInfo = balanceDao.Get <SupplierInfo>(supplierBalanceDrawRequestInfo.SupplierId);
            ManagerInfo  manager      = HiContext.Current.Manager;
            string       text         = (manager == null) ? "" : manager.UserName;
            Database     database     = DatabaseFactory.CreateDatabase();

            using (DbConnection dbConnection = database.CreateConnection())
            {
                dbConnection.Open();
                DbTransaction dbTransaction = dbConnection.BeginTransaction();
                try
                {
                    if (agree)
                    {
                        if (supplierBalanceDrawRequestInfo.IsPass.HasValue)
                        {
                            sError = "已处理该条记录";
                            dbTransaction.Rollback();
                            return(false);
                        }
                        OnLinePayment onLinePayment;
                        if (supplierInfo == null)
                        {
                            sError = "未找到该用户";
                            BalanceDao balanceDao2 = balanceDao;
                            onLinePayment = OnLinePayment.PayFail;
                            flag          = balanceDao2.UpdateBalanceDrawRequest(Id, onLinePayment.GetHashCode().ToNullString(), "未找到该供应商,请拒绝该用户的请求", text);
                            if (!flag)
                            {
                                dbTransaction.Rollback();
                                return(false);
                            }
                            dbTransaction.Commit();
                            return(false);
                        }
                        string text2 = supplierBalanceDrawRequestInfo.RequestState.ToNullString().Trim();
                        onLinePayment = OnLinePayment.Paying;
                        if (text2.Equals(onLinePayment.GetHashCode().ToNullString()))
                        {
                            sError = "付款正在进行中";
                            dbTransaction.Rollback();
                            return(false);
                        }
                        if (supplierBalanceDrawRequestInfo.IsAlipay.ToBool())
                        {
                            BalanceDao balanceDao3 = balanceDao;
                            onLinePayment = OnLinePayment.Paying;
                            flag          = balanceDao3.UpdateBalanceDrawRequest(Id, onLinePayment.GetHashCode().ToNullString(), "", text);
                            if (!flag)
                            {
                                dbTransaction.Rollback();
                                return(false);
                            }
                            EventLogs.WriteOperationLog(Privilege.MemberAccount, string.Format(CultureInfo.InvariantCulture, "给供应商\"{0}\"处理提现申请(支付宝批量付款)", new object[1]
                            {
                                supplierBalanceDrawRequestInfo.SupplierId
                            }), false);
                            return(true);
                        }
                        flag = balanceDao.DeleteBalanceDrawRequestById(agree, supplierInfo.Balance, supplierBalanceDrawRequestInfo, text, dbTransaction, reason);
                        if (!flag)
                        {
                            dbTransaction.Rollback();
                            return(false);
                        }
                    }
                    else
                    {
                        flag = balanceDao.DeleteBalanceDrawRequestById(agree, supplierInfo.Balance, supplierBalanceDrawRequestInfo, text, dbTransaction, reason);
                        if (!flag)
                        {
                            dbTransaction.Rollback();
                            return(false);
                        }
                    }
                    dbTransaction.Commit();
                    EventLogs.WriteOperationLog(Privilege.MemberAccount, string.Format(CultureInfo.InvariantCulture, "给供应商\"{0}\"处理提现申请", new object[1]
                    {
                        supplierBalanceDrawRequestInfo.SupplierId
                    }), false);
                }
                catch (Exception ex)
                {
                    IDictionary <string, string> dictionary = new Dictionary <string, string>();
                    dictionary.Add("ErrorMessage", ex.Message);
                    dictionary.Add("StackTrace", ex.StackTrace);
                    if (ex.InnerException != null)
                    {
                        dictionary.Add("InnerException", ex.InnerException.ToString());
                    }
                    if (ex.GetBaseException() != null)
                    {
                        dictionary.Add("BaseException", ex.GetBaseException().Message);
                    }
                    if (ex.TargetSite != (MethodBase)null)
                    {
                        dictionary.Add("TargetSite", ex.TargetSite.ToString());
                    }
                    dictionary.Add("ExSource", ex.Source);
                    Globals.WriteLog(dictionary, "", "", "", "AcceptDraw");
                    sError = ex.Message;
                    dbTransaction.Rollback();
                }
                finally
                {
                    dbConnection.Close();
                }
                return(flag);
            }
        }
示例#21
0
        private void btnUpdateProductTags_Click(object sender, System.EventArgs e)
        {
            string text = base.Request.Form["CheckBoxGroup"];

            if (string.IsNullOrEmpty(text))
            {
                this.ShowMsg("请先选择要关联的商品", false);
                return;
            }
            System.Collections.Generic.IList <int> list = new System.Collections.Generic.List <int>();
            if (!string.IsNullOrEmpty(this.txtProductTag.Text.Trim()))
            {
                string   text2 = this.txtProductTag.Text.Trim();
                string[] array;
                if (text2.Contains(","))
                {
                    array = text2.Split(new char[]
                    {
                        ','
                    });
                }
                else
                {
                    array = new string[]
                    {
                        text2
                    };
                }
                string[] array2 = array;
                for (int i = 0; i < array2.Length; i++)
                {
                    string value = array2[i];
                    list.Add(System.Convert.ToInt32(value));
                }
            }
            string[] array3;
            if (text.Contains(","))
            {
                array3 = text.Split(new char[]
                {
                    ','
                });
            }
            else
            {
                array3 = new string[]
                {
                    text
                };
            }
            int num = 0;

            string[] array4 = array3;
            for (int j = 0; j < array4.Length; j++)
            {
                string value2 = array4[j];
                ProductHelper.DeleteProductTags(System.Convert.ToInt32(value2), null);
                if (list.Count > 0 && ProductHelper.AddProductTags(System.Convert.ToInt32(value2), list, null))
                {
                    num++;
                }
            }
            if (num > 0)
            {
                EventLogs.WriteOperationLog(Privilege.SubjectProducts, string.Format(CultureInfo.InvariantCulture, "已成功修改了{0}件商品的商品标签", new object[]
                {
                    num,
                }));
                this.ShowMsg(string.Format("已成功修改了{0}件商品的商品标签", num), true);
            }
            else
            {
                this.ShowMsg("已成功取消了商品的关联商品标签", true);
            }
            this.txtProductTag.Text = "";
        }
示例#22
0
        public static ProductActionStatus UpdateProduct(ProductInfo product, Dictionary <string, SKUItem> skus, Dictionary <int, IList <int> > attrs, IList <int> distributorUserIds)
        {
            if (null == product)
            {
                return(ProductActionStatus.UnknowError);
            }
            Globals.EntityCoding(product, true);
            int decimalLength = HiContext.Current.SiteSettings.DecimalLength;

            if (product.MarketPrice.HasValue)
            {
                product.MarketPrice = new decimal?(Math.Round(product.MarketPrice.Value, decimalLength));
            }
            product.LowestSalePrice = Math.Round(product.LowestSalePrice, decimalLength);
            ProductActionStatus unknowError = ProductActionStatus.UnknowError;

            using (DbConnection connection = DatabaseFactory.CreateDatabase().CreateConnection())
            {
                connection.Open();
                DbTransaction dbTran = connection.BeginTransaction();
                try
                {
                    ProductProvider provider = ProductProvider.Instance();
                    if (!provider.UpdateProduct(product, dbTran))
                    {
                        dbTran.Rollback();
                        return(ProductActionStatus.DuplicateSKU);
                    }
                    if (!provider.DeleteProductSKUS(product.ProductId, dbTran))
                    {
                        dbTran.Rollback();
                        return(ProductActionStatus.SKUError);
                    }
                    if (((skus != null) && (skus.Count > 0)) && !provider.AddProductSKUs(product.ProductId, skus, dbTran))
                    {
                        dbTran.Rollback();
                        return(ProductActionStatus.SKUError);
                    }
                    if (!provider.AddProductAttributes(product.ProductId, attrs, dbTran))
                    {
                        dbTran.Rollback();
                        return(ProductActionStatus.AttributeError);
                    }
                    if (!provider.OffShelfProductExcludedSalePrice(product.ProductId, product.LowestSalePrice, dbTran))
                    {
                        dbTran.Rollback();
                        return(ProductActionStatus.OffShelfError);
                    }
                    dbTran.Commit();
                    unknowError = ProductActionStatus.Success;
                }
                catch (Exception)
                {
                    dbTran.Rollback();
                }
                finally
                {
                    connection.Close();
                }
            }
            if (unknowError == ProductActionStatus.Success)
            {
                ProductProvider.Instance().DeleteSkuUnderlingPrice();
                if (product.PenetrationStatus == PenetrationStatus.Notyet)
                {
                    List <int> productIds = new List <int>();
                    productIds.Add(product.ProductId);
                    DeleteCanclePenetrationProducts(productIds, null);
                }
                if ((distributorUserIds != null) && (distributorUserIds.Count != 0))
                {
                    foreach (int num2 in distributorUserIds)
                    {
                        DeleteNotinProductLines(num2);
                    }
                }
                EventLogs.WriteOperationLog(Privilege.EditProducts, string.Format(CultureInfo.InvariantCulture, "修改了编号为 “{0}” 的商品", new object[] { product.ProductId }));
            }
            return(unknowError);
        }
示例#23
0
        private void btnCreateReport_Click(object sender, System.EventArgs e)
        {
            ManagerHelper.CheckPrivilege(Privilege.AggregatePayable);
            DbQueryResult balanceDetailsNoPage = MemberHelper.ExportReconciliationOrders(new ReconciliationOrdersQuery
            {
                StartDate = this.dateStart,
                EndDate   = this.dateEnd,
                SortBy    = "TradingTime",
                SortOrder = SortAction.Desc,
            });
            StringBuilder sbstr = new StringBuilder();

            string text = string.Empty;

            sbstr.Append("付款日期");
            sbstr.Append(",订单号");
            sbstr.Append(",实际金额");
            sbstr.Append(",收款金额");
            sbstr.Append(",退款金额");
            sbstr.Append(",买家昵称");
            sbstr.Append(",拍单时间");
            sbstr.Append(",付款时间");
            sbstr.Append(",商品总金额");
            sbstr.Append(",订单金额");
            sbstr.Append(",优惠金额");
            sbstr.Append(",运费");
            sbstr.Append(",税额");
            sbstr.Append(",货到付款服务费");
            sbstr.Append(",订单备注");
            sbstr.Append(",买家留言");
            sbstr.Append(",收货地址");
            sbstr.Append(",收货人名称");
            sbstr.Append(",收货国家");
            sbstr.Append(",州/省");
            sbstr.Append(",城市");
            sbstr.Append(",区");
            sbstr.Append(",邮编");
            sbstr.Append(",联系电话");
            sbstr.Append(",手机");
            sbstr.Append(",买家选择物流");
            sbstr.Append(",最晚发货时间");
            sbstr.Append(",海外订单");
            sbstr.Append(",是否货到付款");
            sbstr.Append(",订单状态");
            sbstr.Append(",发货快递单号");
            sbstr.Append(",快递公司");
            sbstr.Append(",货主Id");
            sbstr.Append(",货主名称\r\n");
            foreach (System.Data.DataRow dataRow in ((System.Data.DataTable)balanceDetailsNoPage.Data).Rows)
            {
                sbstr.Append(dataRow["TradingTime"]);
                sbstr.AppendFormat(",\"\t{0}\"", dataRow["OrderId"]);
                sbstr.AppendFormat(",{0}", dataRow["ActualAmount"]);
                sbstr.AppendFormat(",{0}", dataRow["TotalAmount"]);
                sbstr.AppendFormat(",{0}", dataRow["RefundAmount"]);
                sbstr.AppendFormat(",{0}", dataRow["RealName"]);
                sbstr.AppendFormat(",{0}", dataRow["OrderDate"]);
                sbstr.AppendFormat(",{0}", dataRow["PayDate"]);
                sbstr.AppendFormat(",{0}", dataRow["Amount"]);
                sbstr.AppendFormat(",{0}", dataRow["OrderTotal"]);
                sbstr.AppendFormat(",{0}", dataRow["DiscountAmount"]);
                sbstr.AppendFormat(",{0}", dataRow["AdjustedFreight"]);
                sbstr.AppendFormat(",{0}", dataRow["Tax"]);
                sbstr.AppendFormat(",{0}", dataRow["PayCharge"]);

                sbstr.AppendFormat(",\"{0}\"", dataRow["ManagerRemark"]);
                sbstr.AppendFormat(",\"{0}\"", dataRow["Remark"]);
                sbstr.AppendFormat(",\"{0}\"", dataRow["Address"]);
                sbstr.AppendFormat(",\"{0}\"", dataRow["ShipTo"]);
                sbstr.AppendFormat(",\"{0}\"", dataRow["Country"]);
                sbstr.AppendFormat(",\"{0}\"", dataRow["Province"]);
                sbstr.AppendFormat(",\"{0}\"", dataRow["City"]);
                sbstr.AppendFormat(",\"{0}\"", dataRow["Area"]);
                sbstr.AppendFormat(",\"\t{0}\"", dataRow["ZipCode"]);
                sbstr.AppendFormat(",\"\t{0}\"", dataRow["TelPhone"]);
                sbstr.AppendFormat(",\"\t{0}\"", dataRow["CellPhone"]);



                sbstr.AppendFormat(",\"{0}\"", dataRow["ModeName"]);
                sbstr.AppendFormat(",\"{0}\"", dataRow["LatestDelivery"]);
                sbstr.AppendFormat(",\"{0}\"", dataRow["OverseasOrders"]);
                sbstr.AppendFormat(",\"{0}\"", dataRow["CashDelivery"]);
                sbstr.AppendFormat(",\"{0}\"", dataRow["OrderStatus"]);
                sbstr.AppendFormat(",\"\t{0}\"", dataRow["ShipOrderNumber"]);
                sbstr.AppendFormat(",\"{0}\"", dataRow["ExpressCompanyName"]);
                sbstr.AppendFormat(",{0}", dataRow["ownerId"]);
                sbstr.AppendFormat(",\"{0}\"", dataRow["ownername"]);
                object obj = sbstr.ToString();
                text = string.Concat(new object[]
                {
                    obj,
                    ",",
                    "\r\n"
                });
            }
            this.Page.Response.Clear();
            this.Page.Response.Buffer  = false;
            this.Page.Response.Charset = "GB2312";
            this.Page.Response.AppendHeader("Content-Disposition", "attachment;filename=BalanceDetailsStatistics.csv");
            this.Page.Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
            this.Page.Response.ContentType     = "application/octet-stream";
            this.Page.EnableViewState          = false;
            this.Page.Response.Write(text);

            EventLogs.WriteOperationLog(Privilege.AggregatePayable, string.Format(CultureInfo.InvariantCulture, "用户{0}生成平台销售额及应付总汇报告成功", new object[]
            {
                this.User.Identity.Name
            }));

            this.Page.Response.End();
        }
示例#24
0
        public static bool ConfirmPay(OrderInfo order)
        {
            ManagerHelper.CheckPrivilege(Privilege.CofimOrderPay);
            bool flag = false;

            if (order.CheckAction(OrderActions.SELLER_CONFIRM_PAY))
            {
                OrderDao dao = new OrderDao();
                order.OrderStatus   = OrderStatus.BuyerAlreadyPaid;
                order.PayDate       = new DateTime?(DateTime.Now);
                order.PaymentTypeId = 0x63;
                order.PaymentType   = "线下支付";
                ManagerInfo currentManager = ManagerHelper.GetCurrentManager();
                string      str            = string.Empty;
                if (currentManager != null)
                {
                    str = string.Concat(new object[] { currentManager.UserName, "(", currentManager.UserId, ")" });
                }
                order.ManagerRemark = "管理员" + str + "后台收款";
                order.Gateway       = "hishop.plugins.payment.offlinerequest";
                flag = dao.UpdateOrder(order, null);
                string str2 = "";
                if (!flag)
                {
                    return(flag);
                }
                dao.UpdatePayOrderStock(order);
                foreach (LineItemInfo info2 in order.LineItems.Values)
                {
                    ProductDao dao2 = new ProductDao();
                    str2 = str2 + "'" + info2.SkuId + "',";
                    ProductInfo productDetails = dao2.GetProductDetails(info2.ProductId);
                    productDetails.SaleCounts     += info2.Quantity;
                    productDetails.ShowSaleCounts += info2.Quantity;
                    dao2.UpdateProduct(productDetails, null);
                }
                if (!string.IsNullOrEmpty(str2))
                {
                    dao.UpdateItemsStatus(order.OrderId, 2, str2.Substring(0, str2.Length - 1));
                }
                if (!string.IsNullOrEmpty(order.ActivitiesId))
                {
                    new ActivitiesDao().UpdateActivitiesTakeEffect(order.ActivitiesId);
                }
                MemberHelper.SetOrderDate(order.UserId, 1);
                SettingsManager.GetMasterSettings(true);
                MemberInfo member = new MemberDao().GetMember(order.UserId);
                if (VshopBrowser.IsPassAutoToDistributor(member, true))
                {
                    DistributorsBrower.MemberAutoToDistributor(member);
                }
                try
                {
                    OrderInfo info5 = order;
                    if (info5 != null)
                    {
                        Messenger.SendWeiXinMsg_OrderPay(info5);
                    }
                }
                catch (Exception)
                {
                }
                EventLogs.WriteOperationLog(Privilege.CofimOrderPay, string.Format(CultureInfo.InvariantCulture, "确认收款编号为\"{0}\"的订单", new object[] { order.OrderId }));
            }
            return(flag);
        }
示例#25
0
        public static bool AddOrderGift(OrderInfo order, GiftInfo giftinfo, int quantity)
        {
            bool flag;

            ManagerHelper.CheckPrivilege(Privilege.EditOrders);
            using (DbConnection connection = DatabaseFactory.CreateDatabase().CreateConnection())
            {
                connection.Open();
                DbTransaction dbTran = connection.BeginTransaction();
                try
                {
                    SalesProvider provider = SalesProvider.Instance();
                    OrderGiftInfo item     = new OrderGiftInfo();
                    item.OrderId  = order.OrderId;
                    item.Quantity = quantity;
                    item.GiftName = giftinfo.Name;
                    decimal costPrice = item.CostPrice;
                    item.CostPrice     = Convert.ToDecimal(giftinfo.CostPrice);
                    item.GiftId        = giftinfo.GiftId;
                    item.ThumbnailsUrl = giftinfo.ThumbnailUrl40;
                    bool flag2 = false;
                    foreach (OrderGiftInfo info2 in order.Gifts)
                    {
                        if (giftinfo.GiftId == info2.GiftId)
                        {
                            flag2          = true;
                            info2.Quantity = quantity;
                            break;
                        }
                    }
                    if (!flag2)
                    {
                        order.Gifts.Add(item);
                    }
                    if (!provider.AddOrderGift(order.OrderId, item, quantity, dbTran))
                    {
                        dbTran.Rollback();
                        return(false);
                    }
                    if (!provider.UpdateOrderAmount(order, dbTran))
                    {
                        dbTran.Rollback();
                        return(false);
                    }
                    dbTran.Commit();
                    flag = true;
                }
                catch
                {
                    dbTran.Rollback();
                    flag = false;
                }
                finally
                {
                    connection.Close();
                }
            }
            if (flag)
            {
                EventLogs.WriteOperationLog(Privilege.EditOrders, string.Format(CultureInfo.InvariantCulture, "成功的为订单号为\"{0}\"的订单添加了礼品", new object[] { order.OrderId }));
            }
            return(flag);
        }
示例#26
0
文件: OrderHelper.cs 项目: zwkjgs/XKD
        public static bool SendGoods(OrderInfo order)
        {
            ManagerHelper.CheckPrivilege(Privilege.OrderSendGoods);
            bool flag = false;

            if (order.CheckAction(OrderActions.SELLER_SEND_GOODS))
            {
                OrderDao orderDao = new OrderDao();
                order.OrderStatus  = OrderStatus.SellerAlreadySent;
                order.ShippingDate = new DateTime?(DateTime.Now);
                flag = orderDao.UpdateOrder(order, null);
                string text = "";
                if (flag)
                {
                    bool flag2 = false;
                    foreach (LineItemInfo current in order.LineItems.Values)
                    {
                        OrderStatus orderItemsStatus = current.OrderItemsStatus;
                        switch (orderItemsStatus)
                        {
                        case OrderStatus.WaitBuyerPay:
                        case OrderStatus.BuyerAlreadyPaid:
                            text = text + "'" + current.SkuId + "',";
                            break;

                        default:
                            if (orderItemsStatus == OrderStatus.ApplyForRefund)
                            {
                                flag2 = true;
                                text  = text + "'" + current.SkuId + "',";
                            }
                            break;
                        }
                    }
                    if (flag2)
                    {
                        orderDao.DeleteReturnRecordForSendGoods(order.OrderId);
                    }
                    if (!string.IsNullOrEmpty(text))
                    {
                        orderDao.UpdateItemsStatus(order.OrderId, 3, text.Substring(0, text.Length - 1));
                    }
                    bool flag3 = true;
                    foreach (LineItemInfo current in order.LineItems.Values)
                    {
                        if (current.Type == 0)
                        {
                            flag3 = false;
                            break;
                        }
                    }
                    if (order.Gateway.ToLower() == "hishop.plugins.payment.podrequest" || flag3)
                    {
                        orderDao.UpdatePayOrderStock(order);
                        foreach (LineItemInfo current in order.LineItems.Values)
                        {
                            text = text + current.SkuId + ",";
                            ProductDao  productDao     = new ProductDao();
                            ProductInfo productDetails = productDao.GetProductDetails(current.ProductId);
                            productDetails.SaleCounts     += current.Quantity;
                            productDetails.ShowSaleCounts += current.Quantity;
                            productDao.UpdateProduct(productDetails, null);
                        }
                    }
                    MemberInfo member = MemberHelper.GetMember(order.UserId);
                    try
                    {
                        if (order != null)
                        {
                            Messenger.SendWeiXinMsg_OrderDeliver(order);
                        }
                    }
                    catch (Exception var_10_293)
                    {
                    }
                    EventLogs.WriteOperationLog(Privilege.OrderSendGoods, string.Format(CultureInfo.InvariantCulture, "发货编号为\"{0}\"的订单", new object[]
                    {
                        order.OrderId
                    }));
                }
            }
            return(flag);
        }
示例#27
0
        public static bool SendGoods(OrderInfo order)
        {
            ManagerHelper.CheckPrivilege(Privilege.OrderSendGoods);
            bool flag = false;

            if (order.CheckAction(OrderActions.SELLER_SEND_GOODS))
            {
                OrderDao dao = new OrderDao();
                order.OrderStatus  = OrderStatus.SellerAlreadySent;
                order.ShippingDate = new DateTime?(DateTime.Now);
                //线下支付,发货时更新付款时间
                if (order.Gateway == "hishop.plugins.payment.offlinerequest")
                {
                    order.PayDate = new DateTime?(DateTime.Now);
                }
                flag = dao.UpdateOrder(order, null);
                string str = "";
                if (!flag)
                {
                    return(flag);
                }
                bool flag2 = false;
                foreach (LineItemInfo info in order.LineItems.Values)
                {
                    OrderStatus orderItemsStatus = info.OrderItemsStatus;
                    switch (orderItemsStatus)
                    {
                    case OrderStatus.WaitBuyerPay:
                    case OrderStatus.BuyerAlreadyPaid:
                        break;

                    default:
                    {
                        if (orderItemsStatus == OrderStatus.ApplyForRefund)
                        {
                            flag2 = true;
                            str   = str + "'" + info.SkuId + "',";
                        }
                        continue;
                    }
                    }
                    str = str + "'" + info.SkuId + "',";
                }
                if (flag2)
                {
                    dao.DeleteReturnRecordForSendGoods(order.OrderId);
                }
                if (!string.IsNullOrEmpty(str))
                {
                    dao.UpdateItemsStatus(order.OrderId, 3, str.Substring(0, str.Length - 1));
                }
                //货到付款 更新库存
                if (order.Gateway.ToLower() == "hishop.plugins.payment.podrequest")
                {
                    dao.UpdatePayOrderStock(order.OrderId);
                    foreach (LineItemInfo info2 in order.LineItems.Values)
                    {
                        str = str + info2.SkuId + ",";
                        ProductDao  dao2           = new ProductDao();
                        ProductInfo productDetails = dao2.GetProductDetails(info2.ProductId);
                        productDetails.SaleCounts     += info2.Quantity;
                        productDetails.ShowSaleCounts += info2.Quantity;
                        dao2.UpdateProduct(productDetails, null);
                    }
                }
                MemberInfo member = MemberHelper.GetMember(order.UserId);
                Messenger.OrderShipping(order, member, order.wid);
                EventLogs.WriteOperationLog(Privilege.OrderSendGoods, string.Format(CultureInfo.InvariantCulture, "发货编号为\"{0}\"的订单", new object[] { order.OrderId }));
            }
            return(flag);
        }
示例#28
0
        public static string AddProductNew(ProductInfo product, Dictionary <string, SKUItem> skus, Dictionary <int, IList <int> > attrs, IList <int> tagsId)
        {
            string str = string.Empty;

            if (null == product)
            {
                return("未知错误");
            }
            Globals.EntityCoding(product, true);
            int decimalLength = SettingsManager.GetMasterSettings(true).DecimalLength;

            if (product.MarketPrice.HasValue)
            {
                product.MarketPrice = new decimal?(Math.Round(product.MarketPrice.Value, decimalLength));
            }
            ProductActionStatus unknowError = ProductActionStatus.UnknowError;

            using (DbConnection connection = DatabaseFactory.CreateDatabase().CreateConnection())
            {
                connection.Open();
                DbTransaction dbTran = connection.BeginTransaction();
                try
                {
                    ProductDao dao       = new ProductDao();
                    int        productId = dao.AddProduct(product, dbTran);
                    if (productId == 0)
                    {
                        dbTran.Rollback();
                        return("货号重复");
                    }
                    str = productId.ToString();
                    product.ProductId = productId;
                    if (((skus != null) && (skus.Count > 0)) && !dao.AddProductSKUs(productId, skus, dbTran))
                    {
                        dbTran.Rollback();
                        return("添加SUK出错");
                    }
                    if (((attrs != null) && (attrs.Count > 0)) && !dao.AddProductAttributes(productId, attrs, dbTran))
                    {
                        dbTran.Rollback();
                        return("添加商品属性出错");
                    }
                    if (((tagsId != null) && (tagsId.Count > 0)) && !new TagDao().AddProductTags(productId, tagsId, dbTran))
                    {
                        dbTran.Rollback();
                        return("添加商品标签出错");
                    }
                    dbTran.Commit();
                    unknowError = ProductActionStatus.Success;
                }
                catch (Exception)
                {
                    dbTran.Rollback();
                }
                finally
                {
                    connection.Close();
                }
            }
            if (unknowError == ProductActionStatus.Success)
            {
                EventLogs.WriteOperationLog(Privilege.AddProducts, string.Format(CultureInfo.InvariantCulture, "上架了一个新商品:”{0}”", new object[] { product.ProductName }));
            }
            return(str);
        }
示例#29
0
        public static bool UpdateLineItem(string sku, OrderInfo order, int quantity)
        {
            bool flag;

            ManagerHelper.CheckPrivilege(Privilege.EditOrders);
            using (DbConnection connection = DatabaseFactory.CreateDatabase().CreateConnection())
            {
                connection.Open();
                DbTransaction dbTran = connection.BeginTransaction();
                try
                {
                    SalesProvider provider = SalesProvider.Instance();
                    int           userId   = order.UserId;
                    if (userId == 1100)
                    {
                        userId = 0;
                    }
                    Member user = Users.GetUser(userId) as Member;
                    if (user != null)
                    {
                        int     purchaseGiftId        = 0;
                        string  purchaseGiftName      = "";
                        int     giveQuantity          = 0;
                        int     wholesaleDiscountId   = 0;
                        string  wholesaleDiscountName = "";
                        decimal?discountRate          = null;

                        int gradeId = user.GradeId;

                        //GetLineItemPromotions(int productId, int quantity, out int purchaseGiftId, out string purchaseGiftName, out int giveQuantity, out int wholesaleDiscountId, out string wholesaleDiscountName, out decimal? discountRate, int gradeId);
                        provider.GetLineItemPromotions(order.LineItems[sku].ProductId, quantity, out purchaseGiftId, out purchaseGiftName, out giveQuantity, out wholesaleDiscountId, out wholesaleDiscountName, out discountRate, gradeId);

                        order.LineItems[sku].PurchaseGiftId        = purchaseGiftId;
                        order.LineItems[sku].PurchaseGiftName      = purchaseGiftName;
                        order.LineItems[sku].ShipmentQuantity      = quantity + giveQuantity;
                        order.LineItems[sku].WholesaleDiscountId   = wholesaleDiscountId;
                        order.LineItems[sku].WholesaleDiscountName = wholesaleDiscountName;
                        order.LineItems[sku].Quantity = quantity;

                        if (discountRate.HasValue && discountRate.Value != 0)
                        {
                            decimal itemListPrice = order.LineItems[sku].ItemListPrice;

                            order.LineItems[sku].ItemAdjustedPrice = Convert.ToDecimal((itemListPrice * discountRate) / 100M);
                        }
                        else
                        {
                            order.LineItems[sku].ItemAdjustedPrice = order.LineItems[sku].ItemListPrice;
                        }
                    }
                    else
                    {
                        order.LineItems[sku].Quantity          = quantity;
                        order.LineItems[sku].ShipmentQuantity  = quantity;
                        order.LineItems[sku].ItemAdjustedPrice = order.LineItems[sku].ItemListPrice;
                    }

                    if (!provider.UpdateLineItem(order.OrderId, order.LineItems[sku], dbTran))
                    {
                        dbTran.Rollback();
                        return(false);
                    }
                    if (!provider.UpdateOrderAmount(order, dbTran))
                    {
                        dbTran.Rollback();
                        return(false);
                    }
                    dbTran.Commit();
                    flag = true;
                }
                catch (Exception)
                {
                    dbTran.Rollback();
                    flag = false;
                }
                finally
                {
                    connection.Close();
                }
            }
            if (flag)
            {
                EventLogs.WriteOperationLog(Privilege.EditOrders, string.Format(CultureInfo.InvariantCulture, "修改了订单号为\"{0}\"的订单商品数量", new object[] { order.OrderId }));
            }
            return(flag);
        }
示例#30
0
        public static bool AddOrderGift(OrderInfo order, GiftInfo giftinfo, int quantity, int promotype)
        {
            ManagerHelper.CheckPrivilege(Privilege.EditOrders);
            Database database = DatabaseFactory.CreateDatabase();
            bool     result;
            bool     flag2;

            using (System.Data.Common.DbConnection dbConnection = database.CreateConnection())
            {
                dbConnection.Open();
                System.Data.Common.DbTransaction dbTransaction = dbConnection.BeginTransaction();
                try
                {
                    SalesProvider salesProvider = SalesProvider.Instance();
                    OrderGiftInfo orderGiftInfo = new OrderGiftInfo();
                    orderGiftInfo.OrderId  = order.OrderId;
                    orderGiftInfo.Quantity = quantity;
                    orderGiftInfo.GiftName = giftinfo.Name;
                    decimal arg_5C_0 = orderGiftInfo.CostPrice;
                    orderGiftInfo.CostPrice     = Convert.ToDecimal(giftinfo.CostPrice);
                    orderGiftInfo.GiftId        = giftinfo.GiftId;
                    orderGiftInfo.ThumbnailsUrl = giftinfo.ThumbnailUrl40;
                    orderGiftInfo.PromoteType   = promotype;
                    bool flag = false;
                    foreach (OrderGiftInfo current in order.Gifts)
                    {
                        if (giftinfo.GiftId == current.GiftId)
                        {
                            flag                = true;
                            current.Quantity    = quantity;
                            current.PromoteType = promotype;
                            break;
                        }
                    }
                    if (!flag)
                    {
                        order.Gifts.Add(orderGiftInfo);
                    }
                    if (!salesProvider.AddOrderGift(order.OrderId, orderGiftInfo, quantity, dbTransaction))
                    {
                        dbTransaction.Rollback();
                        result = false;
                        return(result);
                    }
                    if (!salesProvider.UpdateOrderAmount(order, dbTransaction))
                    {
                        dbTransaction.Rollback();
                        result = false;
                        return(result);
                    }
                    dbTransaction.Commit();
                    flag2 = true;
                }
                catch
                {
                    dbTransaction.Rollback();
                    flag2 = false;
                }
                finally
                {
                    dbConnection.Close();
                }
            }
            if (flag2)
            {
                EventLogs.WriteOperationLog(Privilege.EditOrders, string.Format(CultureInfo.InvariantCulture, "成功的为订单号为\"{0}\"的订单添加了礼品", new object[]
                {
                    order.OrderId
                }));
            }
            result = flag2;
            return(result);
        }