Example #1
0
        private void SubMenuItem_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem    menuItem             = null;
            OrganizationInfoList organizationInfoList = null;

            Report.ReportEntry reportEntry = null;
            try
            {
                menuItem = sender as ToolStripMenuItem;
                if (menuItem.Tag.Equals(0))
                {
                    QuitPage();
                }
                else if (menuItem.Tag.Equals(1))
                {
                    DrawContent(FormType.IncomeList);
                }
                else if (menuItem.Tag.Equals(2))
                {
                    organizationInfoList = new OrganizationInfoList(dbName, null);
                    organizationInfoList.StartPosition = FormStartPosition.CenterParent;
                    organizationInfoList.ShowDialog();
                }
                else if (menuItem.Tag.Equals(3))
                {
                    DrawContent(FormType.OutcomeList);
                }
                else if (menuItem.Tag.Equals(4))
                {
                    reportEntry = new Report.ReportEntry(DocumentType.Income, dbName);
                    reportEntry.StartPosition = FormStartPosition.CenterParent;
                    reportEntry.ShowDialog();
                }
                else if (menuItem.Tag.Equals(5))
                {
                    reportEntry = new Report.ReportEntry(DocumentType.Outcome, dbName);
                    reportEntry.StartPosition = FormStartPosition.CenterParent;
                    reportEntry.ShowDialog();
                }
                else if (menuItem.Tag.Equals(6))
                {
                    DrawContent(FormType.DomesticList);
                }
            }
            catch (MofException ex)
            {
                System.Diagnostics.Debug.WriteLine("(MainPage)Менюний товч дарахад алдаа гарлаа: " + ex.Message);
                Tool.ShowError(ex.Message, ex.InnerException.Message);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("(MainPage)Менюний товч дарахад алдаа гарлаа: " + ex.Message);
                Tool.ShowError("Хуудсанд алдаа гарлаа!", ex.Message);
            }
            finally { menuItem = null; organizationInfoList = null; reportEntry = null; }
        }
Example #2
0
        private void btn_Click(object sender, EventArgs e)
        {
            SimpleButton                btn = null;
            OrganizationInfoList        organizationInfoList = null;
            Dictionary <string, string> filter = null;
            DataTable    info         = null;
            DialogResult dialogResult = DialogResult.Cancel;

            try
            {
                btn = sender as SimpleButton;
                if (btn.Tag.Equals(0))
                {
                    organizationInfoList = new OrganizationInfoList(dbName, decimal.Parse(lkUpLocation.EditValue.ToString()));
                    organizationInfoList.StartPosition = FormStartPosition.CenterParent;
                    dialogResult = organizationInfoList.ShowDialog();
                    if (dialogResult.Equals(DialogResult.Cancel))
                    {
                        return;
                    }
                    else
                    {
                        filter = new Dictionary <string, string>();
                        filter.Add("STATUS", "='Y'");
                        SqlConnector.ResetConnection(dbName);
                        info = SqlConnector.GetTable(dbName, "OrganizationType", new List <String>()
                        {
                            "PKID", "PARENTPKID", "NAME"
                        }, filter);
                        locationDt     = info.Select("PARENTPKID IS NULL").CopyToDataTable();
                        organizationDt = info.Select("PARENTPKID IS NOT NULL").CopyToDataTable();

                        lkUpLocation.Properties.DataSource     = locationDt;
                        lkUpLocation.EditValue                 = organizationInfoList.locationPkId;
                        lkUpOrganization.Properties.DataSource = organizationDt.Select(string.Format("PARENTPKID = {0}", organizationInfoList.locationPkId)).CopyToDataTable();
                        lkUpOrganization.EditValue             = organizationInfoList.organizationPkId;

                        lciOrganization.Control.Enabled = true;
                    }
                }
            }
            catch (MofException ex)
            {
                System.Diagnostics.Debug.WriteLine("Товч дарахад алдаа гарлаа: " + ex.Message);
                Tool.ShowError(ex.Message, ex.InnerException.Message);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Товч дарахад алдаа гарлаа: " + ex.Message);
                Tool.ShowError("Товч дарахад алдаа гарлаа!", ex.Message);
            }
            finally { btn = null; organizationInfoList = null; filter = null; info = null; }
        }