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

📄 ordermodfy.aspx.cs

📁 易想商城系统
💻 CS
📖 第 1 页 / 共 2 页
字号:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Collections.Generic;
using YXShop.Common;
using Shop.Web.UI;

namespace YXShop.Web.Admin.Orders
{
    public partial class orderModfy : System.Web.UI.Page
    {
        public YXShop.Model.Orders model = null;
        YXShop.BLL.Orders bll = new YXShop.BLL.Orders();
        YXShop.BLL.OrderInvoice bllInv = new YXShop.BLL.OrderInvoice();
        YXShop.BLL.YXShop_Deliver bllDeliver = new YXShop.BLL.YXShop_Deliver();
        YXShop.BLL.LineItem orderItem = new YXShop.BLL.LineItem();
        YXShop.BLL.Product product = new YXShop.BLL.Product();
        private static string orderId = "";// "yx201251020";
        private static decimal remiPrice = 0;
        private static decimal paymPrice = 0;
        private static decimal prepPrice = 0;
        public static decimal outPrice = 0;

        YXShop.BLL.RemittanceInfo Remibll = new YXShop.BLL.RemittanceInfo();//银行支付
        YXShop.BLL.PaymentMoney paymbll = new YXShop.BLL.PaymentMoney();//现金支付
        YXShop.BLL.PrepayMoney prepbll = new YXShop.BLL.PrepayMoney();//预付款支付
        BasePage bp = null;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!PowerTree.PowerPass.isPass("006001004", PowerTree.PowerPanel.PowerType.update))
            {
                bp = new BasePage();
                bp.PageError("对不起,你没有修改订单的权限!", "../index.aspx");
            }
            AjaxPro.Utility.RegisterTypeForAjax(typeof(YXShop.Web.Admin.Orders.orderModfy));
            if ((!IsPostBack) || ((Request["Event"] != null) && (Request["Event"] != "")))
            {
                if (!string.IsNullOrEmpty(Request.QueryString["OrderID"]))
                {
                    //bindOrderInfo(YXShop.Common.WebUtility.replaceStr(Request.QueryString["OrderID"]));
                    orderId = YXShop.Common.WebUtility.replaceStr(Request.QueryString["OrderID"]);
                    bindOrderInfo(orderId);
                }
                else
                {
                    Response.Redirect("orderList.aspx");
                }
            }
        }
        #region Formant Str
        //public string checkInv(object obj)
        //{
        //    string reStr = string.Empty;
        //    int invNum = 0;
        //    if (YXShop.Common.WebUtility.isNumeric(obj))
        //    {
        //        invNum = Convert.ToInt32(obj);
        //    }
        //    if (invNum > 0)
        //    {
        //        reStr = "√";
        //    }
        //    else 
        //    {
        //        reStr = "×";
        //    }
        //    return reStr;
        //}
        public string checkOrderStatu(object obj)
        {
            string reStr = string.Empty;
            Type orderStatu = typeof(YXShop.Common.StatuEnum.OrderStatu);
            bool bl = YXShop.Common.WebUtility.isNumeric(obj);
            if (bl)
            {
                reStr = Enum.GetName(orderStatu, obj);
            }
            return reStr;
        }
        public string checkPaymentStatu(object obj)
        {
            string reStr = string.Empty;
            Type paymentStatu = typeof(YXShop.Common.StatuEnum.PaymentStatu);
            bool bl = YXShop.Common.WebUtility.isNumeric(obj);
            if (bl)
            {
                reStr = Enum.GetName(paymentStatu, obj);
            }
            return reStr;
        }
        public string checkOgisticsStatu(object obj)
        {
            string reStr = string.Empty;
            Type ogisticsStatu = typeof(YXShop.Common.StatuEnum.OgisticsStatus);
            bool bl = YXShop.Common.WebUtility.isNumeric(obj);
            if (bl)
            {
                reStr = Enum.GetName(ogisticsStatu, obj);
            }
            return reStr;
        }
        //public string checkInvoice(object obj)
        //{
        //    string reStr = string.Empty;
        //    List<YXShop.Model.OrderInvoice> model = bllInv.GetListByColumn("OrderID", obj);
        //    if (model != null)
        //    {
        //        reStr = "√";
        //    }
        //    return reStr;
        //}
        #endregion

        /// <summary>
        /// 绑定订单信息
        /// </summary>
        /// <param name="orderID"></param>
        private void bindOrderInfo(string orderID)
        {
            string needStr = "", needEdStr = "";
            BindInvoice(out needStr, out needEdStr);
            List<YXShop.Model.Orders> li = bll.GetListByColumn("OrderID", orderID);

            YXShop.Model.RemittanceInfo bankModel =  Remibll.GetModel(orderId);
            YXShop.Model.PaymentMoney paymModel = paymbll.GetModel(orderId);
            YXShop.Model.PrepayMoney prepModel = prepbll.GetModel(orderId);
                
            if (li.Count == 1)
            {
                if (needEdStr == "×" || needStr == "×")
                {
                    sInvoInfo.Visible = false;
                }
                else 
                {
                    sInvoInfo.Visible = true;
                }
                remiPrice = Convert.ToDecimal(bankModel != null ? bankModel.RemittanceMoney : 0);
                paymPrice = Convert.ToDecimal(paymModel != null ? paymModel.GatheringMoney : 0);
                prepPrice = Convert.ToDecimal(prepModel != null ? prepModel.PayoutMoney : 0);

                outPrice = (remiPrice + paymPrice + prepPrice);

                model = li[0];

                YXShop.BLL.MemberInfo data = new YXShop.BLL.MemberInfo();
                DataTable dataStr = data.GetId(li[0].UserId);
                YXShop.BLL.UserCommon ucBll = new YXShop.BLL.UserCommon();
                List<YXShop.Model.UserCommon> ucList = ucBll.GetListByColumn("UID", li[0].UserId);
                string userName="", userReal="";

                if (ucList.Count > 0) 
                {
                    userName = ucList[0].UserName;
                }
                if (dataStr.Rows.Count > 0)
                {
                    //userName = dataStr[0].uUserName;
                    userReal = dataStr.Rows[0]["cTrueName"]!=null?dataStr.Rows[0]["cTrueName"].ToString():string.Empty;
                }
                Label1.Text = model.OrderId;
                Label2.Text = userReal;
                myuser.Text = userName;
                myuser.NavigateUrl = "~/Admin/Consumer/MemberInfo.aspx?ID=" + li[0].UserId;
                Label4.Text = model.ShopDate.ToString();
                Label5.Text = model.OrderDate.ToString();
                Label6.Text = needStr;
                Label7.Text = needEdStr;
                Label8.Text = checkOrderStatu(model.OrderStatus);
                Label9.Text = checkPaymentStatu(model.PaymentStatus);
                Label10.Text = checkOgisticsStatu(model.OgisticsStatus);
                Label12.Text = model.FactPrice.ToString();
                TextBox1.Text = model.ConsigneeName;
                TextBox2.Text = model.ConsigneeTel;
                TextBox3.Text = model.ConsigneeAddress;
                TextBox4.Text = model.ConsigneeZip;
                TextBox5.Text = model.ConsigneeEmail;
                TextBox6.Text = model.ConsigneePhone;
                
                shopDate.Date = Convert.ToDateTime(model.ShopDate);
                TextBox12.Text = model.Remark;
                BindDeliver(DropDownList2, model.Courier);
                BindPayment(DropDownList1, model.PaymentType);
            }
            else
            {
                model = new YXShop.Model.Orders();
            }
        }
        public decimal TotalPrice = 0;
        public decimal Price = 0;
        public decimal getTotalMoney(object unitPrice, object quantity, object markPrice)
        {
            decimal reDec = 0;
            if (unitPrice == null || quantity == null)
                return reDec;
            if (YXShop.Common.WebUtility.isNumeric(Convert.ToInt32(unitPrice)) && YXShop.Common.WebUtility.isNumeric(quantity))
            {
                reDec = Convert.ToDecimal(unitPrice) * Convert.ToInt32(quantity);
            }
            if (YXShop.Common.WebUtility.isNumeric(Convert.ToDecimal(markPrice)))
            {
                Price += Convert.ToDecimal(markPrice) * Convert.ToInt32(quantity);
            }
            TotalPrice += reDec;
            return reDec;
        }
        public void BindPayment(DropDownList ddl,int value) 
        {
            for (int i = 0; i < ddl.Items.Count; i++) 
            {
                if (ddl.Items[i].Value == value.ToString()) 
                {
                    ddl.Items[i].Selected = true;
                    break;
                }
            }
        }
        /// <summary>
        /// 绑定送货方式
        /// </summary>
        /// <param name="ddl"></param>
        public void BindDeliver(DropDownList ddl, string value)
        {
            string str = string.Format(" D_IsUsed=1");
            List<YXShop.Model.YXShop_Deliver> list= bllDeliver.GetList(str);
            if (list.Count > 0)
            {
                ListItem li = null;
                foreach (YXShop.Model.YXShop_Deliver deliModel in list)
                {
                    li = new ListItem();
                    li.Value = deliModel.D_ID.ToString();
                    li.Text = deliModel.D_Name.ToString();
                    if (value == li.Text)
                    {
                        li.Selected = true;
                    }
                    ddl.Items.Add(li);
                }
            }
            if (ddl.Items.Count < 1)
            {
                add.Enabled = false;
                add.ToolTip = "没有已启用的送货方式!";
            }

        }
        private void BindInvoice(out string needStr,out string needEdStr) 
        {
            needStr = "×";
            needEdStr = "×";
            YXShop.BLL.OrderInvoice ordIBll = new YXShop.BLL.OrderInvoice();
            List<YXShop.Model.OrderInvoice> ordIList = ordIBll.GetListByColumn("OrderID", orderId);
            if (ordIList.Count > 0) //需要发票
            {
                needStr = "√";
                YXShop.BLL.InvoiceManage invMBll = new YXShop.BLL.InvoiceManage();
                List<YXShop.Model.InvoiceManage> list = invMBll.GetId(Convert.ToInt32(ordIList[0].InvoiceType));
                if (list.Count == 1)
                {
                    if (list[0].IM_Type == "普通发票" || list[0].IM_Type == "增值税发票")
                    {
                        YXShop.BLL.InvoiceItem invIBll = new YXShop.BLL.InvoiceItem();
                        List<YXShop.Model.InvoiceItem> invIList = invIBll.GetListByColumn("OrderID", orderId);//发票详细信息
                        if (invIList.Count > 0)
                        {
                            needEdStr = "√";
                            Label14.Text = invIList[0].InvoiceNumber;
                            Label15.Text = invIList[0].InvoiceType;
                            Label16.Text = invIList[0].InvoiceName;
                            Label17.Text = invIList[0].InvoiceRise;
                            Label18.Text = Convert.ToDateTime(invIList[0].InvoiceDate).ToShortDateString();
                            TextBox13.Text = invIList[0].InvoiceContent;
                            Label20.Text = invIList[0].NoteName;
                            Label21.Text = invIList[0].InvoiceMoney.ToString();
                            Label22.Text = Convert.ToDateTime(invIList[0].NoteDate).ToShortDateString();
                        }
                    }
                }    

⌨️ 快捷键说明

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