protected override Boolean WfDisplayMode() { vw_stpi100 masterModel = null; try { if (DrMaster != null && DrMaster.RowState != DataRowState.Detached) { masterModel = DrMaster.ToItem <vw_stpi100>(); WfSetDocPicture(masterModel.scavali, masterModel.scaconf, "", pbxDoc); } else { WfSetDocPicture("", "", "", pbxDoc); } if (FormEditMode == YREditType.NA) { WfSetControlsReadOnlyRecursion(this, true); } else { //明細先全開,並交由 WfSetDetailDisplayMode處理-事件觸發 WfSetControlsReadOnlyRecursion(this, false); //先全開 WfSetControlReadonly(uGridMaster, true); //主表grid不可編輯 WfSetControlReadonly(new List <Control> { ute_scacreu, ute_scacreg, udt_scacred }, true); WfSetControlReadonly(new List <Control> { ute_scamodu, ute_scamodg, udt_scamodd }, true); WfSetControlReadonly(new List <Control> { ute_scasecu, ute_scasecg }, true); WfSetControlReadonly(new List <Control> { ute_sca05_c, ute_sca21_c, ute_sca24_c }, true); WfSetControlReadonly(new List <Control> { ute_sca25_c, ute_sca26_c, ute_sca27_c }, true); if (FormEditMode == YREditType.修改) { WfSetControlReadonly(ute_sca01, true); } SelectNextControl(this.uTab_Header, true, true, true, false); } return(true); } catch (Exception ex) { throw ex; } }
//*****************************表單自訂Fuction**************************************** #region WfConfirm 確認 private void WfConfirm() { vw_stpi100 masterModel = null; try { if (DrMaster == null) { return; } if (WfRetrieveMaster() == false) { return; } if (WfLockMasterRow() == false) //這裡會LOCK資料 { return; } WfSetBllTransaction(); masterModel = DrMaster.ToItem <vw_stpi100>(); if (masterModel.scavali == "N") { WfShowErrorMsg("客戶已失效!"); WfRollback(); return; } if (GlobalFn.isNullRet(masterModel.scaconf, "N") != "N") { WfShowErrorMsg("客戶非未確認狀態!"); WfRollback(); return; } DrMaster["scaconf"] = "Y"; DrMaster["scavali"] = "Y"; DrMaster["scamodu"] = LoginInfo.UserNo; DrMaster["scamodg"] = LoginInfo.DeptNo; DrMaster["scamodd"] = Now; BoMaster.OfUpdate(DrMaster.Table); WfCommit(); DrMaster.AcceptChanges(); WfShowBottomStatusMsg("作業成功!"); masterModel = DrMaster.ToItem <vw_stpi100>(); WfSetDocPicture(masterModel.scavali, masterModel.scaconf, "", pbxDoc); } catch (Exception ex) { WfRollback(); DrMaster.RejectChanges(); throw ex; } }
protected override bool WfFormCheck() { vw_stpi100 masterModel = null; string msg; Control chkControl; string chkColName; try { masterModel = DrMaster.ToItem <vw_stpi100>(); #region 單頭資料檢查 chkColName = "sca01"; chkControl = ute_sca01; if (GlobalFn.varIsNull(masterModel.sca01)) { this.uTab_Master.SelectedTab = uTab_Master.Tabs[0]; chkControl.Focus(); msg = TabMaster.AzaTbList.Where(p => p.aza03 == chkColName).Select(p => p.aza04).FirstOrDefault(); msg += "不可為空白"; errorProvider.SetError(chkControl, msg); WfShowErrorMsg(msg); return(false); } chkColName = "sca02"; chkControl = ute_sca02; if (GlobalFn.varIsNull(masterModel.sca02)) { this.uTab_Master.SelectedTab = uTab_Master.Tabs[0]; chkControl.Focus(); msg = TabMaster.AzaTbList.Where(p => p.aza03 == chkColName).Select(p => p.aza04).FirstOrDefault(); msg += "不可為空白"; errorProvider.SetError(chkControl, msg); WfShowErrorMsg(msg); return(false); } chkColName = "sca03"; chkControl = ute_sca03; if (GlobalFn.varIsNull(masterModel.sca03)) { this.uTab_Master.SelectedTab = uTab_Master.Tabs[0]; chkControl.Focus(); msg = TabMaster.AzaTbList.Where(p => p.aza03 == chkColName).Select(p => p.aza04).FirstOrDefault(); msg += "不可為空白"; errorProvider.SetError(chkControl, msg); WfShowErrorMsg(msg); return(false); } chkColName = "sca20";//單據發送方式 chkControl = ucb_sca20; if (GlobalFn.varIsNull(masterModel.sca20)) { this.uTab_Master.SelectedTab = uTab_Master.Tabs[1]; chkControl.Focus(); msg = TabMaster.AzaTbList.Where(p => p.aza03 == chkColName).Select(p => p.aza04).FirstOrDefault(); msg += "不可為空白"; errorProvider.SetError(chkControl, msg); WfShowErrorMsg(msg); return(false); } chkColName = "sca21";//收款方式 chkControl = ute_sca21; if (GlobalFn.varIsNull(masterModel.sca21)) { this.uTab_Master.SelectedTab = uTab_Master.Tabs[1]; chkControl.Focus(); msg = TabMaster.AzaTbList.Where(p => p.aza03 == chkColName).Select(p => p.aza04).FirstOrDefault(); msg += "不可為空白"; errorProvider.SetError(chkControl, msg); WfShowErrorMsg(msg); return(false); } chkColName = "sca22"; chkControl = ucb_sca22;//課稅別 if (GlobalFn.varIsNull(masterModel.sca22)) { this.uTab_Master.SelectedTab = uTab_Master.Tabs[1]; chkControl.Focus(); msg = TabMaster.AzaTbList.Where(p => p.aza03 == chkColName).Select(p => p.aza04).FirstOrDefault(); msg += "不可為空白"; errorProvider.SetError(chkControl, msg); WfShowErrorMsg(msg); return(false); } chkColName = "sca23"; chkControl = ucb_sca23;//發票聯數 if (GlobalFn.varIsNull(masterModel.sca23)) { this.uTab_Master.SelectedTab = uTab_Master.Tabs[1]; chkControl.Focus(); msg = TabMaster.AzaTbList.Where(p => p.aza03 == chkColName).Select(p => p.aza04).FirstOrDefault(); msg += "不可為空白"; errorProvider.SetError(chkControl, msg); WfShowErrorMsg(msg); return(false); } chkColName = "sca24"; chkControl = ute_sca24;//慣用價格條件 if (GlobalFn.varIsNull(masterModel.sca24)) { this.uTab_Master.SelectedTab = uTab_Master.Tabs[1]; chkControl.Focus(); msg = TabMaster.AzaTbList.Where(p => p.aza03 == chkColName).Select(p => p.aza04).FirstOrDefault(); msg += "不可為空白"; errorProvider.SetError(chkControl, msg); WfShowErrorMsg(msg); return(false); } chkColName = "sca28"; chkControl = ute_sca28;//慣用幣別 if (GlobalFn.varIsNull(masterModel.sca28)) { this.uTab_Master.SelectedTab = uTab_Master.Tabs[1]; chkControl.Focus(); msg = TabMaster.AzaTbList.Where(p => p.aza03 == chkColName).Select(p => p.aza04).FirstOrDefault(); msg += "不可為空白"; errorProvider.SetError(chkControl, msg); WfShowErrorMsg(msg); return(false); } #endregion return(true); } catch (Exception ex) { throw ex; } }
private void WfInvalid() { vw_stpi100 masterModel = null; string msg; try { if (DrMaster == null) { return; } if (WfRetrieveMaster() == false) //這裡會LOCK資料 { return; } WfSetBllTransaction(); masterModel = DrMaster.ToItem <vw_stpi100>(); if (masterModel.scavali == "Y") { msg = "是否要作廢客戶?"; } else { msg = "是否要作廢還原客戶?"; } var result = WfShowConfirmMsg(msg); //if (WfShowConfirmMsg(msg) != 1) if (result != DialogResult.Yes) { return; } if (masterModel.scavali == "Y" || masterModel.scavali == "W")//走作廢 { DrMaster["scavali"] = "N"; } else { DrMaster["scavali"] = "Y"; } DrMaster["scamodu"] = LoginInfo.UserNo; DrMaster["scamodg"] = LoginInfo.DeptNo; DrMaster["scamodd"] = Now; BoMaster.OfUpdate(DrMaster.Table); WfCommit(); DrMaster.AcceptChanges(); WfShowBottomStatusMsg("作業成功!"); masterModel = DrMaster.ToItem <vw_stpi100>(); WfSetDocPicture(masterModel.scavali, masterModel.scaconf, "", pbxDoc); } catch (Exception ex) { WfRollback(); DrMaster.RejectChanges(); throw ex; } }