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

📄 myorderinfo.aspx.cs

📁 易想商城系统
💻 CS
字号:
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;

namespace YXShop.Web.Membercenter.Dynamic
{
    public partial class myOrderInfo : System.Web.UI.Page
    {
        private static string orderId = "";// "yx201251020";
        private static decimal remiPrice = 0;
        private static decimal paymPrice = 0;
        private static decimal prepPrice = 0;
        public decimal inPrice = 0;
        private static int userID = 0;
        public decimal TotalPrice = 0;
        public decimal Price = 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();//预付款支付

        YXShop.BLL.Orders bll = new YXShop.BLL.Orders();
        YXShop.BLL.OrderInvoice bllInv = new YXShop.BLL.OrderInvoice();
        YXShop.BLL.LineItem orderItem = new YXShop.BLL.LineItem();
        YXShop.BLL.InvoiceItem invoBll = new YXShop.BLL.InvoiceItem();

        YXShop.BLL.UserInAndExp usieBll = new YXShop.BLL.UserInAndExp();
        public YXShop.Model.Orders model = null;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["MemberID"] == null)
            {
                Response.Redirect("../index.aspx", true);
            }
            else
            {
                if (string.IsNullOrEmpty(Session["MemberID"].ToString()))
                {
                    Response.Redirect("../index.aspx", true);
                }
            }
            if ((!IsPostBack) || ((Request["Event"] != null) && (Request["Event"] != "")))
            {
                if (!string.IsNullOrEmpty(Request.QueryString["OrderID"]))
                {
                    Button5.Attributes.Add("onclick","confirm('你确定要删除订单吗?')");
                    orderId = YXShop.Common.WebUtility.replaceStr(Request.QueryString["OrderID"]);
                    bindOrderInfo(orderId);
                    bindProduct(orderId);
                }
                else
                {
                    Response.Redirect("myOrderList.aspx");
                }
            }
        }
        private void bindOrderInfo(string orderID)
        {
            decimal orderPrice = 0;
            List<YXShop.Model.Orders> li = bll.GetListByColumn("OrderID", orderID);
            if (li.Count == 1)
            {
                model = li[0];
                orderPrice = Convert.ToDecimal(li[0].FactPrice);//订单价格
                userID = Convert.ToInt32(li[0].UserId);
                TotalPrice = Convert.ToDecimal(li[0].FactPrice);
                Price = Convert.ToDecimal(li[0].TotalPrice);
            }
            else
            {
                model = new YXShop.Model.Orders();
            }
            
            YXShop.Model.RemittanceInfo remiModel = Remibll.GetModel(orderId);
            YXShop.Model.PaymentMoney paymModel = paymbll.GetModel(orderId);
            YXShop.Model.PrepayMoney prepModel = prepbll.GetModel(orderId);

            remiPrice = Convert.ToDecimal(remiModel != null ? remiModel.RemittanceMoney : 0);
            paymPrice = Convert.ToDecimal(paymModel != null ? paymModel.GatheringMoney : 0);
            prepPrice = Convert.ToDecimal(prepModel != null ? prepModel.PayoutMoney : 0);
            


            inPrice = remiPrice + paymPrice + prepPrice;//已付款金额
            if (inPrice == orderPrice) 
            {
                Button1.Enabled = false;
                Button2.Enabled = false;
            }
            else if (inPrice < orderPrice) 
            {
                Button4.Enabled = false;
            }
            string str = " userId = " + userID;
            YXShop.BLL.UserInAndExp uiaeBll = new YXShop.BLL.UserInAndExp();
            List<YXShop.Model.UserInAndExp> uiaeList = uiaeBll.GetList(str);
            decimal uiaeMoney=0;
            foreach (YXShop.Model.UserInAndExp uiaeModel in uiaeList)
            {
                uiaeMoney += Convert.ToDecimal(uiaeModel.AdsumMoney);
            }
            if (uiaeMoney >= orderPrice) 
            {
                Button4.Enabled = false;
            }

            #region 是否允许删除订单
            int orderStatu = li[0].OrderStatus;
            int payMentStatu = li[0].PaymentStatus;
            int ogisticsStatu = li[0].OgisticsStatus;

            bool blOrderStatu = (orderStatu == YXShop.Common.StatuEnum.OrderStatu.等待处理.GetHashCode() || orderStatu == YXShop.Common.StatuEnum.OrderStatu.末确认.GetHashCode() || orderStatu == YXShop.Common.StatuEnum.OrderStatu.已经作废.GetHashCode() || orderStatu == YXShop.Common.StatuEnum.OrderStatu.取消.GetHashCode());
            bool blPayStatu = (payMentStatu == YXShop.Common.StatuEnum.PaymentStatu.等待汇款.GetHashCode());
            bool blOgistiStatu = (ogisticsStatu == YXShop.Common.StatuEnum.OgisticsStatus.配送中.GetHashCode() || ogisticsStatu == YXShop.Common.StatuEnum.OgisticsStatus.未送货.GetHashCode());
            if (blOrderStatu && blPayStatu && blOgistiStatu)
            {
                Button5.Enabled = true;
            }

            #endregion

        }
        #region 客户信息查询
        protected string UserName(object UserID)
        {
            string str = "";
            if (!YXShop.Common.WebUtility.isNumeric(UserID))
            {
                return str;
            }
            YXShop.BLL.UserCommon ucBll = new YXShop.BLL.UserCommon();
            List<YXShop.Model.UserCommon> ucList = ucBll.GetListByColumn("UID", UserID);
            if (ucList.Count > 0)
            {
                str = ucList[0].UserName;
            }
            return str;
        }
        protected string UserReal(object UserID)
        {
            string str = "";
            if (!YXShop.Common.WebUtility.isNumeric(UserID))
            {
                return str;
            }
            YXShop.BLL.MemberInfo data = new YXShop.BLL.MemberInfo();
            List<YXShop.Model.MemberInfo> dataStr = data.GetListByColumn("UID ", UserID);
            if (dataStr.Count > 0)
            {
                str = dataStr[0].cTrueName;
            }
            return str;
        }
        #endregion
        #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,object obj1)
        {
            string reStr = string.Empty;
            if (checkInv(obj1) == "×")
            {
                reStr = "不提供发票!";
            }
            else
            {
                List<YXShop.Model.OrderInvoice> model = bllInv.GetListByColumn("OrderID", obj);
                if (model != null)
                {
                    reStr = "√";
                }
                else
                {
                    reStr = "×";
                }
            }
            return reStr;
        }
        public string checkPayType(object obj) 
        {
            string reStr = "";
            if (YXShop.Common.WebUtility.isNumeric(obj)) 
            {
                int payType = Convert.ToInt32(obj);
                switch (payType) 
                {
                    case 0:
                        reStr = "预付款支付";
                        break;
                    case 1:
                        reStr = "为银行支付";
                        break;
                    case 2:
                        reStr = "为在线支付";
                        break;
                    default:
                        break;
                }
            }
            return reStr;
        }
        public string checkFerryMethod(object obj) 
        {
            string reStr = "";
            if (YXShop.Common.WebUtility.isNumeric(obj)) 
            {
                YXShop.BLL.YXShop_Deliver delBll = new YXShop.BLL.YXShop_Deliver();
                string whereStr = "D_ID = '" + obj + "'";
                List<YXShop.Model.YXShop_Deliver> delList = delBll.GetList(whereStr);
                if (delList != null && delList.Count > 0) 
                {
                    reStr = delList[0].D_Name;
                }
            }
            return reStr;
        }
        #endregion

        private void bindProduct(string orderID)
        {
            List<YXShop.Model.LineItem> li = orderItem.GetListByColumn("OrderID", orderID);
            productInfo.DataSource = li;
            productInfo.DataBind();
            //TotalPrice=
        }
        //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;
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            Response.Redirect("myOrderPay1.aspx?OrderID=" + orderId, true);
        }

        protected void Button3_Click(object sender, EventArgs e)
        {
            Response.Redirect("myOrderLeave.aspx?OrderID=" + orderId, true);
        }

        protected void Button4_Click(object sender, EventArgs e)
        {
            Response.Redirect("myMHadPay.aspx?OrderID=" + orderId, true);
        }

        protected void Button5_Click(object sender, EventArgs e)
        {
            //YXShop.Model.Orders orderModels = new YXShop.Model.Orders();
            //orderModels.OrderId = orderId;
            try
            {
                bll.Delect(orderId);
            }
            finally 
            {
                Response.Redirect("myOrderList.aspx", true);
            }
            
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            Response.Redirect("myOrderPay2.aspx?OrderID=" + orderId, true);
        }
    }
}

⌨️ 快捷键说明

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