Example #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;
//        }
        }
Example #2
0
        /// <summary>
        /// Constructor.  Private for singleton instance
        /// </summary>
        public ToolkitWrapper()
        {
            tToolkit = new Enterprise04.Toolkit() as IToolkit3;
            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);
            tkDisposed = false;
        }
Example #3
0
        // Protected implementation of Dispose pattern.
        protected virtual void Dispose(bool disposing)
        {
            // Prevent re-entry
            if (disposed)
            {
                return;
            }

            if (disposing)
            {
                // Free managed objects here.
                if (tToolkit.Status == TToolkitStatus.tkOpen)
                {
                    tToolkit.CloseToolkit();
                    tToolkit = null;
                }
            }

            // Free any unmanaged objects here.
            //
            disposed = true;
        }
Example #4
0
        //---------------------------------------------------------------------------------------------
        /// <summary>
        /// Constructor - called only by Instance method.
        /// </summary>
        private VAT100Database()
        {
            lastErrorString = string.Empty;
            try
            {
                // Create the toolkit
#if DEBUG
                Logger.Log("VAT100Database : Creating COM Toolkit...");

//        string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
//        FileVersionInfo myFileVersionInfo = FileVersionInfo.GetVersionInfo(Path.Combine(path, "EntToolk.exe"));
//        Logger.Log("Toolkit version = " + myFileVersionInfo.FileVersion);
#endif
                tToolkit = new Enterprise04.Toolkit() as IToolkit3;
                if (tToolkit != null)
                {
#if DEBUG
                    Logger.Log("VAT100Database : Opening Toolkit backdoor...");
#endif
                    ctkDebugLog.StartDebugLog(ref tToolkit); // Backdoor the toolkit (renamed for obfuscation)
#if DEBUG
                    Logger.Log("VAT100Database : ...backdoor opened");
#endif
                }
                else
                {
                    lastErrorString = "VAT100Database : Failed to create COM Toolkit";
                    Logger.Log(lastErrorString);
                }
            }
            catch (Exception ex)
            {
                lastErrorString = "VAT100Database exception : Failed to create COM Toolkit : \r\n  " + ex.Message;
                Logger.Log(lastErrorString);
            }
        }
Example #5
0
        protected virtual void Dispose(bool disposing)
        {
            // This allows multiple calls
            if (tkDisposed)
            {
                return;
            }

            if (disposing)
            {
                // Free all managed objects here.
                int tkRCount = System.Runtime.InteropServices.Marshal.ReleaseComObject(tToolkit);
                Console.WriteLine(string.Format("toolkit reference count is {0}", tkRCount));
                while (tkRCount > 0)
                {
                    tkRCount = System.Runtime.InteropServices.Marshal.ReleaseComObject(tToolkit);
                }
                tToolkit = null;
            }

            // Free all unmanaged objects here.
            // This allows multiple calls
            tkDisposed = true;
        }
Example #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                try
                {
                    // Open the toolkit
                    tToolkit = new Enterprise04.Toolkit() as IToolkit3;

                    //        MessageBox.Show("Start your engines...");

//          ctkDebugLog.StartDebugLog(ref tToolkit);  // Backdoor the toolkit (obfuscated name)
                    tToolkit.Configuration.DataDirectory = textExchDir.Text;
                    int tkRes = tToolkit.OpenToolkit();

                    ITransaction12 theTrans = (tToolkit.Transaction as ITransaction12);
                    int            Res      = theTrans.GetEqual(theTrans.BuildOurRefIndex(textSOR.Text));


                    IOrderPaymentTakePayment oPayment = theTrans.TakePayment();

                    oPayment.oppGLCode           = 2010;
                    oPayment.oppCreditCardAction = TCreditCardAction.ccaPayment;

                    oPayment.oppPaymentReference = textSOR.Text;

                    oPayment.oppCreditCardDetails.ccdAuthorisationNo = "auth number";
                    oPayment.oppCreditCardDetails.ccdCardExpiry      = "0116";
                    oPayment.oppCreditCardDetails.ccdCardNumber      = "0006";
                    oPayment.oppCreditCardDetails.ccdReferenceNo     = "SomeTXCode";
                    oPayment.oppCreditCardDetails.ccdCardType        = "VISA";

                    if (tToolkit.SystemSetup.ssUseCCDept)
                    {
                        oPayment.oppCostCentre = "AAA";
                        oPayment.oppDepartment = "AAA";
                    }

                    oPayment.oppValue = 12.34;



                    (oPayment as IBetaOP).SRCRef       = textSRC.Text;
                    (oPayment as IBetaOP).SRCTransDate = string.Format("{0:yyyyMMdd}", DateTime.Now);
                    (oPayment as IBetaOP).SRCYear      = 115;
                    (oPayment as IBetaOP).SRCPeriod    = 3;

                    MessageBox.Show(string.Format("IBetaOP attributes:\r\nRef   : {0}\r\nYear  : {1}\r\nPeriod: {2}\r\nDate  : {3}",
                                                  (oPayment as IBetaOP).SRCRef, (oPayment as IBetaOP).SRCYear, (oPayment as IBetaOP).SRCPeriod, (oPayment as IBetaOP).SRCTransDate));

                    // Don't really want to do this in here...
                    //      Res = oPayment.Execute();

/*
 *        // Create the OP Refund against this transaction
 *        IOrderPaymentGiveRefund oRefund = theTrans.GiveRefund();
 *
 *        oRefund.oprCreditCardAction = TCreditCardAction.ccaRefund;
 *
 *        oRefund.oprCreditCardDetails.ccdAuthorisationNo = "auth number";
 *        oRefund.oprCreditCardDetails.ccdCardExpiry = "0116";
 *        oRefund.oprCreditCardDetails.ccdCardNumber = "0006";
 *        oRefund.oprCreditCardDetails.ccdCardType = "VISA";
 *        oRefund.oprCreditCardDetails.ccdReferenceNo = "Some Tx Code";
 *
 *        (oRefund as IBetaOP).SRCRef = textSRC.Text;
 *        (oRefund as IBetaOP).SRCYear = 115;
 *        (oRefund as IBetaOP).SRCPeriod = 3;
 *        (oRefund as IBetaOP).SRCTransDate = string.Format("{0:yyyyMMdd}", DateTime.Now);
 *
 *        MessageBox.Show(string.Format("IBetaOP attributes:\r\nRef   : {0}\r\nYear  : {1}\r\nPeriod: {2}\r\nDate  : {3}",
 *                        (oRefund as IBetaOP).SRCRef, (oRefund as IBetaOP).SRCYear, (oRefund as IBetaOP).SRCPeriod, (oRefund as IBetaOP).SRCTransDate));
 */
                }
                catch (Exception ex)
                {
                    MessageBox.Show(string.Format("{0}\r\n\r\nStackTrace:\r\n{1}", ex.Message, ex.StackTrace), "Eeeeww! Nasty!");
                }
            }
            finally
            {
                // Close the toolkit
                tToolkit.CloseToolkit();
            }
        }
Example #7
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);
        }