Esempio n. 1
0
    protected void ButtonQuery_Click(object sender, EventArgs e)
    {
        try
        {            
            //清除目前選擇DATA            
            this.SelectLabelCode.Text = "";
            this.SelectLabelName.Text = "";

            GridView1.PageSize = Convert.ToInt32(TextBoxPagesize.Text.Trim());
            VAMModel.VAM15_BCO bco = new VAMModel.VAM15_BCO(ConntionDB);
            firstpage = 0;
            firstindex = -1;

            ParameterList.Clear();
            ParameterList.Add(TextBoxRowCountLimit.Text.Trim());
            ParameterList.Add(TextBoxCode.Text.Trim() + "%");            

            databind(bco.QueryAllForSLP(ParameterList));
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        finally { }
    }//ButtonQuery_Click
Esempio n. 2
0
    private bool CheckExist_PROMOTE(string strPROMOTE_ID)
    {
        bool bResult = true;
        BCO.VAM15_BCO BCO = new BCO.VAM15_BCO(ConntionDB);

        if (strPROMOTE_ID != "")
        {
            ArrayList ParameterList = new ArrayList();
            ParameterList.Add(strPROMOTE_ID);
            DataTable dt = BCO.QueryForSLP(ParameterList);
            if (dt.Rows.Count == 0)
                bResult = false;
        }

        return bResult;
    }
Esempio n. 3
0
    /// <summary>
    /// 繫結資料到畫面控制項
    /// </summary>
    private void LoadData()
    {
        DataTable dt = new DataTable();
        BCO.VAM15_BCO bco = new BCO.VAM15_BCO(ConntionDB);

        if (ViewState["Mode"].ToString() == "INSERT")//Model:新增
        {
            ParameterList.Clear();
            ParameterList.Add("XXXXXXXXXXXXXXXXXXXX");
            dt = bco.QueryDetail(ParameterList);
            for (int i = 0; i < 5; i++)
                addRow(ref dt, i);
            gv_Detail.DataSource = dt;
            gv_Detail.DataBind();
        }
        else if ((ViewState["Mode"].ToString() == "VIEW") || (ViewState["Mode"].ToString() == "EDIT"))//Model:檢視/編輯
        {
            SLP_PROMOTE.Text = ViewState["PROMOTE_ID"].ToString();


            ParameterList.Clear();
            ParameterList.Add(ViewState["PROMOTE_ID"].ToString());
            dt = bco.QueryDetail(ParameterList);

            if (dt.Rows.Count > 0)
            {
                txtUPDATEDATE.Text = dt.Rows[0]["UPDATEDATE"].ToString();
                SLP_UPDATEUSER.Text = dt.Rows[0]["UPDATEUID"].ToString();
                gv_Detail.DataSource = dt;
                gv_Detail.DataBind();
                CheckReadOnly(dt);
            }
            else
            {
                ErrorMsgLabel.Text = "查無資料";
            }
        }
        Session["VAM15_DTL_" + PageTimeStamp.Value] = dt;
    }
Esempio n. 4
0
    // 新增明細事件
    protected void btnAddDetail_Click(object sender, EventArgs e)
    {
        ErrorMsgLabel.Text = "";
        int iStartID = 0;

        if (ViewState["Mode"].ToString() == "INSERT" || ViewState["Mode"].ToString() == "EDIT")
        {
            gv_Detail_CacheUpdate();

            DataTable dt = (DataTable)Session["VAM15_DTL_" + PageTimeStamp.Value];

            if (dt == null || dt.Rows.Count == 0)
            {
                BCO.VAM15_BCO bco = new BCO.VAM15_BCO(ConntionDB);
                ParameterList.Clear();
                ParameterList.Add("XXXXXXXXXXXXXXXXXXXX");
                dt = bco.QueryDetail(ParameterList); //抓取SCHEMA而已
                iStartID = 1;
            }
            else
            {
                iStartID = int.Parse(dt.Compute("MAX(ID)", null).ToString()) + 1;
            }

            addRow(ref dt, iStartID);

            GV_SHOW();

        }
    }
Esempio n. 5
0
    // Save 事件
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        gv_Detail_CacheUpdate();

        DataTable NewDetail = null;

        string strCheckMsg = string.Empty;

        ErrorMsgLabel.Text = "";

        try
        {
            BCO.VAM15_BCO bco = new BCO.VAM15_BCO(ConntionDB);

            if (this.SLP_PROMOTE.Text.Trim() == "")
            {
                ErrorMsgLabel.Text = "檔期編號必填!!";
                return;
            }

            if (CheckExist_PROMOTE(this.SLP_PROMOTE.Text.Trim()) == false)
            {
                ErrorMsgLabel.Text = "此檔期編號不存在!!";
                return;
            }

            if (ViewState["Mode"].ToString() == "INSERT")
            {

                ParameterList.Clear();
                ParameterList.Add(SLP_PROMOTE.Text.Trim());

                DataTable dtCheck = bco.QueryDetail(ParameterList);

                if (dtCheck.Rows.Count > 0)
                {
                    ErrorMsgLabel.Text = "此檔期編號已有設定資料存在!!";
                    return;
                }

            }
            //1.同一個檔期,廠商,稅別 只允許一筆
            //2.如果廠商未輸入要提示哪一行
            //3.無明細不允許儲存

            int iSaveRows = 0;//預計儲存的筆數

            for (int i = 0; i < gv_Detail.Rows.Count; i++)
            {
                string strVendor = ((SLP_VendorBase)gv_Detail.Rows[i].FindControl("SLP_Vendor")).Text.Trim();
                string strTAXTYPE = ((ASP.sys_slp_slp_enumbase_ascx)gv_Detail.Rows[i].FindControl("SLP_TAXTYPE")).Text.Trim();
                string strSUM_AMT = ((TextBox)gv_Detail.Rows[i].FindControl("txtSUM_AMT")).Text.Trim();
                if ((strVendor == "") && (strSUM_AMT != "0"))
                {
                    strCheckMsg += "第 " + (i + 1) + " 列 資料輸入不完整<br />";
                }
                else if (strVendor != "")
                {
                    if (CheckExist_Vendor(strVendor) == false)
                    {
                        strCheckMsg += "第 " + (i + 1) + " 列 廠商編號不存在<br />";
                    }
                    else
                    {
                        iSaveRows++;
                        for (int j = 0; j < gv_Detail.Rows.Count; j++)
                        {
                            if (i != j)
                            {
                                if ((strVendor == ((SLP_VendorBase)gv_Detail.Rows[j].FindControl("SLP_Vendor")).Text.Trim()) &&
                                    (strTAXTYPE == ((ASP.sys_slp_slp_enumbase_ascx)gv_Detail.Rows[j].FindControl("SLP_TAXTYPE")).Text.Trim()))
                                {
                                    strCheckMsg += "第 " + (i + 1) + " 列 與第 " + (j + 1) + " 列 為相同的廠商和稅別資料 <br />";
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            if (strCheckMsg != "")
            {
                ErrorMsgLabel.Text = strCheckMsg;
                return;
            }
            if (iSaveRows == 0)
            {
                ErrorMsgLabel.Text = "明細資料未設定!!";
                return;
            }

            ParameterList.Clear();
            ParameterList.Add(SLP_PROMOTE.Text.Trim());
            ParameterList.Add(Session["UID"].ToString());
            ParameterList.Add(SLP_UPDATEUSER.Text.Trim());
            ParameterList.Add(txtUPDATEDATE.Text.Trim());

            bco.SaveData((DataTable)Session["VAM15_DTL_" + PageTimeStamp.Value], ParameterList);

            Response.Redirect("VAM152.aspx?PROMOTE_ID=" + this.SLP_PROMOTE.Text.Trim() + "&SSID=" + ViewState["SSID"].ToString() + "&mode=VIEW&Code=VAM15");

        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
    }
Esempio n. 6
0
    //刪除主檔 事件
    protected void BtnDelMain_Click(object sender, EventArgs e)
    {
        ErrorMsgLabel.Text = "";
        if (ViewState["Mode"].ToString() == "VIEW")
        {
            try
            {
                BCO.VAM15_BCO bco = new BCO.VAM15_BCO(ConntionDB);
                ParameterList.Clear();
                ParameterList.Add(ViewState["PROMOTE_ID"].ToString());
                ParameterList.Add(Session["UID"].ToString());
                ParameterList.Add(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
                ParameterList.Add(SLP_UPDATEUSER.Text);
                ParameterList.Add(txtUPDATEDATE.Text);
                bco.DelData(ParameterList);

                Page currentPage = (Page)HttpContext.Current.Handler;
                string name = "alert";
                string script = "alert('刪除完成');location.href='VAM151.aspx?Code=VAM15';";
                ScriptManager.RegisterClientScriptBlock(currentPage, currentPage.GetType(), name, script, true);
            }
            catch (Exception ex)
            {
                this.ErrorMsgLabel.Text = ex.Message;
            }
            finally
            {

            }
        }
    }
Esempio n. 7
0
 private DataTable Get_MainData(string strPROMOTE_ID)
 {
     BCO.VAM15_BCO bco = new BCO.VAM15_BCO(ConntionDB);
     ParameterList.Clear();
     ParameterList.Add(strPROMOTE_ID);
     DataTable dt = bco.QueryDetail(ParameterList);
     return dt;
 }
Esempio n. 8
0
 private void SetTaxRate()
 {
     BCO.VAM15_BCO bco = new BCO.VAM15_BCO(ConntionDB);
     DataTable dt = bco.GetTaxRate();
     hidTaxRate.Value = "0";
     if (dt.Rows.Count > 0)
         hidTaxRate.Value = dt.Rows[0]["TAXRATE"].ToString();
 }
Esempio n. 9
0
 public VAM_SLP_PROMOTE()
 {
     VAM15_BCO = new VAMModel.VAM15_BCO(ConntionDB);
 }
Esempio n. 10
0
    }//ButtonNew_Click

    protected void ButtonQuery_Click(object sender, EventArgs e)
    {
        this.ErrorMsgLabel.Text = "";

        ParameterList.Clear();

        //0.PROMOTE_ID
        //1.VENDOR
        //2.TAX_TYPE
        //3.TAX_REMAIN_AMT_OP
        //4.TAX_REMAIN_AMT
        //5.UTAX_REMAIN_AMT_OP
        //6.UTAX_REMAIN_AMT
        //7.TAX_AMT_OP
        //8.TAX_AMT
        //9.UTAX_AMT_OP
        //10.UTAX_AMT
        //11.TAX_OP
        //12.TAX
        //13.TAX_AMT+UTAX_AMT_OP
        //14.TAX_AMT+UTAX_AMT
        if (CheckBoxLikeSearch.Checked == true)
        {
            ParameterList.Add("%" + SLP_PROMOTE.Text.Trim() + "%");
            ParameterList.Add("%" + SLP_VendorBase1.Text.Trim() + "%");
        }
        else
        {
            ParameterList.Add(SLP_PROMOTE.Text.Trim());
            ParameterList.Add(SLP_VendorBase1.Text.Trim());
        }
        ParameterList.Add(SLP_TAXTYPE.Text.Trim());
        ParameterList.Add(SLP_NO_TAX_AMT.Operator);
        ParameterList.Add(SLP_NO_TAX_AMT.Text.Trim());
        ParameterList.Add(SLP_TAX.Operator);
        ParameterList.Add(SLP_TAX.Text.Trim());
        ParameterList.Add(SLP_SUM_AMT.Operator);
        ParameterList.Add(SLP_SUM_AMT.Text.Trim());


        BCO.VAM15_BCO bco = new BCO.VAM15_BCO(ConnectionDB);
        DataTable dt = bco.QueryMain(ParameterList);

        if (dt.Rows.Count == 0)
        {
            this.GridView1.Visible = false;
            ErrorMsgLabel.Text = "查無資料!";
        }
        else
        {
            this.GridView1.Visible = true;

            Session["VAM151_MST" + PageTimeStamp.Value] = dt;

            Set_IDCollection(dt.DefaultView);

            this.GridView1.DataSource = dt;

            if (this.TextBoxPagesize.Text == "")
                this.GridView1.PageSize = 10;
            else
                this.GridView1.PageSize = Convert.ToInt32(this.TextBoxPagesize.Text);

            this.GridView1.PageIndex = 0;

            this.GridView1.DataBind();

            ViewState["SortField"] = null;
            ViewState["SortDirect"] = null;

        }
        UnSetClinetFocus();

    }//ButtonQuery_Click	  
Esempio n. 11
0
    public string PROMOTE_NAME(string strPROMOTE_ID)
    {
        string Name = "";
        string ConnectionDBStr = ((DatabaseSettings)ConfigurationManager.GetSection("dataConfiguration")).DefaultDatabase;
        VAM15_BCO BCO = new VAM15_BCO(ConnectionDBStr);

        if (strPROMOTE_ID != "")
        {
            ArrayList ParameterList = new ArrayList();
            ParameterList.Add(strPROMOTE_ID);
            DataTable dt = BCO.QueryForSLP(ParameterList);
            Name = ((dt.Rows.Count > 0) ? dt.Rows[0]["PROMOTE_NAME"].ToString() : "查無資料");
        }

        return Name;
    }