Beispiel #1
0
    private void QueryData(string v_store, string v_date)
    {
        try
        {
            #region 將變數資料清空

            ds_Data.Tables.Clear();

            //ds_Data.Clear();

            #endregion

            #region 門市基本、配送屬性
            STMModel.MaintainStoreBase BCO = new STMModel.MaintainStoreBase(ConnectionDB);

            DataTable Dt;
            ParameterList.Clear();

            ParameterList.Add(v_store);
            ParameterList.Add(DateTime.Parse(v_date.Trim()).ToString("yyyy/MM/dd"));
            ParameterList.Add(DateTime.Parse(v_date.Trim()).ToString("yyyy/MM/dd"));
            for (int i = 0; i <= 34; i++)
            {
                ParameterList.Add(null);
            }
            ParameterList.Add(">=");
            for (int i = 0; i <= 9; i++)
            {
                ParameterList.Add(null);
            }
            ParameterList.Add(">=");
            for (int i = 0; i <= 16; i++)
            {
                ParameterList.Add(null);
            }

            ParameterList.Add(null);

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

            if (Dt == null || (Dt != null && Dt.Rows.Count <= 0))
            {
                ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "ClientScript", "alert('查無資料');", true);
                return;
            }

            #region 取得畫面元件的值

            TextBox txt_TELAREA = (TextBox)this.SLP_TEL_NO.FindControl("T1");
            TextBox txt_TELNO = (TextBox)this.SLP_TEL_NO.FindControl("T2");
            TextBox txt_FAXAREA = (TextBox)this.SLP_FAX_NO.FindControl("T1");
            TextBox txt_FAXNO = (TextBox)this.SLP_FAX_NO.FindControl("T2");

            CheckBox rdo_DIS_SW = (CheckBox)this.SLP_DIS_SW.FindControl("C1");
            CheckBox rdo_MARKET_RESEARCH = (CheckBox)this.SLP_MARKET_RESEARCH.FindControl("C1");
            CheckBox rdo_SING_VEN = (CheckBox)this.SLP_SING_VEN.FindControl("C1");
            RadioButtonList rdo_MDC_TAXABLE = (RadioButtonList)this.SLP_MDC_TAXABLE.FindControl("R1");
            RadioButtonList rdo_MDC_TAXFREE = (RadioButtonList)this.SLP_MDC_TAXFREE.FindControl("R1");

            CheckBox chk_W1 = (CheckBox)this.SLP_Boolean1.FindControl("C1");
            CheckBox chk_W2 = (CheckBox)this.SLP_Boolean2.FindControl("C1");
            CheckBox chk_W3 = (CheckBox)this.SLP_Boolean3.FindControl("C1");
            CheckBox chk_W4 = (CheckBox)this.SLP_Boolean4.FindControl("C1");
            CheckBox chk_W5 = (CheckBox)this.SLP_Boolean5.FindControl("C1");
            CheckBox chk_W6 = (CheckBox)this.SLP_Boolean6.FindControl("C1");
            CheckBox chk_W7 = (CheckBox)this.SLP_Boolean7.FindControl("C1");

            #endregion

            this.txtSTORE.Text = Dt.Rows[0]["STORE"].ToString();
            this.txtSTORE_NAME.Text = Dt.Rows[0]["STORE_NAME"].ToString();
            this.SLP_MDC_START_DATE.Text = Dt.Rows[0]["MDC_START_DATE"].ToString();
            this.SLP_MDC_END_DATE.Text = Dt.Rows[0]["MDC_END_DATE"].ToString();
            this.SLP_CHAN_NO.Text = Dt.Rows[0]["CHAN_NO"].ToString();
            this.SLP_GROUP_NO.Text = Dt.Rows[0]["GROUP_NO"].ToString();
            this.txtOLD_STORE.Text = Dt.Rows[0]["OLD_STORE"].ToString();
            this.SLP_STORE_OPEN_DATE.Text = Dt.Rows[0]["STORE_OPEN_DATE"].ToString();
            this.SLP_STORE_CLOSE_DATE.Text = Dt.Rows[0]["STORE_CLOSE_DATE"].ToString();
            this.SLP_REOPEN_DATE.Text = Dt.Rows[0]["REOPEN_DATE"].ToString();
            this.SLP_REMODEL_DATE.Text = Dt.Rows[0]["REMODEL_DATE"].ToString();
            this.SLP_Z_O.Text = Dt.Rows[0]["Z_O"].ToString();
            this.SLP_D_O.Text = Dt.Rows[0]["D_O"].ToString();
            this.SLP_STORE_TYPE.Text = Dt.Rows[0]["STORE_TYPE"].ToString();
            this.txtSTORE_ZIP.Text = Dt.Rows[0]["STORE_ZIP"].ToString();
            txt_TELAREA.Text = Dt.Rows[0]["STORE_TEL_AREA"].ToString();
            txt_TELNO.Text = Dt.Rows[0]["STORE_TEL_NO"].ToString();
            txt_FAXAREA.Text = Dt.Rows[0]["STORE_FAX_AREA"].ToString();
            txt_FAXNO.Text = Dt.Rows[0]["STORE_FAX_NO"].ToString();
            this.txtSTORE_ADDRESS.Text = Dt.Rows[0]["STORE_ADDRESS"].ToString();
            this.txtVIRTUAL_FLAG.Text = Dt.Rows[0]["VIRTUAL_FLAG"].ToString();

            this.SLP_AREA_NO.Text = Dt.Rows[0]["AREA_NO"].ToString();
            this.SLP_AREA_CODE.Text = Dt.Rows[0]["AREA_CODE"].ToString();
            this.SLP_SHELVE_CM3.Text = Dt.Rows[0]["SHELVE_CM3"].ToString();
            if (Dt.Rows[0]["DIS_SW"].ToString() == "1")
                this.SLP_DIS_SW.Text = "1";
            //rdo_DIS_SW.Checked = true;
            else
                this.SLP_DIS_SW.Text = "0";
            //rdo_DIS_SW.Checked = false;
            this.SLP_ALLOCATION_TIMES.Text = Dt.Rows[0]["ALLOCATION_TIMES"].ToString();
            if (Dt.Rows[0]["MARKET_RESEARCH"].ToString() == "1")
                this.SLP_MARKET_RESEARCH.Text = "1";
            //rdo_MARKET_RESEARCH.Checked = true;
            else
                this.SLP_MARKET_RESEARCH.Text = "0";
            //rdo_MARKET_RESEARCH.Checked = false;
            this.SLP_AC_UID.Text = Dt.Rows[0]["AC_UID"].ToString();
            this.SLP_SAL_ID.Text = Dt.Rows[0]["SAL_ID"].ToString();
            this.SLP_FEAT_GRADE.Text = Dt.Rows[0]["FEAT_GRADE"].ToString();
            this.txtPAY_RFNO.Text = Dt.Rows[0]["PAY_RFNO"].ToString();
            if (Dt.Rows[0]["SING_VEN"].ToString() == "1")
                //rdo_SING_VEN.Checked = true;
                this.SLP_SING_VEN.Text = "1";
            else
                //rdo_SING_VEN.Checked = false;
                this.SLP_SING_VEN.Text = "0";
            MDC_TAXABLE_ID = Dt.Rows[0]["MDC_TAXABLE"].ToString();
            MDC_TAXFREE_ID = Dt.Rows[0]["MDC_TAXFREE"].ToString();
            SLP_CREATE_DATE.Text = Dt.Rows[0]["CREATEDATE"].ToString();
            SLP_CREATE_UID.Text = Dt.Rows[0]["CREATEUID"].ToString();
            SLP_UPDATE_DATE.Text = Dt.Rows[0]["UPDATEDATE"].ToString();
            SLP_UPDATE_UID.Text = Dt.Rows[0]["UPDATEUID"].ToString();
            txtEFF_DATE_TO.Text = Dt.Rows[0].IsNull("EFF_DATE_TO") ? "" : Convert.ToDateTime(Dt.Rows[0]["EFF_DATE_TO"]).ToShortDateString();
            #endregion

            #region 屬性
            STMModel.MaintainStoreProperty BCO_Property = new STMModel.MaintainStoreProperty(ConnectionDB);

            DataTable Dt_Property;
            ParameterList.Clear();

            ParameterList.Add(v_store);

            Dt_Property = BCO_Property.QuerySwitch(STMModel.MaintainStoreProperty.QueryType.CODE, ParameterList);

            if (Dt_Property != null && Dt_Property.Rows.Count > 0)
            {
                this.txtCOPY_SOURCE.Text = Dt_Property.Rows[0]["COPY_SOURCE"].ToString();
                this.SLP_PSM.Text = Dt_Property.Rows[0]["PSM"].ToString();
                this.SLP_BUSINESS_NO.Text = Dt_Property.Rows[0]["BUSINESS_NO"].ToString();
                this.SLP_OPEN_TIME.Text = Dt_Property.Rows[0]["OPEN_TIME"].ToString();
                this.SLP_CLOSE_TIME.Text = Dt_Property.Rows[0]["CLOSE_TIME"].ToString();
                this.SLP_COMPETITION.Text = Dt_Property.Rows[0]["COMPETITION"].ToString();
                this.SLP_REMARK.Text = Dt_Property.Rows[0]["REMARK"].ToString();
                this.SLP_STORE_SPE.Text = Dt_Property.Rows[0]["STORE_SPE"].ToString();
                if (Dt_Property.Rows[0]["BUSINESS_W1"].ToString() == "1")
                    this.SLP_Boolean1.Text = "1";
                //chk_W1.Checked = true;
                else
                    //chk_W1.Checked = false;
                    this.SLP_Boolean1.Text = "0";
                if (Dt_Property.Rows[0]["BUSINESS_W2"].ToString() == "1")
                    this.SLP_Boolean2.Text = "1";
                //chk_W2.Checked = true;
                else
                    this.SLP_Boolean2.Text = "0";
                //chk_W2.Checked = false;
                if (Dt_Property.Rows[0]["BUSINESS_W3"].ToString() == "1")
                    this.SLP_Boolean3.Text = "1";
                // chk_W3.Checked = true;
                else
                    this.SLP_Boolean3.Text = "0";
                //chk_W3.Checked = false;
                if (Dt_Property.Rows[0]["BUSINESS_W4"].ToString() == "1")
                    this.SLP_Boolean4.Text = "1";
                //chk_W4.Checked = true;
                else
                    this.SLP_Boolean4.Text = "0";
                //chk_W4.Checked = false;
                if (Dt_Property.Rows[0]["BUSINESS_W5"].ToString() == "1")
                    this.SLP_Boolean5.Text = "1";
                //chk_W5.Checked = true;
                else
                    this.SLP_Boolean5.Text = "0";
                //chk_W5.Checked = false;
                if (Dt_Property.Rows[0]["BUSINESS_W6"].ToString() == "1")
                    this.SLP_Boolean6.Text = "1";
                //chk_W6.Checked = true;
                else
                    this.SLP_Boolean6.Text = "0";
                //chk_W6.Checked = false;
                if (Dt_Property.Rows[0]["BUSINESS_W7"].ToString() == "1")
                    this.SLP_Boolean7.Text = "1";
                // chk_W7.Checked = true;
                else
                    this.SLP_Boolean7.Text = "0";
                //chk_W7.Checked = false;          
            }

            #endregion

            #region 貨架設置
            STMModel.MaintainStoreShelf BCO_Shelf = new STMModel.MaintainStoreShelf(ConnectionDB);

            DataTable Dt_Shelf;
            ParameterList.Clear();

            ParameterList.Add(v_store);

            Dt_Shelf = BCO_Shelf.QuerySwitch(STMModel.MaintainStoreShelf.QueryType.STORE, ParameterList);

            GridView1.DataSource = Dt_Shelf;

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

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

            #endregion

            #region 路線、路順、到店時間
            STMModel.MaintainStoreBase STM = new STMModel.MaintainStoreBase(ConntionDB);

            ParameterList.Clear();
            ParameterList.Add(SLP_CHAN_NO.Text.Trim());//通路
            ParameterList.Add(txtSTORE.Text.Trim());//門市

            DataTable dt = STM.GetRouteInfo(ParameterList);
            if (dt.Rows.Count == 1)
            {
                SLP_ROUTE_ID.Text = dt.Rows[0]["ROUTE"].ToString();
                SLP_ROUTE_STEP.Text = dt.Rows[0]["STEP"].ToString();
                SLP_ROUTE_ARRIVE_TIME.Text = dt.Rows[0]["ARRIVE_TIME"].ToString();
            }
            #endregion

            #region 取得審核狀態
            lblARMK.Text = Dt.Rows[0]["STORE_ARMK"].ToString();
            #endregion

            #region 將資料寫入變數

            Dt.TableName = "VDS_STM_STORE";
            Dt_Property.TableName = "VDS_STM_STORE_PROPERTY";
            Dt_Shelf.TableName = "VDS_STM_STORE_SHELF";

            ds_Data.Tables.Add(Dt.Copy());
            ds_Data.Tables.Add(Dt_Property.Copy());
            ds_Data.Tables.Add(Dt_Shelf.Copy());

            DataSet ds = new DataSet();
            ds.Tables.Add(Dt_Shelf.Copy());
            DataColumn[] keys = new DataColumn[2];
            keys[0] = ds.Tables[0].Columns["STORE"];
            keys[1] = ds.Tables[0].Columns["SHELF_NO"];
            ds.Tables[0].PrimaryKey = keys;
            Session["STM012_" + PageTimeStamp.Value] = ds;
            Session["Report_" + PageTimeStamp.Value] = ds.Tables["VDS_STM_STORE"];
            #endregion

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

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

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

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

        ParameterList.Clear();

        //門市基本31
        TextBox txt_TELAREA = (TextBox)this.SLP_TEL_NO.FindControl("T1");
        TextBox txt_TELNO = (TextBox)this.SLP_TEL_NO.FindControl("T2");
        TextBox txt_FAXAREA = (TextBox)this.SLP_FAX_NO.FindControl("T1");
        TextBox txt_FAXNO = (TextBox)this.SLP_FAX_NO.FindControl("T2");

        ParameterList.Add(GetValueSetParameter(this.SLP_STORE.Text.Trim(),"string",CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.SLP_MDC_START_DATE.StartDate,"string",CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.SLP_MDC_START_DATE.EndDate,"string",CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.SLP_MDC_END_DATE.StartDate, "string", CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.SLP_MDC_END_DATE.EndDate, "string", CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.SLP_CHAN_NO.Text,"string",CheckBoxLikeSearch.Checked));;
        ParameterList.Add(GetValueSetParameter(this.SLP_GROUP_NO.Text,"string",CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.txtOLD_STORE.Text, "string", CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.SLP_STORE_OPEN_DATE.StartDate,"string",CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.SLP_STORE_OPEN_DATE.EndDate,"string",CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.SLP_STORE_CLOSE_DATE.StartDate,"string",CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.SLP_STORE_CLOSE_DATE.EndDate,"string",CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.SLP_REOPEN_DATE.StartDate,"string",CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.SLP_REOPEN_DATE.EndDate,"string",CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.SLP_REMODEL_DATE.StartDate,"string",CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.SLP_REMODEL_DATE.EndDate,"string",CheckBoxLikeSearch.Checked));      
        ParameterList.Add(GetValueSetParameter(this.SLP_Z_O.Text,"string",CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.SLP_D_O.Text,"string",CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.SLP_STORE_TYPE.Text,"string",CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.txtSTORE_ZIP.Text,"string",CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(txt_TELAREA.Text,"string",CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(txt_TELNO.Text,"string",CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(txt_FAXAREA.Text,"string",CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(txt_FAXNO.Text,"string",CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.txtSTORE_ADDRESS.Text,"string",CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.SLP_CREATE_DATE.StartDate,"string",CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.SLP_CREATE_DATE.EndDate,"string",CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.SLP_CREATE_UID.Text,"string",CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.SLP_UPDATE_DATE.StartDate,"string",CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.SLP_UPDATE_DATE.EndDate, "string", CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.SLP_UPDATE_UID.Text, "string", CheckBoxLikeSearch.Checked));
        
        //配送屬性17
        RadioButtonList rdo_DIS_SW = (RadioButtonList)this.SLP_DIS_SW.FindControl("R1");
        RadioButtonList rdo_MARKET_RESEARCH = (RadioButtonList)this.SLP_MARKET_RESEARCH.FindControl("R1");
        RadioButtonList rdo_SING_VEN = (RadioButtonList)this.SLP_SING_VEN.FindControl("R1");
        RadioButtonList rdo_MDC_TAXABLE = (RadioButtonList)this.SLP_MDC_TAXABLE.FindControl("R1");
        RadioButtonList rdo_MDC_TAXFREE = (RadioButtonList)this.SLP_MDC_TAXFREE.FindControl("R1");

        ParameterList.Add(GetValueSetParameter(this.SLP_AREA_NO.Text, "string", CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.SLP_AREA_CODE.Text, "string", CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.SLP_SHELVE_CM3.Text, "int", CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.SLP_ROUTE.Text, "string", CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.txtSTEP.Text, "string", CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.txtARRIVE_TIME.Text, "string", CheckBoxLikeSearch.Checked));

        if (rdo_DIS_SW.SelectedValue == "")
            ParameterList.Add(DBNull.Value);
        if (rdo_DIS_SW.SelectedValue == "1")
            ParameterList.Add(1);
        if (rdo_DIS_SW.SelectedValue == "0")
            ParameterList.Add(0);

        ParameterList.Add(this.ddlALLOCATION_TIMES.Text);
        ParameterList.Add(GetValueSetParameter(this.SLP_ALLOCATION_TIMES.Text, "int", CheckBoxLikeSearch.Checked));

        if (rdo_MARKET_RESEARCH.SelectedValue == "")
            ParameterList.Add(DBNull.Value);
        if (rdo_MARKET_RESEARCH.SelectedValue == "1")
            ParameterList.Add(1);
        if (rdo_MARKET_RESEARCH.SelectedValue == "0")
            ParameterList.Add(0);

        ParameterList.Add(GetValueSetParameter(this.SLP_AC_UID.Text, "string", CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.SLP_SAL_ID.Text, "string", CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.SLP_FEAT_GRADE.Text, "string", CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.txtPAY_RFNO.Text, "string", CheckBoxLikeSearch.Checked));

        if (rdo_SING_VEN.SelectedValue == "")
            ParameterList.Add(DBNull.Value);
        if (rdo_SING_VEN.SelectedValue == "1")
            ParameterList.Add(1);
        if (rdo_SING_VEN.SelectedValue == "0")
            ParameterList.Add(0);

        if (rdo_MDC_TAXABLE.SelectedValue == "")
            ParameterList.Add(DBNull.Value);
        if (rdo_MDC_TAXABLE.SelectedValue == "1")
            ParameterList.Add(1);
        if (rdo_MDC_TAXABLE.SelectedValue == "0")
            ParameterList.Add(0);
        
        if (rdo_MDC_TAXFREE.SelectedValue == "")
            ParameterList.Add(DBNull.Value);
        if (rdo_MDC_TAXFREE.SelectedValue == "1")
            ParameterList.Add(1);
        if (rdo_MDC_TAXFREE.SelectedValue == "0")
            ParameterList.Add(0);

        //屬性19
        CheckBox chk_W1 = (CheckBox)this.SLP_Boolean_W1.FindControl("C1");
        CheckBox chk_W2 = (CheckBox)this.SLP_Boolean_W2.FindControl("C1");
        CheckBox chk_W3 = (CheckBox)this.SLP_Boolean_W3.FindControl("C1");
        CheckBox chk_W4 = (CheckBox)this.SLP_Boolean_W4.FindControl("C1");
        CheckBox chk_W5 = (CheckBox)this.SLP_Boolean_W5.FindControl("C1");
        CheckBox chk_W6 = (CheckBox)this.SLP_Boolean_W6.FindControl("C1");
        CheckBox chk_W7 = (CheckBox)this.SLP_Boolean_W7.FindControl("C1");

        ParameterList.Add(GetValueSetParameter(this.txtCOPY_SOURCE.Text, "string", CheckBoxLikeSearch.Checked));
        ParameterList.Add(this.ddlPSM.Text);
        ParameterList.Add(GetValueSetParameter(this.SLP_PSM.Text, "int", CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.SLP_BUSINESS_NO.Text, "string", CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.SLP_OPEN_TIME.Text, "string", CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.SLP_CLOSE_TIME.Text, "string", CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.SLP_COMPETITION.Text, "string", CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.SLP_REMARK.Text, "string", CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.SLP_STORE_SPE.Text, "string", CheckBoxLikeSearch.Checked));
        ParameterList.Add(chk_W1.Checked ? "1" : null);
        ParameterList.Add(chk_W2.Checked ? "1" : null);
        ParameterList.Add(chk_W3.Checked ? "1" : null);
        ParameterList.Add(chk_W4.Checked ? "1" : null);
        ParameterList.Add(chk_W5.Checked ? "1" : null);
        ParameterList.Add(chk_W6.Checked ? "1" : null);
        ParameterList.Add(chk_W7.Checked ? "1" : null);
        ParameterList.Add(GetValueSetParameter(this.SLP_SHELF_NO.Text, "string", CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.SLP_DISPLAY_NUM.Text, "int", CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.SLP_SHELVE_CM3_2.Text, "int", CheckBoxLikeSearch.Checked));

        ParameterList.Add(GetValueSetParameter(this.txtStoreName.Text, "string", CheckBoxLikeSearch.Checked)); //2010/06/14新增店名查詢欄位

        if (strFLAG != "EXCEL")
        {
            DataTable Dt = BCO.QuerySwitch(STMModel.MaintainStoreBase.QueryType.QueryByLike, ParameterList);
            int iRowCount = (this.TextBoxRowCountLimit.Text.Trim() == string.Empty) ? 9999 : int.Parse(TextBoxRowCountLimit.Text);
            while (Dt.Rows.Count > iRowCount)
            {
                DataRow dr = Dt.Rows[Dt.Rows.Count - 1];
                dr.Delete();
                Dt.AcceptChanges();
            }
            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))
            {
                ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "ClientScript", "alert('查無資料');", true);
            }

            #region 將Key值存到Session中

            ArrayList arl_Key = new ArrayList();

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

            Session["STM012_SortKey" + this.PageTimeStamp.Value] = arl_Key;
        }
        else
        {
            DataTable Dt1 = BCO.QuerySwitch(STMModel.MaintainStoreBase.QueryType.Excel, ParameterList);
            int iRowCount = (this.TextBoxRowCountLimit.Text.Trim() == string.Empty) ? 9999 : int.Parse(TextBoxRowCountLimit.Text);
            while (Dt1.Rows.Count > iRowCount)
            {
                DataRow dr = Dt1.Rows[Dt1.Rows.Count - 1];
                dr.Delete();
                Dt1.AcceptChanges();
            }

            for (int j = 0; j < Dt1.Rows.Count; j++)
            {
                LogHelper LOG = new LogHelper(ConnectionDB);
                ParameterList.Clear();
                ParameterList.Add("STM01門市主檔");//0
                ParameterList.Add(Session["UID"].ToString());//1
                ParameterList.Add("O");//2
                ParameterList.Add(Dt1.Rows[j]["STORE"].ToString());//3
                ParameterList.Add(Request.ServerVariables["Server_Name"]);//4

                LOG.AddSafeLog(ParameterList);
            }

                Session[SessionIDName] = Dt1;
        }

        #endregion

        #endregion
    }//databind
Beispiel #3
0
    /// <summary>
    /// 列印鈕

    /// </summary>
    protected void btnStorePrint_Click(object sender, EventArgs e)
    {
        if (VerifyFormData() == true)
        {
            try
            {
                STMModel.MaintainStoreBase BCO = new STMModel.MaintainStoreBase(ConnectionDB);

                DataTable Dt;
                ParameterList.Clear();

                ParameterList.Add(GetValueSetParameter(this.txtSTORE.Text.Trim(), "string", false));
                ParameterList.Add(GetValueSetParameter(DateTime.Parse(this.SLP_MDC_START_DATE.Text).ToString("yyyy/MM/dd"), "string", false));
                ParameterList.Add(GetValueSetParameter(DateTime.Parse(this.SLP_MDC_START_DATE.Text).ToString("yyyy/MM/dd"), "string", false));

                for (int i = 0; i <= 34; i++)
                {
                    ParameterList.Add(null);
                }
                ParameterList.Add(">=");
                for (int i = 0; i <= 9; i++)
                {
                    ParameterList.Add(null);
                }
                ParameterList.Add(">=");
                for (int i = 0; i <= 16; i++)
                {
                    ParameterList.Add(null);
                }

                ParameterList.Add(null);

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

                if (Dt.Rows.Count == 0)
                {
                    ScriptManager.RegisterStartupScript(Page, this.GetType(), "STM012.aspx", "alert(' 查無資料 ');", true);

                    return;
                }
                ShowReport(Dt);
            }
            catch (Exception ex)
            {
                ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0];  //直接取第一個
            }
            finally { }
        }
    }