protected virtual Boolean WfToolbarExecute() { BindingMaster.EndEdit(); string filePath = ""; try { this.errorProvider.Clear(); if (!TabMaster.IsAutoExecuted) //不做條件檢查 --主要由他窗引用 { if (this.WfFormCheck() == false) { //WfRollback(); return(false); } if (this.WfAfterFormCheck() == false) { //WfRollback(); return(false); } } if (GlobalFn.varIsNull(TabMaster.ReportName)) { WfShowErrorMsg("未設定來源報表"); } filePath = Application.StartupPath + @"\reports\" + TabMaster.ReportName; if (!File.Exists(filePath)) { WfShowErrorMsg("無此來源報表路徑!"); } Stimulsoft.Report.StiReport rpt = new Stimulsoft.Report.StiReport(); rpt.Load(filePath); rpt.ReportName = this.AdoModel.ado10; //產生資料來源 if (this.WfExecReport(rpt) == false) { //WfRollback(); return(false); } rpt.Compile(); rpt["ReportId"] = this.StrFormID; rpt["CompNo"] = this.LoginInfo.CompNo; rpt["CompNameA"] = this.LoginInfo.CompNameA; rpt["DeptNo"] = this.LoginInfo.DeptNo; rpt["DeptName"] = this.LoginInfo.DeptName; rpt["UserNo"] = this.LoginInfo.UserNo; rpt["UserName"] = this.LoginInfo.UserName; if (WfExecReportEnd(rpt) == false) { return(false); } FrmReportDisplayBase rptDisplayBase = new FrmReportDisplayBase(rpt); //rptDisplayBase.stiViewerControl1.ClickPrintButton += stiViewerControl1_ClickPrintButton; //rptDisplayBase.stiViewerControl1.ClickPrintButton += new System.EventHandler(this.stiViewerControl1_ClickPrintButton); rptDisplayBase.stiViewerControl1.Report.CompiledReport.Printed += new EventHandler(report_Print); rptDisplayBase.Show(); if (TabMaster.IsCloseAfterExecuted) { this.Close(); } //if (TabMaster.IsCloseAfterExecuted) // this.Close(); } catch (Exception ex) { throw ex; } finally { //this.Cursor = Cursors.Default; //改到工具列處理 } return(true); }
//*****************************覆寫 功能**************************************** #region WfToolbarSave() : 主表存檔 function --覆寫 存檔功能 /// <summary> /// 主表存檔 function /// </summary> /// <returns></returns> protected override Boolean WfToolbarSave() { uGridMaster.PerformAction(UltraGridAction.ExitEditMode); uGridMaster.UpdateData(); BindingMaster.EndEdit(); if (DrMaster == null) { WfShowErrorMsg("查無要存檔的資料!"); return(false); } try { //if (BOMASTER.TRAN==null) //{ // if (this.WfBeginTran() == false) // { return false; } //} WfSetBllTransaction(); this.errorProvider.Clear(); if (this.WfFormCheck() == false) { //WfRollback(); return(false); } if (this.WfAfterFormCheck() == false) { //WfRollback(); return(false); } //if (this.TabMaster.DtSource.GetChanges() != null) //{ // if (this.TabMaster.BoBasic.OfUpdate(BOMASTER.TRAN, this.TabMaster.DtSource.GetChanges()) < 0) // { // { throw new Exception("儲存主表時失敗(boBasic.of_update),請檢核 !"); } // } //} if (!this.WfAppendUpdate()) { throw (new Exception("同步資料時發生錯誤(wf_append_update),請檢核 !")); } //if (this.WfCommit() == false) //{ throw new Exception("確認 (commit) 交易時發生錯誤,請檢核 !"); } } catch (Exception ex) { //this.WfRollback(); throw ex; } finally { //this.Cursor = Cursors.Default; //改到工具列處理 } this.TabMaster.DtSource.AcceptChanges(); this.FormEditMode = YREditType.NA; WfShowRibbonGroup(FormEditMode, TabMaster.IsCheckSecurity, TabMaster.AddTbModel); WfShowBottomStatusMsg("存檔成功!"); this.IsChanged = false; this.DialogResult = DialogResult.Yes; this.Close(); return(true); }
protected virtual void UtbmMain_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e) { try { this.Cursor = Cursors.WaitCursor; WfCleanBottomMsg(); switch (e.Tool.Key.ToLower()) { case "btok": if (WfToolbarExecute() == false) { return; } break; case "btcancel": this.Close(); break; case "btclean": TabMaster.DtSource.Clear(); DrMaster = TabMaster.DtSource.NewRow(); TabMaster.DtSource.Rows.Add(DrMaster); WfSetMasterRowDefault(DrMaster); BindingMaster.EndEdit(); break; case "bthome": var frmMenu = Application.OpenForms .Cast <System.Windows.Forms.Form>() .Where(p => p.Name.ToLower() == "frmmenu" || p.Name.ToLower() == "frmprogramlist") //mdi或sdi .First() ; if (frmMenu != null) { frmMenu.BringToFront(); if (!frmMenu.IsMdiChild) { frmMenu.WindowState = FormWindowState.Maximized; } } break; case "btfrmnavigator": WfOpenFrmNavigator(); break; case "btexit": this.Close(); break; } } catch (Exception ex) { WfShowErrorMsg(ex.Message); } finally { IsInSaveCancle = false; IsInCRUDIni = false; this.Cursor = Cursors.Default; } }