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

📄 ordertransfer.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;
using Shop.Web.UI;

namespace YXShop.Web.Admin.Orders
{
    public partial class orderTransfer : System.Web.UI.Page
    {

        public static string orderId = "";
        YXShop.BLL.Orders bll = new YXShop.BLL.Orders();
        YXShop.BLL.OrderTransfer tranBll = new YXShop.BLL.OrderTransfer();
        YXShop.BLL.MemberInfo membBll = new YXShop.BLL.MemberInfo();

        YXShop.BLL.UserCommon ucBll = new YXShop.BLL.UserCommon();
        List<YXShop.Model.Orders> li = new List<YXShop.Model.Orders>();
        BasePage bp = null;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!PowerTree.PowerPass.isPass("006001012", PowerTree.PowerPanel.PowerType.other))
            {
                bp = new BasePage();
                bp.PageError("对不起,你没有过户订单的权限!", "../index.aspx");
            }
            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");
                }
            }
        }


        /// <summary>
        /// 绑定订单数据及其它
        /// </summary>
        /// <param name="orderID"></param>
        private void bindOrderInfo(string orderID)
        {
            li = bll.GetListByColumn("OrderID", orderID);
            if (li.Count == 1)
            {
                Label1.Text = li[0].OrderId;
                Label2.Text = UserReal(li[0].UserId);
                Label3.Text = UserName(li[0].UserId);
            }
        }
        #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
        protected void okBtn_Click(object sender, EventArgs e)
        {
            
            YXShop.Model.OrderTransfer ordTranModel = new YXShop.Model.OrderTransfer();
            #region 订单过户
            string tranName = YXShop.Common.WebUtility.replaceStr(TextBox1.Text.Trim());
            ordTranModel.OrderID = Label1.Text;
            ordTranModel.UserName = Label2.Text;
            ordTranModel.TransferName = tranName;
            ordTranModel.Poundage = decimal.Parse(string.IsNullOrEmpty(TextBox2.Text) ? "0" : TextBox2.Text);
            ordTranModel.PoundagePaymentPerson = (RadioButtonList1.SelectedIndex == 0) ? Label3.Text : tranName;
            ordTranModel.Remark = YXShop.Common.WebUtility.replaceStr(TextBox3.Text.Trim());
            ordTranModel.NoteDate = DateTime.Now;
            ordTranModel.NoteName = Session["AdminName"].ToString();
            ordTranModel.Update = DateTime.Now;
            #endregion
            
            List<YXShop.Model.MemberInfo> list = null;
            decimal Poundage = decimal.Parse(string.IsNullOrEmpty(TextBox2.Text) ? "0" : TextBox2.Text);
            if (membBll.userExist(tranName))
            {
                if (RadioButtonList1.SelectedIndex == 0)
                {
                    list = membBll.GetListByColumn("uUserName", Label2.Text);
                }
                else
                {
                    list = membBll.GetListByColumn("uUserName", tranName);

                }
                if (list.Count == 1)
                {
                    if (list[0].fSurplusCapital < Poundage)
                    {
                        Response.Redirect("../Succeed/ErrorOrder.aspx?Key=用户余额不足!&OrderId=" + orderId + "");
                    }
                    else
                    {//处理订单过户信息,扣出用户手继费
                        try
                        {
                            int userId = Convert.ToInt32(list[0].Uid);

                            string userName = "";//list[0].uUserName;
                            string userEmail = "";
                            YXShop.BLL.UserCommon ucBll = new YXShop.BLL.UserCommon();
                            List<YXShop.Model.UserCommon> ucList = ucBll.GetListByColumn("UID", userId);
                            if (ucList.Count > 0)
                            {
                                userName = ucList[0].UserName;
                                userEmail = ucList[0].UEmail;
                            }
                            string name = list[0].cTrueName;
                            string tel = list[0].cOfficePhone;
                            string mobile = list[0].cMobilePhone;

                            List<YXShop.Model.Orders> ordeList = bll.GetListByColumn("OrderID", orderId);
                            ordeList[0].UserId = userId.ToString();
                            ordeList[0].ConsigneeName = userName;
                            ordeList[0].ConsigneeRealName = name;
                            ordeList[0].ConsigneeTel = tel;
                            ordeList[0].ConsigneePhone = list[0].cMobilePhone;
                            ordeList[0].ConsigneeAddress = list[0].cAddrInfo;
                            ordeList[0].ConsigneeFax = list[0].cFaxNumber;
                            ordeList[0].ConsigneeEmail = userEmail;
                            ordeList[0].Payment = "";
                            bll.Amend(ordeList[0]);

                            if (Poundage > 0)
                            {//更新用户资费
                                decimal fsurplus = Convert.ToDecimal(list[0].fSurplusCapital - Poundage);
                                decimal fCost = Convert.ToDecimal(list[0].fCostFund + Poundage);
                                membBll.Amend(userName, "fSurplusCapital", fsurplus, "fCostFund", fCost);
                            }
                            tranBll.Add(ordTranModel);
                        }
                        catch (Exception ex)
                        {
                            Response.Redirect("../Succeed/ErrorOrder.aspx?Key=" + ex.Message + "&OrderId=" + orderId + "");
                        }
                        finally
                        {
                            Response.Redirect("../Succeed/SueeccdOrder.aspx?Key=订单过户&OrderId=" + orderId + "");
                        }

                    }
                }
                else
                {
                    Response.Redirect("../Succeed/Error.aspx?Key=没有找到,手续费支付者!");
                }
            }
            else
            {
                Response.Redirect("../Succeed/Error.aspx?Key=错误!找不到指定的用户名!");
            }
        }

       
    }
}

⌨️ 快捷键说明

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