Exemple #1
0
    private DataTable Check_Root()
    {
        STMModel.MaintainStoreAccount BCO_root = new STMModel.MaintainStoreAccount(ConnectionDB);

        DataTable Dt_root;

        ParameterList.Clear();
        ParameterList.Add(SLP_STORE.Text);
        ParameterList.Add((DateTime.Parse(this.SLP_EFF_DATE_FROM.Text)).ToString("yyyy/MM/dd"));
        ParameterList.Add(txtPAY_RFNO.Text);

        Dt_root = BCO_root.QuerySwitch(STMModel.MaintainStoreAccount.QueryType.HeadROOT, ParameterList);

        return Dt_root;
    }
Exemple #2
0
    protected void txt_RFNO_Onblur()
    {
        if (txtPAY_RFNO.Text == txtRFNO.Text)
        {
            string mode = "";
            string v_STORE = "";
            string v_eff_date_from = "";

            #region 帶出總部資料
            STMModel.MaintainStoreAccount BCO = new STMModel.MaintainStoreAccount(ConnectionDB);
            DataTable Dt_rtn;
            ParameterList.Clear();
            ParameterList.Add(GetValueSetParameter(this.SLP_STORE.Text, "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_EFF_DATE_FROM.Text, "date", false));
            ParameterList.Add(GetValueSetParameter(this.txtPAY_RFNO.Text, "string", false));
            ParameterList.Add(GetValueSetParameter(this.txtRFNO.Text, "string", false));
            Dt_rtn = BCO.QueryAccountHead(ParameterList);

            if (Dt_rtn == null || (Dt_rtn != null && Dt_rtn.Rows.Count <= 0))
            {
                //無資料
            }
            else
            {
                #region 帶出總部資料

                v_STORE = Dt_rtn.Rows[0]["STORE"].ToString();
                v_eff_date_from = Dt_rtn.Rows[0]["EFF_DATE_FROM"].ToString();
                this.SLP_EFF_DATE_TO.Text = Dt_rtn.Rows[0]["EFF_DATE_TO"].ToString();
                this.radSTORE_TYPE_HEAD.Checked = false;
                this.radSTORE_TYPE_STORE.Checked = true;
                this.txtTITLE.Text = Dt_rtn.Rows[0]["TITLE"].ToString();
                this.txtINV_ADDR.Text = Dt_rtn.Rows[0]["INV_ADDR"].ToString();
                this.txtPERSON.Text = Dt_rtn.Rows[0]["PERSON"].ToString();
                this.SLP_PROFIT_NO.Text = Dt_rtn.Rows[0]["PROFIT_NO"].ToString();
                this.txtPAY_ACCOUNT.Text = Dt_rtn.Rows[0]["PAY_ACCOUNT"].ToString();
                this.SLP_DUIT_UNIT.Text = Dt_rtn.Rows[0]["DUTY_UNIT"].ToString();
                this.ddlPAYMENT_STORE.SelectedValue = Dt_rtn.Rows[0]["PAYMENT_STORE"].ToString();
                this.txtAC_NAME.Text = Dt_rtn.Rows[0]["AC_NAME"].ToString();
                this.txtINVOICE_MAILADD.Text = Dt_rtn.Rows[0]["INVOICE_MAIL_ADD"].ToString();
                this.SLP_INVOICE_SEND.Text = Dt_rtn.Rows[0]["INVOICE_SEND"].ToString();
                this.SLP_INVOICE_TYPE.Text = Dt_rtn.Rows[0]["INVOICE_TYPE"].ToString();
                this.ddlPAY_TYPE.SelectedValue = Dt_rtn.Rows[0]["PAY_TYPE"].ToString();
                this.SLP_CLS_DATE.Text = Dt_rtn.Rows[0]["CLS_DATE"].ToString();
                #endregion

                #region 帶出總部資料唯讀
                SLP_STORE.ReadOnly = true;
                txtPAY_RFNO.ReadOnly = true;
                txtPAY_RFNO.CssClass = "readtxtbox";
                txtRFNO.ReadOnly = true;
                txtRFNO.CssClass = "readtxtbox";
                this.radSTORE_TYPE_HEAD.Enabled = false;
                this.radSTORE_TYPE_STORE.Enabled = false;
                this.SLP_EFF_DATE_FROM.ReadOnly = true;
                this.radSTORE_TYPE_HEAD.Enabled = false;
                this.radSTORE_TYPE_STORE.Enabled = false;
                this.txtTITLE.ReadOnly = true;
                txtTITLE.CssClass = "readtxtbox";
                this.txtINV_ADDR.ReadOnly = true;
                txtINV_ADDR.CssClass = "readtxtbox";
                this.txtPERSON.ReadOnly = true;
                txtPERSON.CssClass = "readtxtbox";
                this.SLP_PROFIT_NO.ReadOnly = true;
                this.txtPAY_ACCOUNT.ReadOnly = true;
                txtPAY_ACCOUNT.CssClass = "readtxtbox";
                this.SLP_DUIT_UNIT.ReadOnly = true;
                this.ddlPAYMENT_STORE.Enabled = false;
                this.txtAC_NAME.ReadOnly = true;
                txtAC_NAME.CssClass = "readtxtbox";
                this.txtINVOICE_MAILADD.ReadOnly = true;
                txtINVOICE_MAILADD.CssClass = "readtxtbox";
                this.SLP_INVOICE_SEND.ReadOnly = true;
                this.SLP_INVOICE_TYPE.ReadOnly = true;
                this.ddlPAY_TYPE.Enabled = false;
                this.SLP_CLS_DATE.ReadOnly = true;
                #endregion
            }
            #endregion

            #region 帶出設定屬性
            if (v_STORE.Length != 0 && v_eff_date_from.Length != 0)
            {
                STMModel.MaintainStoreAccount BCO_root = new STMModel.MaintainStoreAccount(ConnectionDB);

                DataTable Dt_root;

                ParameterList.Clear();
                ParameterList.Add(v_STORE);
                ParameterList.Add((DateTime.Parse(v_eff_date_from)).ToString("yyyy/MM/dd"));

                Dt_root = BCO_root.QuerySwitch(STMModel.MaintainStoreAccount.QueryType.ROOT, ParameterList);

                if (Dt_root == null || (Dt_root != null && Dt_root.Rows.Count <= 0))
                {
                    //無資料
                }
                else
                {
                    DataSet ds_root = (DataSet)Session["STM252_root" + PageTimeStamp.Value];

                    ds_root.Clear();

                    for (int i = 0; i < Dt_root.Rows.Count; i++)
                    {
                        DataRow dr = ds_root.Tables[0].NewRow();

                        dr["STORE"] = this.SLP_STORE.Text;
                        dr["EFF_DATE_FROM"] = this.SLP_EFF_DATE_FROM.Text;
                        dr["ROOT_NO"] = Dt_root.Rows[i]["ROOT_NO"].ToString();
                        dr["ROOT_NO_EXPLAIN"] = Dt_root.Rows[i]["ROOT_NO_EXPLAIN"].ToString();
                        dr["HEAD_DOC"] = Dt_root.Rows[i]["HEAD_DOC"].ToString();
                        dr["HEAD_DOC_EXPLAIN"] = Dt_root.Rows[i]["HEAD_DOC_EXPLAIN"].ToString();
                        dr["SINGLE_DOC"] = Dt_root.Rows[i]["SINGLE_DOC"].ToString();
                        dr["SINGLE_DOC_EXPLAIN"] = Dt_root.Rows[i]["SINGLE_DOC_EXPLAIN"].ToString();
                        dr["PAYMENT_TYPE"] = Dt_root.Rows[i]["PAYMENT_TYPE"].ToString();
                        dr["PAYMENT_TYPE_EXPLAIN"] = Dt_root.Rows[i]["PAYMENT_TYPE_EXPLAIN"].ToString();

                        ds_root.Tables[0].Rows.Add(dr);
                    }

                    GridView1.DataSource = ds_root;
                    string SessionIDName_root = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value);
                    Session[SessionIDName_root] = ds_root;
                    GridView1.DataBind();
                    Session["STM252_root" + PageTimeStamp.Value] = ds_root;

                    if (GridView1.Rows.Count > 0)
                    {
                        foreach (GridViewRow dr in GridView1.Rows)
                        {
                            ((Button)dr.FindControl("btnDel")).Enabled = false;   //GRID刪除
                            ((Button)dr.FindControl("btnEdit")).Enabled = false;  //GRID編輯
                        }
                    }

                    btnAdd.Enabled = false;//新增
                }
            }
            #endregion

            #region 帶出收款天數
            if (v_STORE.Length != 0 && v_eff_date_from.Length != 0)
            {
                STMModel.MaintainStoreAccount BCO_Charge = new STMModel.MaintainStoreAccount(ConnectionDB);

                DataTable Dt_charge;
                ParameterList.Clear();

                ParameterList.Add(v_STORE);
                ParameterList.Add((DateTime.Parse(v_eff_date_from)).ToString("yyyy/MM/dd"));

                Dt_charge = BCO_Charge.QuerySwitch(STMModel.MaintainStoreAccount.QueryType.CHARGE, ParameterList);

                if (Dt_charge == null || (Dt_charge != null && Dt_charge.Rows.Count <= 0))
                {
                    //無資料
                }
                else
                {
                    DataSet ds = (DataSet)Session["STM252_" + PageTimeStamp.Value];

                    ds.Clear();

                    for (int i = 0; i < Dt_charge.Rows.Count; i++)
                    {
                        DataRow dr = ds.Tables[0].NewRow();

                        dr["ID"] = DateTime.Now.ToFileTime().ToString() + i.ToString();
                        dr["STORE"] = this.SLP_STORE.Text;
                        dr["EFF_DATE_FROM"] = this.SLP_EFF_DATE_FROM.Text;
                        dr["ROOT_NO"] = Dt_charge.Rows[i]["ROOT_NO"].ToString();
                        dr["ROOT_NO_EXPLAIN"] = Dt_charge.Rows[i]["ROOT_NO_EXPLAIN"].ToString();
                        dr["PMA"] = Dt_charge.Rows[i]["PMA"].ToString();
                        dr["PMA_EXPLAIN"] = Dt_charge.Rows[i]["PMA_EXPLAIN"].ToString();
                        dr["COL_DAYS"] = Dt_charge.Rows[i]["COL_DAYS"].ToString();
                        dr["COL_DAYS_EXPLAIN"] = Dt_charge.Rows[i]["COL_DAYS_EXPLAIN"].ToString();

                        ds.Tables[0].Rows.Add(dr);
                    }
                    Session["STM252_" + PageTimeStamp.Value] = ds;

                    GridView2.DataSource = ds;
                    string SessionIDName2 = string.Format("{0}_{1}", PAGE_DT_02, PageTimeStamp.Value);
                    Session[SessionIDName2] = ds;
                    GridView2.DataBind();
                }
            }
            #endregion

            UpdatePanelLineItem.Update();
            UpdatePanel3.Update();
            UpdatePanel4.Update();
            UpdatePanel7.Update();
        }
    }
Exemple #3
0
    private void QueryData(string v_store, string v_eff_date_from)
    {
        try
        {
            #region 將變數資料清空

            ds_Data.Tables.Clear();

            #endregion

            #region 門市帳務主檔
            STMModel.MaintainStoreAccount BCO = new STMModel.MaintainStoreAccount(ConnectionDB);

            DataTable Dt;
            ParameterList.Clear();

            for (int i = 0; i <= 47; i++)
            {
                if (i == 8)
                    ParameterList.Add(v_store);
                else if (i == 9 || i == 10)
                    ParameterList.Add((DateTime.Parse(v_eff_date_from)).ToString("yyyy/MM/dd"));
                else
                    ParameterList.Add(DBNull.Value);
            }

            //筆數為1
            ParameterList.Add(1);

            Dt = BCO.QuerySwitch(STMModel.MaintainStoreAccount.QueryType.QueryByLike, ParameterList);

            if (Dt == null || (Dt != null && Dt.Rows.Count <= 0))
            {
                ErrorMsgLabel.Text = "查無資料";
                return;
            }

            this.SLP_STORE.Text = Dt.Rows[0]["STORE"].ToString();
            this.SLP_EFF_DATE_FROM.Text = Dt.Rows[0].IsNull("EFF_DATE_FROM") ? "" : Convert.ToDateTime(Dt.Rows[0]["EFF_DATE_FROM"]).ToShortDateString();
            this.SLP_EFF_DATE_TO.Text = Dt.Rows[0].IsNull("EFF_DATE_TO") ? "" : Convert.ToDateTime(Dt.Rows[0]["EFF_DATE_TO"]).ToShortDateString();
            this.txtGROUP_NO.Text = Dt.Rows[0]["GROUP_NO"].ToString();
            this.txtSAL_ID.Text = Dt.Rows[0]["SAL_UID"].ToString();
            this.txtAC_UID.Text = Dt.Rows[0]["AC_UID"].ToString();
            this.txtPAY_RFNO.Text = Dt.Rows[0]["PAY_RFNO"].ToString();
            this.radSTORE_TYPE_HEAD.Checked = false;
            this.radSTORE_TYPE_STORE.Checked = false;
            if (Dt.Rows[0]["STORE_TYPE"].ToString() == "1")
                this.radSTORE_TYPE_HEAD.Checked = true;
            else
                this.radSTORE_TYPE_STORE.Checked = true;
            this.txtRFNO.Text = Dt.Rows[0]["RFNO"].ToString();
            this.txtTITLE.Text = Dt.Rows[0]["TITLE"].ToString();
            this.txtINV_ADDR.Text = Dt.Rows[0]["INV_ADDR"].ToString();
            this.txtPERSON.Text = Dt.Rows[0]["PERSON"].ToString();
            this.SLP_PROFIT_NO.Text = Dt.Rows[0]["PROFIT_NO"].ToString();
            this.SLP_FEET.Text = Dt.Rows[0]["FEET"].ToString();
            this.txtPAY_ACCOUNT.Text = Dt.Rows[0]["PAY_ACCOUNT"].ToString();
            this.radDEPOSIT_NO_HEAD.Checked = false;
            this.radDEPOSIT_NO_STORE.Checked = false;
            if (Dt.Rows[0]["DEPOSIT_NO"].ToString() == "1")
                this.radDEPOSIT_NO_HEAD.Checked = true;
            else
                this.radDEPOSIT_NO_STORE.Checked = true;
            this.ddlDEPOSIT_TYPE.SelectedValue = Dt.Rows[0]["DEPOSIT_TYPE"].ToString();
            this.SLP_DEPOSIT.Text = Dt.Rows[0]["DEPOSIT"].ToString();
            this.SLP_DEPOSIT_DATE_FROM.Text = Dt.Rows[0].IsNull("DEPOSIT_DATE_FROM") ? "" : Convert.ToDateTime(Dt.Rows[0]["DEPOSIT_DATE_FROM"]).ToShortDateString();
            this.SLP_DEPOSIT_DATE_TO.Text = Dt.Rows[0].IsNull("DEPOSIT_DATE_TO") ? "" : Convert.ToDateTime(Dt.Rows[0]["DEPOSIT_DATE_TO"]).ToShortDateString();
            this.SLP_DUIT_UNIT.Text = Dt.Rows[0]["DUTY_UNIT"].ToString();
            this.ddlPAYMENT_STORE.SelectedValue = Dt.Rows[0]["PAYMENT_STORE"].ToString();
            this.txtAC_NAME.Text = Dt.Rows[0]["AC_NAME"].ToString();
            this.txtINVOICE_MAILADD.Text = Dt.Rows[0]["INVOICE_MAIL_ADD"].ToString();
            this.SLP_INVOICE_SEND.Text = Dt.Rows[0]["INVOICE_SEND"].ToString();
            this.SLP_INVOICE_TYPE.Text = Dt.Rows[0]["INVOICE_TYPE"].ToString();
            this.ddlPAY_TYPE.SelectedValue = Dt.Rows[0]["PAY_TYPE"].ToString();
            this.SLP_CLS_DATE.Text = Dt.Rows[0]["CLS_DATE"].ToString();
            if (Dt.Rows[0]["ARMK"].ToString() == "1")
                this.txtARMK.Text = "已審核";
            else
                this.txtARMK.Text = "未審核";

            this.txtPID.Text = Dt.Rows[0]["ID"].ToString();

            if (this.txtARMK.Text == "已審核")
                btnPASS.Enabled = false;
            if (this.txtARMK.Text == "未審核")
                btnNOPASS.Enabled = false;

            #endregion

            #region 設定屬性
            STMModel.MaintainStoreAccount BCO_root = new STMModel.MaintainStoreAccount(ConnectionDB);

            DataTable Dt_root;

            ParameterList.Clear();
            ParameterList.Add(v_store);
            ParameterList.Add((DateTime.Parse(v_eff_date_from)).ToString("yyyy/MM/dd"));

            Dt_root = BCO_root.QuerySwitch(STMModel.MaintainStoreAccount.QueryType.ROOT, ParameterList);

            GridView1.DataSource = Dt_root;
            string SessionIDName_root = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value);
            Session[SessionIDName_root] = Dt_root;

            //設定分頁大小
            GridView1.PageIndex = 0;
            GridView1.DataBind();
            this.txtCount_Store.Text = GridView1.Rows.Count.ToString();

            #endregion

            #region 收款天數
            STMModel.MaintainStoreAccount BCO_Charge = new STMModel.MaintainStoreAccount(ConnectionDB);

            DataTable Dt_charge;
            ParameterList.Clear();

            ParameterList.Add(v_store);
            ParameterList.Add((DateTime.Parse(v_eff_date_from)).ToString("yyyy/MM/dd"));

            Dt_charge = BCO_Charge.QuerySwitch(STMModel.MaintainStoreAccount.QueryType.CHARGE, ParameterList);

            GridView2.DataSource = Dt_charge;
            string SessionIDName = string.Format("{0}_{1}", PAGE_DT_02, PageTimeStamp.Value);
            Session[SessionIDName] = Dt_charge;

            //設定分頁大小
            GridView2.PageIndex = 0;
            GridView2.DataBind();
            #endregion

            #region 店群折扣-商品大分類
            STMModel.MaintainStoreAccount BCO_Group1 = new STMModel.MaintainStoreAccount(ConnectionDB);

            DataTable Dt_Group1;
            ParameterList.Clear();

            ParameterList.Add(this.txtGROUP_NO.Text);

            Dt_Group1 = BCO_Group1.GetQueryGroupDiscountPMA(ParameterList);

            GridView3_1.DataSource = Dt_Group1;
            string SessionIDName3_1 = string.Format("{0}_{1}", PAGE_DT_031, PageTimeStamp.Value);
            Session[SessionIDName3_1] = Dt_Group1;

            //設定分頁大小
            GridView3_1.PageIndex = 0;
            GridView3_1.DataBind();
            #endregion

            #region 店群折扣-商品中分類
            STMModel.MaintainStoreAccount BCO_Group2 = new STMModel.MaintainStoreAccount(ConnectionDB);

            DataTable Dt_Group2;
            ParameterList.Clear();

            ParameterList.Add(this.txtGROUP_NO.Text);

            Dt_Group2 = BCO_Group2.GetQueryGroupDiscountCategory(ParameterList);

            GridView3_2.DataSource = Dt_Group2;
            string SessionIDName3_2 = string.Format("{0}_{1}", PAGE_DT_032, PageTimeStamp.Value);
            Session[SessionIDName3_2] = Dt_Group2;

            //設定分頁大小
            GridView3_2.PageIndex = 0;
            GridView3_2.DataBind();
            #endregion

            #region 店群折扣-商品
            STMModel.MaintainStoreAccount BCO_Group3 = new STMModel.MaintainStoreAccount(ConnectionDB);

            DataTable Dt_Group3;
            ParameterList.Clear();

            ParameterList.Add(this.txtGROUP_NO.Text);

            Dt_Group3 = BCO_Group3.GetQueryGroupDiscountItem(ParameterList);

            GridView3_3.DataSource = Dt_Group3;
            string SessionIDName3_3 = string.Format("{0}_{1}", PAGE_DT_033, PageTimeStamp.Value);
            Session[SessionIDName3_3] = Dt_Group3;

            //設定分頁大小
            GridView3_3.PageIndex = 0;
            GridView3_3.DataBind();
            #endregion

            #region 門市折扣-商品大分類
            STMModel.MaintainStoreAccount BCO_Store1 = new STMModel.MaintainStoreAccount(ConnectionDB);

            DataTable Dt_Store1;
            ParameterList.Clear();

            ParameterList.Add(v_store);

            Dt_Store1 = BCO_Store1.GetQueryStoreDiscountPMA(ParameterList);

            GridView4_1.DataSource = Dt_Store1;
            string SessionIDName4_1 = string.Format("{0}_{1}", PAGE_DT_041, PageTimeStamp.Value);
            Session[SessionIDName4_1] = Dt_Store1;

            //設定分頁大小
            GridView4_1.PageIndex = 0;
            GridView4_1.DataBind();
            #endregion

            #region 門市折扣-商品中分類
            STMModel.MaintainStoreAccount BCO_Store2 = new STMModel.MaintainStoreAccount(ConnectionDB);

            DataTable Dt_Store2;
            ParameterList.Clear();

            ParameterList.Add(v_store);

            Dt_Store2 = BCO_Store2.GetQueryStoreDiscountCategory(ParameterList);

            GridView4_2.DataSource = Dt_Store2;
            string SessionIDName4_2 = string.Format("{0}_{1}", PAGE_DT_042, PageTimeStamp.Value);
            Session[SessionIDName4_2] = Dt_Store2;

            //設定分頁大小
            GridView4_2.PageIndex = 0;
            GridView4_2.DataBind();
            #endregion

            #region 門市折扣-商品
            STMModel.MaintainStoreAccount BCO_Store3 = new STMModel.MaintainStoreAccount(ConnectionDB);

            DataTable Dt_Store3;
            ParameterList.Clear();

            ParameterList.Add(v_store);

            Dt_Store3 = BCO_Store3.GetQueryStoreDiscountItem(ParameterList);

            GridView4_3.DataSource = Dt_Store3;
            string SessionIDName4_3 = string.Format("{0}_{1}", PAGE_DT_043, PageTimeStamp.Value);
            Session[SessionIDName4_3] = Dt_Store3;

            //設定分頁大小
            GridView4_3.PageIndex = 0;
            GridView4_3.DataBind();
            #endregion

            if (Dt == null || (Dt != null && Dt.Rows.Count <= 0))
            {
                return;
            }

            #region 將資料寫入變數

            Dt.TableName = "VDS_STM_ACCOUNT_PROPERTY";
            Dt_root.TableName = "VDS_STM_ACCOUNT_ROOT";
            Dt_charge.TableName = "VDS_STM_ACCOUNT_CHARGE";

            ds_Data.Tables.Add(Dt.Copy());
            ds_Data.Tables.Add(Dt_root.Copy());
            ds_Data.Tables.Add(Dt_charge.Copy());

            //設定屬性
            DataSet ds_root = new DataSet();
            ds_root.Tables.Add(Dt_root.Copy());
            DataColumn[] keys_root = new DataColumn[3];
            keys_root[0] = ds_root.Tables[0].Columns["STORE"];
            keys_root[1] = ds_root.Tables[0].Columns["ROOT_NO"];
            keys_root[2] = ds_root.Tables[0].Columns["EFF_DATE_FROM"];

            ds_root.Tables[0].PrimaryKey = keys_root;
            Session["STM252_root" + PageTimeStamp.Value] = ds_root;

            //收款天數
            DataSet ds = new DataSet();
            ds.Tables.Add(Dt_charge.Copy());
            //DataColumn[] keys = new DataColumn[4];
            //keys[0] = ds.Tables[0].Columns["STORE"];
            //keys[1] = ds.Tables[0].Columns["EFF_DATE_FROM"];
            //keys[2] = ds.Tables[0].Columns["ROOT_NO"];
            // keys[3] = ds.Tables[0].Columns["PMA"];

            DataColumn[] keys = new DataColumn[1];
            keys[0] = ds.Tables[0].Columns["ID"];

            ds.Tables[0].PrimaryKey = keys;
            Session["STM252_" + PageTimeStamp.Value] = ds;

            #endregion

            //UpdatePanel12.Update();

        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0];  //直接取第一個
        }
        finally { }
    }
Exemple #4
0
    /// <summary>
    /// 繫結資料到控制項
    /// </summary>
    /// <param name="vdb"></param>
    private void databind()
    {
        #region

        //抓取本頁初次登記的時間

        string SessionIDName = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value);

        STMModel.MaintainStoreAccount BCO = new STMModel.MaintainStoreAccount(ConnectionDB);

        //門市帳務主檔
        ParameterList.Clear();
        ParameterList.Add(DBNull.Value); //N_ID
        ParameterList.Add(DBNull.Value); //V_CODE
        ParameterList.Add(GetValueSetParameter(this.SLP_CREATEDATE.StartDate, "string", CheckBoxLikeSearch.Checked)); //V_CREATEDATE_S
        ParameterList.Add(GetValueSetParameter(this.SLP_CREATEDATE.EndDate, "string", CheckBoxLikeSearch.Checked)); //V_CREATEDATE_E
        ParameterList.Add(GetValueSetParameter(this.SLP_CREATEUI.Text, "string", CheckBoxLikeSearch.Checked)); //V_CREATEUID
        ParameterList.Add(GetValueSetParameter(this.SLP_UPDATEDATE.StartDate, "string", CheckBoxLikeSearch.Checked)); //V_UPDATEDATE_S
        ParameterList.Add(GetValueSetParameter(this.SLP_UPDATEDATE.EndDate, "string", CheckBoxLikeSearch.Checked)); //V_UPDATEDATE_E
        ParameterList.Add(GetValueSetParameter(this.SLP_UPDATEUI.Text, "string", CheckBoxLikeSearch.Checked)); //V_UPDATEUID
        ParameterList.Add(GetValueSetParameter(this.SLP_STORE.Text, "string", CheckBoxLikeSearch.Checked)); //V_STORE
        ParameterList.Add(GetValueSetParameter(this.SLP_EFF_DATE_FROM.StartDate, "string", CheckBoxLikeSearch.Checked)); //V_EFF_DATE_FROM_S
        ParameterList.Add(GetValueSetParameter(this.SLP_EFF_DATE_FROM.EndDate, "string", CheckBoxLikeSearch.Checked)); //V_EFF_DATE_FROM_E
        ParameterList.Add(GetValueSetParameter(this.SLP_EFF_DATE_TO.StartDate, "string", CheckBoxLikeSearch.Checked)); //V_EFF_DATE_TO_S
        ParameterList.Add(GetValueSetParameter(this.SLP_EFF_DATE_TO.EndDate, "string", CheckBoxLikeSearch.Checked)); //V_EFF_DATE_TO_E
        ParameterList.Add(GetValueSetParameter(this.txtPAY_RFNO.Text, "string", CheckBoxLikeSearch.Checked)); //V_PAY_RFNO
        if (radSTORE_TYPE_ALL.Checked)
            ParameterList.Add(DBNull.Value); //V_STORE_TYPE
        if (radSTORE_TYPE_HEAD.Checked)
            ParameterList.Add("1"); //V_STORE_TYPE
        if (radSTORE_TYPE_STORE.Checked)
            ParameterList.Add("2"); //V_STORE_TYPE
        ParameterList.Add(GetValueSetParameter(this.txtRFNO.Text, "string", CheckBoxLikeSearch.Checked)); //V_RFNO
        ParameterList.Add(GetValueSetParameter(this.txtTITLE.Text, "string", CheckBoxLikeSearch.Checked)); //V_TITLE
        ParameterList.Add(GetValueSetParameter(this.txtINV_ADDR.Text, "string", CheckBoxLikeSearch.Checked)); //V_INV_ADDR
        ParameterList.Add(GetValueSetParameter(this.txtPERSON.Text, "string", CheckBoxLikeSearch.Checked)); //V_PERSON
        ParameterList.Add(GetValueSetParameter(this.SLP_PROFIT_NO.Text, "string", CheckBoxLikeSearch.Checked)); //V_PROFIT_NO
        ParameterList.Add(GetValueSetParameter(this.SLP_FEET.Text, "int", CheckBoxLikeSearch.Checked)); //N_FEET
        ParameterList.Add(GetValueSetParameter(this.txtPAY_ACCOUNT.Text, "string", CheckBoxLikeSearch.Checked)); //V_PAY_ACCOUNT
        if (this.radDEPOSIT_NO_ALL.Checked)
            ParameterList.Add(DBNull.Value);  //V_DEPOSIT_NO
        if (this.radDEPOSIT_NO_HEAD.Checked)
            ParameterList.Add("1");  //V_DEPOSIT_NO
        if (this.radDEPOSIT_NO_STORE.Checked)
            ParameterList.Add("2");  //V_DEPOSIT_NO
        ParameterList.Add(GetValueSetParameter(this.ddlDEPOSIT_TYPE.SelectedValue, "string", CheckBoxLikeSearch.Checked)); //N_DEPOSIT
        ParameterList.Add(GetValueSetParameter(this.SLP_DEPOSIT.Text, "int", CheckBoxLikeSearch.Checked)); //N_DEPOSIT
        ParameterList.Add(GetValueSetParameter(this.SLP_DEPOSIT_DATE_FROM.StartDate, "string", CheckBoxLikeSearch.Checked)); //V_DEPOSIT_DATE_FROM_S
        ParameterList.Add(GetValueSetParameter(this.SLP_DEPOSIT_DATE_FROM.EndDate, "string", CheckBoxLikeSearch.Checked)); //V_DEPOSIT_DATE_FROM_E
        ParameterList.Add(GetValueSetParameter(this.SLP_DEPOSIT_DATE_TO.StartDate, "string", CheckBoxLikeSearch.Checked)); //V_DEPOSIT_DATE_TO_S
        ParameterList.Add(GetValueSetParameter(this.SLP_DEPOSIT_DATE_TO.EndDate, "string", CheckBoxLikeSearch.Checked)); //V_DEPOSIT_DATE_TO_E
        ParameterList.Add(GetValueSetParameter(this.SLP_DUTY_UNIT.Text, "string", CheckBoxLikeSearch.Checked)); //V_DUTY_UNIT
        if (this.ddlPAYMENT_STORE.SelectedValue == "0")
            ParameterList.Add(DBNull.Value);
        else
            ParameterList.Add(GetValueSetParameter(this.ddlPAYMENT_STORE.SelectedValue, "string", CheckBoxLikeSearch.Checked)); //V_PAYMENT_STORE
        ParameterList.Add(GetValueSetParameter(this.txtAC_NAME.Text, "string", CheckBoxLikeSearch.Checked)); //V_AC_NAME
        ParameterList.Add(GetValueSetParameter(this.txtINVOICE_MAILADD.Text, "string", CheckBoxLikeSearch.Checked)); //V_INVOICE_MAIL_ADD
        ParameterList.Add(GetValueSetParameter(this.SLP_INVOICE_SEND.Text, "string", CheckBoxLikeSearch.Checked)); //V_INVOICE_SEND
        ParameterList.Add(GetValueSetParameter(this.SLP_INVOICE_TYPE.Text, "string", CheckBoxLikeSearch.Checked)); //V_INVOICE_TYPE

        if (this.ddlPAY_TYPE.SelectedValue == "0") //modify by jsy 2011.02.21 修正欄位對應
            ParameterList.Add(DBNull.Value);
        else
            //modify by jsy 2011.02.21 修正欄位對應
            ParameterList.Add(GetValueSetParameter(this.ddlPAY_TYPE.SelectedValue, "string", CheckBoxLikeSearch.Checked)); //V_PAY_TYPE
        ParameterList.Add(GetValueSetParameter(this.SLP_CLS_DATE.Text, "string", CheckBoxLikeSearch.Checked)); //V_CLS_DATE
        if (this.ddlARMK.SelectedValue == "2")
            ParameterList.Add(DBNull.Value);
        else
            ParameterList.Add(GetValueSetParameter(this.ddlARMK.SelectedValue, "int", CheckBoxLikeSearch.Checked)); //N_ARMK

        //設定屬性
        ParameterList.Add(GetValueSetParameter(this.SLP_ROOT_NO1.Text, "string", CheckBoxLikeSearch.Checked)); //V_ROOT_NO
        if (this.ddlHEAD_DOC.SelectedValue == "000")
            ParameterList.Add(DBNull.Value);
        else
            ParameterList.Add(GetValueSetParameter(this.ddlHEAD_DOC.SelectedValue, "string", CheckBoxLikeSearch.Checked)); //V_HEAD_DOC
        if (this.ddlSINGLE_DOC.SelectedValue == "000")
            ParameterList.Add(DBNull.Value);
        else
            ParameterList.Add(GetValueSetParameter(this.ddlSINGLE_DOC.SelectedValue, "string", CheckBoxLikeSearch.Checked)); //V_SINGLE_DOC
        if (this.ddlPAYMENT_TYPE.SelectedValue == "0")
            ParameterList.Add(DBNull.Value);
        else
            ParameterList.Add(GetValueSetParameter(this.ddlPAYMENT_TYPE.SelectedValue, "string", CheckBoxLikeSearch.Checked)); //V_PAYMENT_TYPE

        //收款天數
        ParameterList.Add(GetValueSetParameter(this.SLP_ROOT_NO2.Text, "string", CheckBoxLikeSearch.Checked)); //V_CHARGE_ROOT_NO
        ParameterList.Add(GetValueSetParameter(this.SLP_PMA.Text, "string", CheckBoxLikeSearch.Checked)); //V_CHARGE_PMA
        if (this.SLP_COL_DAYS.Text == "")
            ParameterList.Add(DBNull.Value);
        else
            ParameterList.Add(GetValueSetParameter(this.SLP_COL_DAYS.Text, "string", CheckBoxLikeSearch.Checked)); //V_CHARGE_COL_DAYS

        ParameterList.Add(GetValueSetParameter(this.SLP_GROUP_NO.Text, "string", CheckBoxLikeSearch.Checked)); //V_GROUP_NO
        ParameterList.Add(GetValueSetParameter(this.SLP_AC_UID.Text, "string", CheckBoxLikeSearch.Checked)); //V_AC_UID
        ParameterList.Add(GetValueSetParameter(this.SLP_SAL_ID.Text, "string", CheckBoxLikeSearch.Checked)); //V_SAL_ID
        ParameterList.Add(GetValueSetParameter(TextBoxRowCountLimit.Text,"int",false));


        DataTable Dt = BCO.QuerySwitch(STMModel.MaintainStoreAccount.QueryType.QueryByLike, ParameterList);
        Session[SessionIDName] = Dt;
        GridView1.DataSource = Dt;

        //設定分頁大小
        GridView1.PageSize = (TextBoxPagesize.Text == "") ? 10 : (int.Parse(TextBoxPagesize.Text) < 0) ? 10 : int.Parse(TextBoxPagesize.Text);
        GridView1.PageIndex = 0;
        GridView1.DataBind();

        LabelQueryRecordCount.Text = string.Format(" {0} Rows ", Dt.Rows.Count.ToString());

        if (Dt == null || (Dt != null && Dt.Rows.Count <= 0))
        {
            ErrorMsgLabel.Text = "查無資料";
        }

        #region 將Key值存到Session中

        ArrayList arl_Key = new ArrayList();

        foreach (DataRow drRow in Dt.Rows)
        { arl_Key.Add("store=" + drRow["STORE"].ToString() + "&eff_date_from=" + drRow["EFF_DATE_FROM"].ToString()); }

        Session["STM252_SortKey" + this.PageTimeStamp.Value] = arl_Key;

        #endregion

        #endregion
    }//databind