Ejemplo n.º 1
0
    private void DataBind_SG(ArrayList ParameterList)
    {
        ErrorMsgLabel_SG.Text = "";


        #region 連結資料庫

        BCO.STM35_BCO bco = new BCO.STM35_BCO(ConntionDB);
        DataTable dt_PRICE_SG = bco.QueryDataPrice_SG(ParameterList);

        #endregion

        if (!dt_PRICE_SG.Columns.Contains("CHECKED"))//增加欄位以方便判別是否可
            dt_PRICE_SG.Columns.Add("CHECKED");

        if (!dt_PRICE_SG.Columns.Contains("ROWID"))//增加欄位以判別勾選與否
            dt_PRICE_SG.Columns.Add("ROWID");

        hidden_RowID_MaxID_G.Value = dt_PRICE_SG == null ? "-1" : (dt_PRICE_SG.Rows.Count - 1).ToString();//記錄最大ROWID
        hidden_RowID_Selected_G.Value = "";//清空已選
        SetRowIDToDataTable(dt_PRICE_SG, false, "SG");//設定ROWID


        //抓取本頁初次登記的時間
        string SessionIDName_SG = "STM352_SG_" + PageTimeStamp.Value;

        //Session["SessionID"] = SessionIDName;
        Session[SessionIDName_SG] = dt_PRICE_SG;

        bAfterQueryDataBinding = true;

        this.GridView2.DataSource = dt_PRICE_SG;
        this.GridView2.PageSize = (TextBoxPagesize1.Text == "") ? 10 : (int.Parse(TextBoxPagesize1.Text) < 0) ? 10 : int.Parse(TextBoxPagesize1.Text);
        this.GridView2.PageIndex = 0;
        this.GridView2.DataBind();
 
        bAfterQueryDataBinding = false;

        if (dt_PRICE_SG.Rows.Count == 0)
        {
            SG_hid.Visible = false;
            SG_hid1.Visible = false;
            ErrorMsgLabel_SG.Text = "查無資料!";
        }

        UpdatePanel4.Update();

    }
Ejemplo n.º 2
0
    /// <summary>
    /// BUTTON [審核通過]鈕(店群)
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnPASS_SG_Click(object sender, EventArgs e)
    {
        try
        {

            DataTable dt = GetCheckData("SG");
            if (dt.Rows.Count == 0)
            {
                ScriptManager.RegisterStartupScript(this.UpdatePanel4, typeof(UpdatePanel), "STM35", "alert('尚未勾選任何資料');", true);
                return;
            }

            #region 連結資料庫

            BCO.STM35_BCO bco = new BCO.STM35_BCO(ConntionDB);
            #endregion

            for (int i = 0; i < dt.Rows.Count; i++)
            {

                ArrayList arl = new ArrayList();
                arl.Add(Convert.ToInt32(dt.Rows[i]["ID"]));
                arl.Add(Session["UID"].ToString());

                string str_Resault = bco.UpdateComfirmPrice_SG(arl, null);

                if (str_Resault=="1")
                {
                    ScriptManager.RegisterStartupScript(this.UpdatePanel4, typeof(UpdatePanel), "STM35", "alert('審核處理失敗');", true);
                    return;
                }

            }

            ArrayList arl_Key = new ArrayList();
            string s_Request_Key = Request.QueryString["STM352_PageTimeStamp"];
            arl_Key = ((ArrayList)Session["STM352_SearchKey" + s_Request_Key]);

            ParameterList.Clear();
            ParameterList.Add(Request["ITEM"].ToString());//[品號]

            for (int i = 0; i < 7; i++)
            {
                if (arl_Key[i].ToString() == string.Empty)
                {
                    ParameterList.Add(DBNull.Value);
                }
                else
                {
                    ParameterList.Add(arl_Key[i]);
                }
            }

            ParameterList.Add(TextBoxRowCountLimit1.Text);


            DataBind_SG(ParameterList);

        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message;
        }
        finally { Finally_Function(); }
    }
Ejemplo n.º 3
0
    /// <summary>
    /// 取得頁面上的資料
    /// </summary>
    /// <param name="s_ITEM">品號</param>
    private void Get_PageDataMainAndDetl(string s_ITEM)
    {
        #region 傳入參數

        BCO.STMCommon STMComm = new BCO.STMCommon();

        ArrayList arl_Key = new ArrayList();
        string s_Request_Key = Request.QueryString["STM352_PageTimeStamp"];
        arl_Key = ((ArrayList)Session["STM352_SearchKey" + s_Request_Key]);

        ParameterList.Clear();
        ParameterList.Add(GetValueSetParameter(s_ITEM, "string", false));//[品號]

        for (int i = 0; i < 7; i++)
        {
            if (arl_Key[i].ToString() == string.Empty)
            {
                ParameterList.Add(DBNull.Value);
            }
            else
            { 
                ParameterList.Add(arl_Key[i]);
            }
        }

        ParameterList.Add(TextBoxRowCountLimit.Text);

        #endregion

        #region 連結資料庫

        BCO.STM35_BCO bco = new BCO.STM35_BCO(ConntionDB);
        DataTable ds_Return = bco.QueryDataItem(ParameterList);

        #endregion

        

        string s_RequestString = Request.QueryString["STM352_Type"];

        if (ds_Return.Rows.Count == 0 || s_ITEM == string.Empty)
        {
            if (s_RequestString != "ToolBar")
            {
                ScriptManager.RegisterStartupScript(this.UpdatePanel3, typeof(UpdatePanel), "STM35", "alert('查無資料');", true);
                Response.Redirect("STM351.aspx?Code=STM35", false);
            }

            ScriptManager.RegisterStartupScript(this.UpdatePanel3, typeof(UpdatePanel), "STM35", "alert('查無此筆資料或已被其他使用者刪除,請點選上一筆/下一筆鈕或回查詢頁重新查詢!');", true);
            TabContainer2.Enabled = false;
        }
        else
        {

            #region 將資料寫入相關欄位 MAIN
            DataRow dr_Return_ITEM = ds_Return.Rows[0];

            this.SLP_ITEM.Text = s_ITEM;
            this.txtITEM_WDS.Text = dr_Return_ITEM["ITEM_MAP"].ToString();
            this.SLP_VENDOR.Text = dr_Return_ITEM["VENDOR"].ToString();
            this.slp_TAX_TYPE.Text = dr_Return_ITEM["TAX_TYPE"].ToString();
            this.slp_ROOT_NO.Text = dr_Return_ITEM["ROOT_NO"].ToString();
            this.SLP_ItemPeriod.Text = dr_Return_ITEM["PERIOD"].ToString();

            this.SLP_PMA.Text = dr_Return_ITEM["PMA"].ToString();//商品群分類
            this.SLP_Category.Text = dr_Return_ITEM["Category"].ToString();//稅別
            this.txt_PRICE.Text = dr_Return_ITEM["PRICE"].ToString();
            this.txt_COST.Text = dr_Return_ITEM["COST"].ToString();
            this.txt_DISCOUNT_RATE.Text = dr_Return_ITEM["DISCOUNT_RATE"].ToString();
            this.slp_CREATEDATE.Text = dr_Return_ITEM["CREATEDATE"].ToString();
            this.slp_CREATEUID.Text = dr_Return_ITEM["CREATEUID"].ToString();
            this.slp_UPDATEDATE.Text = dr_Return_ITEM["UPDATEDATE"].ToString();
            this.slp_UPDATEUID.Text = dr_Return_ITEM["UPDATEUID"].ToString();
            #endregion
            

            #region 設定供應商合約獎勵金資料

            ArrayList arl_Contract = new ArrayList();
            arl_Contract = bco.QueryContract(dr_Return_ITEM["VENDOR"].ToString());

            if (arl_Contract[0].ToString() != string.Empty)
            {
                string CNT_NO = arl_Contract[0].ToString();
                string EDIT_NO = arl_Contract[1].ToString();

                string SessionName = "VDM021_SortKey" + PageTimeStamp.Value;

                arl_Contract.Clear();
                arl_Contract.Add(CNT_NO + "|" + EDIT_NO);

                Session[SessionName] = arl_Contract;

                btnVendor.OnClientClick = "AddIFrameTab('VDM02供應商合約維護處理','../VDM/VDM022.aspx?Code=VDM02&arl_Key=VDM021_SortKey" + PageTimeStamp.Value + "&isToolBar=N&VDM021=EDIT&CNT_NO=" + CNT_NO + "&EDIT_NO=" + EDIT_NO + "');return false;";
                
                //因供應商帳務合約資料錯誤則帳務期別檔會無法抓取資料
                #region 設定期別補貼主檔資料  

                string strSessionName = "ITM031_PK_" + PageTimeStamp.Value;
                Session[strSessionName] = null;

                DataTable dt = new DataTable();
                dt.Columns.Add(new DataColumn("ITEM"));
                dt.Columns.Add(new DataColumn("PERIOD"));
                DataRow dr = dt.NewRow();
                dr["ITEM"] = s_ITEM;
                dr["PERIOD"] = dr_Return_ITEM["PERIOD"].ToString();
                dt.Rows.Add(dr);
                dt.AcceptChanges();
                Session[strSessionName] = dt;

                btnPeriod.OnClientClick = "AddIFrameTab('ITM03期別帳務審核處理','../ITM/ITM032.aspx?Code=ITM03&DataItemIndex=0&SID=" + PageTimeStamp.Value + "');return false;";

                #endregion
            
            }
            else
            {
                btnVendor.OnClientClick = "AddIFrameTab('VDM02供應商合約維護處理','../VDM/VDM021.aspx');return false;";

                btnPeriod.OnClientClick = "AddIFrameTab('ITM03期別帳務審核處理','../ITM/ITM031.aspx');return false;";

            }

            #endregion

            DataBind_S(ParameterList);
            DataBind_SG(ParameterList);
        }

    }
Ejemplo n.º 4
0
    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_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));
            ParameterList.Add(GetValueSetParameter(this.txtITEM_WDS.Text.Trim(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_VENDOR.Text.Trim(), "string", 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_TAX_TYPE.Text, "int", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_Store_B.Text.Trim(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_Store_E.Text.Trim(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_StoreGroup_B.Text.Trim(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_StoreGroup_E.Text.Trim(), "string", 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_CREATEDATE.Text, "date", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_CREATEUID.Text, "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_UPDATEDATE.Text, "date", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_UPDATEUID.Text, "string", false));
            ParameterList.Add(GetValueSetParameter(TextBoxRowCountLimit.Text.Trim(), "Decimal", false));


            #endregion

            #region 取得資料

            DataTable dt_Return = new DataTable();

            STMModel.STM35_BCO bco = new STMModel.STM35_BCO(ConnectionDB);
            dt_Return = bco.QueryByLike(ParameterList);

            #endregion

            #region 資料與GridView繫結

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

            }
            else
            {
                string SessionIDName = string.Format("{0}_{1}", this.PageCode, 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();

                ArrayList arl_Key = new ArrayList();

                for (int i = 0; i < dt_Return.Rows.Count; i++)
                { arl_Key.Add(dt_Return.Rows[i]["ITEM"].ToString()); }

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


                string SessionSearchName = "STM352_SearchKey"+PageTimeStamp.Value;
                                            
                ParameterList.Clear();
                ParameterList.Add(GetValueSetParameter(this.SLP_ItemPeriod_B.Text.Trim(), "string", false));
                ParameterList.Add(GetValueSetParameter(this.SLP_ItemPeriod_E.Text.Trim(), "string", false));
                ParameterList.Add(GetValueSetParameter(this.SLP_Store_B.Text.Trim(), "string", false));
                ParameterList.Add(GetValueSetParameter(this.SLP_Store_E.Text.Trim(), "string", false));
                ParameterList.Add(GetValueSetParameter(this.SLP_StoreGroup_B.Text.Trim(), "string", false));
                ParameterList.Add(GetValueSetParameter(this.SLP_StoreGroup_E.Text.Trim(), "string", 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));
                Session[SessionSearchName]=ParameterList;
                
            }

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