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

📄 orderlist.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 YXShop.Common;

namespace YXShop.Web.Membercenter.Shop
{
    public partial class OrderList : System.Web.UI.Page
    {
        YXShop.BLL.Orders bll = new YXShop.BLL.Orders();
        YXShop.BLL.OrderInvoice bllInv = new YXShop.BLL.OrderInvoice();
        public PageSet ps;
        protected void Page_Load(object sender, EventArgs e)
        {
            AjaxPro.Utility.RegisterTypeForAjax(typeof(YXShop.Web.Admin.Orders.orderList));
            //if ((!IsPostBack) || (string.IsNullOrEmpty(Request["Event"])))
            if ((!IsPostBack) || (Request["Event"] != null) && (Request["Event"] != ""))
            {
                BindOrders();
            }
        }
        #region Bind Data
        private void BindOrders()
        {
            DelBtn.Attributes.Add("onclick", "return confirm('请确认要删除指定项吗?');");
            int pageIndex = Request["pageIndex"] == null ? 0 : int.Parse(Request["pageIndex"]);
            if (pageIndex < 0)
            {
                pageIndex = 0;
            }
            if ((Request["Event"] == null) || (Request["Event"] == ""))
            {
                pageIndex = 0;
            }
            List<YXShop.Model.Orders> datas = bll.GetAll();
            GridView1.DataSource = datas;
            int RecordCount = 0;
            if (datas != null)
                RecordCount = datas.Count;
            ps = new PageSet(RecordCount, PageSet.PageSize, pageIndex);
            if (ps.PageCount <= pageIndex + 1)
            {
                pageIndex = ps.PageCount - 1;
            }

            GridView1.PageSize = PageSet.PageSize;
            GridView1.PageIndex = pageIndex;
            if (RecordCount < 1)
            {
                GridView1.BackColor = System.Drawing.Color.White;
            }
            else
            {
                GridView1.BackColor = System.Drawing.Color.FromArgb(0x5D, 0x8F, 0xB2);
            }
            GridView1.DataBind();
        }

        protected void dgTBOrderInfo_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (!(e.Row.DataItem is YXShop.Model.Orders))
            {
                return;
            }
            YXShop.Model.Orders data = (e.Row.DataItem as YXShop.Model.Orders);
            if (data != null)
            {
                e.Row.Cells[1].Text = "<a href=\"../Consumer/MemberInfo.aspx?Pro_ID=" + data.UserId + "\">" + this.UserReal(Convert.ToInt32(data.UserId)) + "</a>";
                e.Row.Cells[2].Text = "<a href=\"../Consumer/MemberInfo.aspx?Pro_ID=" + data.UserId + "\">" + this.UserName(Convert.ToInt32(data.UserId)) + "</a>";
                e.Row.Cells[3].Text = this.UserReal(Convert.ToInt32(data.UserId));
                e.Row.Cells[5].Text = this.checkInv(data.OrderId);
                e.Row.Cells[6].Text = this.checkInvoice(data.OrderId);
            }
        }
        #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 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 checkInv(string OrderId)
        {
            YXShop.BLL.OrderInvoice datab = new YXShop.BLL.OrderInvoice();
            List<YXShop.Model.OrderInvoice> data = datab.GetListByColumn("OrderID", OrderId);
            if (data.Count > 0)
            {
                return "√";
            }
            return "<span style='color:red'>×</span>";
        }
        public string checkInvoice(string OrderId)
        {
            string reStr = string.Empty;
            YXShop.BLL.InvoiceItem databi = new YXShop.BLL.InvoiceItem();
            List<YXShop.Model.InvoiceItem> data = databi.GetListByColumn("OrderID", OrderId);
            if (data.Count > 0)
            {
                reStr = "√";

            }
            else
            {
                reStr = "<span style='color:red'>×</span>";
            }
            return reStr;
        }
        #endregion

        public void ItemListDel()
        {
            //YXShop.Model.Orders model = null;
            //int statu = 0;
            //for (var i = 0; i < GridView1.Rows.Count; i++)
            //{
            //    model = new YXShop.Model.Orders();
            //    CheckBox checkbox = (CheckBox)GridView1.Rows[i].FindControl("chkItem");
            //    HyperLink hyperlink = (HyperLink)GridView1.Rows[i].FindControl("chkValue");
            //    if (checkbox != null && hyperlink != null)
            //    {
            //        if (checkbox.Checked)
            //        {
            //            model.OrderId = hyperlink.Text;
            //            bll.Delect(model);
            //            YXShop.Common.alert.Show(this, model.OrderId);
            //            statu++;
            //        }
            //    }
            //}
            //if (statu == 0)
            //{
            //    Response.Redirect("../Succeed/Error.aspx?Key=没有项被删除,要删除订单,请选中后点击此按钮!", true);
            //}                                                                                                                                                
            //else 
            //{
            //    Response.Redirect("../Succeed/Error.aspx?Key=操作过程中,有" + statu + "被删除!");
            //    BindOrders();
            //}



        }
        protected void DelBtn_Click(object sender, EventArgs e)
        {
            System.Web.UI.WebControls.CheckBox chkExport;
            string sID;
            int all = GridView1.Rows.Count;
            int i;
            try
            {
                for (i = 0; i < all; i++)
                {
                    chkExport = (CheckBox)GridView1.Rows[i].FindControl("chkItem");
                    if (chkExport.Checked == true)
                    {
                        sID = GridView1.DataKeys[i].Value.ToString();
                        
                        bll.Delect(sID);
                    }
                }
                BindOrders();
            }
            catch (Exception eFS)
            {
                Response.Write(eFS.ToString());
                Response.End();
            }
        }

        protected void AddBtn_Click(object sender, EventArgs e)
        {
            Response.Redirect("OrderAdd.aspx", true);
        }
    }

}

⌨️ 快捷键说明

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