using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Text;
using System.Web.UI.WebControls;
using TopWinCMS.BLL;
using TopWinCMS.BLL.Common;
using TopWinCMS.Common;
using TopWinCMS.Model.Enum;
using TopWinCMS.Model;

namespace TopWinCMS.WebUI.Admin.Shop
{
    public partial class OrdersMerge : System.Web.UI.Page
    {
        int ModelID; 
        OrdersManage MyBLL = new OrdersManage();
        protected void Page_Load(object sender, EventArgs e)
        {
            ModelID = int.Parse(Request.QueryString["ModelID"]);
            if (!IsPostBack)
            {
                LB_Path.Text = string.Format("{0} → <a href='Order.aspx?ModelID={1}'>订单管理</a> → 订单合并", ModelManage.GetModelName(ModelID), ModelID);
                BindList();
            }

        }
        #region 绑定数据
        /// <summary>
        /// 绑定数据
        /// </summary>
        private void BindList()
        {

        }
        #endregion

        protected void BT_SearchMember_Click(object sender, EventArgs e)
        {
            DDL_Member.DataSource = new MemberManage().SearchMember(TB_Key.Text.Trim());
            DDL_Member.DataTextField = "Name";
            DDL_Member.DataValueField = "Name";
            DDL_Member.DataBind();
            DDL_Member.Items.Insert(0, new ListItem("<请选择>", "0"));
        }

        protected void DDL_Member_SelectedIndexChanged(object sender, EventArgs e)
        {
            
            MyBLL.GetOrdersWithUserName(DDL_OrdersZ, DDL_Member.SelectedValue);
            MyBLL.GetOrdersWithUserName(DDL_OrdersC, DDL_Member.SelectedValue);

        }

        protected void BT_OK_Click(object sender, EventArgs e)
        {
            MyBLL.OrdersMerge(int.Parse(DDL_OrdersZ.SelectedValue), int.Parse(DDL_OrdersC.SelectedValue));

            TB_Key.Text = "";
            DDL_Member.Items.Clear();
            DDL_OrdersZ.Items.Clear();
            DDL_OrdersC.Items.Clear();

            MsgBox.Alert("合并完毕！", UpdatePanel1);
        }

    }
}