예제 #1
0
        protected override void OnLoad(EventArgs e)
        {
            if (HiContext.Current.Manager != null)
            {
                this.UserStoreId = HiContext.Current.Manager.StoreId;
            }
            if (this.ShowAllItem)
            {
                this.dlstOrderItems.ItemDataBound += this.dlstOrderItems_ItemDataBound;
            }
            IDictionary <string, LineItemInfo> dictionary = new Dictionary <string, LineItemInfo>();

            foreach (string key in this.order.LineItems.Keys)
            {
                LineItemInfo lineItemInfo = this.order.LineItems[key];
                if (!this.ShowAllItem)
                {
                    if (lineItemInfo.Status != LineItemStatus.Returned && lineItemInfo.Status != LineItemStatus.Refunded)
                    {
                        dictionary.Add(key, this.order.LineItems[key]);
                    }
                }
                else
                {
                    dictionary.Add(key, this.order.LineItems[key]);
                }
            }
            this.dlstOrderItems.DataSource = dictionary.Values;
            this.dlstOrderItems.DataBind();
            if (this.order.Gifts.Count == 0)
            {
                this.grdOrderGift.Visible = false;
            }
            else
            {
                this.grdOrderGift.DataSource = this.order.Gifts;
                this.grdOrderGift.DataBind();
            }
        }
예제 #2
0
        /// <summary>
        /// Read an order from the database
        /// </summary>
        /// <param name="orderId">Order Id</param>
        /// <returns>All information about the order</returns>
        public OrderInfo GetOrder(int orderId)
        {
            OrderInfo order = new OrderInfo();

            //Create a parameter
            SqlParameter parm = new SqlParameter(PARM_ORDER_ID, SqlDbType.Int);

            parm.Value = orderId;

            //Execute a query to read the order
            using (SqlDataReader rdr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringOrderDistributedTransaction, CommandType.Text, SQL_SELECT_ORDER, parm))
            {
                if (rdr.Read())
                {
                    //Generate an order header from the first row
                    AddressInfo billingAddress  = new AddressInfo(rdr.GetString(5), rdr.GetString(6), rdr.GetString(7), rdr.GetString(8), rdr.GetString(9), rdr.GetString(10), rdr.GetString(11), rdr.GetString(12), null, "email");
                    AddressInfo shippingAddress = new AddressInfo(rdr.GetString(13), rdr.GetString(14), rdr.GetString(15), rdr.GetString(16), rdr.GetString(17), rdr.GetString(18), rdr.GetString(19), rdr.GetString(20), null, "email");

                    order = new OrderInfo(orderId, rdr.GetDateTime(0), rdr.GetString(1), null, billingAddress, shippingAddress, rdr.GetDecimal(21), null, null);

                    IList <LineItemInfo> lineItems = new List <LineItemInfo>();
                    LineItemInfo         item      = null;

                    //Create the lineitems from the first row and subsequent rows
                    do
                    {
                        item = new LineItemInfo(rdr.GetString(22), string.Empty, rdr.GetInt32(23), rdr.GetInt32(24), rdr.GetDecimal(25));
                        lineItems.Add(item);
                    } while (rdr.Read());

                    order.LineItems = new LineItemInfo[lineItems.Count];
                    lineItems.CopyTo(order.LineItems, 0);
                }
            }

            return(order);
        }
예제 #3
0
        private void BindOrderItems(OrderInfo order)
        {
            DataTable productReviewAll = ProductBrowser.GetProductReviewAll(this.orderId);
            Dictionary <string, LineItemInfo> dictionary = new Dictionary <string, LineItemInfo>();
            LineItemInfo lineItemInfo = new LineItemInfo();
            int          num          = 0;
            int          num2         = 0;
            bool         flag         = false;

            foreach (KeyValuePair <string, LineItemInfo> lineItem in order.LineItems)
            {
                flag         = false;
                lineItemInfo = lineItem.Value;
                for (int i = 0; i < productReviewAll.Rows.Count; i++)
                {
                    if (lineItemInfo.ProductId.ToString() == productReviewAll.Rows[i][0].ToString() && lineItemInfo.SkuId.ToString().Trim() == productReviewAll.Rows[i][1].ToString().Trim())
                    {
                        flag = true;
                    }
                }
                if (flag)
                {
                    dictionary.Add(lineItem.Key, lineItemInfo);
                }
                else
                {
                    num2++;
                }
            }
            if (num + num2 == order.LineItems.Count)
            {
                this.Page.Response.Redirect("MemberProductReview.aspx?OrderId=" + this.orderId);
            }
            this.orderItems.DataSource = dictionary.Values;
            this.orderItems.DataBind();
        }
예제 #4
0
        /// <summary>
        /// Read an order from the database
        /// </summary>
        /// <param name="orderId"></param>
        /// <returns></returns>
        public OrderInfo GetOrder(int orderId)
        {
            //Create a parameter
            SqlParameter parm = new SqlParameter(PARM_ORDER_ID, SqlDbType.Int);

            parm.Value = orderId;

            //Execute a query to read the order
            using (SqlDataReader rdr = SQLHelper.ExecuteReader(SQLHelper.CONN_STRING_DTC_ORDERS, CommandType.Text, SQL_SELECT_ORDER, parm)) {
                if (rdr.Read())
                {
                    //Generate an order header from the first row
                    CreditCardInfo creditCard      = new CreditCardInfo(rdr.GetString(2), rdr.GetString(3), rdr.GetString(4));
                    AddressInfo    billingAddress  = new AddressInfo(rdr.GetString(5), rdr.GetString(6), rdr.GetString(7), rdr.GetString(8), rdr.GetString(9), rdr.GetString(10), rdr.GetString(11), rdr.GetString(12), null);
                    AddressInfo    shippingAddress = new AddressInfo(rdr.GetString(13), rdr.GetString(14), rdr.GetString(15), rdr.GetString(16), rdr.GetString(17), rdr.GetString(18), rdr.GetString(19), rdr.GetString(20), null);

                    OrderInfo order = new OrderInfo(orderId, rdr.GetDateTime(0), rdr.GetString(1), creditCard, billingAddress, shippingAddress, rdr.GetDecimal(21));

                    ArrayList    lineItems = new ArrayList();
                    LineItemInfo item      = null;

                    //Create the lineitems from the first row and subsequent rows
                    do
                    {
                        item = new LineItemInfo(rdr.GetString(22), string.Empty, rdr.GetInt32(23), rdr.GetInt32(24), rdr.GetDecimal(25));
                        lineItems.Add(item);
                    }while(rdr.Read());

                    order.LineItems = (LineItemInfo[])lineItems.ToArray(typeof(LineItemInfo));

                    return(order);
                }
            }

            return(null);
        }
예제 #5
0
        public bool UpdateLineItem(string orderId, LineItemInfo lineItem, DbTransaction dbTran)
        {
            string str = string.Empty;

            if (!lineItem.IsAdminModify)
            {
                str = "IsAdminModify=0,";
            }
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand("UPDATE Hishop_OrderItems SET " + str + "ShipmentQuantity=@ShipmentQuantity,ItemAdjustedPrice=@ItemAdjustedPrice,ItemAdjustedCommssion=@ItemAdjustedCommssion,OrderItemsStatus=@OrderItemsStatus,ItemsCommission=@ItemsCommission,Quantity=@Quantity, PromotionId = NULL, PromotionName = NULL WHERE OrderId=@OrderId AND SkuId=@SkuId");

            this.database.AddInParameter(sqlStringCommand, "OrderId", DbType.String, orderId);
            this.database.AddInParameter(sqlStringCommand, "SkuId", DbType.String, lineItem.SkuId);
            this.database.AddInParameter(sqlStringCommand, "ShipmentQuantity", DbType.Int32, lineItem.ShipmentQuantity);
            this.database.AddInParameter(sqlStringCommand, "ItemAdjustedPrice", DbType.Currency, lineItem.ItemAdjustedPrice);
            this.database.AddInParameter(sqlStringCommand, "Quantity", DbType.Int32, lineItem.Quantity);
            this.database.AddInParameter(sqlStringCommand, "ItemAdjustedCommssion", DbType.Currency, lineItem.ItemAdjustedCommssion);
            this.database.AddInParameter(sqlStringCommand, "OrderItemsStatus", DbType.Int16, (int)lineItem.OrderItemsStatus);
            this.database.AddInParameter(sqlStringCommand, "ItemsCommission", DbType.Currency, lineItem.ItemsCommission);
            if (dbTran != null)
            {
                return(this.database.ExecuteNonQuery(sqlStringCommand, dbTran) == 1);
            }
            return(this.database.ExecuteNonQuery(sqlStringCommand) == 1);
        }
예제 #6
0
파일: QuickPay.cs 프로젝트: tyriankid/WFX
        protected void btnSubmit_Click(object sender, System.EventArgs e)
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);

            for (int i = 0; i < this.Orders.Rows.Count; i++)
            {
                OrderInfo orderInfo = OrderHelper.GetOrderInfo(this.Orders.Rows[i]["OrderId"].ToString());
                if (orderInfo != null)
                {
                    ManagerInfo currentManager = ManagerHelper.GetCurrentManager();//获取目前的管理员信息
                    if (orderInfo.GroupBuyId > 0 && orderInfo.GroupBuyStatus != GroupBuyStatus.Success)
                    {
                        this.ShowMsg("当前订单为团购订单,团购活动还未成功结束,所以不能发货", false);
                    }
                    else
                    {
                        if (!orderInfo.CheckAction(OrderActions.SELLER_SEND_GOODS))
                        {
                            this.ShowMsg("当前订单状态没有付款或不是等待发货的订单,所以不能发货", false);
                        }
                        else
                        {
                            orderInfo.RealShippingModeId = 1;//固定为1,为第一种快递方式(店家初始化时自己配置的第一种方式是什么这里就是什么)
                            orderInfo.RealModeName       = "快速收银";
                            orderInfo.ShipOrderNumber    = "";
                            if (OrderHelper.SendGoods(orderInfo))
                            {
                                SendNoteInfo info5 = new SendNoteInfo();
                                info5.NoteId   = Globals.GetGenerateId();
                                info5.OrderId  = orderInfo.OrderId;
                                info5.Operator = currentManager.UserName;
                                info5.Remark   = "后台" + info5.Operator + "发货成功";
                                OrderHelper.SaveSendNote(info5);
                                MemberInfo member = MemberHelper.GetMember(orderInfo.UserId);
                                Messenger.OrderShipping(orderInfo, member);
                                if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && orderInfo.GatewayOrderId.Trim().Length > 0)
                                {
                                    if (orderInfo.Gateway == "hishop.plugins.payment.ws_wappay.wswappayrequest")
                                    {
                                        PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode(orderInfo.PaymentTypeId);
                                        if (paymentMode != null)
                                        {
                                            PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单发货", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, Globals.FullPath(Globals.GetSiteUrls().Home), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[]
                                            {
                                                paymentMode.Gateway
                                            })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentNotify_url", new object[]
                                            {
                                                paymentMode.Gateway
                                            })), "").SendGoods(orderInfo.GatewayOrderId, orderInfo.RealModeName, orderInfo.ShipOrderNumber, "EXPRESS");
                                        }
                                    }
                                    if (orderInfo.Gateway == "hishop.plugins.payment.weixinrequest")
                                    {
                                        //SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
                                        PayClient   client  = new PayClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, masterSettings.WeixinPaySignKey);
                                        DeliverInfo deliver = new DeliverInfo
                                        {
                                            TransId    = orderInfo.GatewayOrderId,
                                            OutTradeNo = orderInfo.OrderId,
                                            OpenId     = MemberHelper.GetMember(orderInfo.UserId).OpenId
                                        };
                                        client.DeliverNotify(deliver);
                                    }
                                }
                                orderInfo.OnDeliver();
                                //this.ShowMsg("发货成功", true);

                                //发送成功后,确认收货
                                bool flag = false;
                                orderInfo = ShoppingProcessor.GetOrderInfo(this.Orders.Rows[i]["OrderId"].ToString());
                                Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems;
                                LineItemInfo lineItemInfo = new LineItemInfo();
                                foreach (KeyValuePair <string, LineItemInfo> lineItem in lineItems)
                                {
                                    lineItemInfo = lineItem.Value;
                                    if (lineItemInfo.OrderItemsStatus != OrderStatus.ApplyForRefund && lineItemInfo.OrderItemsStatus != OrderStatus.ApplyForReturns)
                                    {
                                        continue;
                                    }
                                    flag = true;
                                }
                                if (flag)
                                {
                                    Response.Write("<script>alert('订单中商品有退货(款)不允许完成');</script>");
                                    return;
                                }
                                if (orderInfo == null || !MemberProcessor.ConfirmOrderFinish(orderInfo))
                                {
                                    Response.Write("<script>alert('订单当前状态不允许完成');</script>");
                                    return;
                                }
                                DistributorsBrower.UpdateCalculationCommission(orderInfo);//增加佣金记录、更新分销商的有效推广佣金和订单总额
                                MemberInfo currentMember = MemberProcessor.GetMember(orderInfo.UserId);
                                int        num           = 0;
                                if (masterSettings.IsRequestDistributor && !string.IsNullOrEmpty(masterSettings.FinishedOrderMoney.ToString()) && currentMember.Expenditure >= masterSettings.FinishedOrderMoney)
                                {
                                    num = 1;
                                }
                                foreach (LineItemInfo value in orderInfo.LineItems.Values)
                                {
                                    if (value.OrderItemsStatus.ToString() != OrderStatus.SellerAlreadySent.ToString())
                                    {
                                        continue;
                                    }
                                    ShoppingProcessor.UpdateOrderGoodStatu(orderInfo.OrderId, value.SkuId, 5);
                                }
                                DistributorsInfo distributorsInfo = new DistributorsInfo();
                                distributorsInfo = DistributorsBrower.GetUserIdDistributors(orderInfo.UserId);
                                if (distributorsInfo != null && distributorsInfo.UserId > 0)
                                {
                                    num = 0;
                                }
                                this.Orders.Clear();
                                dlstOrders.DataSource = this.Orders;
                                dlstOrders.DataBind();
                                this.ShowMsg("收银成功", true);
                            }
                            else
                            {
                                this.ShowMsg("发货失败", false);
                            }
                        }
                    }
                }
            }
        }
예제 #7
0
        protected override void AttachChildControls()
        {
            this.hidErrorMsg        = (HtmlInputHidden)this.FindControl("hidErrorMsg");
            this.txtOrderId         = (HtmlInputHidden)this.FindControl("txtOrderId");
            this.litOrderIds        = (Literal)this.FindControl("litOrderIds");
            this.txtSkuId           = (HtmlInputHidden)this.FindControl("txtSkuId");
            this.txtRemark          = (TextBox)this.FindControl("txtRemark");
            this.litRefundMoney     = (Literal)this.FindControl("litRefundMoney");
            this.dropRefundType     = (WapRefundTypeDropDownList)this.FindControl("dropRefundType");
            this.DropRefundReason   = (WapAfterSalesReasonDropDownList)this.FindControl("RefundReasonDropDownList");
            this.btnRefund          = ButtonManager.Create(this.FindControl("btnRefund"));
            this.groupbuyPanel      = (HtmlGenericControl)this.FindControl("groupbuyPanel");
            this.hidOneRefundAmount = (HtmlInputHidden)this.FindControl("hidOneRefundAmount");
            this.hidIsServiceOrder  = (HtmlInputHidden)this.FindControl("hidIsServiceOrder");
            this.hidValidCodes      = (HtmlInputHidden)this.FindControl("hidValidCodes");
            this.rptOrderPassword   = (WapTemplatedRepeater)this.FindControl("rptOrderPassword");
            decimal num = default(decimal);
            decimal d   = default(decimal);

            this.txtOrderId.Value = this.OrderId;
            this.litOrderIds.Text = this.OrderId;
            this.txtSkuId.Value   = this.SkuId;
            this.order            = TradeHelper.GetOrderInfo(this.OrderId);
            if (this.order == null)
            {
                this.ShowError("错误的订单信息!");
            }
            else
            {
                this.IsServiceOrder           = (this.order.OrderType == OrderType.ServiceOrder);
                this.hidIsServiceOrder.Value  = (this.IsServiceOrder ? "1" : "0");
                this.hidOneRefundAmount.Value = "0";
                if (this.order.FightGroupId > 0)
                {
                    FightGroupInfo fightGroup = VShopHelper.GetFightGroup(this.order.FightGroupId);
                    if (fightGroup.Status != FightGroupStatus.FightGroupSuccess)
                    {
                        this.ShowError("火拼团订单成团之前不能进行退款操作!");
                        return;
                    }
                }
                GroupBuyInfo groupBuyInfo = null;
                if (this.order.GroupBuyId > 0)
                {
                    groupBuyInfo = ProductBrowser.GetGroupBuy(this.order.GroupBuyId);
                    if (groupBuyInfo != null)
                    {
                        if (this.groupbuyPanel != null && groupBuyInfo.Status != GroupBuyStatus.Failed)
                        {
                            this.groupbuyPanel.Visible = true;
                        }
                        if (groupBuyInfo.NeedPrice >= this.order.GetTotal(false) && groupBuyInfo.Status != GroupBuyStatus.Failed)
                        {
                            this.ShowError("团购违约金大于等于订单总金额,不能进行退款申请!");
                            return;
                        }
                    }
                    num = this.order.GetCanRefundAmount(this.SkuId, groupBuyInfo, 0);
                }
                else
                {
                    num = this.order.GetCanRefundAmount(this.SkuId, null, 0);
                }
                if (!this.IsServiceOrder)
                {
                    if (TradeHelper.IsOnlyOneSku(this.order))
                    {
                        this.SkuId = "";
                    }
                    if (!string.IsNullOrEmpty(this.SkuId) && !this.order.LineItems.ContainsKey(this.SkuId))
                    {
                        this.ShowError("错误的商品信息!");
                        return;
                    }
                    if (!TradeHelper.CanRefund(this.order, this.SkuId))
                    {
                        this.ShowError("订单状态不正确或者已有未处理完成的退款/退货申请!");
                        return;
                    }
                    if (this.order.LineItems.ContainsKey(this.SkuId))
                    {
                        this.RefundItem = this.order.LineItems[this.SkuId];
                    }
                }
                else
                {
                    if (this.order.OrderStatus == OrderStatus.WaitBuyerPay || this.order.OrderStatus == OrderStatus.Closed || this.order.OrderStatus == OrderStatus.ApplyForRefund || this.order.OrderStatus == OrderStatus.Refunded)
                    {
                        this.ShowError("订单状态不正确,不能申请退款!");
                    }
                    bool         flag         = TradeHelper.GatewayIsCanBackReturn(this.order.Gateway);
                    bool         flag2        = this.order.Gateway.ToLower() == "hishop.plugins.payment.cashreceipts" && this.order.StoreId > 0 && this.order.ShippingModeId == -2;
                    MemberInfo   user         = Users.GetUser(this.order.UserId);
                    LineItemInfo lineItemInfo = this.order.LineItems.Values.FirstOrDefault();
                    if (!lineItemInfo.IsRefund)
                    {
                        this.ShowError("商品不支持退款!");
                    }
                    if (!lineItemInfo.IsValid && lineItemInfo.ValidEndDate.HasValue && lineItemInfo.ValidEndDate.Value < DateTime.Now && !lineItemInfo.IsOverRefund)
                    {
                        this.ShowError("已过有效期,不能申请退款!");
                    }
                    IList <OrderVerificationItemInfo> orderVerificationItems = TradeHelper.GetOrderVerificationItems(this.order.OrderId);
                    if (orderVerificationItems == null || orderVerificationItems.Count == 0)
                    {
                        this.ShowError("核销码为空!");
                    }
                    IList <OrderVerificationItemInfo> list = null;
                    list = ((!lineItemInfo.ValidEndDate.HasValue || !(lineItemInfo.ValidEndDate.Value < DateTime.Now) || !lineItemInfo.IsOverRefund) ? (from vi in orderVerificationItems
                                                                                                                                                        where vi.VerificationStatus == 0
                                                                                                                                                        select vi).ToList() : (from vi in orderVerificationItems
                                                                                                                                                                               where vi.VerificationStatus == 0 || vi.VerificationStatus == 3
                                                                                                                                                                               select vi).ToList());
                    if (list == null || list.Count == 0)
                    {
                        this.ShowError("没有可以退款的核销码!");
                    }
                    DataTable dataTable = new DataTable();
                    dataTable.Columns.Add(new DataColumn("Index"));
                    dataTable.Columns.Add(new DataColumn("Password"));
                    for (int j = 0; j < list.Count; j++)
                    {
                        DataRow dataRow = dataTable.NewRow();
                        dataRow["Index"]    = j + 1;
                        dataRow["Password"] = list[j].VerificationPassword;
                        dataTable.Rows.Add(dataRow);
                    }
                    this.rptOrderPassword.DataSource = dataTable;
                    this.rptOrderPassword.DataBind();
                    d = (this.order.GetTotal(false) / (decimal)lineItemInfo.Quantity).F2ToString("f2").ToDecimal(0);
                    this.hidValidCodes.Value = string.Join(",", (from i in list
                                                                 select i.VerificationPassword).ToList());
                    this.hidOneRefundAmount.Value = d.ToString();
                    num = d * (decimal)list.Count;
                }
                if (num < decimal.Zero)
                {
                    this.ShowError("订单中已申请的退款金额超过了订单总额!");
                }
                else
                {
                    this.litRefundMoney.Text = num.F2ToString("f2");
                    PageTitle.AddSiteNameTitle("我的订单");
                    if (!this.Page.IsPostBack)
                    {
                        this.dropRefundType.IsServiceOrder = (this.order.OrderType == OrderType.ServiceOrder);
                        this.DropRefundReason.IsRefund     = true;
                        this.dropRefundType.preSaleId      = this.order.PreSaleId;
                        string enumDescription = EnumDescription.GetEnumDescription((Enum)(object)EnumPaymentType.AdvancePay, 1);
                        this.dropRefundType.OrderGateWay  = ((this.order.PreSaleId > 0 && this.order.DepositGatewayOrderId.ToNullString().ToLower() == enumDescription) ? enumDescription : this.order.Gateway);
                        this.dropRefundType.BalanceAmount = this.order.BalanceAmount;
                    }
                }
            }
        }
예제 #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string orderIds = base.Request["orderIds"].Trim(new char[] { ',' });

            if (!string.IsNullOrEmpty(base.Request["orderIds"]))
            {
                foreach (OrderInfo info in this.GetPrintData(orderIds))
                {
                    HtmlGenericControl child = new HtmlGenericControl("div");
                    child.Attributes["class"] = "order print";
                    StringBuilder builder = new StringBuilder("");
                    builder.AppendFormat("<div class=\"info\"><div class=\"prime-info\" style=\"margin-right: 20px;\"><p><span><h3 style=\"font-weight: normal\">{0}</h3></span></p></div><ul class=\"sub-info\"><li><span>生成时间: </span>{1}</li><li><span>订单编号: </span>{2}</li></ul><br class=\"clear\" /></div>", info.ShipTo, info.OrderDate.ToString("yyyy-MM-dd HH:mm"), info.OrderId);
                    builder.Append("<table><col class=\"col-0\" /><col class=\"col-1\" /><col class=\"col-2\" /><col class=\"col-3\" /><col class=\"col-4\" /><col class=\"col-5\" /><thead><tr><th>货号</th><th>商品名称</th><th>规格</th><th>数量</th><th>单价</th><th>总价</th></tr></thead><tbody>");
                    Dictionary <string, LineItemInfo> lineItems = info.LineItems;
                    if (lineItems != null)
                    {
                        foreach (string str2 in lineItems.Keys)
                        {
                            LineItemInfo info2 = lineItems[str2];
                            builder.AppendFormat("<tr><td>{0}</td>", info2.SKU);
                            builder.AppendFormat("<td>{0}</td>", info2.ItemDescription);
                            builder.AppendFormat("<td>{0}</td>", info2.SKUContent);
                            builder.AppendFormat("<td>{0}</td>", info2.ShipmentQuantity);
                            builder.AppendFormat("<td>{0}</td>", Math.Round(info2.ItemListPrice, 2));
                            builder.AppendFormat("<td>{0}</td></tr>", Math.Round(info2.GetSubTotal(), 2));
                        }
                    }
                    builder.AppendFormat("</tbody></table><ul class=\"price\"><li><span>商品总价: </span>{0}</li><li><span>运费: </span>{1}</li>", Math.Round(info.GetAmount(), 2), Math.Round(info.AdjustedFreight, 2));
                    decimal reducedPromotionAmount = info.ReducedPromotionAmount;
                    if (reducedPromotionAmount > 0M)
                    {
                        builder.AppendFormat("<li><span>优惠金额:</span>{0}</li>", Math.Round(reducedPromotionAmount, 2));
                    }
                    decimal payCharge = info.PayCharge;
                    if (payCharge > 0M)
                    {
                        builder.AppendFormat("<li><span>支付手续费:</span>{0}</li>", Math.Round(payCharge, 2));
                    }
                    if (!string.IsNullOrEmpty(info.CouponCode))
                    {
                        decimal couponValue = info.CouponValue;
                        if (couponValue > 0M)
                        {
                            builder.AppendFormat("<li><span>优惠券:</span>{0}</li>", Math.Round(couponValue, 2));
                        }
                    }
                    decimal adjustedDiscount = info.AdjustedDiscount;
                    if (adjustedDiscount > 0M)
                    {
                        builder.AppendFormat("<li><span>管理员手工加价:</span>{0}</li>", Math.Round(adjustedDiscount, 2));
                    }
                    else
                    {
                        builder.AppendFormat("<li><span>管理员手工减价:</span>{0}</li>", Math.Round(-adjustedDiscount, 2));
                    }
                    builder.AppendFormat("<li><span>实付金额:</span>{0}</li></ul><br class=\"clear\" /><br><br>", Math.Round(info.GetTotal(), 2));
                    child.InnerHtml = builder.ToString();
                    this.divContent.Controls.AddAt(0, child);
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string str = base.Request["OrderIds"].Trim(new char[] { ',' });

            if (!string.IsNullOrEmpty(str))
            {
                foreach (OrderInfo info in (from a in this.GetPrintData(str)
                                            orderby string.Concat(new object[] { a.ShipTo, a.RegionId, a.ExpressCompanyAbb, a.Address, a.CellPhone }) descending
                                            select a).ToList <OrderInfo>())
                {
                    HtmlGenericControl child = new HtmlGenericControl("div");
                    child.Attributes["class"] = "order print";
                    child.Attributes["style"] = "padding-bottom:60px;padding-top:40px;";
                    StringBuilder builder = new StringBuilder("");
                    builder.AppendFormat("<div class=\"info clear\"><ul class=\"sub-info\"><li><span>订单号: </span>{2}</li><li><span>成交时间: </span>{1}</li><li><span>收货人姓名: </span>{0}</li></ul></div>", info.ShipTo, (info.FinishDate.HasValue ? DateTime.Parse(info.FinishDate.ToString()) : info.OrderDate).ToString("yyyy-MM-dd HH:mm:ss"), info.OrderId);
                    builder.Append("<table><col class=\"col-1\" /><col class=\"col-3\" /><col class=\"col-3\" /><col class=\"col-3\" /><col class=\"col-4\" /><col class=\"col-5\" /><thead><tr><th>商品信息</th><th>商品编码</th><th>单价</th><th>数量</th><th>小计</th><th>总价</th></tr></thead><tbody>");
                    Dictionary <string, LineItemInfo> lineItems = info.LineItems;
                    if (lineItems != null)
                    {
                        int num = 0;
                        foreach (string str2 in lineItems.Keys)
                        {
                            LineItemInfo info2 = lineItems[str2];
                            string       sKU   = string.Empty;
                            if (info2.OrderItemsStatus == OrderStatus.Returned)
                            {
                                sKU = "(已退货,金额¥" + info2.ReturnMoney.ToString("F2") + ")";
                            }
                            else if (info2.OrderItemsStatus == OrderStatus.Refunded)
                            {
                                sKU = "(已退款,金额¥" + info2.ReturnMoney.ToString("F2") + ")";
                            }
                            builder.AppendFormat("<tr><td>{0}</td>", info2.ItemDescription + sKU + (string.IsNullOrEmpty(info2.SKUContent) ? "" : ("<br>" + info2.SKUContent)));
                            sKU = info2.SKU;
                            if (string.IsNullOrEmpty(sKU))
                            {
                                ProductInfo productDetails = ProductHelper.GetProductDetails(info2.ProductId);
                                if (productDetails != null)
                                {
                                    sKU = productDetails.ProductCode;
                                }
                            }
                            if (string.IsNullOrEmpty(sKU))
                            {
                                sKU = "-";
                            }
                            builder.AppendFormat("<td style='text-align:center;'>{0}</td>", sKU);
                            builder.AppendFormat("<td>¥{0}</td>", Math.Round(info2.ItemListPrice, 2));
                            builder.AppendFormat("<td style='padding-left:15px;'>{0}</td>", info2.ShipmentQuantity);
                            builder.AppendFormat("<td style='border-left:1px solid #858585;'>¥{0}</td>", Math.Round((decimal)(info2.GetSubTotal() - info2.DiscountAverage), 2));
                            if (num == 0)
                            {
                                string        str4     = string.Empty;
                                StringBuilder builder2 = new StringBuilder();
                                if (!string.IsNullOrEmpty(info.ActivitiesName))
                                {
                                    builder2.Append("<p>" + info.ActivitiesName + ":¥" + info.DiscountAmount.ToString("F2") + "</p>");
                                }
                                if (!string.IsNullOrEmpty(info.ReducedPromotionName))
                                {
                                    builder2.Append("<p>" + info.ReducedPromotionName + ":¥" + info.ReducedPromotionAmount.ToString("F2") + "</p>");
                                }
                                if (!string.IsNullOrEmpty(info.CouponName))
                                {
                                    builder2.Append("<p>" + info.CouponName + ":¥" + info.CouponAmount.ToString("F2") + "</p>");
                                }
                                if (!string.IsNullOrEmpty(info.RedPagerActivityName))
                                {
                                    builder2.Append("<p>" + info.RedPagerActivityName + ":¥" + info.RedPagerAmount.ToString("F2") + "</p>");
                                }
                                if (info.PointToCash > 0M)
                                {
                                    builder2.Append("<p>积分抵现:¥" + info.PointToCash.ToString("F2") + "</p>");
                                }
                                decimal adjustCommssion = info.GetAdjustCommssion();
                                if (adjustCommssion > 0M)
                                {
                                    builder2.Append("<p>管理员调价优惠:¥" + adjustCommssion.ToString("F2") + "</p>");
                                }
                                else if (adjustCommssion < 0M)
                                {
                                    builder2.Append("<p>管理员调价增加:¥" + adjustCommssion.ToString("F2").Trim(new char[] { '-' }) + "</p>");
                                }
                                str4 = builder2.ToString();
                                builder.AppendFormat("<td rowspan='{0}' colspan='1' style='border-left:1px solid #858585;'>{1}</td>", lineItems.Keys.Count, string.Format("<p><strong>¥{0}</strong></p>" + str4 + "<p>含运费¥{1}</p><p></p>", info.GetTotal().ToString("F2"), info.AdjustedFreight.ToString("F2")));
                            }
                            builder.Append("</tr>");
                            num++;
                        }
                    }
                    builder.Append("</tbody></table>");
                    child.InnerHtml = builder.ToString();
                    this.divContent.Controls.AddAt(0, child);
                }
            }
        }
예제 #10
0
        private void ProcessOrderAdd(HttpContext context)
        {
            OrderInfo orderInfo = new OrderInfo();

            try
            {
                string text = context.Request.Form["TaobaoOrderId"];
                if (string.IsNullOrEmpty(text) || ShoppingProcessor.IsExistOuterOrder("tb_" + text))
                {
                    context.Response.Write("0");
                }
                else
                {
                    orderInfo.OrderId      = this.GenerateOrderId();
                    orderInfo.OuterOrderId = "tb_" + context.Request.Form["TaobaoOrderId"];
                    orderInfo.Remark       = context.Request.Form["BuyerMemo"] + context.Request.Form["BuyerMessage"];
                    string text2 = context.Request.Form["SellerFlag"];
                    if (!string.IsNullOrEmpty(text2) && text2 != "0")
                    {
                        orderInfo.ManagerMark = (OrderMark)int.Parse(text2);
                    }
                    orderInfo.ManagerRemark = context.Request.Form["SellerMemo"];
                    orderInfo.OrderDate     = DateTime.Parse(context.Request.Form["OrderDate"]);
                    orderInfo.PayDate       = DateTime.Parse(context.Request.Form["PayDate"]);
                    orderInfo.UserId        = 1100;
                    OrderInfo orderInfo2 = orderInfo;
                    OrderInfo orderInfo3 = orderInfo;
                    string    text5      = orderInfo2.RealName = (orderInfo3.Username = context.Request.Form["Username"]);
                    orderInfo.EmailAddress   = context.Request.Form["EmailAddress"];
                    orderInfo.ShipTo         = context.Request.Form["ShipTo"];
                    orderInfo.ShippingRegion = context.Request.Form["ReceiverState"] + context.Request.Form["ReceiverCity"] + context.Request.Form["ReceiverDistrict"];
                    orderInfo.RegionId       = RegionHelper.GetRegionId(context.Request.Form["ReceiverDistrict"], context.Request.Form["ReceiverCity"], context.Request.Form["ReceiverState"]);
                    orderInfo.FullRegionPath = RegionHelper.GetFullPath(orderInfo.RegionId, true);
                    orderInfo.Address        = context.Request.Form["ReceiverAddress"];
                    orderInfo.TelPhone       = context.Request.Form["TelPhone"];
                    orderInfo.CellPhone      = context.Request.Form["CellPhone"];
                    OrderInfo orderInfo4 = orderInfo;
                    OrderInfo orderInfo5 = orderInfo;
                    int       num3       = orderInfo4.RealShippingModeId = (orderInfo5.ShippingModeId = 0);
                    OrderInfo orderInfo6 = orderInfo;
                    OrderInfo orderInfo7 = orderInfo;
                    text5 = (orderInfo6.RealModeName = (orderInfo7.ModeName = context.Request.Form["ModeName"]));
                    orderInfo.PaymentType      = "支付宝担宝交易";
                    orderInfo.Gateway          = "hishop.plugins.payment.alipayassure.assurerequest";
                    orderInfo.AdjustedDiscount = decimal.Zero;
                    string text8 = context.Request.Form["Products"];
                    if (string.IsNullOrEmpty(text8))
                    {
                        context.Response.Write("-1");
                    }
                    else
                    {
                        string[] array = text8.Split('|');
                        if (array.Length == 0)
                        {
                            context.Response.Write("-2");
                        }
                        else
                        {
                            string[] array2 = array;
                            decimal  num9;
                            foreach (string text9 in array2)
                            {
                                string[]     array3       = text9.Split(',');
                                LineItemInfo lineItemInfo = new LineItemInfo();
                                int          productId    = 0;
                                int.TryParse(array3[1], out productId);
                                int num4 = 1;
                                int.TryParse(array3[3], out num4);
                                lineItemInfo.SkuId     = array3[0];
                                lineItemInfo.ProductId = productId;
                                lineItemInfo.SKU       = array3[2];
                                LineItemInfo lineItemInfo2 = lineItemInfo;
                                LineItemInfo lineItemInfo3 = lineItemInfo;
                                num3 = (lineItemInfo2.Quantity = (lineItemInfo3.ShipmentQuantity = num4));
                                LineItemInfo lineItemInfo4 = lineItemInfo;
                                LineItemInfo lineItemInfo5 = lineItemInfo;
                                num9 = (lineItemInfo4.ItemCostPrice = (lineItemInfo5.ItemAdjustedPrice = decimal.Parse(array3[4])));
                                lineItemInfo.ItemListPrice   = decimal.Parse(array3[5]);
                                lineItemInfo.ItemDescription = HttpUtility.UrlDecode(array3[6]);
                                lineItemInfo.ThumbnailsUrl   = array3[7];
                                lineItemInfo.ItemWeight      = decimal.Zero;
                                lineItemInfo.SKUContent      = array3[8];
                                lineItemInfo.PromotionId     = 0;
                                lineItemInfo.PromotionName   = "";
                                orderInfo.ParentOrderId      = "0";
                                orderInfo.LineItems.Add(lineItemInfo.SkuId, lineItemInfo);
                            }
                            OrderInfo orderInfo8 = orderInfo;
                            OrderInfo orderInfo9 = orderInfo;
                            num9 = (orderInfo8.AdjustedFreight = (orderInfo9.Freight = decimal.Parse(context.Request.Form["PostFee"])));
                            orderInfo.OrderStatus = OrderStatus.BuyerAlreadyPaid;
                            orderInfo.OrderSource = OrderSource.Taobao;
                            if (ShoppingProcessor.CreatOrder(orderInfo))
                            {
                                context.Response.Write("1");
                            }
                            else
                            {
                                context.Response.Write("0");
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                NameValueCollection nameValueCollection = new NameValueCollection
                {
                    HttpContext.Current.Request.Form,
                    HttpContext.Current.Request.QueryString
                };
                nameValueCollection.Add("ErrorMessage", ex.Message);
                nameValueCollection.Add("StackTrace", ex.StackTrace);
                if (ex.InnerException != null)
                {
                    nameValueCollection.Add("InnerException", ex.InnerException.ToString());
                }
                if (ex.GetBaseException() != null)
                {
                    nameValueCollection.Add("BaseException", ex.GetBaseException().Message);
                }
                if (ex.TargetSite != (MethodBase)null)
                {
                    nameValueCollection.Add("TargetSite", ex.TargetSite.ToString());
                }
                nameValueCollection.Add("ExSource", ex.Source);
                Globals.AppendLog(nameValueCollection, "", "", HttpContext.Current.Request.Url.ToString(), "TaobaoOrder");
            }
        }
예제 #11
0
        public static bool InsertCalculationCommission(string orderid)
        {
            OrderInfo        orderInfo          = GetOrderInfo(orderid);
            DistributorsInfo userIdDistributors = DistributorsBrower.GetUserIdDistributors(orderInfo.ReferralUserId);
            bool             flag = false;

            if (userIdDistributors != null)
            {
                Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems;
                LineItemInfo info3       = new LineItemInfo();
                DataView     defaultView = CategoryBrowser.GetAllCategories().DefaultView;
                string       str2        = null;
                string       str3        = null;
                string       str4        = null;
                decimal      subTotal    = 0M;
                foreach (KeyValuePair <string, LineItemInfo> pair in lineItems)
                {
                    string key = pair.Key;
                    info3 = pair.Value;
                    DataTable productCategories = ProductBrowser.GetProductCategories(info3.ProductId);
                    if ((productCategories.Rows.Count > 0) && (productCategories.Rows[0][0].ToString() != "0"))
                    {
                        defaultView.RowFilter = " CategoryId=" + productCategories.Rows[0][0];
                        str2 = defaultView[0]["FirstCommission"].ToString();
                        str3 = defaultView[0]["SecondCommission"].ToString();
                        str4 = defaultView[0]["ThirdCommission"].ToString();
                        if ((!string.IsNullOrEmpty(str2) && !string.IsNullOrEmpty(str3)) && !string.IsNullOrEmpty(str4))
                        {
                            ArrayList referralBlanceList = new ArrayList();
                            ArrayList userIdList         = new ArrayList();
                            ArrayList ordersTotalList    = new ArrayList();
                            subTotal = info3.GetSubTotal();
                            if (string.IsNullOrEmpty(userIdDistributors.ReferralPath))
                            {
                                referralBlanceList.Add((decimal.Parse(str4) / 100M) * info3.GetSubTotal());
                                userIdList.Add(orderInfo.ReferralUserId);
                                ordersTotalList.Add(subTotal);
                            }
                            else
                            {
                                string[] strArray = userIdDistributors.ReferralPath.Split(new char[] { '|' });
                                if (strArray.Length == 1)
                                {
                                    referralBlanceList.Add((decimal.Parse(str3) / 100M) * info3.GetSubTotal());
                                    userIdList.Add(strArray[0]);
                                    ordersTotalList.Add(subTotal);
                                    referralBlanceList.Add((decimal.Parse(str4) / 100M) * info3.GetSubTotal());
                                    userIdList.Add(orderInfo.ReferralUserId);
                                    ordersTotalList.Add(subTotal);
                                }
                                if (strArray.Length == 2)
                                {
                                    referralBlanceList.Add((decimal.Parse(str2) / 100M) * info3.GetSubTotal());
                                    userIdList.Add(strArray[0]);
                                    ordersTotalList.Add(subTotal);
                                    referralBlanceList.Add((decimal.Parse(str3) / 100M) * info3.GetSubTotal());
                                    userIdList.Add(strArray[1]);
                                    ordersTotalList.Add(subTotal);
                                    referralBlanceList.Add((decimal.Parse(str4) / 100M) * info3.GetSubTotal());
                                    userIdList.Add(orderInfo.ReferralUserId);
                                    ordersTotalList.Add(subTotal);
                                }
                            }
                            flag = InsertCalculationCommission(userIdList, referralBlanceList, orderInfo.OrderId, ordersTotalList, orderInfo.UserId.ToString());
                        }
                    }
                }
            }
            return(flag);
        }
예제 #12
0
 public static LineItemInfo PopulateLineItem(IDataRecord reader)
 {
     if (null == reader)
     {
         return null;
     }
     LineItemInfo info = new LineItemInfo {
         SkuId = (string) reader["SkuId"],
         ProductId = (int) reader["ProductId"]
     };
     if (reader["SKU"] != DBNull.Value)
     {
         info.SKU = (string) reader["SKU"];
     }
     info.Quantity = (int) reader["Quantity"];
     info.ShipmentQuantity = (int) reader["ShipmentQuantity"];
     info.ItemCostPrice = (decimal) reader["CostPrice"];
     info.ItemListPrice = (decimal) reader["ItemListPrice"];
     info.ItemAdjustedPrice = (decimal) reader["ItemAdjustedPrice"];
     info.ItemDescription = (string) reader["ItemDescription"];
     if (reader["ThumbnailsUrl"] != DBNull.Value)
     {
         info.ThumbnailsUrl = (string) reader["ThumbnailsUrl"];
     }
     info.ItemWeight = (decimal) reader["Weight"];
     if (DBNull.Value != reader["SKUContent"])
     {
         info.SKUContent = (string) reader["SKUContent"];
     }
     if (DBNull.Value != reader["PromotionId"])
     {
         info.PromotionId = (int) reader["PromotionId"];
     }
     if (DBNull.Value != reader["PromotionName"])
     {
         info.PromotionName = (string) reader["PromotionName"];
     }
     return info;
 }
예제 #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string orderIds = base.Request["orderIds"].Trim(',');

            if (!string.IsNullOrEmpty(base.Request["orderIds"]))
            {
                foreach (OrderInfo printDatum in this.GetPrintData(orderIds))
                {
                    HtmlGenericControl htmlGenericControl = new HtmlGenericControl("div");
                    htmlGenericControl.Attributes["class"] = "order1 print";
                    StringBuilder stringBuilder = new StringBuilder("");
                    stringBuilder.AppendFormat("<div class=\"info\"><div class=\"prime-info\" style=\"margin-right: 20px;\"><p><span><h3>{0}</h3></span></p></div><ul class=\"sub-info\"><li><span>手机号码: </span>{3}</li><li><span>生成时间: </span>{1}</li><li><span>订单编号: </span>{2}</li></ul><br class=\"clear\" /></div>", printDatum.ShipTo.ToNullString(), printDatum.OrderDate.ToString("yyyy-MM-dd HH:mm"), printDatum.OrderId, printDatum.CellPhone);
                    stringBuilder.Append("<table><col class=\"col-0\" /><col class=\"col-1\" /><col class=\"col-2\" /><col class=\"col-3\" /><col class=\"col-4\" /><col class=\"col-5\" /><thead><tr><th>货号</th><th>商品名称</th><th>规格</th><th>数量</th><th nowrap=\"nowrap\">单价</th><th>总价</th></tr></thead><tbody>");
                    Dictionary <string, LineItemInfo> lineItems = printDatum.LineItems;
                    if (lineItems != null)
                    {
                        foreach (string key in lineItems.Keys)
                        {
                            LineItemInfo lineItemInfo = lineItems[key];
                            if (lineItemInfo.Status != LineItemStatus.Refunded && lineItemInfo.Status != LineItemStatus.Returned)
                            {
                                stringBuilder.AppendFormat("<tr><td nowrap=\"nowrap\">{0}</td>", lineItemInfo.SKU);
                                stringBuilder.AppendFormat("<td>{0}</td>", lineItemInfo.ItemDescription);
                                stringBuilder.AppendFormat("<td>{0}</td>", lineItemInfo.SKUContent);
                                stringBuilder.AppendFormat("<td nowrap=\"nowrap\">{0}</td>", lineItemInfo.ShipmentQuantity);
                                stringBuilder.AppendFormat("<td nowrap=\"nowrap\">{0}</td>", Math.Round(lineItemInfo.ItemListPrice, 2));
                                stringBuilder.AppendFormat("<td nowrap=\"nowrap\">{0}</td></tr>", Math.Round(lineItemInfo.GetSubTotal(), 2));
                            }
                        }
                    }
                    stringBuilder.Append("</tbody></table>");
                    string value = "";
                    IList <OrderGiftInfo> gifts = printDatum.Gifts;
                    if (gifts != null && gifts.Count > 0)
                    {
                        OrderGiftInfo orderGiftInfo = gifts[0];
                        stringBuilder.Append("<p style=\"text-align:left;\"><b>&nbsp;</b></p>");
                        stringBuilder.Append("<table><col class=\"col-0\" /><col class=\"col-1\" /><col class=\"col-2\" /><col class=\"col-3\" /><thead><tr><th>礼品名称</th><th>成本价</th><th>数量</th><th>类型</th></tr></thead><tbody>");
                        foreach (OrderGiftInfo gift in printDatum.Gifts)
                        {
                            stringBuilder.AppendFormat("<tr><td nowrap=\"nowrap\">{0}</td>", gift.GiftName);
                            stringBuilder.AppendFormat("<td>{0}</td>", gift.CostPrice.F2ToString("f2"));
                            stringBuilder.AppendFormat("<td>{0}</td>", gift.Quantity);
                            stringBuilder.AppendFormat("<td nowrap=\"nowrap\">{0}</td>", (gift.PromoteType == 5) ? "商品促销" : ((gift.PromoteType == 15) ? "订单促销" : "积分兑换"));
                        }
                        stringBuilder.Append("</tbody></table>");
                    }
                    stringBuilder.AppendFormat("<ul class=\"price\"><li><span>收货地址: </span>{0}</li><li><span>送货上门时间: </span>{1}</li></ul>", printDatum.ShippingRegion + printDatum.Address, printDatum.ShipToDate);
                    stringBuilder.AppendFormat("<br class=\"clear\" /><ul class=\"price\"><li><span>商品总价: </span>{0}</li><li><span>运费: </span>{1}</li>", Math.Round(printDatum.GetAmount(false), 2), Math.Round(printDatum.AdjustedFreight, 2));
                    decimal reducedPromotionAmount = printDatum.ReducedPromotionAmount;
                    if (reducedPromotionAmount > decimal.Zero)
                    {
                        stringBuilder.AppendFormat("<li><span>优惠金额:</span>{0}</li>", Math.Round(reducedPromotionAmount, 2));
                    }
                    if (!string.IsNullOrEmpty(printDatum.CouponCode))
                    {
                        decimal couponValue = printDatum.CouponValue;
                        if (couponValue > decimal.Zero)
                        {
                            stringBuilder.AppendFormat("<li><span>优惠券:</span>{0}</li>", Math.Round(couponValue, 2));
                        }
                    }
                    decimal adjustedDiscount = printDatum.AdjustedDiscount;
                    if (adjustedDiscount > decimal.Zero)
                    {
                        stringBuilder.AppendFormat("<li><span>管理员手工加价:</span>{0}</li>", Math.Round(adjustedDiscount, 2));
                    }
                    else
                    {
                        stringBuilder.AppendFormat("<li><span>管理员手工减价:</span>{0}</li>", Math.Round(-adjustedDiscount, 2));
                    }
                    stringBuilder.Append(value);
                    stringBuilder.AppendFormat("<li><span>实付金额:</span>{0}</li>", Math.Round(printDatum.GetTotal(false), 2));
                    stringBuilder.AppendFormat("<li><span>支付方式:</span>{0}</li></ul>", printDatum.PaymentType);
                    stringBuilder.AppendFormat("<br class=\"clear\" /><ul class=\"price\"><li><span>备注: </span>{0}</li></ul><br class=\"clear\" /><br><br>", printDatum.Remark);
                    htmlGenericControl.InnerHtml = stringBuilder.ToString();
                    this.divContent.Controls.AddAt(0, htmlGenericControl);
                }
            }
        }
예제 #14
0
        protected void orderItems_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                LineItemStatus lineItemStatus = (LineItemStatus)DataBinder.Eval(e.Item.DataItem, "Status");
                string         text           = DataBinder.Eval(e.Item.DataItem, "SkuId").ToString();
                OrderStatus    orderStatus    = this.order.OrderStatus;
                DateTime       finishDate     = this.order.FinishDate;
                string         gateway        = this.order.Gateway;
                LineItemInfo   lineItemInfo   = this.order.LineItems[text];
                HtmlAnchor     htmlAnchor     = (HtmlAnchor)e.Item.FindControl("lkbtnAfterSalesApply");
                Label          label          = (Label)e.Item.FindControl("Logistics");
                HtmlAnchor     htmlAnchor2    = (HtmlAnchor)e.Item.FindControl("lkbtnViewMessage");
                htmlAnchor.Attributes.Add("OrderId", this.order.OrderId);
                htmlAnchor.Attributes.Add("SkuId", text);
                htmlAnchor.Attributes.Add("GateWay", gateway);
                ReplaceInfo replaceInfo = lineItemInfo.ReplaceInfo;
                ReturnInfo  returnInfo  = lineItemInfo.ReturnInfo;
                string      text2       = (string)DataBinder.Eval(e.Item.DataItem, "StatusText");
                if (lineItemStatus == LineItemStatus.Normal)
                {
                    text2 = "";
                }
                else if (returnInfo != null)
                {
                    text2 = ((returnInfo.AfterSaleType != AfterSaleTypes.OnlyRefund) ? EnumDescription.GetEnumDescription((Enum)(object)returnInfo.HandleStatus, 1) : EnumDescription.GetEnumDescription((Enum)(object)returnInfo.HandleStatus, 3));
                }
                else if (replaceInfo != null)
                {
                    text2 = EnumDescription.GetEnumDescription((Enum)(object)replaceInfo.HandleStatus, 1);
                }
                SiteSettings masterSettings = SettingsManager.GetMasterSettings();
                HtmlAnchor   htmlAnchor3    = htmlAnchor;
                int          visible;
                switch (orderStatus)
                {
                case OrderStatus.Finished:
                    visible = ((!this.order.IsServiceOver) ? 1 : 0);
                    break;

                default:
                    visible = 0;
                    break;

                case OrderStatus.SellerAlreadySent:
                    visible = 1;
                    break;
                }
                htmlAnchor3.Visible = ((byte)visible != 0);
                if (htmlAnchor.Visible)
                {
                    htmlAnchor.Visible = (this.order.LineItems.Count >= 1 && (returnInfo == null || returnInfo.HandleStatus == ReturnStatus.Refused) && (replaceInfo == null || replaceInfo.HandleStatus == ReplaceStatus.Refused));
                }
                Literal literal = (Literal)e.Item.FindControl("litStatusText");
                if (literal != null && lineItemStatus != 0)
                {
                    if (returnInfo != null && (lineItemStatus == LineItemStatus.DeliveryForReturn || lineItemStatus == LineItemStatus.GetGoodsForReturn || lineItemStatus == LineItemStatus.MerchantsAgreedForReturn || lineItemStatus == LineItemStatus.ReturnApplied || lineItemStatus == LineItemStatus.Returned || lineItemStatus == LineItemStatus.ReturnsRefused))
                    {
                        literal.Text = "<a href=\"/User/UserReturnsApplyDetails?ReturnsId=" + returnInfo.ReturnId + "\">" + text2 + "</a>";
                    }
                    else if (replaceInfo != null)
                    {
                        literal.Text = "<a href=\"/User/UserReplaceApplyDetails?ReplaceId=" + replaceInfo.ReplaceId + "\">" + text2 + "</a>";
                    }
                }
                int num;
                if (replaceInfo != null && (replaceInfo.HandleStatus == ReplaceStatus.Replaced || replaceInfo.HandleStatus == ReplaceStatus.UserDelivery || replaceInfo.HandleStatus == ReplaceStatus.MerchantsDelivery))
                {
                    label.Attributes.Add("action", "replace");
                    AttributeCollection attributes = label.Attributes;
                    num = replaceInfo.ReplaceId;
                    attributes.Add("ReplaceId", num.ToString());
                    label.Visible = true;
                }
                if (returnInfo != null && returnInfo.AfterSaleType == AfterSaleTypes.ReturnAndRefund && (returnInfo.HandleStatus == ReturnStatus.Deliverying || returnInfo.HandleStatus == ReturnStatus.Returned || returnInfo.HandleStatus == ReturnStatus.GetGoods))
                {
                    label.Attributes.Add("action", "return");
                    AttributeCollection attributes2 = label.Attributes;
                    num = returnInfo.ReturnId;
                    attributes2.Add("returnId", num.ToString());
                    label.Visible = true;
                }
            }
        }
예제 #15
0
        /// <summary>
        /// 提交到订货列表按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnBuy_Click(object sender, System.EventArgs e)
        {
            this.btnBuy.Enabled = false;                                    //禁用当前按钮
            ManagerInfo currentManager = ManagerHelper.GetCurrentManager(); //当前登录用户信息

            if (currentManager != null /*&& currentManager.ClientUserId > 0*/)
            {
                string strSkuIds     = string.Empty; //存储所有订购商品的SkuId,用于操作后清除待选列表Erp_AgentProduct表数据
                int    shipaddressId = 0;            //送货地址Id
                int    givemodeId    = 0;            //配送方式Id
                int    paymodeId     = 0;            //支付方式Id

                ShoppingCartInfo shoppingCart = null;

                OrderInfo  orderInfo     = new OrderInfo();
                MemberInfo currentMember = MemberHelper.GetMember(currentManager.ClientUserId);
                foreach (System.Web.UI.WebControls.GridViewRow row in this.grdProducts.Rows)
                {
                    //decimal total = 0;
                    decimal price     = 0;                                                                                                 //单价
                    int     resultNum = 0;                                                                                                 //数量

                    System.Web.UI.WebControls.HiddenField txtboxvalue = (System.Web.UI.WebControls.HiddenField)row.FindControl("hiValue"); //得到SkuId
                    //System.Web.UI.WebControls.HiddenField txtboxproduct = (System.Web.UI.WebControls.HiddenField)row.FindControl("hiProductId");//得到ProductId
                    System.Web.UI.WebControls.Literal litSalePrice = (System.Web.UI.WebControls.Literal)row.FindControl("litSalePrice");

                    if (int.TryParse(txtboxvalue.Value.Trim(), out resultNum) && decimal.TryParse(litSalePrice.Text, out price))
                    {
                        string skuId = this.grdProducts.DataKeys[row.RowIndex].Value.ToString();
                        strSkuIds += "'" + skuId + "',";//累加SkuId值并用'',''分割
                        if (!string.IsNullOrEmpty(skuId))
                        {
                            //首先将商品插入购物车
                            //后台订单的购物车处理
                            int pcUserid = 0;
                            if (Hidistro.ControlPanel.Config.CustomConfigHelper.Instance.RegionalFunction && ManagerHelper.GetCurrentManager() != null)
                            {
                                int categoryId = CategoryBrowser.GetCategoryIdBySkuId(skuId);
                                pcUserid = currentManager.UserId;
                                ShoppingCartProcessor.AddLineItemPC(skuId, resultNum, categoryId, pcUserid);
                            }


                            //total += price * resultNum;//计算合计
                            //生成订单项

                            //shoppingCart = ShoppingCartProcessor.GetGroupBuyShoppingCart(currentMember, price, skuId, resultNum);
                            shoppingCart = ShoppingCartProcessor.GetShoppingCart(currentManager.UserId);
                            if (shoppingCart != null && shoppingCart.LineItems != null && shoppingCart.LineItems.Count > 0)
                            {
                                foreach (ShoppingCartItemInfo info2 in shoppingCart.LineItems)
                                {
                                    LineItemInfo info3 = new LineItemInfo
                                    {
                                        SkuId             = info2.SkuId,
                                        ProductId         = info2.ProductId,
                                        SKU               = info2.SKU,
                                        Quantity          = info2.Quantity,
                                        ShipmentQuantity  = info2.ShippQuantity,
                                        ItemCostPrice     = new SkuDao().GetSkuItem(info2.SkuId).CostPrice,
                                        ItemListPrice     = info2.MemberPrice,
                                        ItemAdjustedPrice = info2.AdjustedPrice,
                                        ItemDescription   = info2.Name,
                                        ThumbnailsUrl     = info2.ThumbnailUrl40,
                                        ItemWeight        = info2.Weight,
                                        SKUContent        = info2.SkuContent,
                                        PromotionId       = info2.PromotionId,
                                        PromotionName     = info2.PromotionName,
                                        MainCategoryPath  = info2.MainCategoryPath
                                    };
                                    orderInfo.LineItems.Add(info3.SkuId, info3);
                                }
                            }
                            else
                            {
                                this.ShowMsg("订单生成失败。", true);
                                this.btnBuy.Enabled = true;//启用当前按钮
                                return;
                            }
                        }
                    }
                }
                //一个商品数量都没输入,则退出
                if (string.IsNullOrEmpty(strSkuIds))
                {
                    this.ShowMsg("请输入商品数量。", true);
                    this.btnBuy.Enabled = true;//启用当前按钮
                    return;
                }

                //送货地址
                if (int.TryParse(this.userAddress.SelectedValue, out shipaddressId))
                {
                    ShippingAddressInfo shippingAddress = MemberProcessor.GetShippingAddress(shipaddressId, Convert.ToInt32("99999" + currentManager.UserId.ToString()));//(shipaddressId, currentMember.UserId);
                    if (shippingAddress != null)
                    {
                        //this.userAddress.SelectedItem.Text
                        orderInfo.ShippingRegion = RegionHelper.GetFullRegion(shippingAddress.RegionId, ",");
                        orderInfo.RegionId       = shippingAddress.RegionId;
                        orderInfo.Address        = shippingAddress.Address;
                        orderInfo.ZipCode        = shippingAddress.Zipcode;
                        orderInfo.ShipTo         = shippingAddress.ShipTo;
                        orderInfo.TelPhone       = shippingAddress.TelPhone;
                        orderInfo.CellPhone      = shippingAddress.CellPhone;
                        MemberProcessor.SetDefaultShippingAddress(shipaddressId, Convert.ToInt32("99999" + currentManager.UserId.ToString()));
                    }
                }
                //配送方式
                if (int.TryParse(this.userGiveMode.SelectedValue, out givemodeId))
                {
                    ShippingModeInfo shippingMode = ShoppingProcessor.GetShippingMode(givemodeId, true);
                    if (shippingMode != null)
                    {
                        orderInfo.ShippingModeId = shippingMode.ModeId;
                        orderInfo.ModeName       = shippingMode.Name;
                        if (shoppingCart.LineItems.Count != shoppingCart.LineItems.Count((ShoppingCartItemInfo a) => a.IsfreeShipping))
                        {
                            orderInfo.AdjustedFreight = (orderInfo.Freight = ShoppingProcessor.CalcFreight(orderInfo.RegionId, shoppingCart.Weight, shippingMode));
                        }
                        else
                        {
                            orderInfo.AdjustedFreight = (orderInfo.Freight = 0m);
                        }
                    }
                }
                //支付方式
                if (int.TryParse(this.userPayMode.SelectedValue, out paymodeId))
                {
                    orderInfo.PaymentTypeId = paymodeId;
                    switch (paymodeId)
                    {
                    //case -1:
                    //case 0:
                    //    {
                    //        orderInfo.PaymentType = "货到付款";
                    //        orderInfo.Gateway = "hishop.plugins.payment.podrequest";
                    //        break;
                    //    }
                    //case 88:
                    //    {
                    //        orderInfo.PaymentType = "微信支付";
                    //        orderInfo.Gateway = "hishop.plugins.payment.weixinrequest";
                    //        break;
                    //    }
                    case 99:
                    {
                        orderInfo.PaymentType = "线下付款";
                        orderInfo.Gateway     = "hishop.plugins.payment.offlinerequest";
                        break;
                    }

                    default:
                    {
                        PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(paymodeId);
                        if (paymentMode != null)
                        {
                            orderInfo.PaymentTypeId = paymentMode.ModeId;
                            orderInfo.PaymentType   = paymentMode.Name;
                            orderInfo.Gateway       = paymentMode.Gateway;
                        }
                        break;
                    }
                    }
                }
                orderInfo.OrderId   = this.GenerateOrderId(currentManager.UserId); //生成ID
                orderInfo.OrderDate = System.DateTime.Now;                         //当前时间
                //基本信息
                orderInfo.OrderStatus    = OrderStatus.WaitBuyerPay;
                orderInfo.RefundStatus   = RefundStatus.None;
                orderInfo.ShipToDate     = "时间不限";
                orderInfo.ReferralUserId = 0;//订单的所属分销ID,没有就设置为0

                //代理商用户相关信息
                orderInfo.UserId       = Convert.ToInt32("99999" + currentManager.UserId.ToString()); //currentMember.UserId;
                orderInfo.Username     = currentManager.UserName;                                     //currentMember.UserName;
                orderInfo.EmailAddress = currentManager.Email;                                        //currentMember.Email;

                //orderInfo.RealName = currentMember.RealName;
                orderInfo.RealName = currentManager.AgentName;//存储用户后台昵称

                //orderInfo.QQ = currentMember.QQ;
                orderInfo.Remark      = this.txtOrderRemark.Text; //得到前端TextBox值
                orderInfo.OrderSource = 1;                        //来源代理商采购
                this.SetOrderItemStatus(orderInfo);



                if (ShoppingProcessor.CreatOrder(orderInfo))
                {
                    ShoppingCartProcessor.ClearShoppingCartPC();
                    //订单生成成功后清空
                    strSkuIds = strSkuIds.TrimEnd(',');
                    //清除已经订购的商品在订购列表中
                    ProductBrowser.DeleteAgentProduct(strSkuIds, currentManager.UserId);

                    this.ShowMsg("订单生成成功,请尽快完成支付。", true);
                }
                else
                {
                    this.ShowMsg("订单生成失败。", true);
                }

                //HiCache.Remove("DataCache-Categories");//刷前台缓存
                this.BindProducts();
            }
            else
            {
                this.ShowMsg("当前登录用户不是前端用户升级而来,无法进行生成订单操作。", true);
            }
            this.btnBuy.Enabled = true;//启用当前按钮
        }
예제 #16
0
        private void Down(HttpContext context)
        {
            string parameter = base.GetParameter(context, "ids", true);

            if (context.Session["jdOrder"] != null && !string.IsNullOrEmpty(parameter))
            {
                string text = "";
                text = parameter;
                string[] idArray = text.Split(',');
                PageModel <JDOrderModel> pageModel = (PageModel <JDOrderModel>)context.Session["jdOrder"];
                int i;
                for (i = 0; i < idArray.Length; i++)
                {
                    JDOrderModel jDOrderModel = ((List <JDOrderModel>) pageModel.Models).Find(delegate(JDOrderModel jdOrder)
                    {
                        if (jdOrder.OrderId.Equals(idArray[i]))
                        {
                            return(true);
                        }
                        return(false);
                    });
                    if (jDOrderModel != null)
                    {
                        OrderInfo orderInfo = new OrderInfo();
                        try
                        {
                            if (!ShoppingProcessor.IsExistOuterOrder("jd_" + jDOrderModel.OrderId))
                            {
                                orderInfo.OrderId       = this.GenerateOrderId();
                                orderInfo.OuterOrderId  = "jd_" + jDOrderModel.OrderId;
                                orderInfo.Remark        = jDOrderModel.OrderReMark;
                                orderInfo.ManagerRemark = jDOrderModel.OrderManagerReMark;
                                orderInfo.OrderDate     = DateTime.Parse(jDOrderModel.CreatedAt);
                                orderInfo.PayDate       = DateTime.Parse(jDOrderModel.ModifyAt);
                                orderInfo.UserId        = 1100;
                                OrderInfo orderInfo2 = orderInfo;
                                OrderInfo orderInfo3 = orderInfo;
                                string    text3      = orderInfo2.RealName = (orderInfo3.Username = jDOrderModel.Consignee.FullName);
                                orderInfo.EmailAddress   = "";
                                orderInfo.ShipTo         = jDOrderModel.Consignee.FullName;
                                orderInfo.ShippingRegion = jDOrderModel.Consignee.Province + jDOrderModel.Consignee.City + jDOrderModel.Consignee.County;
                                orderInfo.RegionId       = RegionHelper.GetRegionId(jDOrderModel.Consignee.County, jDOrderModel.Consignee.City, jDOrderModel.Consignee.Province);
                                orderInfo.FullRegionPath = RegionHelper.GetFullPath(orderInfo.RegionId, true);
                                orderInfo.Address        = jDOrderModel.Consignee.FullAddress;
                                orderInfo.TelPhone       = jDOrderModel.Consignee.Telephone;
                                orderInfo.CellPhone      = jDOrderModel.Consignee.Mobile;
                                orderInfo.ZipCode        = "";
                                OrderInfo orderInfo4 = orderInfo;
                                OrderInfo orderInfo5 = orderInfo;
                                int       num3       = orderInfo4.RealShippingModeId = (orderInfo5.ShippingModeId = 0);
                                OrderInfo orderInfo6 = orderInfo;
                                OrderInfo orderInfo7 = orderInfo;
                                text3 = (orderInfo6.RealModeName = (orderInfo7.ModeName = ""));
                                orderInfo.PaymentType      = jDOrderModel.PayType;
                                orderInfo.Gateway          = "";
                                orderInfo.AdjustedDiscount = decimal.Zero;
                                if (jDOrderModel.Products.Count > 0)
                                {
                                    decimal num8;
                                    foreach (JDOrderItemModel product in jDOrderModel.Products)
                                    {
                                        LineItemInfo lineItemInfo = new LineItemInfo();
                                        lineItemInfo.SkuId     = product.SkuId;
                                        lineItemInfo.ProductId = Convert.ToInt32(product.ProductId);
                                        lineItemInfo.SKU       = "";
                                        LineItemInfo lineItemInfo2 = lineItemInfo;
                                        LineItemInfo lineItemInfo3 = lineItemInfo;
                                        num3 = (lineItemInfo2.Quantity = (lineItemInfo3.ShipmentQuantity = Convert.ToInt32(product.Total)));
                                        LineItemInfo lineItemInfo4 = lineItemInfo;
                                        LineItemInfo lineItemInfo5 = lineItemInfo;
                                        num8 = (lineItemInfo4.ItemCostPrice = (lineItemInfo5.ItemAdjustedPrice = decimal.Parse(product.Price)));
                                        lineItemInfo.ItemListPrice   = decimal.Parse(product.Price);
                                        lineItemInfo.ItemDescription = "";
                                        lineItemInfo.ThumbnailsUrl   = "";
                                        lineItemInfo.ItemWeight      = decimal.Zero;
                                        lineItemInfo.SKUContent      = product.SkuName;
                                        lineItemInfo.PromotionId     = 0;
                                        lineItemInfo.PromotionName   = "";
                                        orderInfo.LineItems.Add(lineItemInfo.SkuId, lineItemInfo);
                                    }
                                    OrderInfo orderInfo8 = orderInfo;
                                    OrderInfo orderInfo9 = orderInfo;
                                    num8 = (orderInfo8.AdjustedFreight = (orderInfo9.Freight = decimal.Parse(jDOrderModel.Freight)));
                                    orderInfo.OrderStatus = OrderStatus.BuyerAlreadyPaid;
                                    orderInfo.OrderSource = OrderSource.JD;
                                    if (ShoppingProcessor.CreatOrder(orderInfo))
                                    {
                                        jDOrderModel.IsExsit = true;
                                        jDOrderModel.Status  = "已下载";
                                    }
                                    else
                                    {
                                        jDOrderModel.Status = "下载失败";
                                    }
                                    continue;
                                }
                                goto end_IL_00c4;
                            }
                            return;

                            end_IL_00c4 :;
                        }
                        catch (Exception ex)
                        {
                            NameValueCollection param = new NameValueCollection
                            {
                                HttpContext.Current.Request.Form,
                                HttpContext.Current.Request.QueryString
                            };
                            Globals.WriteExceptionLog_Page(ex, param, "JDOrder");
                            continue;
                        }
                        break;
                    }
                }
                base.ReturnSuccessResult(context, "操作完成", 0, true);
                return;
            }
            throw new HidistroAshxException("无数据");
        }
예제 #17
0
        public static string UpdateAdjustCommssions(string orderId, string itemid, decimal commssionmoney, decimal adjustcommssion)
        {
            string   text     = string.Empty;
            Database database = DatabaseFactory.CreateDatabase();
            string   result;

            using (System.Data.Common.DbConnection dbConnection = database.CreateConnection())
            {
                dbConnection.Open();
                System.Data.Common.DbTransaction dbTransaction = dbConnection.BeginTransaction();
                try
                {
                    OrderInfo orderInfo = ShoppingProcessor.GetOrderInfo(orderId);
                    if (orderId == null)
                    {
                        result = "订单编号不合法";
                        return(result);
                    }
                    int userId = DistributorsBrower.GetCurrentDistributors(true).UserId;
                    if (orderInfo.ReferralUserId != userId || orderInfo.OrderStatus != OrderStatus.WaitBuyerPay)
                    {
                        result = "不是您的订单";
                        return(result);
                    }
                    LineItemInfo lineItemInfo = orderInfo.LineItems[itemid];
                    if (lineItemInfo == null || lineItemInfo.ItemsCommission < adjustcommssion)
                    {
                        if (!(lineItemInfo.ItemsCommission.ToString("F2") == adjustcommssion.ToString("F2")))
                        {
                            result = "修改金额过大";
                            return(result);
                        }
                        adjustcommssion = lineItemInfo.ItemsCommission;
                    }
                    lineItemInfo.ItemAdjustedCommssion = adjustcommssion;
                    lineItemInfo.IsAdminModify         = false;
                    if (!new LineItemDao().UpdateLineItem(orderId, lineItemInfo, dbTransaction))
                    {
                        dbTransaction.Rollback();
                    }
                    if (!new OrderDao().UpdateOrder(orderInfo, dbTransaction))
                    {
                        dbTransaction.Rollback();
                        result = "更新订单信息失败";
                        return(result);
                    }
                    dbTransaction.Commit();
                    text = "1";
                }
                catch (Exception ex)
                {
                    text = ex.ToString();
                    dbTransaction.Rollback();
                }
                finally
                {
                    dbConnection.Close();
                }
                result = text;
            }
            return(result);
        }
예제 #18
0
        public static OrderInfo ConvertShoppingCartToOrder(ShoppingCartInfo shoppingCart, bool isCountDown, bool isSignBuy)
        {
            OrderInfo result;

            if (shoppingCart.LineItems.Count == 0)
            {
                result = null;
            }
            else
            {
                OrderInfo orderInfo = new OrderInfo();
                orderInfo.Points                      = shoppingCart.GetPoint();
                orderInfo.ReducedPromotionId          = shoppingCart.ReducedPromotionId;
                orderInfo.ReducedPromotionName        = shoppingCart.ReducedPromotionName;
                orderInfo.ReducedPromotionAmount      = shoppingCart.ReducedPromotionAmount;
                orderInfo.IsReduced                   = shoppingCart.IsReduced;
                orderInfo.SentTimesPointPromotionId   = shoppingCart.SentTimesPointPromotionId;
                orderInfo.SentTimesPointPromotionName = shoppingCart.SentTimesPointPromotionName;
                orderInfo.IsSendTimesPoint            = shoppingCart.IsSendTimesPoint;
                orderInfo.TimesPoint                  = shoppingCart.TimesPoint;
                orderInfo.FreightFreePromotionId      = shoppingCart.FreightFreePromotionId;
                orderInfo.FreightFreePromotionName    = shoppingCart.FreightFreePromotionName;
                orderInfo.IsFreightFree               = shoppingCart.IsFreightFree;

                string str = string.Empty;
                if (shoppingCart.LineItems.Count > 0)
                {
                    foreach (ShoppingCartItemInfo current in shoppingCart.LineItems)
                    {
                        str += string.Format("'{0}',", current.SkuId);
                    }
                }
                if (shoppingCart.LineItems.Count > 0)
                {
                    foreach (ShoppingCartItemInfo current in shoppingCart.LineItems)
                    {
                        LineItemInfo lineItemInfo = new LineItemInfo();
                        lineItemInfo.SkuId              = current.SkuId;
                        lineItemInfo.ProductId          = current.ProductId;
                        lineItemInfo.SKU                = current.SKU;
                        lineItemInfo.Quantity           = current.Quantity;
                        lineItemInfo.ShipmentQuantity   = current.ShippQuantity;
                        lineItemInfo.CommissionDiscount = 100;


                        if (current.LimitedTimeDiscountId > 0)
                        {
                            bool flag = true;
                            LimitedTimeDiscountInfo discountInfo = new LimitedTimeDiscountDao().GetDiscountInfo(current.LimitedTimeDiscountId);
                            if (discountInfo == null)
                            {
                                flag = false;
                            }
                            else
                            {
                                lineItemInfo.CommissionDiscount = discountInfo.CommissionDiscount;
                            }
                            if (!flag)
                            {
                                current.LimitedTimeDiscountId = 0;
                            }
                        }
                        lineItemInfo.ItemCostPrice     = new SkuDao().GetSkuItem(current.SkuId).CostPrice;
                        lineItemInfo.ItemListPrice     = current.MemberPrice;
                        lineItemInfo.ItemAdjustedPrice = current.AdjustedPrice;
                        lineItemInfo.ItemDescription   = current.Name;
                        lineItemInfo.ThumbnailsUrl     = current.ThumbnailUrl60;
                        lineItemInfo.ItemWeight        = current.Weight;
                        lineItemInfo.SKUContent        = current.SkuContent;
                        lineItemInfo.PromotionId       = current.PromotionId;
                        lineItemInfo.PromotionName     = current.PromotionName;
                        lineItemInfo.MainCategoryPath  = current.MainCategoryPath;
                        lineItemInfo.Type                  = current.Type;
                        lineItemInfo.ExchangeId            = current.ExchangeId;
                        lineItemInfo.PointNumber           = current.PointNumber * lineItemInfo.Quantity;
                        lineItemInfo.ThirdCommission       = current.ThirdCommission;
                        lineItemInfo.SecondCommission      = current.SecondCommission;
                        lineItemInfo.FirstCommission       = current.FirstCommission;
                        lineItemInfo.IsSetCommission       = current.IsSetCommission;
                        lineItemInfo.LimitedTimeDiscountId = current.LimitedTimeDiscountId;
                        orderInfo.LineItems.Add(lineItemInfo.SkuId + lineItemInfo.Type + lineItemInfo.LimitedTimeDiscountId, lineItemInfo);
                    }
                }
                orderInfo.Tax          = 0.00m;
                orderInfo.InvoiceTitle = "";
                result = orderInfo;
            }
            return(result);
        }
예제 #19
0
 public abstract bool UpdateLineItem(string orderId, LineItemInfo lineItem, DbTransaction dbTran);
        protected void btnSelOrdersFinish_Click(object sender, EventArgs e)
        {
            bool   flag = false;
            string str  = "";

            if (!string.IsNullOrEmpty(base.Request["CheckBoxGroup"]))
            {
                str = base.Request["CheckBoxGroup"];
            }
            if (str.Length <= 0)
            {
                this.ShowMsg("请先选择要批量确认收货的订单", false);
            }
            else
            {
                string[] strArray = str.Trim(new char[] { ',' }).Split(new char[] { ',' });
                int      num      = 0;
                int      num2     = 0;
                foreach (string str2 in strArray)
                {
                    if (!string.IsNullOrEmpty(str2))
                    {
                        OrderInfo orderInfo = OrderHelper.GetOrderInfo(str2);
                        if (orderInfo != null)
                        {
                            Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems;
                            LineItemInfo info2 = new LineItemInfo();
                            foreach (KeyValuePair <string, LineItemInfo> pair in lineItems)
                            {
                                info2 = pair.Value;
                                if ((info2.OrderItemsStatus == OrderStatus.ApplyForRefund) || (info2.OrderItemsStatus == OrderStatus.ApplyForReturns))
                                {
                                    flag = true;
                                    break;
                                }
                            }
                            if (!flag)
                            {
                                if (OrderHelper.ConfirmOrderFinish(orderInfo))
                                {
                                    num++;
                                    this.myNotifier.updateAction = UpdateAction.OrderUpdate;
                                    this.myNotifier.actionDesc   = "订单已完成";
                                    if (orderInfo.PayDate.HasValue)
                                    {
                                        this.myNotifier.RecDateUpdate = orderInfo.PayDate.Value;
                                    }
                                    else
                                    {
                                        this.myNotifier.RecDateUpdate = DateTime.Today;
                                    }
                                    this.myNotifier.DataUpdated += new StatisticNotifier.DataUpdatedEventHandler(this.myEvent.Update);
                                    this.myNotifier.UpdateDB();
                                }
                            }
                            else
                            {
                                num2++;
                            }
                        }
                    }
                    flag = false;
                }
                if (num > 0)
                {
                    string msg = "批量确认收货了" + num.ToString() + "个订单";
                    if (num2 > 0)
                    {
                        msg = msg + "," + num2.ToString() + "个订单中有退货(款)未完成";
                    }
                    this.ShowMsg(msg, true);
                }
                else
                {
                    this.ShowMsg("订单中商品有退货(款)不允许完成!", false);
                }
                this.BindOrders();
            }
        }
예제 #21
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string orderIds = base.Request["orderIds"].Trim(new char[]
            {
                ','
            });

            if (string.IsNullOrEmpty(base.Request["orderIds"]))
            {
                return;
            }
            foreach (OrderInfo current in this.GetPrintData(orderIds))
            {
                System.Web.UI.HtmlControls.HtmlGenericControl htmlGenericControl = new System.Web.UI.HtmlControls.HtmlGenericControl("div");
                htmlGenericControl.Attributes["class"] = "order print";
                System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder("");
                stringBuilder.AppendFormat("<div class=\"info\"><div class=\"prime-info\" style=\"margin-right: 20px;\"><p><span><h3 style=\"font-weight: normal\">{0}</h3></span></p></div><ul class=\"sub-info\"><li><span>生成时间: </span>{1}</li><li><span>发货单号: </span>{2}</li></ul><br class=\"clear\" /></div>", current.ShipTo, current.OrderDate.ToString("yyyy-MM-dd HH:mm"), current.OrderId);
                stringBuilder.Append("<table><col class=\"col-0\" /><col class=\"col-1\" /><col class=\"col-2\" /><col class=\"col-3\" /><col class=\"col-4\" /><col class=\"col-5\" /><thead><tr><th>货号</th><th>商品名称</th><th>规格</th><th>数量</th><th style=\"display:none\">单价</th><th style=\"display:none\">总价</th></tr></thead><tbody>");
                System.Collections.Generic.Dictionary <string, LineItemInfo> lineItems = current.LineItems;
                if (lineItems != null)
                {
                    foreach (string current2 in lineItems.Keys)
                    {
                        LineItemInfo lineItemInfo = lineItems[current2];
                        stringBuilder.AppendFormat("<tr><td>{0}</td>", lineItemInfo.SKU);
                        stringBuilder.AppendFormat("<td>{0}</td>", lineItemInfo.ItemDescription);
                        stringBuilder.AppendFormat("<td>{0}</td>", lineItemInfo.SKUContent);
                        stringBuilder.AppendFormat("<td>{0}</td>", lineItemInfo.ShipmentQuantity);
                        stringBuilder.AppendFormat("<td style=\"display:none\">{0}</td>", System.Math.Round(lineItemInfo.ItemListPrice, 2));
                        stringBuilder.AppendFormat("<td style=\"display:none\">{0}</td></tr>", System.Math.Round(lineItemInfo.GetSubTotal(), 2));
                    }
                }
                string value = "";
                System.Collections.Generic.IList <OrderGiftInfo> gifts = current.Gifts;
                if (gifts != null && gifts.Count > 0)
                {
                    OrderGiftInfo orderGiftInfo = gifts[0];
                    value = string.Format("<li><span>赠送礼品:</span>{0},数量:{1}</li>", orderGiftInfo.GiftName, orderGiftInfo.Quantity);
                }
                stringBuilder.AppendFormat("</tbody></table><ul class=\"price\" style=\"display:none\"><li><span>商品总价: </span>{0}</li><li><span>运费: </span>{1}</li>", System.Math.Round(current.GetAmount(), 2), System.Math.Round(current.AdjustedFreight, 2));
                decimal reducedPromotionAmount = current.ReducedPromotionAmount;
                if (reducedPromotionAmount > 0m)
                {
                    stringBuilder.AppendFormat("<li style=\"display:none\"><span>优惠金额:</span>{0}</li>", System.Math.Round(reducedPromotionAmount, 2));
                }
                decimal payCharge = current.PayCharge;
                if (payCharge > 0m)
                {
                    stringBuilder.AppendFormat("<li style=\"display:none\"><span>支付手续费:</span>{0}</li>", System.Math.Round(payCharge, 2));
                }
                if (!string.IsNullOrEmpty(current.CouponCode))
                {
                    decimal couponValue = current.CouponValue;
                    if (couponValue > 0m)
                    {
                        stringBuilder.AppendFormat("<li style=\"display:none\"><span>优惠券:</span>{0}</li>", System.Math.Round(couponValue, 2));
                    }
                }
                decimal adjustedDiscount = current.AdjustedDiscount;
                if (adjustedDiscount > 0m)
                {
                    stringBuilder.AppendFormat("<li style=\"display:none\"><span>管理员手工打折:</span>{0}</li>", System.Math.Round(adjustedDiscount, 2));
                }
                stringBuilder.Append(value);
                stringBuilder.AppendFormat("<li style=\"display:none\"><span>实付金额:</span>{0}</li></ul><br class=\"clear\" /><br><br>", System.Math.Round(current.GetTotal(), 2));
                htmlGenericControl.InnerHtml = stringBuilder.ToString();
                this.divContent.Controls.AddAt(0, htmlGenericControl);
            }
        }
예제 #22
0
        protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            bool      flag      = false;
            OrderInfo orderInfo = OrderHelper.GetOrderInfo(e.CommandArgument.ToString());

            if (orderInfo != null)
            {
                if ((e.CommandName == "CONFIRM_PAY") && orderInfo.CheckAction(OrderActions.SELLER_CONFIRM_PAY))
                {
                    int num2       = 0;
                    int num3       = 0;
                    int groupBuyId = orderInfo.GroupBuyId;
                    if (OrderHelper.ConfirmPay(orderInfo))
                    {
                        DebitNoteInfo info2 = new DebitNoteInfo();
                        info2.NoteId   = Globals.GetGenerateId();
                        info2.OrderId  = e.CommandArgument.ToString();
                        info2.Operator = ManagerHelper.GetCurrentManager().UserName;
                        info2.Remark   = "后台" + info2.Operator + "收款成功";
                        OrderHelper.SaveDebitNote(info2);
                        if (orderInfo.GroupBuyId > 0)
                        {
                            int num4 = num2 + num3;
                        }
                        this.BindOrders();
                        orderInfo.OnPayment();
                        this.ShowMsg("成功的确认了订单收款", true);
                    }
                    else
                    {
                        this.ShowMsg("确认订单收款失败", false);
                    }
                }
                else if ((e.CommandName == "FINISH_TRADE") && orderInfo.CheckAction(OrderActions.SELLER_FINISH_TRADE))
                {
                    Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems;
                    LineItemInfo info3 = new LineItemInfo();
                    foreach (KeyValuePair <string, LineItemInfo> pair in lineItems)
                    {
                        info3 = pair.Value;
                        if ((info3.OrderItemsStatus == OrderStatus.ApplyForRefund) || (info3.OrderItemsStatus == OrderStatus.ApplyForReturns))
                        {
                            flag = true;
                        }
                    }
                    if (!flag)
                    {
                        if (OrderHelper.ConfirmOrderFinish(orderInfo))
                        {
                            this.BindOrders();
                            DistributorsBrower.UpdateCalculationCommission(orderInfo, wid);
                            foreach (LineItemInfo info4 in orderInfo.LineItems.Values)
                            {
                                if (info4.OrderItemsStatus.ToString() == OrderStatus.SellerAlreadySent.ToString())
                                {
                                    RefundHelper.UpdateOrderGoodStatu(orderInfo.OrderId, info4.SkuId, 5);
                                }
                            }
                            this.ShowMsg("成功的完成了该订单", true);
                        }
                        else
                        {
                            this.ShowMsg("完成订单失败", false);
                        }
                    }
                    else
                    {
                        this.ShowMsg("订单中商品有退货(款)不允许完成!", false);
                    }
                }
            }
        }
예제 #23
0
        public static OrderInfo ConvertShoppingCartToOrder(ShoppingCartInfo shoppingCart, bool isCountDown, bool isSignBuy, bool isAgent)
        {
            if (shoppingCart.LineItems.Count == 0 && shoppingCart.LineGifts.Count == 0)
            {
                return(null);
            }
            OrderInfo info = new OrderInfo
            {
                Points                      = shoppingCart.GetPoint(),
                ReducedPromotionId          = shoppingCart.ReducedPromotionId,
                ReducedPromotionName        = shoppingCart.ReducedPromotionName,
                ReducedPromotionAmount      = shoppingCart.ReducedPromotionAmount,
                IsReduced                   = shoppingCart.IsReduced,
                SentTimesPointPromotionId   = shoppingCart.SentTimesPointPromotionId,
                SentTimesPointPromotionName = shoppingCart.SentTimesPointPromotionName,
                IsSendTimesPoint            = shoppingCart.IsSendTimesPoint,
                TimesPoint                  = shoppingCart.TimesPoint,
                FreightFreePromotionId      = shoppingCart.FreightFreePromotionId,
                FreightFreePromotionName    = shoppingCart.FreightFreePromotionName,
                IsFreightFree               = shoppingCart.IsFreightFree
            };
            string str = string.Empty;

            if (shoppingCart.LineItems.Count > 0)
            {
                foreach (ShoppingCartItemInfo info2 in shoppingCart.LineItems)
                {
                    str = str + string.Format("'{0}',", info2.SkuId);
                }
            }
            if (shoppingCart.LineItems.Count > 0)
            {
                foreach (ShoppingCartItemInfo info2 in shoppingCart.LineItems)
                {
                    decimal      costprice = new SkuDao().GetSkuItem(info2.SkuId).CostPrice;
                    LineItemInfo info3     = new LineItemInfo
                    {
                        SkuId             = info2.SkuId,
                        ProductId         = info2.ProductId,
                        SKU               = info2.SKU,
                        Quantity          = info2.Quantity,
                        ShipmentQuantity  = info2.ShippQuantity,
                        ItemCostPrice     = costprice,
                        ItemListPrice     = isAgent ? costprice : info2.MemberPrice,
                        ItemAdjustedPrice = isAgent ? costprice : info2.AdjustedPrice,
                        ItemDescription   = info2.Name,
                        ThumbnailsUrl     = info2.ThumbnailUrl40,
                        ItemWeight        = info2.Weight,
                        SKUContent        = info2.SkuContent,
                        PromotionId       = info2.PromotionId,
                        PromotionName     = info2.PromotionName,
                        MainCategoryPath  = info2.MainCategoryPath,
                        GiveQuantity      = info2.GiveQuantity,
                        HalfPriceQuantity = info2.HalfPriceQuantity
                    };
                    info.LineItems.Add(info3.SkuId, info3);
                }
            }
            //如果有礼品在购物车内,增加礼品到订单
            if (shoppingCart.LineGifts.Count > 0)
            {
                foreach (ShoppingCartGiftInfo info4 in shoppingCart.LineGifts)
                {
                    OrderGiftInfo item = new OrderGiftInfo
                    {
                        GiftId        = info4.GiftId,
                        GiftName      = info4.Name,
                        Quantity      = info4.Quantity,
                        ThumbnailsUrl = info4.ThumbnailUrl100,
                        CostPrice     = info4.CostPrice,
                        costPoint     = info4.NeedPoint * info4.Quantity
                    };
                    info.Gifts.Add(item);
                }
            }
            //如果当前订单内商品数量为零的话,则订单状态为已付款
            if ((info.GetTotal() == 0M) && (info.LineItems.Count == 0))
            {
                info.OrderStatus = OrderStatus.BuyerAlreadyPaid;
            }
            info.Tax          = 0.00M;
            info.InvoiceTitle = "";
            return(info);
        }
예제 #24
0
        protected void listOrders_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                OrderStatus orderStatus = (OrderStatus)DataBinder.Eval(e.Item.DataItem, "OrderStatus");
                string      text        = DataBinder.Eval(e.Item.DataItem, "OrderId").ToString();
                OrderInfo   orderInfo   = TradeHelper.GetOrderInfo(text);
                if (orderInfo != null)
                {
                    if (orderInfo.PreSaleId > 0)
                    {
                        Literal literal = (Literal)e.Item.FindControl("litPresale");
                        literal.Text    = "(预售)";
                        literal.Visible = true;
                    }
                    OrderItemStatus itemStatus = orderInfo.ItemStatus;
                    DateTime        dateTime   = (DataBinder.Eval(e.Item.DataItem, "FinishDate") == DBNull.Value) ? DateTime.Now.AddYears(-1) : ((DateTime)DataBinder.Eval(e.Item.DataItem, "FinishDate"));
                    string          text2      = "";
                    if (DataBinder.Eval(e.Item.DataItem, "Gateway") != null && !(DataBinder.Eval(e.Item.DataItem, "Gateway") is DBNull))
                    {
                        text2 = (string)DataBinder.Eval(e.Item.DataItem, "Gateway");
                    }
                    HyperLink       hyperLink        = (HyperLink)e.Item.FindControl("hplinkorderreview");
                    HtmlAnchor      htmlAnchor       = (HtmlAnchor)e.Item.FindControl("hlinkPay");
                    ImageLinkButton imageLinkButton  = (ImageLinkButton)e.Item.FindControl("lkbtnConfirmOrder");
                    ImageLinkButton imageLinkButton2 = (ImageLinkButton)e.Item.FindControl("lkbtnCloseOrder");
                    HtmlAnchor      htmlAnchor2      = (HtmlAnchor)e.Item.FindControl("lkbtnApplyForRefund");
                    HtmlAnchor      htmlAnchor3      = (HtmlAnchor)e.Item.FindControl("lkbtnUserRealNameVerify");
                    HyperLink       hyperLink2       = (HyperLink)e.Item.FindControl("hlinkOrderDetails");
                    Repeater        repeater         = (Repeater)e.Item.FindControl("rpProduct");
                    Repeater        repeater2        = (Repeater)e.Item.FindControl("rpGift");
                    Label           label            = (Label)e.Item.FindControl("Logistics");
                    HtmlAnchor      htmlAnchor4      = (HtmlAnchor)e.Item.FindControl("lkbtnViewMessage");
                    HtmlAnchor      htmlAnchor5      = (HtmlAnchor)e.Item.FindControl("lkbtnRefundDetail");
                    htmlAnchor2.Attributes.Add("OrderId", text);
                    htmlAnchor2.Attributes.Add("SkuId", "");
                    htmlAnchor2.Attributes.Add("GateWay", text2);
                    OrderStatusLabel orderStatusLabel = (OrderStatusLabel)e.Item.FindControl("lblOrderStatus");
                    Literal          literal2         = (Literal)e.Item.FindControl("lblGiftTitle");
                    orderStatusLabel.order = orderInfo;
                    if (orderInfo.LineItems.Count <= 0)
                    {
                        Literal literal3 = literal2;
                        literal3.Text += "(礼)";
                    }
                    if (hyperLink != null)
                    {
                        if (orderInfo.GetGiftQuantity() > 0 && orderInfo.LineItems.Count() == 0)
                        {
                            hyperLink.Visible = false;
                        }
                        else
                        {
                            HyperLink hyperLink3 = hyperLink;
                            int       visible;
                            switch (orderStatus)
                            {
                            case OrderStatus.Closed:
                                visible = ((orderInfo.OnlyReturnedCount == orderInfo.LineItems.Count) ? 1 : 0);
                                break;

                            default:
                                visible = 0;
                                break;

                            case OrderStatus.Finished:
                                visible = 1;
                                break;
                            }
                            hyperLink3.Visible = ((byte)visible != 0);
                            if (hyperLink.Visible)
                            {
                                DataTable    productReviewAll = ProductBrowser.GetProductReviewAll(orderInfo.OrderId);
                                LineItemInfo lineItemInfo     = new LineItemInfo();
                                int          num  = 0;
                                int          num2 = 0;
                                int          num3 = 0;
                                bool         flag = false;
                                foreach (KeyValuePair <string, LineItemInfo> lineItem in orderInfo.LineItems)
                                {
                                    flag         = false;
                                    lineItemInfo = lineItem.Value;
                                    for (int i = 0; i < productReviewAll.Rows.Count; i++)
                                    {
                                        if (lineItemInfo.ProductId.ToString() == productReviewAll.Rows[i][0].ToString() && lineItemInfo.SkuId.ToString().Trim() == productReviewAll.Rows[i][1].ToString().Trim())
                                        {
                                            flag = true;
                                        }
                                    }
                                    if (!flag)
                                    {
                                        num2++;
                                    }
                                    else
                                    {
                                        num3++;
                                    }
                                }
                                if (num + num2 == orderInfo.LineItems.Count)
                                {
                                    hyperLink.Text = "查看评论";
                                }
                                else
                                {
                                    SiteSettings masterSettings = SettingsManager.GetMasterSettings();
                                    if (masterSettings != null)
                                    {
                                        if (masterSettings.ProductCommentPoint <= 0)
                                        {
                                            hyperLink.Text = "评价";
                                        }
                                        else
                                        {
                                            hyperLink.Text = $"评价得{num3 * masterSettings.ProductCommentPoint}积分";
                                        }
                                    }
                                }
                            }
                        }
                    }
                    if (orderInfo.PreSaleId > 0)
                    {
                        FormatedMoneyLabel formatedMoneyLabel = (FormatedMoneyLabel)e.Item.FindControl("FormatedMoneyLabel2");
                        formatedMoneyLabel.Money = orderInfo.Deposit + orderInfo.FinalPayment;
                        formatedMoneyLabel.Text  = (orderInfo.Deposit + orderInfo.FinalPayment).F2ToString("f2");
                        if (orderStatus == OrderStatus.WaitBuyerPay && text2 != "hishop.plugins.payment.podrequest" && text2 != "hishop.plugins.payment.bankrequest" && orderInfo.PaymentTypeId != -3)
                        {
                            if (!orderInfo.DepositDate.HasValue)
                            {
                                htmlAnchor.Visible = true;
                            }
                            else if (orderInfo.DepositDate.HasValue)
                            {
                                ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                                if (productPreSaleInfo.PaymentStartDate <= DateTime.Now && DateTime.Now <= productPreSaleInfo.PaymentEndDate)
                                {
                                    htmlAnchor.Visible = true;
                                }
                                else
                                {
                                    htmlAnchor.Visible = false;
                                }
                            }
                            else
                            {
                                htmlAnchor.Visible = false;
                            }
                        }
                        else
                        {
                            htmlAnchor.Visible = false;
                        }
                    }
                    else
                    {
                        htmlAnchor.Visible = (orderStatus == OrderStatus.WaitBuyerPay && text2 != "hishop.plugins.payment.podrequest" && text2 != "hishop.plugins.payment.bankrequest" && orderInfo.PaymentTypeId != -3);
                    }
                    imageLinkButton.Visible = (orderStatus == OrderStatus.SellerAlreadySent && itemStatus == OrderItemStatus.Nomarl);
                    if (orderInfo.PreSaleId > 0)
                    {
                        imageLinkButton2.Visible = (orderStatus == OrderStatus.WaitBuyerPay && itemStatus == OrderItemStatus.Nomarl && !orderInfo.DepositDate.HasValue);
                    }
                    else
                    {
                        imageLinkButton2.Visible = (orderStatus == OrderStatus.WaitBuyerPay && itemStatus == OrderItemStatus.Nomarl);
                    }
                    RefundInfo refundInfo = TradeHelper.GetRefundInfo(text);
                    htmlAnchor2.Visible = ((orderInfo.FightGroupId > 0 && VShopHelper.IsFightGroupCanRefund(orderInfo.FightGroupId) && orderInfo.IsCanRefund) || (orderInfo.FightGroupId <= 0 && orderInfo.IsCanRefund));
                    htmlAnchor3.Visible = (HiContext.Current.SiteSettings.IsOpenCertification && orderInfo.IDStatus == 0 && orderInfo.IsincludeCrossBorderGoods);
                    if (htmlAnchor3.Visible)
                    {
                        htmlAnchor3.Attributes.Add("OrderId", text);
                    }
                    if (repeater != null && repeater2 != null)
                    {
                        repeater.ItemDataBound += this.listProduct_ItemDataBound;
                        IList <NewLineItemInfo> list = new List <NewLineItemInfo>();
                        foreach (LineItemInfo value in orderInfo.LineItems.Values)
                        {
                            NewLineItemInfo newLineItemInfo = this.GetNewLineItemInfo(value, orderInfo.OrderId);
                            list.Add(newLineItemInfo);
                        }
                        if (list == null || list.Count == 0)
                        {
                            repeater.Visible = false;
                            DataTable dataTable = (DataTable)(repeater2.DataSource = TradeHelper.GetOrderGiftsThumbnailsUrl(((DataRowView)e.Item.DataItem).Row["OrderId"].ToString()));
                            repeater2.DataBind();
                            repeater2.Visible = true;
                        }
                        else
                        {
                            repeater.DataSource = list;
                            repeater.DataBind();
                            repeater2.Visible = false;
                            repeater.Visible  = true;
                        }
                    }
                    if (refundInfo != null && orderInfo.ItemStatus == OrderItemStatus.Nomarl && (orderInfo.OrderStatus == OrderStatus.ApplyForRefund || orderInfo.OrderStatus == OrderStatus.RefundRefused || orderInfo.OrderStatus == OrderStatus.Closed))
                    {
                        htmlAnchor5.HRef    = "/user/UserRefundApplyDetails/" + refundInfo.RefundId;
                        htmlAnchor5.Visible = true;
                    }
                    hyperLink2.NavigateUrl = "/user/OrderDetails/" + orderInfo.OrderId;
                    if ((orderStatus == OrderStatus.SellerAlreadySent || orderStatus == OrderStatus.Finished) && !string.IsNullOrEmpty(orderInfo.ExpressCompanyAbb) && !string.IsNullOrEmpty(orderInfo.ShipOrderNumber) && orderInfo.ShippingModeId != -2)
                    {
                        label.Attributes.Add("action", "order");
                        label.Attributes.Add("orderId", text);
                        label.Visible = true;
                    }
                    if (orderInfo.FightGroupId > 0)
                    {
                        FightGroupInfo fightGroup = VShopHelper.GetFightGroup(orderInfo.FightGroupId);
                        htmlAnchor2.Visible = (fightGroup.Status != 0 && orderInfo.GetPayTotal() > decimal.Zero && (refundInfo == null || refundInfo.HandleStatus == RefundStatus.Refused) && orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid);
                    }
                    if (orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid || orderInfo.OrderStatus == OrderStatus.Finished || orderInfo.OrderStatus == OrderStatus.WaitReview || orderInfo.OrderStatus == OrderStatus.History)
                    {
                        WeiXinRedEnvelopeInfo openedWeiXinRedEnvelope = WeiXinRedEnvelopeProcessor.GetOpenedWeiXinRedEnvelope();
                        bool flag2 = false;
                        if (openedWeiXinRedEnvelope != null && openedWeiXinRedEnvelope.EnableIssueMinAmount <= orderInfo.GetPayTotal() && orderInfo.OrderDate >= openedWeiXinRedEnvelope.ActiveStartTime && orderInfo.OrderDate <= openedWeiXinRedEnvelope.ActiveEndTime)
                        {
                            flag2 = true;
                        }
                        if (flag2)
                        {
                            Image image = (Image)e.Item.FindControl("imgRedEnvelope");
                            image.ImageUrl = "../../../../common/images/SendRedEnvelope.png";
                            image.Attributes.Add("class", "ztitle_RedEnvelope");
                            image.Attributes.Add("onclick", "GetRedEnvelope(" + orderInfo.OrderId + ")");
                            image.Visible = true;
                        }
                    }
                    if (orderInfo.OrderStatus != OrderStatus.WaitBuyerPay || !(orderInfo.ParentOrderId == "-1") || !orderInfo.OrderId.Contains("P"))
                    {
                        Label label2 = (Label)e.Item.FindControl("lblsupplier");
                        if (label2 != null)
                        {
                            string empty = string.Empty;
                            if (HiContext.Current.SiteSettings.OpenMultStore && orderInfo.StoreId > 0 && !string.IsNullOrWhiteSpace(orderInfo.StoreName))
                            {
                                label2.Text = orderInfo.StoreName;
                                empty       = "mtitle_1";
                            }
                            else if (orderInfo.StoreId == 0 && HiContext.Current.SiteSettings.OpenSupplier && orderInfo.SupplierId > 0)
                            {
                                label2.Text = orderInfo.ShipperName;
                                empty       = "stitle_1";
                            }
                            else
                            {
                                label2.Text = "平台";
                                empty       = "ztitle_1_new";
                            }
                            label2.Attributes.Add("style", string.IsNullOrWhiteSpace(label2.Text) ? "display:none" : "display:inline");
                            label2.Attributes.Add("class", empty);
                            label2.Visible = true;
                        }
                    }
                }
            }
        }
        protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            bool      flag      = false;
            OrderInfo orderInfo = OrderHelper.GetOrderInfo(e.CommandArgument.ToString());

            if (orderInfo != null)
            {
                if ((e.CommandName == "CONFIRM_PAY") && orderInfo.CheckAction(OrderActions.SELLER_CONFIRM_PAY))
                {
                    int num2       = 0;
                    int num3       = 0;
                    int groupBuyId = orderInfo.GroupBuyId;
                    if (OrderHelper.ConfirmPay(orderInfo))
                    {
                        DebitNoteInfo info2 = new DebitNoteInfo();
                        info2 = new DebitNoteInfo
                        {
                            NoteId   = Globals.GetGenerateId(),
                            OrderId  = e.CommandArgument.ToString(),
                            Operator = ManagerHelper.GetCurrentManager().UserName,
                            Remark   = "后台" + info2.Operator + "收款成功"
                        };
                        OrderHelper.SaveDebitNote(info2);
                        if (orderInfo.GroupBuyId > 0)
                        {
                            int num4 = num2 + num3;
                        }
                        this.BindOrders();
                        orderInfo.OnPayment();
                        this.ShowMsg("成功的确认了订单收款", true);
                    }
                    else
                    {
                        this.ShowMsg("确认订单收款失败", false);
                    }
                }
                else if ((e.CommandName == "FINISH_TRADE") && orderInfo.CheckAction(OrderActions.SELLER_FINISH_TRADE))
                {
                    Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems;
                    LineItemInfo info3 = new LineItemInfo();
                    foreach (KeyValuePair <string, LineItemInfo> pair in lineItems)
                    {
                        info3 = pair.Value;
                        if ((info3.OrderItemsStatus == OrderStatus.ApplyForRefund) || (info3.OrderItemsStatus == OrderStatus.ApplyForReturns))
                        {
                            flag = true;
                        }
                    }
                    if (!flag)
                    {
                        if (OrderHelper.ConfirmOrderFinish(orderInfo))
                        {
                            this.BindOrders();
                            this.myNotifier.updateAction = UpdateAction.OrderUpdate;
                            this.myNotifier.actionDesc   = "订单已完成";
                            if (orderInfo.PayDate.HasValue)
                            {
                                this.myNotifier.RecDateUpdate = orderInfo.PayDate.Value;
                            }
                            else
                            {
                                this.myNotifier.RecDateUpdate = DateTime.Today;
                            }
                            this.myNotifier.DataUpdated += new StatisticNotifier.DataUpdatedEventHandler(this.myEvent.Update);
                            this.myNotifier.UpdateDB();
                            this.ShowMsg("成功的完成了该订单", true);
                        }
                        else
                        {
                            this.ShowMsg("完成订单失败", false);
                        }
                    }
                    else
                    {
                        this.ShowMsg("订单中商品有退货(款)不允许完成!", false);
                    }
                }
            }
        }
예제 #26
0
 public static OrderInfo ConvertShoppingCartToOrder(ShoppingCartInfo shoppingCart, bool isCountDown, bool isSignBuy)
 {
     if (shoppingCart.LineItems.Count == 0)
     {
         return null;
     }
     OrderInfo info = new OrderInfo {
         Points = shoppingCart.GetPoint(),
         ReducedPromotionId = shoppingCart.ReducedPromotionId,
         ReducedPromotionName = shoppingCart.ReducedPromotionName,
         ReducedPromotionAmount = shoppingCart.ReducedPromotionAmount,
         IsReduced = shoppingCart.IsReduced,
         SentTimesPointPromotionId = shoppingCart.SentTimesPointPromotionId,
         SentTimesPointPromotionName = shoppingCart.SentTimesPointPromotionName,
         IsSendTimesPoint = shoppingCart.IsSendTimesPoint,
         TimesPoint = shoppingCart.TimesPoint,
         FreightFreePromotionId = shoppingCart.FreightFreePromotionId,
         FreightFreePromotionName = shoppingCart.FreightFreePromotionName,
         IsFreightFree = shoppingCart.IsFreightFree
     };
     string str = string.Empty;
     if (shoppingCart.LineItems.Count > 0)
     {
         foreach (ShoppingCartItemInfo info2 in shoppingCart.LineItems)
         {
             str = str + string.Format("'{0}',", info2.SkuId);
         }
     }
     if (shoppingCart.LineItems.Count > 0)
     {
         foreach (ShoppingCartItemInfo info2 in shoppingCart.LineItems)
         {
             LineItemInfo info3 = new LineItemInfo {
                 SkuId = info2.SkuId,
                 ProductId = info2.ProductId,
                 SKU = info2.SKU,
                 Quantity = info2.Quantity,
                 ShipmentQuantity = info2.ShippQuantity,
                 ItemCostPrice = new SkuDao().GetSkuItem(info2.SkuId).CostPrice,
                 ItemListPrice = info2.MemberPrice,
                 ItemAdjustedPrice = info2.AdjustedPrice,
                 ItemDescription = info2.Name,
                 ThumbnailsUrl = info2.ThumbnailUrl40,
                 ItemWeight = info2.Weight,
                 SKUContent = info2.SkuContent,
                 PromotionId = info2.PromotionId,
                 PromotionName = info2.PromotionName
             };
             info.LineItems.Add(info3.SkuId, info3);
         }
     }
     info.Tax = 0.00M;
     info.InvoiceTitle = "";
     return info;
 }
예제 #27
0
        public static OrderInfo ConvertShoppingCartToOrder(ShoppingCartInfo shoppingCart, bool isCountDown, bool isSignBuy)
        {
            if (shoppingCart.LineItems.Count == 0)
            {
                return(null);
            }
            OrderInfo info = new OrderInfo {
                Points                      = shoppingCart.GetPoint(),
                ReducedPromotionId          = shoppingCart.ReducedPromotionId,
                ReducedPromotionName        = shoppingCart.ReducedPromotionName,
                ReducedPromotionAmount      = shoppingCart.ReducedPromotionAmount,
                IsReduced                   = shoppingCart.IsReduced,
                SentTimesPointPromotionId   = shoppingCart.SentTimesPointPromotionId,
                SentTimesPointPromotionName = shoppingCart.SentTimesPointPromotionName,
                IsSendTimesPoint            = shoppingCart.IsSendTimesPoint,
                TimesPoint                  = shoppingCart.TimesPoint,
                FreightFreePromotionId      = shoppingCart.FreightFreePromotionId,
                FreightFreePromotionName    = shoppingCart.FreightFreePromotionName,
                IsFreightFree               = shoppingCart.IsFreightFree
            };
            string str = string.Empty;

            if (shoppingCart.LineItems.Count > 0)
            {
                foreach (ShoppingCartItemInfo info2 in shoppingCart.LineItems)
                {
                    str = str + string.Format("'{0}',", info2.SkuId);
                }
            }
            if (shoppingCart.LineItems.Count > 0)
            {
                foreach (ShoppingCartItemInfo info3 in shoppingCart.LineItems)
                {
                    LineItemInfo info4 = new LineItemInfo {
                        SkuId              = info3.SkuId,
                        ProductId          = info3.ProductId,
                        SKU                = info3.SKU,
                        Quantity           = info3.Quantity,
                        ShipmentQuantity   = info3.ShippQuantity,
                        CommissionDiscount = 100
                    };
                    if (info3.LimitedTimeDiscountId > 0)
                    {
                        bool flag = true;
                        LimitedTimeDiscountInfo discountInfo = new LimitedTimeDiscountDao().GetDiscountInfo(info3.LimitedTimeDiscountId);
                        if (discountInfo == null)
                        {
                            flag = false;
                        }
                        else
                        {
                            info4.CommissionDiscount = discountInfo.CommissionDiscount;
                        }
                        if (!flag)
                        {
                            info3.LimitedTimeDiscountId = 0;
                        }
                    }
                    info4.ItemCostPrice     = new SkuDao().GetSkuItem(info3.SkuId).CostPrice;
                    info4.ItemListPrice     = info3.MemberPrice;
                    info4.ItemAdjustedPrice = info3.AdjustedPrice;
                    info4.ItemDescription   = info3.Name;
                    info4.ThumbnailsUrl     = info3.ThumbnailUrl60;
                    info4.ItemWeight        = info3.Weight;
                    info4.SKUContent        = info3.SkuContent;
                    info4.PromotionId       = info3.PromotionId;
                    info4.PromotionName     = info3.PromotionName;
                    info4.MainCategoryPath  = info3.MainCategoryPath;
                    info4.Type                  = info3.Type;
                    info4.ExchangeId            = info3.ExchangeId;
                    info4.PointNumber           = info3.PointNumber * info4.Quantity;
                    info4.ThirdCommission       = info3.ThirdCommission;
                    info4.SecondCommission      = info3.SecondCommission;
                    info4.FirstCommission       = info3.FirstCommission;
                    info4.IsSetCommission       = info3.IsSetCommission;
                    info4.LimitedTimeDiscountId = info3.LimitedTimeDiscountId;
                    info.LineItems.Add(info4.SkuId + info4.Type + info4.LimitedTimeDiscountId, info4);
                }
            }
            info.Tax          = 0.00M;
            info.InvoiceTitle = "";
            return(info);
        }
예제 #28
0
        /// <summary>
        /// 满减活动等打折活动
        /// </summary>
        /// <param name="order"></param>
        /// <param name="ActivitiesId"></param>
        /// <param name="ActivitiesName"></param>
        /// <returns></returns>
        public void getDiscountTotal(System.Web.HttpContext context)
        {
            ShoppingCartInfo shoppingCart;

            shoppingCart = ShoppingCartProcessor.GetShoppingCart(ManagerHelper.GetCurrentManager().UserId);
            OrderInfo order = ShoppingProcessor.ConvertShoppingCartToOrder(shoppingCart, false, false, false);

            if (null == order)
            {
                context.Response.Write("{\"success\":false,\"discount\":\"" + 0 + "\"}");
                return;
            }

            decimal      num          = new decimal(0);
            decimal      num1         = new decimal(0);
            decimal      num2         = new decimal(0);
            LineItemInfo lineItemInfo = new LineItemInfo();

            System.Data.DataTable type = ProductBrowser.GetType();
            for (int i = 0; i < type.Rows.Count; i++)
            {
                string  str      = "";
                string  str1     = "";
                decimal subTotal = new decimal(0);
                foreach (KeyValuePair <string, LineItemInfo> lineItem in order.LineItems)
                {
                    lineItemInfo = lineItem.Value;
                    if (string.IsNullOrEmpty(lineItemInfo.MainCategoryPath))
                    {
                        continue;
                    }
                    int    num3             = int.Parse(type.Rows[i]["ActivitiesType"].ToString());
                    string mainCategoryPath = lineItemInfo.MainCategoryPath;
                    char[] chrArray         = new char[] { '|' };
                    if (num3 == int.Parse(mainCategoryPath.Split(chrArray)[0].ToString()))
                    {
                        subTotal = subTotal + lineItemInfo.GetSubTotal();
                    }
                    if (int.Parse(type.Rows[i]["ActivitiesType"].ToString()) != 0)
                    {
                        continue;
                    }
                    subTotal = subTotal + lineItemInfo.GetSubTotal();
                }
                if (subTotal != new decimal(0))
                {
                    //获取所有活动列表
                    System.Data.DataTable allFull = ProductBrowser.GetAllFull(int.Parse(type.Rows[i]["ActivitiesType"].ToString()));



                    if (allFull.Rows.Count > 0)//如果存在活动时进入
                    {
                        //2017-2 如果活动实体类包含了门店id,那么该活动仅对当前门店生效,

                        int currentOrderStoreId    = Convert.ToInt32(context.Request["storeid"]); //当前订单的门店id
                        int currentActivityStoreId = 0;                                           //当前活动的门店id
                        int num0 = 0;

                        int num4 = 0;
                        while (true)
                        {
                            if (num4 >= allFull.Rows.Count)
                            {
                                break;
                            }

                            else if (subTotal >= decimal.Parse(allFull.Rows[allFull.Rows.Count - 1]["MeetMoney"].ToString()))
                            {
                                num1 = decimal.Parse(allFull.Rows[allFull.Rows.Count - 1]["MeetMoney"].ToString());
                                num  = decimal.Parse(allFull.Rows[allFull.Rows.Count - 1]["ReductionMoney"].ToString());
                                currentActivityStoreId = int.TryParse(allFull.Rows[allFull.Rows.Count - 1]["storeid"].ToString(), out num0)?Convert.ToInt32(allFull.Rows[allFull.Rows.Count - 1]["storeid"]):num0;
                                str  = string.Concat(allFull.Rows[allFull.Rows.Count - 1]["ActivitiesId"].ToString(), ",");
                                str1 = string.Concat(allFull.Rows[allFull.Rows.Count - 1]["ActivitiesName"].ToString(), ",");
                                break;
                            }
                            else if (subTotal <= decimal.Parse(allFull.Rows[0]["MeetMoney"].ToString()))
                            {
                                num1 = decimal.Parse(allFull.Rows[0]["MeetMoney"].ToString());
                                num  = num + decimal.Parse(allFull.Rows[0]["ReductionMoney"].ToString());
                                currentActivityStoreId = int.TryParse(allFull.Rows[allFull.Rows.Count - 1]["storeid"].ToString(), out num0) ? Convert.ToInt32(allFull.Rows[allFull.Rows.Count - 1]["storeid"]) : num0;
                                str  = string.Concat(allFull.Rows[0]["ActivitiesId"].ToString(), ",");
                                str1 = string.Concat(allFull.Rows[0]["ActivitiesName"].ToString(), ",");
                                break;
                            }
                            else
                            {
                                if (subTotal >= decimal.Parse(allFull.Rows[num4]["MeetMoney"].ToString()))
                                {
                                    num1 = decimal.Parse(allFull.Rows[num4]["MeetMoney"].ToString());
                                    num  = decimal.Parse(allFull.Rows[num4]["ReductionMoney"].ToString());
                                    currentActivityStoreId = int.TryParse(allFull.Rows[allFull.Rows.Count - 1]["storeid"].ToString(), out num0) ? Convert.ToInt32(allFull.Rows[allFull.Rows.Count - 1]["storeid"]) : num0;
                                    str  = string.Concat(allFull.Rows[num4]["ActivitiesId"].ToString(), ",");
                                    str1 = string.Concat(allFull.Rows[num4]["ActivitiesName"].ToString(), ",");
                                }
                                num4++;
                            }
                        }
                        if (subTotal >= num1)
                        {
                            //如果当前门店id不等于当前活动门店id,返回0元,活动id与活动名为null
                            if (currentOrderStoreId != 0 && currentOrderStoreId != currentActivityStoreId)
                            {
                                context.Response.Write("{\"success\":false,\"discount\":\"" + 0 + "\"}");
                                return;
                            }

                            num2 = num2 + num;
                            foreach (KeyValuePair <string, LineItemInfo> keyValuePair in order.LineItems)
                            {
                                LineItemInfo value = keyValuePair.Value;
                                if (string.IsNullOrEmpty(value.MainCategoryPath))
                                {
                                    continue;
                                }
                                int    num5 = int.Parse(type.Rows[i]["ActivitiesType"].ToString());
                                string mainCategoryPath1 = value.MainCategoryPath;
                                char[] chrArray1         = new char[] { '|' };
                                if (num5 != int.Parse(mainCategoryPath1.Split(chrArray1)[0].ToString()) && int.Parse(type.Rows[i]["ActivitiesType"].ToString()) != 0)
                                {
                                    continue;
                                }
                                value.PromotionName = str1.Substring(0, str1.Length - 1);
                                value.PromotionId   = int.Parse(str.Substring(0, str.Length - 1));
                            }
                        }
                    }
                }
            }
            context.Response.Write("{\"success\":true,\"discount\":\"" + num2.ToString("F0") + "\"}");
            return;
        }
예제 #29
0
        protected void listProduct_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                LineItemStatus lineItemStatus = (LineItemStatus)DataBinder.Eval(e.Item.DataItem, "Status");
                string         text           = (string)DataBinder.Eval(e.Item.DataItem, "StatusText");
                string         orderId        = (string)DataBinder.Eval(e.Item.DataItem, "OrderId");
                OrderInfo      orderInfo      = TradeHelper.GetOrderInfo(orderId);
                string         text2          = DataBinder.Eval(e.Item.DataItem, "SkuId").ToString();
                LineItemInfo   lineItemInfo   = orderInfo.LineItems[text2];
                if (lineItemStatus == LineItemStatus.Normal)
                {
                    text = TradeHelper.GetOrderItemSatusText(lineItemInfo.Status);
                }
                OrderStatus orderStatus = orderInfo.OrderStatus;
                DateTime    finishDate  = orderInfo.FinishDate;
                string      gateway     = orderInfo.Gateway;
                HtmlAnchor  htmlAnchor  = (HtmlAnchor)e.Item.FindControl("lkbtnAfterSalesApply");
                Label       label       = (Label)e.Item.FindControl("ItemLogistics");
                HtmlAnchor  htmlAnchor2 = (HtmlAnchor)e.Item.FindControl("lkbtnViewMessage");
                htmlAnchor.Attributes.Add("OrderId", orderInfo.OrderId);
                htmlAnchor.Attributes.Add("SkuId", text2);
                htmlAnchor.Attributes.Add("GateWay", gateway);
                ReplaceInfo replaceInfo = lineItemInfo.ReplaceInfo;
                ReturnInfo  returnInfo  = lineItemInfo.ReturnInfo;
                Literal     literal     = (Literal)e.Item.FindControl("litStatusText");
                if (literal != null && (replaceInfo != null || returnInfo != null))
                {
                    if (returnInfo != null)
                    {
                        if (returnInfo.AfterSaleType == AfterSaleTypes.OnlyRefund)
                        {
                            literal.Text = "<a href=\"UserReturnsApplyDetails?ReturnsId=" + returnInfo.ReturnId + "\" class=\"aslink\">" + EnumDescription.GetEnumDescription((Enum)(object)lineItemStatus, 3) + "</a>";
                        }
                        else
                        {
                            literal.Text = "<a href=\"UserReturnsApplyDetails?ReturnsId=" + returnInfo.ReturnId + "\" class=\"aslink\">" + EnumDescription.GetEnumDescription((Enum)(object)lineItemStatus, 2) + "</a>";
                        }
                    }
                    else
                    {
                        literal.Text = "<a href=\"UserReplaceApplyDetails?ReplaceId=" + replaceInfo.ReplaceId + "\" class=\"aslink\">" + EnumDescription.GetEnumDescription((Enum)(object)lineItemStatus, 2) + "</a>";
                    }
                }
                SiteSettings masterSettings = SettingsManager.GetMasterSettings();
                HtmlAnchor   htmlAnchor3    = htmlAnchor;
                int          visible;
                if (orderInfo.OrderType != OrderType.ServiceOrder)
                {
                    switch (orderStatus)
                    {
                    case OrderStatus.Finished:
                        visible = ((!orderInfo.IsServiceOver) ? 1 : 0);
                        break;

                    default:
                        visible = 0;
                        break;

                    case OrderStatus.SellerAlreadySent:
                        visible = 1;
                        break;
                    }
                }
                else
                {
                    visible = 0;
                }
                htmlAnchor3.Visible = ((byte)visible != 0);
                if (htmlAnchor.Visible)
                {
                    htmlAnchor.Visible = ((returnInfo == null || returnInfo.HandleStatus == ReturnStatus.Refused) && (replaceInfo == null || replaceInfo.HandleStatus == ReplaceStatus.Refused || replaceInfo.HandleStatus == ReplaceStatus.Replaced));
                }
            }
        }
예제 #30
0
        protected void btnSelOrdersFinish_Click(object sender, System.EventArgs e)
        {
            bool   flag = false;
            string text = "";

            if (!string.IsNullOrEmpty(base.Request["CheckBoxGroup"]))
            {
                text = base.Request["CheckBoxGroup"];
            }
            if (text.Length <= 0)
            {
                this.ShowMsg("请先选择要批量确认收货的订单", false);
                return;
            }
            string[] array = text.Trim(new char[]
            {
                ','
            }).Split(new char[]
            {
                ','
            });
            int num  = 0;
            int num2 = 0;

            string[] array2 = array;
            for (int i = 0; i < array2.Length; i++)
            {
                string text2 = array2[i];
                if (!string.IsNullOrEmpty(text2))
                {
                    OrderInfo orderInfo = OrderHelper.GetOrderInfo(text2);
                    if (orderInfo != null)
                    {
                        System.Collections.Generic.Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems;
                        LineItemInfo lineItemInfo = new LineItemInfo();
                        foreach (System.Collections.Generic.KeyValuePair <string, LineItemInfo> current in lineItems)
                        {
                            lineItemInfo = current.Value;
                            if (lineItemInfo.OrderItemsStatus == OrderStatus.ApplyForRefund || lineItemInfo.OrderItemsStatus == OrderStatus.ApplyForReturns)
                            {
                                flag = true;
                                break;
                            }
                        }
                        if (!flag)
                        {
                            if (OrderHelper.ConfirmOrderFinish(orderInfo))
                            {
                                num++;
                                DistributorsBrower.UpdateCalculationCommission(orderInfo);
                                foreach (LineItemInfo current2 in orderInfo.LineItems.Values)
                                {
                                    if (current2.OrderItemsStatus.ToString() == OrderStatus.SellerAlreadySent.ToString())
                                    {
                                        RefundHelper.UpdateOrderGoodStatu(orderInfo.OrderId, current2.SkuId, 5, current2.ID);
                                    }
                                }
                                this.myNotifier.updateAction = UpdateAction.OrderUpdate;
                                this.myNotifier.actionDesc   = "订单已完成";
                                if (orderInfo.PayDate.HasValue)
                                {
                                    this.myNotifier.RecDateUpdate = orderInfo.PayDate.Value;
                                }
                                else
                                {
                                    this.myNotifier.RecDateUpdate = System.DateTime.Today;
                                }
                                this.myNotifier.DataUpdated += new StatisticNotifier.DataUpdatedEventHandler(this.myEvent.Update);
                                this.myNotifier.UpdateDB();
                            }
                        }
                        else
                        {
                            num2++;
                        }
                    }
                }
                flag = false;
            }
            if (num > 0)
            {
                string text3 = "批量确认收货了" + num.ToString() + "个订单";
                if (num2 > 0)
                {
                    text3 = text3 + "," + num2.ToString() + "个订单中有退货(款)未完成";
                }
                this.ShowMsg(text3, true);
            }
            else
            {
                this.ShowMsg("订单中商品有退货(款)不允许完成!", false);
            }
            this.BindOrders();
        }
예제 #31
0
        public static LineItemInfo PopulateLineItem(IDataRecord reader)
        {
            if (reader == null)
            {
                return(null);
            }
            LineItemInfo info = new LineItemInfo {
                ID        = (int)reader["ID"],
                SkuId     = (string)reader["SkuId"],
                ProductId = (int)reader["ProductId"]
            };

            if (reader["SKU"] != DBNull.Value)
            {
                info.SKU = (string)reader["SKU"];
            }
            info.Quantity              = (int)reader["Quantity"];
            info.ShipmentQuantity      = (int)reader["ShipmentQuantity"];
            info.ItemCostPrice         = (decimal)reader["CostPrice"];
            info.ItemListPrice         = (decimal)reader["ItemListPrice"];
            info.ItemAdjustedPrice     = (decimal)reader["ItemAdjustedPrice"];
            info.ItemDescription       = (string)reader["ItemDescription"];
            info.OrderItemsStatus      = (OrderStatus)Enum.Parse(typeof(OrderStatus), reader["OrderItemsStatus"].ToString());
            info.ItemsCommission       = (decimal)reader["ItemsCommission"];
            info.ItemAdjustedCommssion = (decimal)reader["ItemAdjustedCommssion"];
            info.SecondItemsCommission = (decimal)reader["SecondItemsCommission"];
            info.ThirdItemsCommission  = (decimal)reader["ThirdItemsCommission"];
            if (reader["ThumbnailsUrl"] != DBNull.Value)
            {
                info.ThumbnailsUrl = (string)reader["ThumbnailsUrl"];
            }
            info.ItemWeight = (decimal)reader["Weight"];
            if (DBNull.Value != reader["SKUContent"])
            {
                info.SKUContent = (string)reader["SKUContent"];
            }
            if (DBNull.Value != reader["PromotionId"])
            {
                info.PromotionId = (int)reader["PromotionId"];
            }
            if (DBNull.Value != reader["PromotionName"])
            {
                info.PromotionName = (string)reader["PromotionName"];
            }
            if (DBNull.Value != reader["PointNumber"])
            {
                info.PointNumber = (int)reader["PointNumber"];
            }
            if (DBNull.Value != reader["Type"])
            {
                info.Type = (int)reader["Type"];
            }
            if (DBNull.Value != reader["ReturnMoney"])
            {
                info.ReturnMoney = (decimal)reader["ReturnMoney"];
            }
            if (DBNull.Value != reader["DiscountAverage"])
            {
                info.DiscountAverage = (decimal)reader["DiscountAverage"];
            }
            if (DBNull.Value != reader["OrderID"])
            {
                info.OrderID = (string)reader["OrderID"];
            }
            if (DBNull.Value != reader["IsAdminModify"])
            {
                info.IsAdminModify = (bool)reader["IsAdminModify"];
            }
            return(info);
        }
예제 #32
0
파일: SendInfo.cs 프로젝트: zwkjgs/XKD
        protected void rptList_ItemCommand(object source, System.Web.UI.WebControls.RepeaterCommandEventArgs e)
        {
            bool      flag      = false;
            OrderInfo orderInfo = OrderHelper.GetOrderInfo(e.CommandArgument.ToString());

            if (orderInfo != null)
            {
                if (e.CommandName == "CONFIRM_PAY" && orderInfo.CheckAction(OrderActions.SELLER_CONFIRM_PAY))
                {
                    int num      = 0;
                    int num2     = 0;
                    int arg_49_0 = orderInfo.GroupBuyId;
                    if (OrderHelper.ConfirmPay(orderInfo))
                    {
                        DebitNoteInfo debitNoteInfo = new DebitNoteInfo();
                        debitNoteInfo.NoteId   = Globals.GetGenerateId();
                        debitNoteInfo.OrderId  = e.CommandArgument.ToString();
                        debitNoteInfo.Operator = ManagerHelper.GetCurrentManager().UserName;
                        debitNoteInfo.Remark   = "后台" + debitNoteInfo.Operator + "收款成功";
                        OrderHelper.SaveDebitNote(debitNoteInfo);
                        if (orderInfo.GroupBuyId > 0)
                        {
                            int arg_BE_0 = num + num2;
                        }
                        this.BindOrders();
                        orderInfo.OnPayment();
                        this.ShowMsg("成功的确认了订单收款", true);
                        return;
                    }
                    this.ShowMsg("确认订单收款失败", false);
                    return;
                }
                else if (e.CommandName == "FINISH_TRADE" && orderInfo.CheckAction(OrderActions.SELLER_FINISH_TRADE))
                {
                    System.Collections.Generic.Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems;
                    LineItemInfo lineItemInfo = new LineItemInfo();
                    foreach (System.Collections.Generic.KeyValuePair <string, LineItemInfo> current in lineItems)
                    {
                        lineItemInfo = current.Value;
                        if (lineItemInfo.OrderItemsStatus == OrderStatus.ApplyForRefund || lineItemInfo.OrderItemsStatus == OrderStatus.ApplyForReturns)
                        {
                            flag = true;
                        }
                    }
                    if (!flag)
                    {
                        if (OrderHelper.ConfirmOrderFinish(orderInfo))
                        {
                            this.BindOrders();
                            DistributorsBrower.UpdateCalculationCommission(orderInfo);
                            foreach (LineItemInfo current2 in orderInfo.LineItems.Values)
                            {
                                if (current2.OrderItemsStatus.ToString() == OrderStatus.SellerAlreadySent.ToString())
                                {
                                    RefundHelper.UpdateOrderGoodStatu(orderInfo.OrderId, current2.SkuId, 5, current2.ID);
                                }
                            }
                            this.ShowMsg("成功的完成了该订单", true);
                            return;
                        }
                        this.ShowMsg("完成订单失败", false);
                        return;
                    }
                    else
                    {
                        this.ShowMsg("订单中商品有退货(款)不允许完成!", false);
                    }
                }
            }
        }