示例#1
0
    /// <summary>
    /// 繫結資料到控制項
    /// </summary>
    /// <param name="vdb"></param>
    private void databind(string strSTAKind, string strOUT_NO)
    {
        #region 呼叫BCO查詢1

        string strAC_STATUS = "";
        CAMModel.CAMCommon bco1 = new CAMModel.CAMCommon();

        ParameterList.Clear();
        ParameterList.Add(bco1.GetValueSetParameter(strSTAKind, "string", false));
        ParameterList.Add(bco1.GetValueSetParameter(strOUT_NO, "string", false));


        DataTable dt1 = new DataTable();

        CAMModel.MaintainStoreAcceptAndBackwardTick bco = new CAMModel.MaintainStoreAcceptAndBackwardTick(ConntionDB);

        dt1 = bco.QueryTick_D1(ParameterList);
        if (dt1.Rows.Count > 0)
        {
            //txtSTAKind.Text = strSTAKind == "1" ? "進貨單" : "退貨單";
            if (strSTAKind == "1")
            {
                txtSTAKind.Text = "進貨單";
            }
            else if (strSTAKind == "2")
            {
                txtSTAKind.Text = "退貨單";
            }
            else if (strSTAKind == "3")
            {
                txtSTAKind.Text = "補帳單";
            }
            else if (strSTAKind == "4")
            {
                txtSTAKind.Text = "調撥單";
            } 
            txtGROUP_NO.Text = dt1.Rows[0]["GROUP_NO"].ToString();
            txtGROUP_NAME.Text = dt1.Rows[0]["GROUP_NAME"].ToString();
            txtSTORE.Text = dt1.Rows[0]["STORE"].ToString();
            txtSTORE_NAME.Text = dt1.Rows[0]["STORE_NAME"].ToString();
            txtPROFIT_NO.Text = dt1.Rows[0]["PROFIT_NO"].ToString();
            txtPROFIT_NAME.Text = dt1.Rows[0]["PROFIT_NAME"].ToString();
            txtROUTE.Text = dt1.Rows[0]["ROUTE"].ToString();
            txtROUTE_NAME.Text = dt1.Rows[0]["ROUTE_NAME"].ToString();
            txtSTEP.Text = dt1.Rows[0]["STEP"].ToString();
            txtTAX_TYPE.Text = dt1.Rows[0]["TAX_TYPE"].ToString();
            txtTYPE_NO.Text = dt1.Rows[0]["TYPE_NO"].ToString();
            txtBUS_DATE.Text = dt1.Rows[0]["BUS_DATE"].ToString();
            txtSIGN_DATE.Text = dt1.Rows[0]["SIGN_DATE"].ToString();
            hidSIGN_DATE_OLD.Value = dt1.Rows[0]["SIGN_DATE"].ToString();
            txtT_DATE.Text = dt1.Rows[0]["T_DATE"].ToString();
            txtSB_NO.Text = dt1.Rows[0]["SB_NO"].ToString();
            txtCHAN_SOURCE_NO.Text = dt1.Rows[0]["CHAN_SOURCE_NO"].ToString();
            hidCHAN_SOURCE_NO_OLD.Value = dt1.Rows[0]["CHAN_SOURCE_NO"].ToString();
            txtINOUT_NO.Text = dt1.Rows[0]["INOUT_NO"].ToString();
            txtROOT_NO.Text = dt1.Rows[0]["ROOT_NO"].ToString();
            txtIS_SCHEDULE.Text = dt1.Rows[0]["IS_SCHEDULE"].ToString();
            txtAC_STATUS.Text = dt1.Rows[0]["AC_STATUS_NAME"].ToString();
            strAC_STATUS = dt1.Rows[0]["AC_STATUS"].ToString();
            txtBALANCE_DATE_S.Text = dt1.Rows[0]["AC_BALANCE_DATE_S"].ToString();
            txtBALANCE_DATE.Text = dt1.Rows[0]["AC_BALANCE_DATE"].ToString();
            slpPROMOTE_ID.Text = dt1.Rows[0]["PROMOTE_ID"].ToString();
        }
        else
        {
            txtSTAKind.Text = "";
            txtGROUP_NO.Text = "";
            txtGROUP_NAME.Text = "";
            txtSTORE.Text = "";
            txtSTORE_NAME.Text = "";
            txtPROFIT_NO.Text = "";
            txtPROFIT_NAME.Text = "";
            txtROUTE.Text = "";
            txtROUTE_NAME.Text = "";
            txtSTEP.Text = "";
            txtTAX_TYPE.Text = "";
            txtTYPE_NO.Text = "";
            txtBUS_DATE.Text = "";
            txtSIGN_DATE.Text = "";
            hidSIGN_DATE_OLD.Value = "";
            txtT_DATE.Text = "";
            txtSB_NO.Text = "";
            txtCHAN_SOURCE_NO.Text = "";
            hidCHAN_SOURCE_NO_OLD.Value = "";
            txtINOUT_NO.Text = "";
            txtROOT_NO.Text = "";
            txtIS_SCHEDULE.Text = "";
            txtAC_STATUS.Text = "";
            strAC_STATUS = "";
            txtBALANCE_DATE_S.Text = "";
            txtBALANCE_DATE.Text = "";
            slpPROMOTE_ID.Text = "";
            ErrorMsgLabel.Text = "查無資料";
        }

        #endregion

        #region 呼叫BCO查詢2

        ParameterList.Clear();
        ParameterList.Add(bco1.GetValueSetParameter(strSTAKind, "string", false));
        ParameterList.Add(bco1.GetValueSetParameter(strOUT_NO, "string", false));


        DataTable dt = new DataTable();

        bco = new CAMModel.MaintainStoreAcceptAndBackwardTick(ConntionDB);

        dt = bco.QueryTick_D2(ParameterList);
        #endregion

        #region 查詢完控制項重置
        //抓取本頁初次登記的時間
        string SessionIDName = "CAM232_GridView1" + PageTimeStamp.Value;

        Session["SessionID"] = SessionIDName;
        Session[SessionIDName] = dt;
        GridView1.DataSource = dt;
        //設定分頁大小
        GridView1.PageSize = 20;
        GridView1.PageIndex = 0;
        GridView1.DataBind();

        //簽收日結帳後不可改
        if (strAC_STATUS != "1")
        {
            txtSIGN_DATE.ReadOnly = true;
        }
        else
        {
            txtSIGN_DATE.ReadOnly = false;
        }

        btnUpdate.Enabled = true;
        txtCHAN_SOURCE_NO.ReadOnly = false;
        txtCHAN_SOURCE_NO.CssClass = "";
        #endregion
    }
示例#2
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        string[] bResult = null;
        string dtSIGN_DATE = txtSIGN_DATE.Text == "" ? "0001/01/01" : txtSIGN_DATE.Text;
        string dtSIGN_DATE_OLD = hidSIGN_DATE_OLD.Value == "" ? "0001/01/01" : hidSIGN_DATE_OLD.Value;

        try
        {
            #region 檢核作業
            if (Convert.ToDateTime(dtSIGN_DATE).CompareTo(Convert.ToDateTime(dtSIGN_DATE_OLD)) == 0
                   && txtCHAN_SOURCE_NO.Text == hidCHAN_SOURCE_NO_OLD.Value)
            {
                ScriptManager.RegisterStartupScript(UpdatePanel4, this.GetType(), "ClientScript", string.Format("alert('資料無更改');"), true);
                return;
            }
            #endregion

            #region 呼叫BCO

            CAMModel.CAMCommon bco1 = new CAMModel.CAMCommon();

            ParameterList.Clear();
            ParameterList.Add(bco1.GetValueSetParameter(txtSB_NO.Text, "string", false));
            ParameterList.Add(bco1.GetValueSetParameter(txtSTORE.Text, "string", false));
            ParameterList.Add(bco1.GetValueSetParameter(hidSIGN_DATE_OLD.Value, "date", false));
            ParameterList.Add(bco1.GetValueSetParameter(hidCHAN_SOURCE_NO_OLD.Value, "string", false));
            ParameterList.Add(bco1.GetValueSetParameter(txtSIGN_DATE.Text, "date", false));
            ParameterList.Add(bco1.GetValueSetParameter(txtCHAN_SOURCE_NO.Text, "string", false));
            ParameterList.Add(bco1.GetValueSetParameter(txtBUS_DATE.Text, "date", false));
            ParameterList.Add(bco1.GetValueSetParameter(Session["UID"].ToString(), "string", false));

            CAMModel.MaintainStoreAcceptAndBackwardTick bco = new CAMModel.MaintainStoreAcceptAndBackwardTick(ConntionDB);

            if (txtSTAKind.Text == "進貨單")
            {
                bResult = bco.UpdateStAccept(ParameterList);
            }
            else if (txtSTAKind.Text == "退貨單")
            {
                bResult = bco.UpdateBackward(ParameterList);
            }
            else if (txtSTAKind.Text == "補帳單")
            {
                bResult = bco.UpdateCamPatch(ParameterList);
            }
            else if (txtSTAKind.Text == "調撥單")
            {
                bResult = bco.UpdateCamTran(ParameterList); 
            }

            if (bResult[0] == "0")//成功
            {
                databind(hidSTAKind.Value, hidSB_NO.Value);
                ScriptManager.RegisterStartupScript(UpdatePanel4, this.GetType(), "ClientScript", string.Format("alert('更新成功');"), true);
            }
            else//失敗
            {
                string strErrMsg = bResult[1];
                if (bResult[1].IndexOf("此入帳日年月己月結,請確認入帳日期是否正確?") > 0)
                {
                    strErrMsg = "此入帳日年月己月結,請確認入帳日期是否正確?";
                }
                ScriptManager.RegisterStartupScript(UpdatePanel4, this.GetType(), "ClientScript", string.Format("alert('更新失敗:" + strErrMsg + "');"), true);
            }

            #endregion
        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0];  //直接取第一個
        }
        finally { Finally_Function(); }
    }
示例#3
0
    /// <summary>
    /// 繫結資料到控制項
    /// </summary>
    /// <param name="vdb"></param>
    private void databind()
    {
        #region 呼叫BCO查詢

        CAMModel.CAMCommon bco1 = new CAMModel.CAMCommon();

        ParameterList.Clear();
        //ParameterList.Add(bco1.GetValueSetParameter(chkSTAKind1.Checked && chkSTAKind2.Checked ? "0" : (chkSTAKind1.Checked ? "1" : "2"), "string", false));
        string strSTAKind = "";
        if (chkSTAKind1.Checked)
        {
           strSTAKind += "1,";
        }
        if (chkSTAKind2.Checked)
        {
            strSTAKind += "2,";
        }
        if (chkSTAKind3.Checked)
        {
            strSTAKind += "3,";
        }
        if (chkSTAKind4.Checked)
        {
            strSTAKind += "4,";
        }

        if (strSTAKind=="")
        {
            strSTAKind = "1,2,3,4";
        }
        else
        {
            strSTAKind = strSTAKind.Substring(0, strSTAKind.Length - 1);
        }

        ParameterList.Add(bco1.GetValueSetParameter(strSTAKind, "string", false));
        ParameterList.Add(bco1.GetValueSetParameter(slp_GROUP_NO.Text, "string", CheckBoxLikeSearch.Checked));
        ParameterList.Add(bco1.GetValueSetParameter(slp_STORE.Text, "string", CheckBoxLikeSearch.Checked));
        ParameterList.Add(bco1.GetValueSetParameter(slp_PROFIT_NO.Text, "string", false));
        ParameterList.Add(bco1.GetValueSetParameter(slp_ROUTE.Text, "string", false));
        ParameterList.Add(bco1.GetValueSetParameter(txtSTEP.Text, "string", false));
        ParameterList.Add(bco1.GetValueSetParameter(slp_TAX_TYPE.Text, "string", false));
        ParameterList.Add(bco1.GetValueSetParameter(slp_TYPE_NO.Text, "string", false));
        ParameterList.Add(bco1.GetValueSetParameter(slp_BUS_DATE.StartDate, "date", false));
        ParameterList.Add(bco1.GetValueSetParameter(slp_BUS_DATE.EndDate, "date", false));
        ParameterList.Add(bco1.GetValueSetParameter(slp_SIGN_DATE.StartDate, "date", false));
        ParameterList.Add(bco1.GetValueSetParameter(slp_SIGN_DATE.EndDate, "date", false));
        ParameterList.Add(bco1.GetValueSetParameter(slp_T_DATE.StartDate, "date", false));
        ParameterList.Add(bco1.GetValueSetParameter(slp_T_DATE.EndDate, "date", false));
        ParameterList.Add(bco1.GetValueSetParameter(txtSB_NO.Text, "string", CheckBoxLikeSearch.Checked));
        ParameterList.Add(bco1.GetValueSetParameter(txtCHAN_SOURCE_NO.Text, "string", CheckBoxLikeSearch.Checked));
        ParameterList.Add(bco1.GetValueSetParameter(txtINOUT_NO.Text, "string", CheckBoxLikeSearch.Checked));
        ParameterList.Add(bco1.GetValueSetParameter(slp_ROOT_NO.Text, "string", false));
        ParameterList.Add(bco1.GetValueSetParameter(rdlIS_SCHEDULE.SelectedValue, "string", false));
        ParameterList.Add(bco1.GetValueSetParameter(slp_AC_STATUS.Text, "string", false));
        ParameterList.Add(bco1.GetValueSetParameter(slp_BALANCE_DATE_S.Text, "string", false));
        ParameterList.Add(bco1.GetValueSetParameter(slp_BALANCE_DATE.Text, "string", false));
        ParameterList.Add(bco1.GetValueSetParameter(slp_BALANCE_DATE_E.Text, "string", false));
        ParameterList.Add(bco1.GetValueSetParameter(TextBoxRowCountLimit.Text, "string", false));
        ParameterList.Add(bco1.GetValueSetParameter(slpPROMOTE_ID_S.Text, "string", false));
        ParameterList.Add(bco1.GetValueSetParameter(slpPROMOTE_ID_E.Text, "string", false));

        DataTable dt = new DataTable();

        CAMModel.MaintainStoreAcceptAndBackwardTick bco = new CAMModel.MaintainStoreAcceptAndBackwardTick(ConntionDB);

        dt = bco.QueryTick_M(ParameterList);
        #endregion

        #region 查詢完控制項重置
        //抓取本頁初次登記的時間
        string SessionIDName = "CAM231_GridView1" + PageTimeStamp.Value;
        ArrayList NOList = new ArrayList();

        Session["SessionID"] = SessionIDName;
        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();

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            string[] strNO = new string[2];
            strNO[0] = dt.Rows[i]["STAKind"].ToString();
            strNO[1] = dt.Rows[i]["OUT_NO"].ToString();
            NOList.Add(strNO);
        }

        Session["CAM23Query"] = NOList;

        LabelQueryRecordCount.Text = string.Format(" {0} Rows ", dt.Rows.Count.ToString());
        if (dt == null || (dt != null && dt.Rows.Count <= 0))
        {
            ErrorMsgLabel.Text = "查無資料";
        }

        #endregion
    }