⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ordermodify.cs

📁 动易SiteFactory&#8482 网上商店系统1.0源代码
💻 CS
📖 第 1 页 / 共 2 页
字号:
                    if (couponId > 0)
                    {
                        CouponInfo couponInfoById = PowerEasy.Shop.Coupon.GetCouponInfoById(couponId);
                        if (!couponInfoById.IsNull)
                        {
                            totalMoney -= couponInfoById.Money;
                            if (totalMoney < 0M)
                            {
                                totalMoney = 0M;
                            }
                            orderById.CouponId = couponId;
                        }
                    }
                    totalMoney += chargeDeliver;
                    orderById.PaymentType = num;
                    orderById.DeliverType = deliverTypeId;
                    orderById.MoneyTotal = totalMoney;
                    orderById.ChargeDeliver = chargeDeliver;
                }
            }
            if (string.IsNullOrEmpty(builder.ToString()))
            {
                bool flag2 = false;
                if ((DataConverter.CLng(this.HdnState.Value) < 1) && (orderItemInfoList.Count > 0))
                {
                    OrderItem.Delete(this.m_OrderId);
                    flag2 = OrderItem.Add(orderItemInfoList);
                }
                else
                {
                    flag2 = true;
                }
                bool flag3 = false;
                if (flag2)
                {
                    flag3 = Order.Update(orderById);
                }
                if (flag3)
                {
                    AdminPage.WriteSuccessMsg("修改订单成功!", "OrderManage.aspx?OrderID=" + this.HdnOrderId.Value);
                }
                else
                {
                    AdminPage.WriteErrMsg("修改订单失败!", "OrderManage.aspx?OrderID=" + this.HdnOrderId.Value);
                }
            }
            else
            {
                AdminPage.WriteErrMsg(builder.ToString(), "");
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            this.m_OrderId = BasePage.RequestInt32("OrderID");
            if (this.m_OrderId == 0)
            {
                AdminPage.WriteErrMsg("<li>请指定OrderID!</li>", "OrderList.aspx");
            }
            if (!this.Page.IsPostBack)
            {
                OrderInfo orderById = Order.GetOrderById(this.m_OrderId, true);
                if (orderById.IsNull)
                {
                    AdminPage.WriteErrMsg("<li>指定OrderID找不到对应的订单!</li>", "OrderList.aspx");
                }
                this.HdnOrderId.Value = Convert.ToString(orderById.OrderId);
                this.LblOrderNum.Text = orderById.OrderNum;
                this.LblUserName.Text = orderById.UserName;
                this.SelectAgent1.AgentName = orderById.AgentName;
                this.LblClientName.Text = orderById.ClientName;
                if (orderById.NeedInvoice)
                {
                    this.LblNeedInvoice.Text = "√";
                    this.ChkNeedInvoice.Checked = true;
                }
                else
                {
                    this.LblNeedInvoice.Text = "\x00d7";
                    this.LblNeedInvoice.ForeColor = Color.Red;
                    this.ChkNeedInvoice.Checked = false;
                }
                if (orderById.Invoiced)
                {
                    this.LblInvoiced.Text = "√";
                }
                else
                {
                    this.LblInvoiced.Text = "\x00d7";
                    this.LblInvoiced.ForeColor = Color.Red;
                }
                this.HdnState.Value = ((int) orderById.Status).ToString();
                this.LblStatus.Text = BasePage.EnumToHtml<OrderStatus>(orderById.Status);
                switch (Order.GetPayStatus(orderById))
                {
                    case PayStatus.WaitForPay:
                        this.LblMoneyTotal.Text = BasePage.EnumToHtml<PayStatus>(PayStatus.WaitForPay);
                        break;

                    case PayStatus.ReceivedEarnest:
                        this.LblMoneyTotal.Text = BasePage.EnumToHtml<PayStatus>(PayStatus.ReceivedEarnest);
                        break;

                    case PayStatus.Payoff:
                        this.LblMoneyTotal.Text = BasePage.EnumToHtml<PayStatus>(PayStatus.Payoff);
                        break;
                }
                this.LblDeliverStatus.Text = BasePage.EnumToHtml<DeliverStatus>(orderById.DeliverStatus);
                if (orderById.NeedInvoice)
                {
                    this.TxtInvoiceContent.Text = orderById.InvoiceContent;
                }
                this.TxtRemark.Text = orderById.Remark;
                this.DpkBeginDate.Text = Convert.ToString(orderById.BeginDate.ToString("yyyy-MM-dd"));
                this.LblInputTime.Text = Convert.ToString(orderById.InputTime);
                this.TxtContacterName.Text = orderById.ContacterName;
                this.TxtAddress.Text = orderById.Address;
                this.TxtZipCode.Text = orderById.ZipCode;
                this.TxtMobile.Text = orderById.Mobile;
                this.TxtPhone.Text = orderById.Phone;
                this.TxtEmail.Text = orderById.Email;
                this.TxtMemo.Text = orderById.Memo;
                if (RolePermissions.AccessCheck(OperateCode.ModifyFunctionary))
                {
                    this.SelectFunctionary.ButtonEnabled = true;
                }
                else if (string.IsNullOrEmpty(orderById.Functionary) && RolePermissions.AccessCheck(OperateCode.AddFunctionary))
                {
                    this.SelectFunctionary.ButtonEnabled = true;
                }
                else
                {
                    this.SelectFunctionary.Enabled = false;
                }
                this.SelectFunctionary.Text = orderById.Functionary;
                this.RadlOutOfStockProject.SelectedValue = ((int) orderById.OutOfStockProject).ToString();
                this.HdnMoneyTotal.Value = Convert.ToString(orderById.MoneyTotal);
                this.HdnMoneyGoods.Value = Convert.ToString(orderById.MoneyGoods);
                this.HdnDiscountPayment.Value = Convert.ToString(orderById.DiscountPayment);
                this.HdnCouponID.Value = orderById.CouponId.ToString();
                this.DropPaymentType.DataSource = PaymentType.GetPaymentTypeListByEnabled();
                this.DropPaymentType.DataBind();
                this.DropPaymentType.SelectedValue = Convert.ToString(orderById.PaymentType);
                this.DropDeliverType.DataSource = DeliverType.GetEnableDeliverTypeList();
                this.DropDeliverType.DataBind();
                this.DropDeliverType.SelectedValue = Convert.ToString(orderById.DeliverType);
                this.DropOrderType.DataSource = Choiceset.GetDictionaryFieldValueByName("PE_Orders", "OrderType");
                this.DropOrderType.DataBind();
                this.DropOrderType.SelectedValue = orderById.OrderType.ToString();
                IList<OrderItemInfo> infoListByOrderId = OrderItem.GetInfoListByOrderId(this.m_OrderId);
                this.RptOrderItem.DataSource = infoListByOrderId;
                this.RptOrderItem.DataBind();
                if (orderById.Status <= OrderStatus.WaitForConfirm)
                {
                    this.BtnAddProduct.Visible = true;
                    this.RadlDeliverChargeType.Enabled = true;
                    this.TxtDeliverCharge.Enabled = true;
                    this.TxtDeliverCharge.Text = orderById.ChargeDeliver.ToString("0.00");
                    this.ViewState["OrderItemInfo"] = infoListByOrderId;
                    UserInfo usersByUserName = Users.GetUsersByUserName(orderById.UserName);
                    UserPurviewInfo userPurview = usersByUserName.UserPurview;
                    if (userPurview != null)
                    {
                        this.ViewState["HaveWholesalePurview"] = userPurview.Enablepm;
                    }
                    else
                    {
                        this.ViewState["HaveWholesalePurview"] = false;
                    }
                    this.ViewState["UserInfo"] = usersByUserName;
                }
            }
            string str = base.Request.Params.Get("__EVENTARGUMENT");
            if ((base.Request.Params.Get("__EVENTTARGET") == "AddProductButton") && !string.IsNullOrEmpty(str))
            {
                this.AddProduct(str);
            }
        }

        protected void RptOrderItem_ItemCommand(object sender, CommandEventArgs e)
        {
            string str2;
            if (((str2 = e.CommandName) != null) && (str2 == "DelOrderItem"))
            {
                IList<OrderItemInfo> infoListByOrderId = new List<OrderItemInfo>();
                if (this.ViewState["OrderItemInfo"] == null)
                {
                    infoListByOrderId = OrderItem.GetInfoListByOrderId(this.m_OrderId);
                }
                else
                {
                    infoListByOrderId = this.ViewState["OrderItemInfo"] as List<OrderItemInfo>;
                }
                string[] strArray = e.CommandArgument.ToString().Split(new char[] { '|' });
                int num = DataConverter.CLng(strArray[0]);
                string str = strArray[1];
                int num2 = DataConverter.CLng(strArray[2]);
                decimal num3 = DataConverter.CDecimal(strArray[3]);
                foreach (OrderItemInfo info in infoListByOrderId)
                {
                    if (string.IsNullOrEmpty(info.TableName))
                    {
                        if (((info.ProductId != num) || (info.SaleType != num2)) || !(info.SubTotal == num3))
                        {
                            continue;
                        }
                        infoListByOrderId.Remove(info);
                        break;
                    }
                    if (((info.ProductId == num) && (info.TableName == str)) && ((info.SaleType == num2) && (info.SubTotal == num3)))
                    {
                        infoListByOrderId.Remove(info);
                        break;
                    }
                }
                this.RptOrderItem.DataSource = infoListByOrderId;
                this.RptOrderItem.DataBind();
                this.ViewState["OrderItemInfo"] = infoListByOrderId;
            }
        }

        protected void RptOrderItem_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
            {
                OrderItemInfo dataItem = (OrderItemInfo) e.Item.DataItem;
                DropDownList listControl = (DropDownList) e.Item.FindControl("DropServiceTermUnit");
                BasePage.SetSelectedIndexByValue(listControl, Convert.ToString((int) dataItem.ServiceTermUnit));
                if (Convert.ToInt32(this.HdnState.Value) > 0)
                {
                    ((TextBox) e.Item.FindControl("TxtTruePrice")).Enabled = false;
                    ((TextBox) e.Item.FindControl("TxtServiceTerm")).Enabled = false;
                    ((DropDownList) e.Item.FindControl("DropServiceTermUnit")).Enabled = false;
                    ((TextBox) e.Item.FindControl("TxtAmount")).Enabled = false;
                    ((LinkButton) e.Item.FindControl("LbtnDelete")).Enabled = false;
                    this.DropDeliverType.Enabled = false;
                    this.DropPaymentType.Enabled = false;
                }
            }
        }

        protected string ShowProductNameForType(string productName, string properties, int saleType)
        {
            properties = string.IsNullOrEmpty(properties) ? string.Empty : ("(" + properties + ")");
            return DataSecurity.HtmlDecode(productName + properties + Product.ShowProductType(saleType));
        }

        protected void ValxPhone_ServerValidate(object source, ServerValidateEventArgs args)
        {
            if (string.IsNullOrEmpty(this.TxtPhone.Text) && string.IsNullOrEmpty(this.TxtMobile.Text))
            {
                args.IsValid = false;
            }
            else
            {
                args.IsValid = true;
            }
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -