Ejemplo n.º 1
0
    protected void btnExport_Click(object sender, EventArgs e)
    {
        try
        {
            #region 檢查條件
            this.ErrorMsgLabel.Text = "";
            string s_CheckPage = CheckPage(sender);

            if (s_CheckPage != string.Empty)
            {
                this.ErrorMsgLabel.Text = s_CheckPage;
                return;
            }

            #endregion

            #region 傳入參數

            ParameterList.Clear();
            ParameterList.Add(GetValueSetParameter(this.SLP_StoreGroup_B.Text.Trim(), "string", false)); //0
            ParameterList.Add(GetValueSetParameter(this.SLP_StoreGroup_E.Text.Trim(), "string", false)); //1
            ParameterList.Add(GetValueSetParameter(this.SLP_EFF_START.StartDate.ToString(), "date", false));//2
            ParameterList.Add(GetValueSetParameter(this.SLP_EFF_START.EndDate.ToString(), "date", false));//3
            ParameterList.Add(GetValueSetParameter(this.SLP_EFF_END.StartDate.ToString(), "date", false));//4
            ParameterList.Add(GetValueSetParameter(this.SLP_EFF_END.EndDate.ToString(), "date", false));//5
            if (this.ddlDISCOUNT_KIND.SelectedValue == "0") //6
                ParameterList.Add(GetValueSetParameter("", "int", false));
            else
                ParameterList.Add(GetValueSetParameter(this.ddlDISCOUNT_KIND.SelectedValue, "int", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_RootNo1.Text.Trim(), "string", false)); //7
            ParameterList.Add(GetValueSetParameter(this.SLP_PMA_B.Text.Trim(), "string", false)); //8
            ParameterList.Add(GetValueSetParameter(this.SLP_PMA_E.Text.Trim(), "string", false)); //9
            ParameterList.Add(GetValueSetParameter(this.SLP_Category_B.Text.Trim(), "string", false)); //10
            ParameterList.Add(GetValueSetParameter(this.SLP_Category_E.Text.Trim(), "string", false)); //11
            ParameterList.Add(GetValueSetParameter(this.SLP_SKU_B.Text.Trim(), "string", false)); //12
            ParameterList.Add(GetValueSetParameter(this.SLP_SKU_E.Text.Trim(), "string", false)); //13
            ParameterList.Add(GetValueSetParameter(this.SLP_ItemPeriod_B.Text.Trim(), "string", false)); //14
            ParameterList.Add(GetValueSetParameter(this.SLP_ItemPeriod_E.Text.Trim(), "string", false)); //15
            if (SLP_SLPNumber_PRICE_DIS.Text.Trim() == "") //16
            {
                ParameterList.Add(GetValueSetParameter(SLP_SLPNumber_PRICE_DIS.Text.Trim(), "Decimal", false));
            }
            else
            {
                ParameterList.Add(GetValueSetParameter(Convert.ToString(Convert.ToDecimal(this.SLP_SLPNumber_PRICE_DIS.Text.Trim()) / 100), "Decimal", false));
            }
            ParameterList.Add(GetValueSetParameter(this.SLP_SLPNumber_FIX_DIS.Text.Trim(), "Decimal", false)); //17
            if (this.rdoCONFIRM1.Checked) //18
                ParameterList.Add(GetValueSetParameter("", "int", false));
            else if (this.rdoCONFIRM2.Checked)
                ParameterList.Add(GetValueSetParameter("1", "int", false));
            else
                ParameterList.Add(GetValueSetParameter("0", "int", false));

            ParameterList.Add(GetValueSetParameter(this.SLP_SLPDate_CREATE_S.Text.Trim(), "date", false)); //19
            ParameterList.Add(GetValueSetParameter(this.SLP_SLPDate_CREATE_E.Text.Trim(), "date", false)); //20
            ParameterList.Add(GetValueSetParameter(this.SLP_User_CREATE.Text.Trim(), "string", false)); //21
            ParameterList.Add(GetValueSetParameter(this.SLP_SLPDate_UPDATE_S.Text.Trim(), "date", false)); //22
            ParameterList.Add(GetValueSetParameter(this.SLP_SLPDate_UPDATE_E.Text.Trim(), "date", false)); //23
            ParameterList.Add(GetValueSetParameter(this.SLP_User_UPDATE.Text.Trim(), "string", false)); //24
            ParameterList.Add(GetValueSetParameter(TextBoxRowCountLimit.Text.Trim(), "Decimal", false)); //25
            ParameterList.Add(GetValueSetParameter(this.txtItemPeriod_END_B.Text.Trim(), "string", false)); //26
            ParameterList.Add(GetValueSetParameter(this.txtItemPeriod_END_E.Text.Trim(), "string", false)); //27

            #endregion

            #region 取得資料

            DataTable dt_Return = new DataTable();

            BCO.MaintainStoreGroupDiscount bco = new BCO.MaintainStoreGroupDiscount(ConnectionDB);
            dt_Return = bco.QueryStoreGroupDiscount(ParameterList);

            #endregion

            if (dt_Return.Rows.Count > 0)
            {
                Export_Excel(dt_Return);
            }
            else
            {
                this.ErrorMsgLabel.Text = "查無資料";
            }

        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message;
        }

    }
Ejemplo n.º 2
0
    }//ButtonNew_Click

    protected void ButtonQuery_Click(object sender, EventArgs e)
    {
        #region
        try
        {
            #region 檢查條件
            this.ErrorMsgLabel.Text = "";
            string s_CheckPage = CheckPage(sender);

            if (s_CheckPage != string.Empty)
            {
                this.ErrorMsgLabel.Text = s_CheckPage;
                return;
            }

            #endregion

            #region 傳入參數
            
            ParameterList.Clear();
            ParameterList.Add(GetValueSetParameter(this.SLP_StoreGroup_B.Text.Trim(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_StoreGroup_E.Text.Trim(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_EFF_START.StartDate.ToString(), "date", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_EFF_START.EndDate.ToString(), "date", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_EFF_END.StartDate.ToString(), "date", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_EFF_END.EndDate.ToString(), "date", false));
            if (this.ddlDISCOUNT_KIND.SelectedValue=="0")
                ParameterList.Add(GetValueSetParameter("", "int", false));
            else
                ParameterList.Add(GetValueSetParameter(this.ddlDISCOUNT_KIND.SelectedValue, "int", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_RootNo1.Text.Trim(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_PMA_B.Text.Trim(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_PMA_E.Text.Trim(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_Category_B.Text.Trim(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_Category_E.Text.Trim(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_SKU_B.Text.Trim(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_SKU_E.Text.Trim(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_ItemPeriod_B.Text.Trim(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_ItemPeriod_E.Text.Trim(), "string", false));
            if (SLP_SLPNumber_PRICE_DIS.Text.Trim() == "")
            {
                ParameterList.Add(GetValueSetParameter(SLP_SLPNumber_PRICE_DIS.Text.Trim(), "Decimal", false));
            }
            else
            {
                ParameterList.Add(GetValueSetParameter(Convert.ToString(Convert.ToDecimal(this.SLP_SLPNumber_PRICE_DIS.Text.Trim()) / 100), "Decimal", false));
            }
            ParameterList.Add(GetValueSetParameter(this.SLP_SLPNumber_FIX_DIS.Text.Trim(), "Decimal", false));
            if (this.rdoCONFIRM1.Checked)
                ParameterList.Add(GetValueSetParameter("", "int", false));
            else if (this.rdoCONFIRM2.Checked)
                ParameterList.Add(GetValueSetParameter("1", "int", false));
            else 
                ParameterList.Add(GetValueSetParameter("0", "int", false));

            ParameterList.Add(GetValueSetParameter(this.SLP_SLPDate_CREATE_S.Text.Trim(), "date", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_SLPDate_CREATE_E.Text.Trim(), "date", false)); 
            ParameterList.Add(GetValueSetParameter(this.SLP_User_CREATE.Text.Trim(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_SLPDate_UPDATE_S.Text.Trim(), "date", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_SLPDate_UPDATE_E.Text.Trim(), "date", false));                      
            ParameterList.Add(GetValueSetParameter(this.SLP_User_UPDATE.Text.Trim(), "string", false));
            ParameterList.Add(GetValueSetParameter(TextBoxRowCountLimit.Text.Trim(), "Decimal", false));
            ParameterList.Add(GetValueSetParameter(this.txtItemPeriod_END_B.Text.Trim(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.txtItemPeriod_END_E.Text.Trim(), "string", false));
            
            #endregion

            #region 取得資料

            DataTable dt_Return = new DataTable();

            BCO.MaintainStoreGroupDiscount bco = new BCO.MaintainStoreGroupDiscount(ConnectionDB);
            dt_Return = bco.QueryStoreGroupDiscount(ParameterList);

            #endregion

            #region 資料與GridView繫結

            //抓取本頁初次登記的時間
            if (dt_Return.Rows.Count == 0)
            {
                this.GridView1.Visible = false;
                ErrorMsgLabel.Text = "查無資料!";

            }
            else
            {
                string SessionIDName = "STM181_gv_ItemInfo" + PageTimeStamp.Value;

                this.GridView1.Visible = true;
                Session["SessionID"] = SessionIDName;
                Session[SessionIDName] = dt_Return;
                this.GridView1.DataSource = dt_Return;
                if (this.TextBoxPagesize.Text == "")
                    this.GridView1.PageSize = 10;
                else
                    this.GridView1.PageSize = Convert.ToInt32(this.TextBoxPagesize.Text);
                this.GridView1.PageIndex = 0;
                this.GridView1.DataBind();
            }

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