Пример #1
0
 private void TGiftDetailFindScreen_Closed(object sender, EventArgs e)
 {
     // ReleaseServerObject
     if (FGiftDetailFindObject != null)
     {
         // UnRegister Object from the TEnsureKeepAlive Class so that the Object can get GC'd on the PetraServer
         TEnsureKeepAlive.UnRegister(FGiftDetailFindObject);
         FGiftDetailFindObject = null;
     }
 }
Пример #2
0
        private void Form_Closed(object sender, EventArgs e)
        {
            if (FSupplierFindObject != null)
            {
                // UnRegister Object from the TEnsureKeepAlive Class so that the Object can get GC'd on the PetraServer
                TEnsureKeepAlive.UnRegister(FSupplierFindObject);
                FSupplierFindObject = null;
            }

            if (FInvoiceFindObject != null)
            {
                // UnRegister Object from the TEnsureKeepAlive Class so that the Object can get GC'd on the PetraServer
                TEnsureKeepAlive.UnRegister(FInvoiceFindObject);
                FInvoiceFindObject = null;
            }
        }
Пример #3
0
        private void TabChange(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;

            if (tabSearchResult.SelectedTab == tpgOutstandingInvoices)
            {
                // Invoice tab has been selected...
                mniInvoice.Visible  = true;
                mniSupplier.Visible = false;

                if (FInvoiceFindObject == null)
                {
                    FInvoiceFindObject = TRemote.MFinance.AP.UIConnectors.Find();
                    // Register Object with the TEnsureKeepAlive Class so that it doesn't get GC'd
                    TEnsureKeepAlive.Register(FInvoiceFindObject);
                }

                ucoOutstandingInvoices.LoadInvoices();
            }
            else
            {
                // Suppliers tab has been selected...
                mniSupplier.Visible = true;
                mniInvoice.Visible  = false;

                if (FSupplierFindObject == null)
                {
                    FSupplierFindObject = TRemote.MFinance.AP.UIConnectors.Find();
                    // Register Object with the TEnsureKeepAlive Class so that it doesn't get GC'd
                    TEnsureKeepAlive.Register(FSupplierFindObject);
                }

                ucoSuppliers.LoadSuppliers();
            }

            this.Cursor = Cursors.Default;
        }
Пример #4
0
        static void Main(string[] args)
        {
            new TLogging("../../log/TestRemotingClient.log");

            try
            {
                new TAppSettingsManager("../../etc/Client.config");

                TLogging.DebugLevel = Convert.ToInt32(TAppSettingsManager.GetValue("Client.DebugLevel", "0"));

                new TClientSettings();

                // initialize the client
                TConnectionManagementBase.ConnectorType         = typeof(TConnector);
                TConnectionManagementBase.GConnectionManagement = new TConnectionManagement();

                TClientInfo.InitializeUnit();

                Catalog.Init("en-GB", "en-GB");

                string error;
                ConnectToTestServer("DEMO", "DEMO", out error);

                IMyUIConnector MyUIConnector = TRemote.MyService.SubNamespace.MyUIConnector();
                TEnsureKeepAlive.Register(MyUIConnector);
                IMySubNamespace test = TRemote.MyService.SubNamespace;

                while (true)
                {
                    try
                    {
                        TLogging.Log(TRemote.MyService.HelloWorld("Hello World"));
                    }
                    catch (Exception e)
                    {
                        TLogging.Log("problem with MyService HelloWorld: " + Environment.NewLine + e.ToString());
                    }

                    try
                    {
                        TLogging.Log(test.HelloSubWorld("Hello SubWorld"));
                    }
                    catch (Exception e)
                    {
                        TLogging.Log("problem with sub namespace HelloSubWorld: " + Environment.NewLine + e.ToString());
                    }

                    try
                    {
                        TLogging.Log(MyUIConnector.HelloWorldUIConnector());
                    }
                    catch (Exception e)
                    {
                        TLogging.Log("problem with HelloWorldUIConnector: " + Environment.NewLine + e.ToString());
                    }

                    Console.WriteLine("Press ENTER to say Hello World again... ");
                    Console.WriteLine("Press CTRL-C to exit ...");
                    Console.ReadLine();
                }
            }
            catch (Exception e)
            {
                TLogging.Log(e.ToString());
                Console.ReadLine();
            }
        }
Пример #5
0
        private void InitializeManualCode()
        {
            FGiftDetailFindObject = TRemote.MFinance.Finance.UIConnectors.GiftDetailFind();

            // Register Object with the TEnsureKeepAlive Class so that it doesn't get GC'd
            TEnsureKeepAlive.Register(FGiftDetailFindObject);

            // remove from the combobox all ledger numbers which the user does not have permission to access
            DataView cmbLedgerDataView = (DataView)cmbLedger.cmbCombobox.DataSource;

            for (int i = 0; i < cmbLedgerDataView.Count; i++)
            {
                string LedgerNumberStr;

                // postgresql
                if (cmbLedgerDataView[i].Row[0].GetType().Equals(typeof(int)))
                {
                    LedgerNumberStr = ((int)cmbLedgerDataView[i].Row[0]).ToString("0000");
                }
                else // sqlite
                {
                    LedgerNumberStr = ((Int64)cmbLedgerDataView[i].Row[0]).ToString("0000");
                }

                if (!UserInfo.GUserInfo.IsInModule("LEDGER" + LedgerNumberStr))
                {
                    cmbLedgerDataView.Delete(i);
                    i--;
                }
            }

            // add event to combobox (this is the best moment to do this)
            cmbLedger.SelectedValueChanged += new System.EventHandler(this.OnCmbLedgerChange);

            // add divider line (can't currently do this in YAML)
            DevAge.Windows.Forms.Line linCriteriaDivider = new DevAge.Windows.Forms.Line();
            linCriteriaDivider.Anchor =
                ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) |
                                                      System.Windows.Forms.AnchorStyles.Right)));
            linCriteriaDivider.DashStyle   = System.Drawing.Drawing2D.DashStyle.Solid;
            linCriteriaDivider.FirstColor  = System.Drawing.SystemColors.ControlDark;
            linCriteriaDivider.LineStyle   = DevAge.Windows.Forms.LineStyle.Horizontal;
            linCriteriaDivider.Location    = new System.Drawing.Point(grpFindCriteria.Location.Y + 6, btnSearch.Location.Y - 2);
            linCriteriaDivider.Name        = "linCriteriaDivider";
            linCriteriaDivider.SecondColor = System.Drawing.SystemColors.ControlLightLight;
            linCriteriaDivider.Size        = new System.Drawing.Size(grpFindCriteria.Size.Width - 12, 2);
            grpFindCriteria.Controls.Add(linCriteriaDivider);

            // pnlBlankSearchResult
            pnlBlankSearchResult.BackColor = System.Drawing.SystemColors.ControlLightLight;
            pnlBlankSearchResult.Size      = grdResult.Size; lblSearchInfo.Anchor =
                ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) |
                                                       System.Windows.Forms.AnchorStyles.Left) |
                                                      System.Windows.Forms.AnchorStyles.Right)));

            // lblSearchInfo
            this.lblSearchInfo.Font =
                new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.lblSearchInfo.ForeColor = System.Drawing.SystemColors.ControlDarkDark;
            lblSearchInfo.Size           = grdResult.Size;
            lblSearchInfo.TextAlign      = System.Drawing.ContentAlignment.MiddleCenter;

            // remove '0' from these textboxes
            txtGiftBatchNumber.NumberValueInt       = null;
            txtGiftTransactionNumber.NumberValueInt = null;
            txtReceiptNumber.NumberValueInt         = null;
            txtMinimumAmount.NumberValueInt         = null;
            txtMaximumAmount.NumberValueInt         = null;

            // set button to be on the very right of the screen (can't make this work in YAML)
            btnClear.Location = new System.Drawing.Point(linCriteriaDivider.Location.X + linCriteriaDivider.Width - btnClear.Width,
                                                         btnClear.Location.Y);

            // set to blank initially
            lblRecordCounter.Text = "";

            // event fired on screen close
            this.Closed += new System.EventHandler(this.TGiftDetailFindScreen_Closed);

            // catch enter on all controls, to trigger search or accept (could use this.AcceptButton, but we have several search buttons etc)
            this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.CatchEnterKey);

            // catch enter on grid to view the selected transaction
            this.grdResult.EnterKeyPressed += new Ict.Common.Controls.TKeyPressedEventHandler(this.BtnView_Click);

            // fix tab order
            int Temp = txtDonor.TabIndex;

            txtDonor.TabIndex                 = cmbMotivationGroup.TabIndex;
            cmbMotivationGroup.TabIndex       = txtRecipient.TabIndex;
            txtRecipient.TabIndex             = dtpDateTo.TabIndex;
            dtpDateTo.TabIndex                = txtMinimumAmount.TabIndex;
            txtMinimumAmount.TabIndex         = txtComment1.TabIndex;
            txtComment1.TabIndex              = dtpDateFrom.TabIndex;
            dtpDateFrom.TabIndex              = cmbMotivationDetail.TabIndex;
            cmbMotivationDetail.TabIndex      = txtReceiptNumber.TabIndex;
            txtReceiptNumber.TabIndex         = txtGiftTransactionNumber.TabIndex;
            txtGiftTransactionNumber.TabIndex = Temp;

            this.ActiveControl = txtGiftBatchNumber;

            // set statusbar messages
            FPetraUtilsObject.SetStatusBarText(cmbLedger, Catalog.GetString("Select a ledger"));
            FPetraUtilsObject.SetStatusBarText(txtGiftBatchNumber, Catalog.GetString("Enter a Gift Batch Number"));
            FPetraUtilsObject.SetStatusBarText(txtGiftTransactionNumber, Catalog.GetString("Enter a Gift Transaction Number"));
            FPetraUtilsObject.SetStatusBarText(txtReceiptNumber, Catalog.GetString("Enter a Gift Receipt Number"));
            FPetraUtilsObject.SetStatusBarText(cmbMotivationGroup, Catalog.GetString("Select a Motivation Group"));
            FPetraUtilsObject.SetStatusBarText(cmbMotivationDetail, Catalog.GetString("Select a Motivation Detail"));
            FPetraUtilsObject.SetStatusBarText(txtReceiptNumber, Catalog.GetString("Enter a Comment"));
            FPetraUtilsObject.SetStatusBarText(txtDonor, Catalog.GetString("Enter a Donor's Partner Key"));
            FPetraUtilsObject.SetStatusBarText(txtRecipient, Catalog.GetString("Enter a Recipient's Partner Key"));
            FPetraUtilsObject.SetStatusBarText(dtpDateFrom, Catalog.GetString("Enter a date for which gifts must have been entered on or after"));
            FPetraUtilsObject.SetStatusBarText(dtpDateTo, Catalog.GetString("Enter a date for which gifts must have been enetered on or before"));
            FPetraUtilsObject.SetStatusBarText(txtMinimumAmount,
                                               Catalog.GetString("Enter an amount for which gifts must have an amount equal or greater than"));
            FPetraUtilsObject.SetStatusBarText(txtMaximumAmount,
                                               Catalog.GetString("Enter an amount for which gifts must have an amount equal or less than"));
            FPetraUtilsObject.SetStatusBarText(btnSearch, Catalog.GetString("Searches the OpenPetra database with above criteria"));
            FPetraUtilsObject.SetStatusBarText(btnClear, Catalog.GetString("Clears the search criteria fields and the search result"));
            FPetraUtilsObject.SetStatusBarText(btnView, Catalog.GetString("Views the selected Gift"));
        }
Пример #6
0
        /// <summary>
        /// this is where all the calculations take place
        /// </summary>
        /// <returns>true if the report was successfully generated
        /// </returns>
        public Boolean GenerateResultRemoteClient()
        {
            Boolean ReturnValue;
            Thread  ProgressCheckThread;

            ReturnValue          = false;
            FReportingGenerator  = TRemote.MReporting.UIConnectors.ReportGenerator();
            FKeepUpProgressCheck = true;

            // Register Object with the TEnsureKeepAlive Class so that it doesn't get GC'd
            TEnsureKeepAlive.Register(FReportingGenerator);
            try
            {
                this.Results = new TResultList();
                FReportingGenerator.Start(this.Parameters.ToDataTable());
                ProgressCheckThread = new Thread(new ThreadStart(AsyncProgressCheckThread));
                ProgressCheckThread.Start();
            }
            catch (Exception e)
            {
                TLogging.Log(e.Message);

                // UnRegister Object from the TEnsureKeepAlive Class so that the Object can get GC'd on the PetraServer
                TEnsureKeepAlive.UnRegister(FReportingGenerator);

                return(false);
            }

            // todo: allow canceling of the calculation of a report
            while (FKeepUpProgressCheck)
            {
                Thread.Sleep(500);
            }

            ReturnValue = FReportingGenerator.GetSuccess();

            // UnRegister Object from the TEnsureKeepAlive Class so that the Object can get GC'd on the PetraServer
            TEnsureKeepAlive.UnRegister(FReportingGenerator);

            if (ReturnValue)
            {
                if (FCalculatesExtract)
                {
                    TLogging.Log("Extract calculation finished. Look for extract '" +
                                 Parameters.Get("param_extract_name").ToString() +
                                 "' in Extract Master List.", TLoggingType.ToStatusBar);

                    TFormsMessage BroadcastMessage = new TFormsMessage(TFormsMessageClassEnum.mcExtractCreated);

                    BroadcastMessage.SetMessageDataName(Parameters.Get("param_extract_name").ToString());

                    TFormsList.GFormsList.BroadcastFormMessage(BroadcastMessage);
                }
                else
                {
                    TLogging.Log("Report calculation finished.", TLoggingType.ToStatusBar);
                }
            }

            return(ReturnValue);
        }