コード例 #1
0
        private void PostingEnabledDisabled(bool EnableDisable, string CompanyCode)
        {
            Int32 Long1 = 0;
            Int32 Long2 = 0;
            Int32 Long3 = 0;

            clsToolkit.EncodeOpCode(97, out Long1, out Long2, out Long3);

            IToolkit2 oToolkit2 = (IToolkit2) new Enterprise01.Toolkit();

            int resToolkit = oToolkit2.OpenToolkit();

            if (resToolkit == 0)
            {
                IHashFunctions oHashFunctions = (IHashFunctions)oToolkit2.Functions;

                clsIniFile ini = new clsIniFile();

                ini.IniFiles(ExchequerPath + "\\SQLConfig.ini");

                if (EnableDisable)
                {
                    // Posting Enabled String
                    string CompStatus = CompanyCode.TrimEnd() + "=1";
                    ini.WriteString("Posting", "SQLDaybookPosting-" + CompanyCode.TrimEnd(), oHashFunctions.HashText(CompStatus, ""));
                }
                else
                {
                    string CompStatus = CompanyCode.TrimEnd() + "=2";
                    ini.WriteString("Posting", "SQLDaybookPosting-" + CompanyCode.TrimEnd(), oHashFunctions.HashText(CompStatus, ""));
                }
            }

            resToolkit = oToolkit2.CloseToolkit();

            oToolkit2 = null;
        }
コード例 #2
0
        private void PostingEnabledDisabled(bool EnableDisable, bool Cancelled)
        {
            Int32 Long1 = 0;
            Int32 Long2 = 0;
            Int32 Long3 = 0;

            clsToolkit.EncodeOpCode(97, out Long1, out Long2, out Long3);

            IToolkit2 oToolkit2 = (IToolkit2) new Enterprise01.Toolkit();

            int resToolkit = oToolkit2.OpenToolkit();

            if (resToolkit == 0)
            {
                IHashFunctions oHashFunctions = (IHashFunctions)oToolkit2.Functions;

                clsIniFile ini = new clsIniFile();

                ini.IniFiles(ExchequerPath + "\\SQLConfig.ini");

                if (EnableDisable)
                {
                    // Posting Enabled String
                    string CompStatus = CompanyCode.TrimEnd() + "=1";
                    ini.WriteString("Posting", "SQLDaybookPosting-" + CompanyCode.TrimEnd(), oHashFunctions.HashText(CompStatus, ""));
                    MessageBox.Show("SQL Posting Optimisations are enabled for this company", "Exchequer SQL Data Validation Tool", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    // if not cancelled show message or export file
                    if (!Cancelled)
                    {
                        string CompStatus = CompanyCode.TrimEnd() + "=2";
                        ini.WriteString("Posting", "SQLDaybookPosting-" + CompanyCode.TrimEnd(), oHashFunctions.HashText(CompStatus, ""));

                        if (!HookEnabled)
                        {
                            MessageBox.Show("Unfortunately due to High Severity items being found you will be unable to use the SQL Posting Optimisations." + "\n" + "Please send the results to your Exchequer support provider to allow the issues to be investigated.", "Exchequer SQL Data Validation Tool", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                            frmExportEmail frmExport = new frmExportEmail();

                            frmExport.Text = "Save Results";
                            frmExport.ChangeButtonText("Save Results");

                            frmExport.ExchequerPath = ExchequerPath;
                            frmExport.VersionInfo   = tssVersion.Text;
                            frmExport.ExchequerCommonSQLConnection = ExchequerCommonSQLConnection;
                            frmExport.CompanyCode = CompanyCode;
                            // ABSEXCH-20380 - NullReferenceException when saving results in DVT following database connection changes
                            frmExport.ConnPassword = connPassword;
                            frmExport.ShowDialog();
                        }
                    }
                    else
                    {
                        string CompStatus = CompanyCode.TrimEnd() + "=0";
                        ini.WriteString("Posting", "SQLDaybookPosting-" + CompanyCode.TrimEnd(), oHashFunctions.HashText(CompStatus, ""));
                    }
                }
            }
        }
コード例 #3
0
        public void GetCompanies()
        {
            Int32 Long1 = 0;
            Int32 Long2 = 0;
            Int32 Long3 = 0;

            clsToolkit.EncodeOpCode(97, out Long1, out Long2, out Long3);

            IToolkit2 oToolkit2 = (IToolkit2) new Enterprise01.Toolkit();

            for (int i = 1; i <= oToolkit2.Company.cmCount; i++)
            {
                ICompanyDetail2 oCompanyDetail = (ICompanyDetail2)oToolkit2.Company.cmCompany[i];

                if (oCompanyDetail.coCode == CompanyCode)
                {
                    oToolkit2.Configuration.DataDirectory = oCompanyDetail.coPath;
                    CompanyPath = oCompanyDetail.coPath.TrimEnd();

                    // Create flag file to show posting check is running
                    fileString = Path.Combine(CompanyPath, "SQLPost.lck");

                    if (!File.Exists(fileString))
                    {
                        using (FileStream fs = File.Create(fileString))
                        {
                        }
                    }
                    else
                    {
                        MessageBox.Show("A Data Validation check is currently in progress.");
                        Application.Exit();
                    }

                    break;
                }
            }

            oToolkit2.Configuration.SetDebugMode(Long1, Long2, Long3);

            // Check if Multi-Locations, CC/Depts, Stock and Committment Accounting are enabled company
            int resToolkit = oToolkit2.OpenToolkit();

            if (resToolkit == 0)
            {
                if (oToolkit2.Enterprise.enModuleVersion == TEnterpriseModuleVersion.enModStandard)
                {
                    StockModule = false;
                }
                else
                {
                    StockModule = true;
                }

                ISystemSetup8 oSystemSetup = (ISystemSetup8)oToolkit2.SystemSetup;

                if (oSystemSetup.ssReleaseCodes.rcCommitment == TReleaseCodeStatus.rcDisabled)
                {
                    CommitmentAccounting = false;
                }
                else
                {
                    CommitmentAccounting = true;
                }

                if (oSystemSetup.ssReleaseCodes.rcJobCosting == TReleaseCodeStatus.rcDisabled)
                {
                    JobCosting = false;
                }
                else
                {
                    JobCosting = true;
                }

                if (oSystemSetup.ssUseCCDept == false)
                {
                    CCDept = false;
                }
                else
                {
                    CCDept = true;
                }

                if (oSystemSetup.ssUseLocations == false)
                {
                    Locations = false;
                }
                else
                {
                    Locations = true;
                }

                if (oToolkit2.Enterprise.enCurrencyVersion == 0)
                {
                    MultiCurrency = false;
                }
                else
                {
                    MultiCurrency = true;
                }

                oSystemSetup = null;
            }

            resToolkit = oToolkit2.CloseToolkit();
        }
コード例 #4
0
        public void GetCompanies()
        {
            lvCompanies.Items.Clear();

            Int32 Long1 = 0;
            Int32 Long2 = 0;
            Int32 Long3 = 0;

            clsToolkit.EncodeOpCode(97, out Long1, out Long2, out Long3);

            IToolkit2 oToolkit2 = (IToolkit2) new Enterprise01.Toolkit();

            for (int i = 1; i <= oToolkit2.Company.cmCount; i++)
            {
                ICompanyDetail2 oCompanyDetail = (ICompanyDetail2)oToolkit2.Company.cmCompany[i];
                ListViewItem    lv             = new ListViewItem("");
                lv.SubItems.Add(oCompanyDetail.coCode);
                lv.SubItems.Add(oCompanyDetail.coName.TrimEnd());
                lv.SubItems.Add(oCompanyDetail.coPath.Replace("\0", string.Empty).TrimEnd());
                lv.SubItems.Add("Pending");
                lvCompanies.Items.Add(lv);
            }

            oToolkit2.Configuration.SetDebugMode(Long1, Long2, Long3);

            // Check if Multi-Locations, CC/Depts, Stock and Committment Accounting are enabled for each company

            // Set Array sizes based on number of companies
            CommitmentAccounting = new bool[lvCompanies.Items.Count];
            StockModule          = new bool[lvCompanies.Items.Count];
            JobCosting           = new bool[lvCompanies.Items.Count];
            CCDept    = new bool[lvCompanies.Items.Count];
            Locations = new bool[lvCompanies.Items.Count];

            foreach (ListViewItem lvItem in lvCompanies.Items)
            {
                oToolkit2.Configuration.DataDirectory = lvItem.SubItems[3].Text.ToString().TrimEnd();
                int resToolkit = oToolkit2.OpenToolkit();

                if (resToolkit == 0)
                {
                    if (oToolkit2.Enterprise.enModuleVersion == TEnterpriseModuleVersion.enModStandard)
                    {
                        StockModule[lvItem.Index] = false;
                    }
                    else
                    {
                        StockModule[lvItem.Index] = true;
                    }

                    ISystemSetup8 oSystemSetup = (ISystemSetup8)oToolkit2.SystemSetup;

                    if (oSystemSetup.ssReleaseCodes.rcCommitment == TReleaseCodeStatus.rcDisabled)
                    {
                        CommitmentAccounting[lvItem.Index] = false;
                    }
                    else
                    {
                        CommitmentAccounting[lvItem.Index] = true;
                    }

                    if (oSystemSetup.ssReleaseCodes.rcJobCosting == TReleaseCodeStatus.rcDisabled)
                    {
                        JobCosting[lvItem.Index] = false;
                    }
                    else
                    {
                        JobCosting[lvItem.Index] = true;
                    }

                    if (oToolkit2.Enterprise.enCurrencyVersion == 0)
                    {
                        MultiCurrency = false;
                    }
                    else
                    {
                        MultiCurrency = true;
                    }

                    if (oSystemSetup.ssUseCCDept == false)
                    {
                        CCDept[lvItem.Index] = false;
                    }
                    else
                    {
                        CCDept[lvItem.Index] = true;
                    }

                    if (oSystemSetup.ssUseLocations == false)
                    {
                        Locations[lvItem.Index] = false;
                    }
                    else
                    {
                        Locations[lvItem.Index] = true;
                    }

                    oSystemSetup = null;

                    // Check Current Posting Status
                    IHashFunctions oHashFunctions = (IHashFunctions)oToolkit2.Functions;

                    clsIniFile ini = new clsIniFile();

                    ini.IniFiles(ExchequerPath + "\\SQLConfig.ini");

                    // read current company status
                    string hash = ini.ReadString("Posting", "SQLDaybookPosting-" + lvItem.SubItems[1].Text.ToString().TrimEnd(), "0");

                    if (hash != "0")
                    {
                        if (hash == oHashFunctions.HashText(lvItem.SubItems[1].Text.ToString().TrimEnd() + "=1", ""))
                        {
                            lvItem.SubItems[4].Text = "Enabled";
                        }
                        else if (hash == oHashFunctions.HashText(lvItem.SubItems[1].Text.ToString().TrimEnd() + "=2", ""))
                        {
                            lvItem.SubItems[4].Text = "Disabled";
                        }
                    }
                }

                resToolkit = oToolkit2.CloseToolkit();
            }
        }