Exemplo n.º 1
0
 private void butQuit_Click(object sender, EventArgs e)
 {
     using (MB.WinBase.WaitCursor cursor = new MB.WinBase.WaitCursor(this)) {
         // timer1.Enabled = false;
         OnClickCanceled(null);
     }
 }
Exemplo n.º 2
0
        private void loadModuleComment()
        {
            using (MB.WinBase.WaitCursor cursor = new MB.WinBase.WaitCursor(this.ParentForm)) {
                if (_CommentClient == null)
                {
                    throw new MB.Util.APPException("需要配置 IBfModuleCommentClient 客户端");
                }

                if (string.IsNullOrEmpty(_ViewGridForm.ClientRuleObject.ModuleTreeNodeInfo.PriID))
                {
                    throw new MB.Util.APPException("该模块对应的权限 PriID 没有配置,请先配置");
                }

                MB.Util.Common.QueryParameterHelper parHelper = new MB.Util.Common.QueryParameterHelper();
                parHelper.AddParameterInfo("APPLICATION_IDENTITY", COMMENT_APPLICATION_IDENTITY, MB.Util.DataFilterConditions.Equal);
                parHelper.AddParameterInfo("MODULE_IDENTITY", _ViewGridForm.ClientRuleObject.ModuleTreeNodeInfo.PriID, MB.Util.DataFilterConditions.Equal);
                _LstComments = _CommentClient.GetObjects(parHelper.ToArray());

                _LstComments.Sort(new Comparison <MB.Util.Model.BfModuleCommentInfo>(commentCreateDateCompare));

                rxtModuleComment.Clear();
                foreach (var commentInfo in _LstComments)
                {
                    appendModuleComment(commentInfo);
                }
            }
        }
Exemplo n.º 3
0
        private void butLogin_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(cobUserName.Text))
            {
                MB.WinBase.MessageBoxEx.Show("登录用户不能为空,请输入!");
                return;
            }
            using (MB.WinBase.WaitCursor cursor = new MB.WinBase.WaitCursor(this)){
                //把选择的服务项存储到
                MB.Util.MyNetworkCredential.CurrentSelectedServerInfo = cobService.SelectedItem as MB.Util.Model.ServerConfigInfo;

                bool existsVersion = CheckApplicationVersion();
                if (existsVersion)
                {
                    return;
                }

                try {
                    OnClickLogin(cobUserName.Text, txtPassword.Text);
                }
                catch (Exception ex) {
                    MB.WinBase.ApplicationExceptionTerminate.DefaultInstance.ExceptionTerminate(ex);
                }
            }
        }
 private void butSure_Click(object sender, EventArgs e)
 {
     try
     {
         using (MB.WinBase.WaitCursor cursor = new MB.WinBase.WaitCursor(this))
         {
             //IDataAssistantListControl listView = _StepShowControlPane[PaneViewType.DataSelect] as IDataAssistantListControl;
             SaveSelectedCurrentPageRows();
             object[] rows = GetSelectedRows();
             if (rows == null || rows.Length == 0)
             {
                 MB.WinBase.MessageBoxEx.Show("请选择数据!");
                 return;
             }
             if (rows.Length > _MaxSelectRows)
             {
                 MB.WinBase.MessageBoxEx.Show(string.Format("选择数据超过最大设置行数{0}!", _MaxSelectRows));
                 return;
             }
             this.DialogResult = System.Windows.Forms.DialogResult.OK;
             OnAfterGetObjectData(new GetObjectDataAssistantEventArgs(rows));
             this.Close();
         }
     }
     catch (Exception ex)
     {
         MB.WinBase.ApplicationExceptionTerminate.DefaultInstance.ExceptionTerminate(ex);
     }
 }
        protected override void LoadObjectData(MB.Util.Model.QueryParameterInfo[] queryParams)
        {
            if (_ClientRuleObject == null)
            {
                throw new MB.Util.APPException("在加载浏览窗口<DefaultViewForm>时 需要配置对应的ClientRule 类!");
            }

            if (_ClientRuleObject.ClientLayoutAttribute == null)
            {
                throw new MB.Util.APPException(string.Format("对于客户段逻辑类 {0} ,需要配置 RuleClientLayoutAttribute.", _ClientRuleObject.GetType().FullName));
            }

            ITreeListViewHoster treeListHoster = _TreeListHoster;

            try {
                using (MB.WinBase.WaitCursor cursor = new MB.WinBase.WaitCursor(this)) {
                    if (_ClientRuleObject.ClientLayoutAttribute.CommunicationDataType == CommunicationDataType.DataSet)
                    {
                        throw new MB.Util.APPException("树型浏览主界面暂时不支持DataSet 的绑定", MB.Util.APPMessageType.SysErrInfo);
                    }
                    else
                    {
                        IList lstDatas = null;
                        try {
                            lstDatas = _ClientRuleObject.GetObjects((int)_ClientRuleObject.MainDataTypeInDoc, queryParams);
                        }
                        catch (Exception ex) {
                            throw MB.Util.APPExceptionHandlerHelper.PromoteException(ex, "DefaultTreeListViewForm.GetObjects 出错!");
                        }

                        if (_BindingSource == null || _RecreateTreeAfterSorting)
                        {
                            IBindingList bl = _ClientRuleObject.CreateMainBindList(lstDatas);
                            _BindingSource              = new MB.WinBase.Binding.BindingSourceEx();
                            _BindingSource.ListChanged += new ListChangedEventHandler(_BindingSource_ListChanged);
                            _BindingSource.DataSource   = bl;
                            treeListHoster.CreateTreeListViewDataBinding(trvLstMain, _BindingSource);

                            if (trvLstMain.Nodes.Count > 0)
                            {
                                trvLstMain.Nodes[0].Expanded = true;
                                trvLstMain.FocusedNode       = trvLstMain.Nodes[0];
                            }
                            _RecreateTreeAfterSorting = false;
                        }
                        else
                        {
                            treeListHoster.RefreshTreeListData(trvLstMain, lstDatas);
                        }
                    }
                    panTitle.Visible = false;
                }
            }
            catch (MB.Util.APPException aex) {
                throw aex;
            }
            catch (Exception ex) {
                throw MB.Util.APPExceptionHandlerHelper.PromoteException(ex, "在浏览窗口DefaultTreeListViewForm_Load 时出错!");
            }
        }
Exemplo n.º 6
0
 private void tButDesign_Click(object sender, EventArgs e)
 {
     using (MB.WinBase.WaitCursor cursor = new MB.WinBase.WaitCursor(this)) {
         try {
             _ReportTempleteHelper.ShowDesign(_ModuleID, trvReport.SelectedNode.Tag as MB.WinPrintReport.Model.PrintTempleteContentInfo);
         }
         catch (Exception ex) {
             MB.WinBase.ApplicationExceptionTerminate.DefaultInstance.ExceptionTerminate(ex);
         }
     }
 }
Exemplo n.º 7
0
        private void button1_Click(object sender, EventArgs e)
        {
            string   sql = "INSERT INTO MYTable(ID,Name) VALUES ({0},'{1}')";
            Database db  = MB.Orm.Persistence.DatabaseHelper.CreateDatabase();


            DateTime begin = System.DateTime.Now;

            try {
                using (MB.WinBase.WaitCursor cursor = new MB.WinBase.WaitCursor(this)) {
                    using (System.Transactions.TransactionScope scope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required)) {
                        int index = 1;
                        while (true)
                        {
                            DateTime end  = System.DateTime.Now;
                            TimeSpan span = end.Subtract(begin);
                            //if (span.TotalSeconds > 5) {
                            //    MB.Util.TraceEx.Write("正在执行长时间操作...");
                            //}
                            if (span.TotalSeconds > 100)
                            {
                                break;
                            }

                            string newsql = string.Format(sql, index++, "ABC" + index);
                            var    cmd    = db.GetSqlStringCommand(newsql);
                            db.ExecuteNonQuery(cmd);
                        }
                        scope.Complete();
                    }
                }
                MessageBox.Show("OK");
            }
            catch (Exception ex) {
                DateTime end  = System.DateTime.Now;
                TimeSpan span = end.Subtract(begin);
                MessageBox.Show("出错 总共花费:" + span.TotalMilliseconds);
                MB.Util.TraceEx.Write(ex.Message);
            }


            //string str = MB.Orm.Persistence.DatabaseHelper.GetConnectionString();
            //MB.Orm.Persistence.DatabaseHelper.SaveConnectionString("12412412414214");


            //Microsoft.Practices.EnterpriseLibrary.Data.Database db2 = MB.Orm.Persistence.DatabaseHelper.CreateDatabase();

            //MB.Util.Compression.Instance.Zip();
            //MB.Util.Compression.Instance.UnZip();
        }
 private void butPreviouss_Click(object sender, EventArgs e)
 {
     try
     {
         using (MB.WinBase.WaitCursor cursor = new MB.WinBase.WaitCursor(this))
         {
             _StepShowControlPane[PaneViewType.FilterPane].BringToFront();
             validateButton(PaneViewType.FilterPane);
             lnkChecked.Visible = false;
         }
     }
     catch (Exception ex)
     {
         MB.WinBase.ApplicationExceptionTerminate.DefaultInstance.ExceptionTerminate(ex);
     }
 }
        private void TreeViewNodesSortingForm_Load(object sender, EventArgs e)
        {
            ITreeListViewHoster treeListHoster = _TreeListHoster;

            try {
                using (MB.WinBase.WaitCursor cursor = new MB.WinBase.WaitCursor(this)) {
                    LoadDataObject();
                }
            }
            catch (MB.Util.APPException aex) {
                throw aex;
            }
            catch (Exception ex) {
                throw MB.Util.APPExceptionHandlerHelper.PromoteException(ex, "在浏览窗口TreeViewNodesSortingForm_Load 时出错!");
            }
        }
Exemplo n.º 10
0
        //
        void btnItem_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (e.Item.Tag == null)
            {
                return;
            }

            try {
                using (MB.WinBase.WaitCursor cursor = new MB.WinBase.WaitCursor()) {
                    XMenuInfo menuInfo = e.Item.Tag as XMenuInfo;
                    _CommandExecutor.ExecCommand(menuInfo.CommandID);
                }
            }
            catch (Exception ex) {
                MB.WinBase.ApplicationExceptionTerminate.DefaultInstance.ExceptionTerminate(ex);
            }
        }
Exemplo n.º 11
0
        private void tButClear_Click(object sender, EventArgs e)
        {
            DialogResult re = MB.WinBase.MessageBoxEx.Question("是否决定清除当前模板的所有评语");

            if (re != DialogResult.Yes)
            {
                return;
            }

            using (MB.WinBase.WaitCursor cursor = new MB.WinBase.WaitCursor(this.ParentForm)) {
                int v = _CommentClient.ClearObject(COMMENT_APPLICATION_IDENTITY, _ViewGridForm.ClientRuleObject.ModuleTreeNodeInfo.PriID);
                if (v > 0)
                {
                    rxtModuleComment.Clear();
                }
            }
        }
Exemplo n.º 12
0
        private void trvMainFunction_DoubleClick(object sender, EventArgs e)
        {
            try {
                using (MB.WinBase.WaitCursor cursor = new MB.WinBase.WaitCursor(this)) {
                    TreeViewHitTestInfo hitInfo = trvMainFunction.HitTest(_CurrentMovePoint);
                    if (hitInfo == null || hitInfo.Node == null)
                    {
                        return;
                    }

                    trvMainFunction.SelectedNode = hitInfo.Node;

                    ModuleTreeNodeInfo nodeInfo = hitInfo.Node.Tag as ModuleTreeNodeInfo;
                    OnBeforeDoubleClickTreeNode(new MdiMainFunctionTreeEventArgs(trvMainFunction.SelectedNode, nodeInfo));

                    if (nodeInfo == null || nodeInfo.Commands == null || nodeInfo.Commands.Count == 0)
                    {
                        return;
                    }

                    //判断是否已经打开
                    foreach (Form f in this.MdiChildren)
                    {
                        MB.WinBase.IFace.IViewGridForm iView = f as MB.WinBase.IFace.IViewGridForm;
                        if (iView == null)
                        {
                            continue;
                        }
                        if (iView.ClientRuleObject.ModuleTreeNodeInfo.Equals(nodeInfo))
                        {
                            (iView as Form).BringToFront();
                            return;
                        }
                    }

                    UICreateHelper.Instance.ShowViewGridForm(this, nodeInfo);

                    // _MenuManager.RefreshToolsButtonItem(nodeInfo);
                }
            }
            catch (Exception ex) {
                MB.WinBase.ApplicationExceptionTerminate.DefaultInstance.ExceptionTerminate(ex);
            }
        }
Exemplo n.º 13
0
        private void butSubmitComment_Click(object sender, EventArgs e)
        {
            using (MB.WinBase.WaitCursor cursor = new MB.WinBase.WaitCursor(this.ParentForm)) {
                try {
                    checkInputData();

                    MB.Util.Model.BfModuleCommentInfo newInfo = createNewCommentInfo();
                    if (_CommentClient == null)
                    {
                        throw new MB.Util.APPException("需要配置 IBfModuleCommentClient 客户端");
                    }

                    _CommentClient.AddObject(newInfo);
                    appendModuleComment(newInfo);

                    rxtInputComment.Clear();
                    rxtInputComment.Focus();
                }
                catch (Exception ex) {
                    MB.WinBase.ApplicationExceptionTerminate.DefaultInstance.ExceptionTerminate(ex);
                }
            }
        }
Exemplo n.º 14
0
        //打开焦点模块
        protected void OpenModuleByTreeNode(DevExpress.XtraTreeList.Nodes.TreeListNode treeNode, ModuleOpenState openState)
        {
            try {
                using (MB.WinBase.WaitCursor cursor = new MB.WinBase.WaitCursor(this)) {
                    ModuleTreeNodeInfo nodeInfo = GetFocusedNodeInfo(treeNode);
                    OnBeforeDoubleClickTreeNode(new MdiMainFunctionTreeEventArgs(null, nodeInfo));

                    if (nodeInfo == null || nodeInfo.Commands == null || nodeInfo.Commands.Count == 0)
                    {
                        return;
                    }

                    //判断是否已经打开
                    foreach (Form f in this.MdiChildren)
                    {
                        MB.WinBase.IFace.IForm iView = f as MB.WinBase.IFace.IForm;
                        if (iView == null)
                        {
                            continue;
                        }
                        if (iView.ClientRuleObject.ModuleTreeNodeInfo.ID == nodeInfo.ID)
                        {
                            (iView as Form).BringToFront();
                            return;
                        }
                    }

                    UICreateHelper.Instance.ShowViewGridForm(this, nodeInfo, openState);

                    recordUserActivity(nodeInfo);
                }
            }
            catch (Exception ex) {
                MB.WinBase.ApplicationExceptionTerminate.DefaultInstance.ExceptionTerminate(ex);
            }
        }
Exemplo n.º 15
0
        //打开焦点模块
        protected void OpenFavoritesModuleByTreeNode(DevExpress.XtraTreeList.Nodes.TreeListNode treeNode)
        {
            try
            {
                using (MB.WinBase.WaitCursor cursor = new MB.WinBase.WaitCursor(this))
                {
                    if (treeNode.Nodes.Count > 0)
                    {
                        return;
                    }

                    ModuleTreeNodeInfo nodeInfo = GetFocusedFavoritesModuleId(treeNode);

                    //判断是否已经打开
                    foreach (Form f in this.MdiChildren)
                    {
                        MB.WinBase.IFace.IViewGridForm iView = f as MB.WinBase.IFace.IViewGridForm;
                        if (iView == null)
                        {
                            continue;
                        }
                        if (iView.ClientRuleObject.ModuleTreeNodeInfo.ID == nodeInfo.ID)
                        {
                            (iView as Form).BringToFront();
                            return;
                        }
                    }

                    UICreateHelper.Instance.ShowViewGridForm(this, nodeInfo);
                }
            }
            catch (Exception ex)
            {
                MB.WinBase.ApplicationExceptionTerminate.DefaultInstance.ExceptionTerminate(ex);
            }
        }
Exemplo n.º 16
0
        void bindingNavMain_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            using (MB.WinBase.WaitCursor cursor = new MB.WinBase.WaitCursor(this)) {
                tsbHideTextBox.Focus();
                try {
                    if (e.ClickedItem.Equals(bntMoveFirstItem))
                    {
                        moveFocusPosition(GridDataRowMoveType.First);

                        //OnBindingSourcePositionChanging(0);
                    }
                    else if (e.ClickedItem.Equals(bntMovePreviousItem))
                    {
                        moveFocusPosition(GridDataRowMoveType.Prev);
                        // OnBindingSourcePositionChanging(_BindingSource.Position);
                    }
                    else if (e.ClickedItem.Equals(bntMoveNextItem))
                    {
                        moveFocusPosition(GridDataRowMoveType.Next);
                        // OnBindingSourcePositionChanging(_BindingSource.Position + 1);
                    }
                    else if (e.ClickedItem.Equals(bntMoveLastItem))
                    {
                        moveFocusPosition(GridDataRowMoveType.Last);
                        //OnBindingSourcePositionChanging(_BindingSource.Count - 1);
                    }
                    else if (e.ClickedItem.Equals(bntAddNewItem))
                    {
                        AddNew();
                    }
                    else if (e.ClickedItem.Equals(bntCancelItem))
                    {
                        Cancel();
                    }
                    else if (e.ClickedItem.Equals(bntSaveItem))
                    {
                        Save();
                    }
                    else if (e.ClickedItem.Equals(bntDeleteItem))
                    {
                        Delete();
                    }
                    else if (e.ClickedItem.Equals(bntSubmitItem))
                    {
                        if (_BindingSource.Current == null)
                        {
                            return;
                        }
                        MB.Util.Model.EntityState entityState = MB.WinBase.UIDataEditHelper.Instance.GetEntityState(_BindingSource.Current);
                        if (entityState == MB.Util.Model.EntityState.Modified)
                        {
                            throw MB.Util.APPExceptionHandlerHelper.CreateDisplayToUser("单据数据已经发生改变,请先保存");
                        }
                        Submit();
                    }
                    else if (e.ClickedItem.Equals(bntCancelSubmitItem))
                    {
                        CancelSubmit();
                    }
                    else if (e.ClickedItem.Equals(butExtendItem))
                    {
                        if (_ExtendToolStripButtonMenu != null)
                        {
                            _ExtendToolStripButtonMenu.Show(this, new Point(butExtendItem.Bounds.X, butExtendItem.Height));
                        }
                    }
                    else
                    {
                    }
                    OnToolsButtonValidate();
                }
                catch (Exception ex) {
                    MB.WinBase.ApplicationExceptionTerminate.DefaultInstance.ExceptionTerminate(ex);
                }
            }
        }
Exemplo n.º 17
0
        protected override void LoadObjectData(MB.Util.Model.QueryParameterInfo[] queryParams)
        {
            if (_ClientRuleObject == null)
            {
                throw new MB.Util.APPException("在加载浏览窗口<DefaultViewForm>时 需要配置对应的ClientRule 类!");
            }

            if (_ClientRuleObject.ClientLayoutAttribute == null)
            {
                throw new MB.Util.APPException(string.Format("对于客户段逻辑类 {0} ,需要配置 RuleClientLayoutAttribute.", _ClientRuleObject.GetType().FullName));
            }



            try {
                //添加右键菜单扩展
                if (_ClientRuleObject.ReSetContextMenu != null)
                {
                    grdCtlMain.ContextMenu = _ClientRuleObject.ReSetContextMenu;
                    //else {
                    //    grdCtlMain.ContextMenu.MenuItems.Add(new MenuItem("-"));
                    //    foreach (MenuItem item in _ClientRuleObject.ReSetContextMenu.MenuItems) {
                    //        grdCtlMain.ContextMenu.MenuItems.Add(item);
                    //    }
                    //}
                }

                string messageHeaderKey = string.Empty;

                if (_ClientRuleObject.ClientLayoutAttribute.LoadType == ClientDataLoadType.ReLoad)
                {
                    messageHeaderKey = _ClientRuleObject.ClientLayoutAttribute.MessageHeaderKey;
                }


                gridViewMain.RowHeight = MB.WinBase.LayoutXmlConfigHelper.Instance.GetMainGridViewRowHeight(_ClientRuleObject.ClientLayoutAttribute.UIXmlConfigFile);
                using (MB.WinBase.WaitCursor cursor = new MB.WinBase.WaitCursor(this)) {
                    using (MethodTraceWithTime timeTrack = new MethodTraceWithTime(null)) {
                        //特殊说明 2009-02-20 在这里需要增加 RefreshLookupDataSource 以便在加载数据ID 时能得到对应的描述信息。
                        if (_ClientRuleObject.ClientLayoutAttribute.CommunicationDataType == CommunicationDataType.DataSet)
                        {
                            throw new MB.Util.APPException("当前不支持基于DataSet 的网格编辑", MB.Util.APPMessageType.SysErrInfo);
                        }
                        else
                        {
                            IList lstDatas = null;
                            try {
                                using (QueryBehaviorScope scope = new QueryBehaviorScope(_ClientRuleObject.CurrentQueryBehavior, messageHeaderKey)) {
                                    lstDatas = _ClientRuleObject.GetObjects((int)_ClientRuleObject.MainDataTypeInDoc, queryParams);
                                }
                            }
                            catch (Exception ex) {
                                throw MB.Util.APPExceptionHandlerHelper.PromoteException(ex, " 在加载编辑网格窗口获取数据时执行业务类的 GetObjects 出错");
                            }

                            //IGridViewEditRule gridViewEditRule = _ClientRuleObject as IGridViewEditRule;
                            //if (gridViewEditRule == null)
                            //    throw new MB.Util.APPException("所有基于Mid 子窗口网格编辑的业务类必须实现IGridViewEditRule 接口", MB.Util.APPMessageType.SysErrInfo);

                            if (_BindingSource == null)
                            {
                                IBindingList bl = _ClientRuleObject.CreateMainBindList(lstDatas);
                                _BindingSource              = new MB.WinBase.Binding.BindingSourceEx();
                                _BindingSource.ListChanged += new ListChangedEventHandler(_BindingSource_ListChanged);
                                _BindingSource.AddingNew   += new AddingNewEventHandler(_BindingSource_AddingNew);
                                _BindingSource.DataSource   = bl;

                                MB.WinBase.Common.GridViewLayoutInfo gridViewLayoutInfo = MB.WinBase.LayoutXmlConfigHelper.Instance.GetGridColumnLayoutInfo(_ClientRuleObject.ClientLayoutAttribute.UIXmlConfigFile, string.Empty);
                                var detailBindingParams = new MB.XWinLib.GridDataBindingParam(grdCtlMain, _BindingSource, false);
                                MB.XWinLib.XtraGrid.XtraGridEditHelper.Instance.CreateEditXtraGrid(detailBindingParams, _ClientRuleObject.UIRuleXmlConfigInfo.GetDefaultColumns(), _ClientRuleObject.UIRuleXmlConfigInfo.ColumnsCfgEdit, gridViewLayoutInfo);
                            }
                            else
                            {
                                MB.XWinLib.XtraGrid.XtraGridHelper.Instance.RefreshDataGrid(grdCtlMain, lstDatas);
                            }
                            #region 刷新status strip

                            int    rowCount = (lstDatas == null ? 0 : lstDatas.Count);
                            var    msg      = string.Format("查询花费:{0} 毫秒,返回 {1} 记录,查询时间:{2}", timeTrack.GetExecutedTimes(), rowCount, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                            string totalPageandCurrentPage = GetTotalPageAndCurrentpage(rowCount);

                            //刷新查询消息
                            labTitleMsg.Text = msg;

                            //刷新上一页/下一页
                            lnkNextPage.Enabled     = rowCount >= _ClientRuleObject.CurrentQueryBehavior.PageSize;
                            lnkPreviousPage.Enabled = _ClientRuleObject.CurrentQueryBehavior.PageIndex > 0;

                            //刷新总页数
                            labTotalPageNumber.Visible   = IsTotalPageDisplayed;
                            labCurrentPageNumber.Visible = IsTotalPageDisplayed;
                            if (this.IsTotalPageDisplayed)
                            {
                                string[] totalPage_currentPage = totalPageandCurrentPage.Split(',');
                                labTotalPageNumber.Text   = string.Format("共{0}页", totalPage_currentPage[0]);
                                labCurrentPageNumber.Text = string.Format("第{0}页", totalPage_currentPage[1]);
                            }


                            #endregion
                            _ClientRuleObject.BindingSource = _BindingSource;
                        }
                        panTitle.Visible = false;
                    }
                }

                //在GRIDVIEW创建完成以后
                //根据UI RULE来判断GRID的编辑状态,是否允许新增,修改,删除
                DevExpress.XtraGrid.Views.Grid.GridView mainView = grdCtlMain.MainView as DevExpress.XtraGrid.Views.Grid.GridView;
                if (_ClientRuleObject != null)
                {
                    var rejectCfg = MB.WinBase.Atts.AttributeConfigHelper.Instance.GetModuleRejectCommands(_ClientRuleObject.GetType());
                    if (rejectCfg != null)
                    {
                        if ((rejectCfg.RejectCommands & UICommandType.AddNew) != 0)
                        {
                            mainView.OptionsBehavior.AllowAddRows   = DevExpress.Utils.DefaultBoolean.False;
                            mainView.OptionsView.NewItemRowPosition = DevExpress.XtraGrid.Views.Grid.NewItemRowPosition.None;
                        }
                        else
                        {
                            mainView.OptionsBehavior.AllowAddRows   = DevExpress.Utils.DefaultBoolean.True;
                            mainView.OptionsView.NewItemRowPosition = DevExpress.XtraGrid.Views.Grid.NewItemRowPosition.Bottom;
                        }

                        if ((rejectCfg.RejectCommands & UICommandType.Edit) != 0)
                        {
                            mainView.OptionsBehavior.ReadOnly = true;
                            mainView.OptionsBehavior.Editable = false;
                        }
                        else
                        {
                            mainView.OptionsBehavior.ReadOnly = false;
                            mainView.OptionsBehavior.Editable = true;
                        }

                        if ((rejectCfg.RejectCommands & UICommandType.Delete) != 0)
                        {
                            mainView.OptionsBehavior.AllowDeleteRows = DevExpress.Utils.DefaultBoolean.False;
                        }
                        else
                        {
                            mainView.OptionsBehavior.AllowDeleteRows = DevExpress.Utils.DefaultBoolean.True;
                        }
                    }
                }
            }
            catch (MB.Util.APPException aex) {
                throw aex;
            }
            catch (Exception ex) {
                throw MB.Util.APPExceptionHandlerHelper.PromoteException(ex, "加载网格浏览编辑窗口Form_Load 时出错");
            }
        }
Exemplo n.º 18
0
 private void tButPreview_Click(object sender, EventArgs e)
 {
     using (MB.WinBase.WaitCursor cursor = new MB.WinBase.WaitCursor(this)) {
         _ReportTempleteHelper.ShowPreview(_ModuleID, _PrintTemplete);
     }
 }
        private void queryFilterData()
        {
            try
            {
                ucFilterCondition filterCtl = _StepShowControlPane[PaneViewType.FilterPane] as ucFilterCondition;
                MB.Util.Model.QueryParameterInfo[] filters = filterCtl.GetQueryParameters();

                List <QueryParameterInfo> tempFilters = new List <QueryParameterInfo>(filters);

                //判断如果是自定义的条件,在查询的时候,需要再加上这个条件
                if (_FilterParametersIfNoFiterPanel != null && _FilterParametersIfNoFiterPanel.Count > 0)
                {
                    tempFilters.AddRange(_FilterParametersIfNoFiterPanel);
                    filters = tempFilters.ToArray();
                }


                if (filters == null || filters.Length == 0)
                {
                    if (!filterCtl.AllowEmptyFilter)
                    {
                        MB.WinBase.MessageBoxEx.Show("请至少输入一个数据过滤的条件!");
                        return;
                    }
                    else
                    {
                        MB.Util.Model.QueryParameterInfo allFilter = new MB.Util.Model.QueryParameterInfo("0", "0", MB.Util.DataFilterConditions.Special);
                        filters = new MB.Util.Model.QueryParameterInfo[] { allFilter };
                    }
                }
                //modify by aifang 2012-04-17 支持树型控件数据助手选择
                //ucDataCheckListView listView = _StepShowControlPane[PaneViewType.DataSelect] as ucDataCheckListView;
                IDataAssistantListControl listView = _StepShowControlPane[PaneViewType.DataSelect] as IDataAssistantListControl;
                //modify by aifang 2012-04-17 支持树型控件数据助手选择

                listView.MultiSelect       = _MultiSelect;
                listView.ColumnEditCfgInfo = _ClumnEditCfgInfo;
                lnkChecked.Visible         = _MultiSelect;

                using (MB.WinBase.WaitCursor cursor = new MB.WinBase.WaitCursor(this))
                {
                    int mainType = 0;
                    if (_ClientRule.MainDataTypeInDoc != null)
                    {
                        mainType = (int)_ClientRule.MainDataTypeInDoc;
                    }

                    //获得动态列的MessageKey
                    string messageHeaderKey = string.Empty;
                    if (_ClientRule.ClientLayoutAttribute.LoadType == ClientDataLoadType.ReLoad)
                    {
                        messageHeaderKey = _ClientRule.ClientLayoutAttribute.MessageHeaderKey;
                    }

                    //添加动态列消息头
                    MB.XWinLib.XtraGrid.XtraGridDynamicHelper.Instance.AppendQueryBehaviorColumns(_ClientRule);

                    using (QueryBehaviorScope scope = new QueryBehaviorScope(_ClientRule.CurrentQueryBehavior, messageHeaderKey))
                    {
                        var lstDatas = this.GetFilterObjects(mainType, new List <MB.Util.Model.QueryParameterInfo>(filters));
                        if (lstDatas != null && lstDatas.Count > 0)
                        {
                            listView.SetDataSource(_ClientRule, lstDatas);
                            _StepShowControlPane[PaneViewType.DataSelect].BringToFront();
                            validateButton(PaneViewType.DataSelect);
                            validatedPageControl((lstDatas as IList).Count);
                        }
                        else
                        {
                            MB.WinBase.MessageBoxEx.Show("根据该条件查找不到数据,请重试!");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MB.WinBase.ApplicationExceptionTerminate.DefaultInstance.ExceptionTerminate(ex);
            }
        }