private void TGiftDetailFindScreen_Closed(object sender, EventArgs e)
 {
     // ReleaseServerObject
     FGiftDetailFindObject = null;
 }
        private void InitializeManualCode()
        {
            FGiftDetailFindObject = TRemote.MFinance.Finance.UIConnectors.GiftDetailFind();

            // 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(txtComment1, 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 entered 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"));

            FinishButtonPanelSetup();
        }
 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;
     }
 }