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); flag = dao.UpdateOrder(order, null); if (!flag) { return flag; } dao.UpdatePayOrderStock(order.OrderId); foreach (LineItemInfo info in order.LineItems.Values) { ProductDao dao2 = new ProductDao(); ProductInfo productDetails = dao2.GetProductDetails(info.ProductId); productDetails.SaleCounts += info.Quantity; productDetails.ShowSaleCounts += info.Quantity; dao2.UpdateProduct(productDetails, null); } UpdateUserAccount(order); Messenger.OrderPayment(new MemberDao().GetMember(order.UserId), order.OrderId, order.GetTotal()); EventLogs.WriteOperationLog(Privilege.CofimOrderPay, string.Format(CultureInfo.InvariantCulture, "确认收款编号为\"{0}\"的订单", new object[] { order.OrderId })); } return flag; }
public static bool ConfirmOrderFinish(OrderInfo order) { bool flag = false; if (order.CheckAction(OrderActions.BUYER_CONFIRM_GOODS)) { order.OrderStatus = OrderStatus.Finished; order.FinishDate = new DateTime?(DateTime.Now); flag = new OrderDao().UpdateOrder(order, null); } return flag; }
public static bool ConfirmOrderFinish(OrderInfo order) { ManagerHelper.CheckPrivilege(Privilege.EditOrders); bool flag = false; if (order.CheckAction(OrderActions.SELLER_FINISH_TRADE)) { order.OrderStatus = OrderStatus.Finished; order.FinishDate = new DateTime?(DateTime.Now); flag = new OrderDao().UpdateOrder(order, null); if (flag) { EventLogs.WriteOperationLog(Privilege.EditOrders, string.Format(CultureInfo.InvariantCulture, "完成编号为\"{0}\"的订单", new object[] { order.OrderId })); } } return flag; }
public static bool CloseTransaction(OrderInfo order) { ManagerHelper.CheckPrivilege(Privilege.EditOrders); if (order.CheckAction(OrderActions.SELLER_CLOSE)) { order.OrderStatus = OrderStatus.Closed; bool flag = new OrderDao().UpdateOrder(order, null); if (order.GroupBuyId > 0) { GroupBuyInfo groupBuy = GroupBuyHelper.GetGroupBuy(order.GroupBuyId); groupBuy.SoldCount -= order.GetGroupBuyProductQuantity(); GroupBuyHelper.UpdateGroupBuy(groupBuy); } if (flag) { EventLogs.WriteOperationLog(Privilege.EditOrders, string.Format(CultureInfo.InvariantCulture, "关闭了订单“{0}”", new object[] { order.OrderId })); } return flag; } return false; }
public static bool UserPayOrder(OrderInfo order) { OrderDao dao = new OrderDao(); order.OrderStatus = OrderStatus.BuyerAlreadyPaid; order.PayDate = new DateTime?(DateTime.Now); bool flag = dao.UpdateOrder(order, null); if (flag) { dao.UpdatePayOrderStock(order.OrderId); foreach (LineItemInfo info in order.LineItems.Values) { ProductDao dao2 = new ProductDao(); ProductInfo productDetails = dao2.GetProductDetails(info.ProductId); productDetails.SaleCounts += info.Quantity; productDetails.ShowSaleCounts += info.Quantity; dao2.UpdateProduct(productDetails, null); } MemberInfo member = GetMember(order.UserId); if (member == null) { return flag; } MemberDao dao3 = new MemberDao(); PointDetailInfo point = new PointDetailInfo { OrderId = order.OrderId, UserId = member.UserId, TradeDate = DateTime.Now, TradeType = PointTradeType.Bounty, Increased = new int?(order.Points), Points = order.Points + member.Points }; if ((point.Points > 0x7fffffff) || (point.Points < 0)) { point.Points = 0x7fffffff; } PointDetailDao dao4 = new PointDetailDao(); dao4.AddPointDetail(point); member.Expenditure += order.GetTotal(); member.OrderNumber++; dao3.Update(member); Messenger.OrderPayment(member, order.OrderId, order.GetTotal()); int historyPoint = dao4.GetHistoryPoint(member.UserId); List<MemberGradeInfo> memberGrades = new MemberGradeDao().GetMemberGrades() as List<MemberGradeInfo>; foreach (MemberGradeInfo info5 in from item in memberGrades orderby item.Points descending select item) { if (member.GradeId == info5.GradeId) { return flag; } if (info5.Points <= historyPoint) { member.GradeId = info5.GradeId; dao3.Update(member); return flag; } } } return flag; }
public static bool UpdateOrderShippingMode(OrderInfo order) { ManagerHelper.CheckPrivilege(Privilege.EditOrders); if (order.CheckAction(OrderActions.MASTER_SELLER_MODIFY_SHIPPING_MODE)) { bool flag = new OrderDao().UpdateOrder(order, null); if (flag) { EventLogs.WriteOperationLog(Privilege.EditOrders, string.Format(CultureInfo.InvariantCulture, "修改了订单“{0}”的配送方式", new object[] { order.OrderId })); } return flag; } return false; }
public static bool UpdateOrderAmount(OrderInfo order) { ManagerHelper.CheckPrivilege(Privilege.EditOrders); bool flag = false; if (order.CheckAction(OrderActions.SELLER_MODIFY_TRADE)) { flag = new OrderDao().UpdateOrder(order, null); if (flag) { EventLogs.WriteOperationLog(Privilege.EditOrders, string.Format(CultureInfo.InvariantCulture, "修改了编号为\"{0}\"订单的金额", new object[] { order.OrderId })); } } return flag; }
public static void SetOrderState(string orderId, OrderStatus orderStatus) { OrderDao dao = new OrderDao(); OrderInfo orderInfo = dao.GetOrderInfo(orderId); orderInfo.OrderStatus = orderStatus; dao.UpdateOrder(orderInfo, null); }
public static void SetOrderShipNumber(string[] orderIds, string startNumber, string ExpressCom = "") { string strno = startNumber; OrderDao dao = new OrderDao(); for (int i = 0; i < orderIds.Length; i++) { if (i != 0) { strno = GetNextExpress(ExpressCom, strno); } else { GetNextExpress(ExpressCom, strno); } dao.EditOrderShipNumber(orderIds[i], strno); } }
public static bool SetOrderShipNumber(string orderId, string startNumber) { OrderInfo orderInfo = new OrderDao().GetOrderInfo(orderId); orderInfo.ShipOrderNumber = startNumber; return new OrderDao().UpdateOrder(orderInfo, null); }
public static void SetOrderPrinted(string[] orderIds) { foreach (string str in orderIds) { OrderInfo orderInfo = new OrderDao().GetOrderInfo(str); orderInfo.IsPrinted = true; new OrderDao().UpdateOrder(orderInfo, null); } }
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); flag = dao.UpdateOrder(order, null); if (!flag) { return flag; } if (order.Gateway.ToLower() == "hishop.plugins.payment.podrequest") { dao.UpdatePayOrderStock(order.OrderId); foreach (LineItemInfo info in order.LineItems.Values) { ProductDao dao2 = new ProductDao(); ProductInfo productDetails = dao2.GetProductDetails(info.ProductId); productDetails.SaleCounts += info.Quantity; productDetails.ShowSaleCounts += info.Quantity; dao2.UpdateProduct(productDetails, null); } UpdateUserAccount(order); } EventLogs.WriteOperationLog(Privilege.OrderSendGoods, string.Format(CultureInfo.InvariantCulture, "发货编号为\"{0}\"的订单", new object[] { order.OrderId })); } return flag; }
public static bool SaveRemark(OrderInfo order) { ManagerHelper.CheckPrivilege(Privilege.RemarkOrder); bool flag = new OrderDao().UpdateOrder(order, null); if (flag) { EventLogs.WriteOperationLog(Privilege.RemarkOrder, string.Format(CultureInfo.InvariantCulture, "对订单“{0}”进行了备注", new object[] { order.OrderId })); } return flag; }
public static bool MondifyAddress(OrderInfo order) { ManagerHelper.CheckPrivilege(Privilege.EditOrders); 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 })); } return flag; } return false; }
public static int DeleteOrders(string orderIds) { ManagerHelper.CheckPrivilege(Privilege.DeleteOrder); int num = new OrderDao().DeleteOrders(orderIds); if (num > 0) { EventLogs.WriteOperationLog(Privilege.DeleteOrder, string.Format(CultureInfo.InvariantCulture, "删除了编号为\"{0}\"的订单", new object[] { orderIds })); } return num; }