Esempio n. 1
0
        protected override void WfSaveCancel()
        {
            try
            {
                //if (BOMASTER.TRAN != null)
                //    WfRollback();//TODO:先全部都ROLLBACK
                IsInSaveCancle = true;

                this.errorProvider.Clear();
                BindingMaster.CancelEdit();
                TabMaster.DtSource.RejectChanges();

                this.DialogResult = DialogResult.Cancel;
                this.Close();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                this.FormEditMode = YREditType.NA;
                WfShowRibbonGroup(FormEditMode, TabMaster.IsCheckSecurity, TabMaster.AddTbModel);
                this.IsChanged      = false;
                this.IsInSaveCancle = false;
            }
        }
Esempio n. 2
0
        void uTree_AfterActivate(object sender, NodeEventArgs e)
        {
            string gba01;

            try
            {
                //if (_isInDeleteing == true)
                //    return;

                if (e.TreeNode == null)//有可能連根節點都刪掉了
                {
                    return;
                }

                gba01 = e.TreeNode.Key;
                var position = BindingMaster.Find("gba01", gba01);
                if (position == -1)
                {
                    return;
                }
                BindingMaster.Position = position;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 3
0
 void ultraTree1_AfterActivate(object sender, NodeEventArgs e)
 {
     try
     {
         var activeNode = e.TreeNode;
         if (!GlobalFn.varIsNull(e.TreeNode.Cells["keySelf"].Value))
         {
             int position = BindingMaster.Find("keySelf", e.TreeNode.Cells["keySelf"].Value.ToString());
             if (position >= 0)
             {
                 BindingMaster.Position = position;
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 4
0
        //*****************************覆寫 功能****************************************

        #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);
        }
Esempio n. 5
0
        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);
        }
Esempio n. 6
0
        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;
            }
        }