Пример #1
0
        internal void AddOutcome()
        {
            OutcomeRegister outcomeRegister = null;

            try
            {
                outcomeRegister = new OutcomeRegister(dbName);
                if (outcomeRegister.IsDisposed)
                {
                    return;
                }
                outcomeRegister.StartPosition = FormStartPosition.CenterParent;
                dialogResult = outcomeRegister.ShowDialog();
                if (dialogResult.Equals(DialogResult.Cancel))
                {
                    return;
                }
                RefreshControlInner();
            }
            catch (MofException ex)
            {
                System.Diagnostics.Debug.WriteLine("Явсан бичгийн мэдээллийг нэмэхэд алдаа гарлаа: " + ex.Message);
                throw new MofException(ex.Message, ex);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Явсан бичгийн мэдээллийг нэмэхэд алдаа гарлаа: " + ex.Message);
                throw new MofException("Явсан бичгийн мэдээллийг нэмэхэд алдаа гарлаа!", ex);
            }
            finally { outcomeRegister = null; dialogResult = DialogResult.Cancel; }
        }
Пример #2
0
        private void EditOutcome()
        {
            DialogResult    dialogResult    = DialogResult.Cancel;
            OutcomeRegister outcomeRegister = null;
            DataTable       dataTab         = null;

            try
            {
                if (treeList.FocusedNode == null)
                {
                    return;
                }
                if (treeList.FocusedNode["PkId"] == null)
                {
                    return;
                }
                if (string.IsNullOrEmpty(treeList.FocusedNode["PkId"].ToString()))
                {
                    return;
                }
                if (!bool.Parse(treeList.FocusedNode["Status"].ToString()))
                {
                    return;
                }

                if (Tool.permissionId.Equals(decimal.One))
                {
                }
                else if (treeList.FocusedNode.ParentNode == null)
                {
                    Tool.ShowInfo("Бичгийн эх хувийг засах боломжгүй. Засах бол бичгийн хэрэгт хандана уу.");
                    return;
                }
                else if (Tool.permissionId.Equals(2))
                {
                    if (!Tool.userBrId.Equals(decimal.Parse(treeList.FocusedNode["ToBrId"].ToString())))
                    {
                        Tool.ShowInfo("Зөвхөн өөрийн хэлтэстээс явсан мэдээллийг зассан уу.");
                        return;
                    }
                }
                else if (Tool.permissionId.Equals(3))
                {
                    dataTab = MainPage.branchInfo.Select(string.Format("BR_MAIN_ID1 = {0}", Tool.userMainBrId)).CopyToDataTable();
                    if (dataTab.Select(string.Format("BR_ID = {0}", treeList.FocusedNode["ToBrId"])).Length.Equals(0))
                    {
                        Tool.ShowInfo("Зөвхөн өөрийн газраас явсан мэдээллийг зассан уу.");
                        return;
                    }
                }
                else if (Tool.permissionId.Equals(4))
                {
                    if (MainPage.availableUsers.Select(string.Format("ST_ID = {0}", treeList.FocusedNode["ToStaffId"])).Length.Equals(0))
                    {
                        Tool.ShowInfo("Зөвхөн удирдах албаас явсан мэдээллийг зассан уу.");
                        return;
                    }
                }
                else if (Tool.permissionId.Equals(5))
                {
                    if (!Tool.userStaffId.Equals(decimal.Parse(treeList.FocusedNode["ToStaffId"].ToString())))
                    {
                        Tool.ShowInfo("Зөвхөн өөрийн илгээсэн мэдээллийг зассан уу.");
                        return;
                    }
                }
                else
                {
                    throw new MofException("Эрхийн код олдсонгүй!");
                }

                outcomeRegister = new OutcomeRegister(dbName, listDocument.SingleOrDefault(t => t.PkId.Equals(decimal.Parse(treeList.FocusedNode["PkId"].ToString()))));
                if (outcomeRegister.IsDisposed)
                {
                    return;
                }
                outcomeRegister.StartPosition = FormStartPosition.CenterParent;
                dialogResult = outcomeRegister.ShowDialog();
                if (dialogResult.Equals(DialogResult.Cancel))
                {
                    return;
                }
                RefreshControlInner();
            }
            catch (MofException ex)
            {
                System.Diagnostics.Debug.WriteLine("Явсан бичиг засахад алдаа гарлаа: " + ex.Message);
                throw ex;
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Явсан бичиг засахад алдаа гарлаа: " + ex.Message);
                throw new MofException("Явсан бичиг засахад алдаа гарлаа!", ex);
            }
            finally { outcomeRegister = null; dataTab = null; }
        }