Пример #1
0
        public mainform()
        {
            InitializeComponent();

            if (tToolkit == null)
            {
                tToolkit = new Enterprise04.Toolkit() as IToolkit3;
                // Backdoor the toolkit
                int val1 = 0, val2 = 0, val3 = 0;
                ctkDebugLog.StartDebugLog(ref val1, ref val2, ref val3); // Backdoor the toolkit (renamed for obfuscation)
                tToolkit.Configuration.SetDebugMode(val1, val2, val3);
            }

            Enterprise04.ICompanyManager coManager = tToolkit.Company;
            int nCos = coManager.cmCount;

            for (int index = 1; index <= nCos; index++)
            {
                mcmCombo.Items.Add(new MCMComboBoxItem(coManager.cmCompany[index].coName, coManager.cmCompany[index].coCode.Trim(), coManager.cmCompany[index].coPath));
            }
//      if (mcmCombo.Items.Count > 0)
//        {
//        mcmCombo.SelectedIndex = 0;
//        }
        }
Пример #2
0
        //---------------------------------------------------------------------------------------------
        public StatusCodes StartBatch(RCTCallBack aCallback, string MCMCompanyCode)
        {
            // Set up the callback function
            callback = aCallback;

            status = StatusCodes.Success;

            // Create the toolkit if it's not already created
            if (tToolkit == null)
            {
                tToolkit = new Enterprise04.Toolkit() as IToolkit3;
                // Backdoor the toolkit
                int val1 = 0, val2 = 0, val3 = 0;
                ctkDebugLog.StartDebugLog(ref val1, ref val2, ref val3); // Backdoor the toolkit (renamed for obfuscation)
                tToolkit.Configuration.SetDebugMode(val1, val2, val3);
            }

            // Open the toolkit for the selected company
            Enterprise04.ICompanyManager coManager = tToolkit.Company;
            int nCos = coManager.cmCount;

            for (int index = 1; index <= nCos; index++)
            {
                MCMCompany aCompany = new MCMCompany();
                aCompany.name = coManager.cmCompany[index].coName.Trim();
                aCompany.code = coManager.cmCompany[index].coCode.Trim();
                aCompany.path = coManager.cmCompany[index].coPath.Trim();
                MCMCompanyList.Add(aCompany);

                if (MCMCompanyCode.ToUpper() == aCompany.code.ToUpper())
                {
                    selCompany = aCompany;
                    log("Found company " + aCompany.code);
                }
            }

            // Find the selected company and open the toolkit against it
            if (selCompany == null)
            {
                errorString = "Invalid company code : " + MCMCompanyCode;
                status      = StatusCodes.DataError;
            }
            else
            {
                // Open the toolkit against the company
                if (tToolkit.Status == TToolkitStatus.tkOpen)
                {
                    tToolkit.CloseToolkit();
                }
                tToolkit.Configuration.DataDirectory = selCompany.path;
                int Res = tToolkit.OpenToolkit();
                if (Res != 0)
                {
                    errorString = "Couldn't open toolkit for company " + selCompany.code;
                    status      = StatusCodes.ToolkitError;
                }
                else
                {
                    log("Toolkit opened successfully for company " + selCompany.code);
                    status = StatusCodes.Success;
                }
            }

            if (status == StatusCodes.Success)
            {
                rctBatch.Clear();
                batchstatus = BatchStatuses.Initialised;

                log("Empty Batch ready");
            }

            return(status);
        }