protected void btnUpdate_Click(object sender, EventArgs e) { try { string SessionIDName = "CAM221_GridView1" + PageTimeStamp.Value; //同步GRIDVIEW至DT DoUPD_DT(); #region UPDATE bool bResult; DataTable dt = ((DataTable)Session[SessionIDName]); DataTable dt_new = dt.GetChanges(); if (dt_new != null) { CAMModel.MaintainPAYCompareResure BCO = new CAMModel.MaintainPAYCompareResure(ConntionDB); bResult = BCO.UpdatePAYComapreResure(Session["UID"].ToString(), dt_new, null); if (bResult) { ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "ClientScript", string.Format("alert('資料更新完成');location.replace('CAM221.aspx?Code=CAM22');"), true); } } else { ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "ClientScript", string.Format("alert('沒有需更新的資料');location.replace('CAM221.aspx?Code=CAM22');"), true); } #endregion } catch (Exception ex) { WaringLogProcess(ex.Message); this.ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0]; //直接取第一個 } finally { Finally_Function(); } }
protected void btnQuery_Click(object sender, EventArgs e) { try { ErrorMsgLabel.Text = ""; #region 呼叫BCO查詢 CAMModel.CAMCommon bco1 = new CAMModel.CAMCommon(); ParameterList.Clear(); ParameterList.Add(bco1.GetValueSetParameter(slp_ACCT_MONTH.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(txtBUS_NO.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(ddlGROUP_NO.SelectedValue, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(slp_STORE.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(chkSTA1.Checked?"1":"0", "int", false)); ParameterList.Add(bco1.GetValueSetParameter(chkSTA2.Checked?"2":"0", "int", false)); ParameterList.Add(bco1.GetValueSetParameter(chkDiff1.Checked?"1":"0", "int", false)); ParameterList.Add(bco1.GetValueSetParameter(chkDiff2.Checked?"1":"0", "int", false)); ParameterList.Add(bco1.GetValueSetParameter(TextBoxRowCountLimit.Text, "int", false)); DataTable dt = new DataTable(); CAMModel.MaintainPAYCompareResure bco = new CAMModel.MaintainPAYCompareResure(ConntionDB); dt = bco.QueryPAYCompareResure(ParameterList); #endregion #region 查詢完控制項重置 //抓取本頁初次登記的時間 string SessionIDName = "CAM221_GridView1" + PageTimeStamp.Value; 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(); if (dt == null || (dt != null && dt.Rows.Count <= 0)) { btnUpdate.Enabled = false; GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Save, false, "", btnUpdate, WUI_GMToolbarV.ClickAction.ButtonClick); ErrorMsgLabel.Text = "查無資料"; } else { btnUpdate.Enabled = true; LockControl(); GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Save, true, "", btnUpdate, WUI_GMToolbarV.ClickAction.ButtonClick); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "$get('ctl00_CPH_PanelQuery').style.display='none';", true); } #endregion } catch (Exception ex) { WaringLogProcess(ex.Message); this.ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0]; //直接取第一個 } finally { Finally_Function(); } }