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

📄 ordermodify.aspx.cs

📁 动易SiteFactory&#8482 网上商店系统1.0源代码
💻 CS
📖 第 1 页 / 共 2 页
字号:
namespace PowerEasy.WebSite.Admin.Shop
{
    using PowerEasy.AccessManage;
    using PowerEasy.Accessories;
    using PowerEasy.Common;
    using PowerEasy.Components;
    using PowerEasy.Controls;
    using PowerEasy.Enumerations;
    using PowerEasy.Model.Shop;
    using PowerEasy.Model.UserManage;
    using PowerEasy.ModelControls;
    using PowerEasy.Shop;
    using PowerEasy.UserManage;
    using PowerEasy.Web.UI;
    using PowerEasy.WebSite.Controls;
    using System;
    using System.Collections.Generic;
    using System.Drawing;
    using System.Text;
    using System.Web.UI.WebControls;

    public class OrderModify : AdminPage
    {
        protected Button BtnAddProduct;
        protected Button BtnCancel;
        protected Button BtnOrderItemModify;
        protected Button BtnSave;
        protected CheckBox ChkNeedInvoice;
        protected DatePicker DpkBeginDate;
        protected DropDownList DropDeliverType;
        protected DropDownList DropOrderType;
        protected DropDownList DropPaymentType;
        protected HiddenField HdnCouponID;
        protected HiddenField HdnDiscountPayment;
        protected HiddenField HdnMoneyGoods;
        protected HiddenField HdnMoneyTotal;
        protected HiddenField HdnOrderId;
        protected HiddenField HdnState;
        protected Label LblClientName;
        protected Label LblDeliverStatus;
        protected Label LblInputTime;
        protected Label LblInvoiced;
        protected Label LblMoneyTotal;
        protected Label LblNeedInvoice;
        protected Label LblOrderNum;
        protected Label LblStatus;
        protected Label LblUserName;
        private int m_OrderId;
        protected RadioButtonList RadlDeliverChargeType;
        protected RadioButtonList RadlOutOfStockProject;
        protected Repeater RptOrderItem;
        protected SelectAgent SelectAgent1;
        protected CrmSelectControl SelectFunctionary;
        protected ExtendedSiteMapPath SmpNavigator;
        protected TextBox TxtAddress;
        protected TextBox TxtContacterName;
        protected TextBox TxtDeliverCharge;
        protected TextBox TxtEmail;
        protected TextBox TxtInvoiceContent;
        protected TextBox TxtMemo;
        protected TextBox TxtMobile;
        protected TextBox TxtPhone;
        protected TextBox TxtRemark;
        protected TextBox TxtZipCode;
        protected PowerEasy.Controls.RequiredFieldValidator ValrAddress;
        protected PowerEasy.Controls.RequiredFieldValidator ValrContacterName;
        protected PowerEasy.Controls.RequiredFieldValidator ValrEmail;
        protected PowerEasy.Controls.RequiredFieldValidator ValrZipCode;
        protected CustomValidator ValxPhone;
        protected DateValidator VdateBeginDate;
        protected EmailValidator VmailEmail;
        protected MobileValidator VmblMobile;
        protected TelephoneValidator VtelPhone;
        protected ZipCodeValidator VzipZipCode;

        private void AddProduct(string eventArgument)
        {
            string[] strArray = eventArgument.Split(new string[] { "$$$" }, StringSplitOptions.RemoveEmptyEntries);
            if (strArray.Length == 2)
            {
                string[] strArray2 = strArray[1].Split(new char[] { '|' });
                int id = DataConverter.CLng(strArray2[0]);
                string property = strArray2[1].Replace('#', '|');
                ProductInfo productById = Product.GetProductById(id, true);
                IList<OrderItemInfo> infoListByOrderId = this.ViewState["OrderItemInfo"] as List<OrderItemInfo>;
                if (infoListByOrderId == null)
                {
                    infoListByOrderId = OrderItem.GetInfoListByOrderId(this.m_OrderId);
                }
                bool flag = false;
                decimal totalMoney = 0M;
                IList<OrderItemInfo> list2 = new List<OrderItemInfo>();
                foreach (OrderItemInfo info2 in infoListByOrderId)
                {
                    if (((info2.ProductId == id) && (info2.Property == property)) && (info2.SaleType == 1))
                    {
                        info2.Amount++;
                        info2.SubTotal += info2.Price;
                        flag = true;
                    }
                    list2.Add(info2);
                    totalMoney += info2.SubTotal;
                }
                infoListByOrderId = list2;
                UserInfo usersByUserName = Users.GetUsersByUserName(this.LblUserName.Text);
                UserPurviewInfo userPurview = usersByUserName.UserPurview;
                bool haveWholesalePurview = false;
                if (userPurview != null)
                {
                    haveWholesalePurview = userPurview.Enablepm;
                }
                if (!flag)
                {
                    AbstractItemInfo info5 = new ConcreteProductInfo(1, property, productById, usersByUserName, this.ChkNeedInvoice.Checked, true, haveWholesalePurview);
                    info5.GetItemInfo();
                    OrderItemInfo orderItemInfo = info5.GetOrderItemInfo(this.m_OrderId);
                    infoListByOrderId.Add(orderItemInfo);
                    totalMoney += info5.SubTotal;
                    int amount = orderItemInfo.Amount;
                    if ((productById.SalePromotionType > 0) && (amount >= productById.MinNumber))
                    {
                        AbstractItemInfo info7 = new ConcreteSalePromotionType(amount, productById, true, null);
                        info7.GetItemInfo();
                        if (!info7.IsNull)
                        {
                            infoListByOrderId.Add(info7.GetOrderItemInfo(this.m_OrderId));
                            totalMoney += info7.SubTotal;
                        }
                    }
                }
                PresentProjectInfo presentProjectByTotalMoney = PresentProject.GetPresentProjectByTotalMoney(totalMoney);
                if (!presentProjectByTotalMoney.IsNull && presentProjectByTotalMoney.PresentContent.Contains("1"))
                {
                    foreach (string str2 in presentProjectByTotalMoney.PresentId.Split(new char[] { ',' }))
                    {
                        int num4 = DataConverter.CLng(str2);
                        if (!PowerEasy.Shop.Present.GetPresentById(num4).IsNull)
                        {
                            AbstractItemInfo info10 = new ConcretePresentProject(num4, presentProjectByTotalMoney);
                            if (!info10.IsNull)
                            {
                                info10.GetItemInfo();
                                infoListByOrderId.Add(info10.GetOrderItemInfo(this.m_OrderId));
                            }
                        }
                    }
                }
                this.RptOrderItem.DataSource = infoListByOrderId;
                this.RptOrderItem.DataBind();
                this.ViewState["OrderItemInfo"] = infoListByOrderId;
            }
        }

        protected void BtnCancel_Click(object sender, EventArgs e)
        {
            BasePage.ResponseRedirect("OrderManage.aspx?OrderID=" + this.HdnOrderId.Value);
        }

        protected void BtnOrderItemModify_Click(object sender, EventArgs e)
        {
        }

        protected void BtnSave_Click(object sender, EventArgs e)
        {
            OrderInfo orderById = Order.GetOrderById(DataConverter.CLng(this.HdnOrderId.Value));
            orderById.ContacterName = this.TxtContacterName.Text;
            orderById.Address = this.TxtAddress.Text;
            orderById.ZipCode = this.TxtZipCode.Text;
            orderById.Phone = this.TxtPhone.Text;
            orderById.Email = this.TxtEmail.Text;
            orderById.Mobile = this.TxtMobile.Text;
            orderById.Status = (OrderStatus) DataConverter.CLng(this.HdnState.Value);
            orderById.NeedInvoice = this.ChkNeedInvoice.Checked;
            orderById.InvoiceContent = this.TxtInvoiceContent.Text;
            orderById.Remark = this.TxtRemark.Text;
            orderById.AgentName = this.SelectAgent1.AgentName;
            orderById.BeginDate = DataConverter.CDate(this.DpkBeginDate.Text);
            orderById.UserName = this.LblUserName.Text;
            orderById.MoneyTotal = DataConverter.CDecimal(this.HdnMoneyTotal.Value);
            orderById.MoneyGoods = DataConverter.CDecimal(this.HdnMoneyGoods.Value);
            orderById.PaymentType = DataConverter.CLng(this.DropPaymentType.SelectedValue);
            orderById.DeliverType = DataConverter.CLng(this.DropDeliverType.SelectedValue);
            orderById.Memo = this.TxtMemo.Text;
            if (!string.IsNullOrEmpty(this.SelectFunctionary.Text))
            {
                orderById.Functionary = this.SelectFunctionary.Text;
            }
            else
            {
                orderById.Functionary = PEContext.Current.Admin.AdminName;
            }
            orderById.OutOfStockProject = (OutOfStockProject) DataConverter.CLng(this.RadlOutOfStockProject.SelectedValue);
            orderById.OrderType = DataConverter.CLng(this.DropOrderType.SelectedValue);
            StringBuilder builder = new StringBuilder();
            IList<OrderItemInfo> orderItemInfoList = null;
            if (orderById.Status <= OrderStatus.WaitForConfirm)
            {
                int num = DataConverter.CLng(this.DropPaymentType.SelectedValue);
                if (num <= 0)
                {
                    builder.Append("<li>请指定付款方式!</li>");
                }
                int deliverTypeId = DataConverter.CLng(this.DropDeliverType.SelectedValue);
                if (deliverTypeId <= 0)
                {
                    builder.Append("<li>请指定送货方式!</li>");
                }
                if (string.IsNullOrEmpty(builder.ToString()))
                {
                    orderItemInfoList = new List<OrderItemInfo>();
                    IList<OrderItemInfo> list2 = this.ViewState["OrderItemInfo"] as List<OrderItemInfo>;
                    decimal num3 = 0M;
                    decimal totalMoney = 0M;
                    double goodsWeight = 0.0;
                    int num6 = 0;
                    bool haveWholesalePurview = Convert.ToBoolean(this.ViewState["HaveWholesalePurview"]);
                    foreach (OrderItemInfo info2 in list2)
                    {
                        int quantity = DataConverter.CLng(((TextBox) this.RptOrderItem.Items[num6].FindControl("TxtAmount")).Text, 1);
                        decimal price = DataConverter.CDecimal(((TextBox) this.RptOrderItem.Items[num6].FindControl("TxtTruePrice")).Text);
                        if (haveWholesalePurview && (quantity != info2.Amount))
                        {
                            UserInfo userInfo = this.ViewState["UserInfo"] as UserInfo;
                            ProductInfo productById = Product.GetProductById(info2.ProductId, info2.TableName);
                            AbstractItemInfo info5 = new ConcreteProductInfo(quantity, info2.Property, productById, userInfo, false, false, haveWholesalePurview);
                            info5.GetItemInfo();
                            price = info5.Price;
                            info2.Price = price;
                            info2.SaleType = info5.SaleType;
                        }
                        num3 = price * quantity;
                        totalMoney += num3;
                        goodsWeight += DataConverter.CDouble(info2.Weight) * quantity;
                        info2.TruePrice = price;
                        info2.SubTotal = num3;
                        info2.ServiceTermUnit = (ServiceTermUnit) DataConverter.CLng(((DropDownList) this.RptOrderItem.Items[num6].FindControl("DropServiceTermUnit")).SelectedValue);
                        info2.ServiceTerm = DataConverter.CLng(((TextBox) this.RptOrderItem.Items[num6].FindControl("TxtServiceTerm")).Text);
                        info2.Remark = ((TextBox) this.RptOrderItem.Items[num6].FindControl("TxtItemRemark")).Text;
                        info2.BeginDate = orderById.BeginDate;
                        info2.Amount = quantity;
                        orderItemInfoList.Add(info2);
                        num6++;
                    }
                    orderById.MoneyGoods = totalMoney;
                    decimal chargeDeliver = orderById.ChargeDeliver;
                    switch (DataConverter.CLng(this.RadlDeliverChargeType.SelectedValue))
                    {
                        case 1:
                        {
                            PackageInfo packageByGoodsWeight = Package.GetPackageByGoodsWeight(goodsWeight);
                            if (!packageByGoodsWeight.IsNull)
                            {
                                goodsWeight += packageByGoodsWeight.PackageWeight;
                            }
                            chargeDeliver = DeliverCharge.GetDeliverCharge(deliverTypeId, goodsWeight, orderById.ZipCode, totalMoney, this.ChkNeedInvoice.Checked);
                            break;
                        }
                        case 2:
                            chargeDeliver = DataConverter.CDecimal(this.TxtDeliverCharge.Text);
                            break;
                    }
                    int couponId = DataConverter.CLng(this.HdnCouponID.Value);

⌨️ 快捷键说明

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