Example #1
0
    protected void gv_Item_Detl_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        try
        {
            #region 傳入參數

            TextBox txt_MEMO = (TextBox)this.gv_Item_Detl.Rows[e.RowIndex].FindControl("txt_MEMO");
            HiddenField hid_TRANS_DATE = (HiddenField)this.gv_Item_Detl.Rows[e.RowIndex].FindControl("hid_TRANS_DATE");
            Label lab_ITEM = (Label)this.gv_Item_Detl.Rows[e.RowIndex].FindControl("lab_ITEM");
            Label lab_PERIOD = (Label)this.gv_Item_Detl.Rows[e.RowIndex].FindControl("lab_PERIOD");
            Label lab_SRC_LOCATE_NO = (Label)this.gv_Item_Detl.Rows[e.RowIndex].FindControl("lab_SRC_LOCATE_NO");
            Label lab_DST_LOCATE_NO = (Label)this.gv_Item_Detl.Rows[e.RowIndex].FindControl("lab_DST_LOCATE_NO");

            if (GetStringLen(txt_MEMO.Text.Trim()) > txt_MEMO.MaxLength)
            {
                //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CRM071", "alert('[注意事項]欄位輸入資料長度過長');", true);
                throw new Exception("[注意事項]欄位輸入資料長度過長");
                return;
                
            }

            BCO.CRMCommon CRMComm = new BCO.CRMCommon();
            ArrayList ParameterList = new ArrayList();//20091117

            ParameterList.Clear();
            ParameterList.Add(Session["UID"].ToString());
            ParameterList.Add(CRMComm.GetValueSetParameter(txt_MEMO.Text, "string", false));
            ParameterList.Add(CRMComm.GetValueSetParameter(hid_TRANS_DATE.Value, "date", false));
            ParameterList.Add(CRMComm.GetValueSetParameter(lab_ITEM.Text, "string", false));
            ParameterList.Add(CRMComm.GetValueSetParameter(lab_PERIOD.Text, "string", false));
            ParameterList.Add(CRMComm.GetValueSetParameter(lab_SRC_LOCATE_NO.Text, "string", false));
            ParameterList.Add(CRMComm.GetValueSetParameter(lab_DST_LOCATE_NO.Text, "string", false));

            #endregion

            #region 儲存明細編輯資訊

            BCO.RecordCRMOrder bco = new BCO.RecordCRMOrder(ConntionDB);
            bco.UpdateTransferMemo(ParameterList, null);

            #endregion

            this.RightMsgLabel.Text = "更新成功";
        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message;
            return;
        }
        //finally
        //{
            HiddenField hid_TRANS_DATE2 = (HiddenField)this.gv_Item_Detl.Rows[e.RowIndex].FindControl("hid_TRANS_DATE");

            this.gv_Item_Detl.EditIndex = -1;
            int i_PageSize = this.gv_Item_Detl.PageSize;
            int i_PageIndex = this.gv_Item_Detl.PageIndex;

            Get_Trans_Detl_Data(hid_TRANS_DATE2.Value, i_PageSize, i_PageIndex);
        //}
    }