private void InitializeManualCode()
        {
            Type DataTableType;

            DataTable CacheRegionDT =
                TDataCache.GetCacheableDataTableFromCache("PostcodeRegionList", String.Empty, null, out DataTableType);
            DataTable CacheRegionRangeDT =
                TDataCache.GetCacheableDataTableFromCache("PostcodeRegionRangeList", String.Empty, null, out DataTableType);
            PPostcodeRangeTable RangeTable =
                (PPostcodeRangeTable)TDataCache.GetCacheableDataTableFromCache("PostcodeRangeList", String.Empty, null, out DataTableType);

            FMainDS.PPostcodeRegion.Merge(CacheRegionDT);
            FMainDS.PPostcodeRegionRange.Merge(CacheRegionRangeDT);

            foreach (PostcodeRegionsTDSPPostcodeRegionRangeRow Row in FMainDS.PPostcodeRegionRange.Rows)
            {
                PPostcodeRangeRow RangeRow = (PPostcodeRangeRow)RangeTable.Rows.Find(new object[] { Row.Range });
                Row.From = RangeRow.From;
                Row.To   = RangeRow.To;
            }

            FMainDS.AcceptChanges();

            FPetraUtilsObject.ApplySecurity(TSecurityChecks.SecurityPermissionsSetupScreensEditingAndSaving);
        }
Exemple #2
0
        private void InitializeManualCode()
        {
            FesrDefaults = TRemote.MFinance.Gift.WebConnectors.GetEsrDefaults();
            grdDetails.Columns.Add("a_partner_key_n", "ESR Key", typeof(Int64));
            grdDetails.Columns.Add("a_new_partner_key_n", "Substitute", typeof(Int64));
            grdDetails.Columns.Add("a_motiv_group_s", "Motiv. Group", typeof(String));
            grdDetails.Columns.Add("a_motiv_detail_s", "Motiv. Detail", typeof(String));

            grdDetails.Selection.SelectionChanged += Selection_SelectionChanged;
            grdDetails.Selection.FocusRowLeaving  += UpdateGrid;
            txtPartnerKey.Leave                 += OnLeavePartnerKey;
            txtNewPartnerKey.Leave              += UpdateGrid;
            cmbMotivGroup.SelectedValueChanged  += UpdateMotivationDetail;
            cmbMotivDetail.SelectedValueChanged += UpdateGrid;

            FesrDefaults.DefaultView.Sort      = "a_partner_key_n";
            FesrDefaults.DefaultView.AllowNew  = false;
            FesrDefaults.DefaultView.AllowEdit = false;
            grdDetails.DataSource = new DevAge.ComponentModel.BoundDataView(FesrDefaults.DefaultView);

            txtPartnerKey.Enabled    = false;
            txtNewPartnerKey.Enabled = false;
            cmbMotivGroup.Enabled    = false;
            cmbMotivDetail.Enabled   = false;

            FPetraUtilsObject.ApplySecurity(TSecurityChecks.SecurityPermissionsSetupScreensEditingAndSaving);
        }
        private void InitializeManualCode()
        {
            var SecurityPermissionRequired = new List <string>();

            SecurityPermissionRequired.Add(TSecurityChecks.SECURITYPERMISSION_FINANCEREPORTING);
            FPetraUtilsObject.ApplySecurity(SecurityPermissionRequired);

            // 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--;
                }
            }

            FPetraUtilsObject.SetStatusBarText(grdDetails, Catalog.GetString("Use the mouse or navigation keys to select a data row to view"));

            // set the currency code to be blank initially
            txtGiftTotal.CurrencyCode       = String.Empty;
            txtGiftTotal.NumberValueDecimal = 0.0m;

            lblRecordCounter.Text = "";
            pnlPostedOnlyNote.Top = 0;

            // correct the tab indexes
            int TabOrder = dtpDateFrom.TabIndex;

            dtpDateFrom.TabIndex  = txtRecipient.TabIndex;
            txtRecipient.TabIndex = TabOrder;

            cmbMotivationGroup.RemoveDescriptionLabel();
            cmbMotivationDetail.RemoveDescriptionLabel();

            // catch enter on all controls, to trigger search
            this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.CatchEnterKey);

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

            // focus on txtDonor
            this.ActiveControl = txtDonor;
        }
Exemple #4
0
        private void InitializeManualCode()
        {
            // load the data
            Ict.Common.Data.TTypedDataTable TypedTable;
            TRemote.MCommon.DataReader.WebConnectors.GetData(ACorporateExchangeRateTable.GetTableDBName(), null, out TypedTable);
            FMainDS.ACorporateExchangeRate.Merge(TypedTable);

            FUseCurrencyFormatForDecimal = TUserDefaults.GetBooleanDefault(Ict.Common.StringHelper.FINANCE_DECIMAL_FORMAT_AS_CURRENCY, true);

            FPetraUtilsObject.ApplySecurity(TSecurityChecks.SecurityPermissionsSetupScreensEditingAndSaving);

            if (FPetraUtilsObject.SecurityReadOnly)
            {
                mniImport.Enabled = false;
                tbbImport.Enabled = false;
            }
        }
        private void InitializeManualCode()
        {
            string ConferenceName;

            // load data into dataset
            FMainDS.Clear();
            FMainDS.Merge(TRemote.MConference.Conference.WebConnectors.LoadConferenceSettings(FPartnerKey, out ConferenceName));

            // display conference name
            this.Text = this.Text + " [" + ConferenceName + "]";
            txtConferenceName.Text = ConferenceName;

            // display campaign code prefix
            txtCampaignPrefixCode.Text = ((PcConferenceRow)FMainDS.PcConference.Rows[0]).OutreachPrefix;

            // display start/end dates
            dtpStartDate.Date = ((PPartnerLocationRow)FMainDS.PPartnerLocation.Rows[0]).DateEffective;
            dtpEndDate.Date   = ((PPartnerLocationRow)FMainDS.PPartnerLocation.Rows[0]).DateGoodUntil;

            // enable dtps only if date is null
            if ((dtpStartDate.Date == null) || (dtpStartDate.Date == DateTime.MinValue))
            {
                dtpStartDate.ReadOnly = false;
                dtpStartDate.TabStop  = true;
            }

            if ((dtpEndDate.Date == null) || (dtpEndDate.Date == DateTime.MinValue))
            {
                dtpEndDate.ReadOnly = false;
                dtpEndDate.TabStop  = true;
            }

            // display currency (if currency code in PUnit has changed then use that over the currency code in PcConference)
            if (FMainDS.PUnit.Rows.Count == 0)
            {
                cmbCurrency.SetSelectedString(((PcConferenceRow)FMainDS.PcConference.Rows[0]).CurrencyCode, -1);
            }
            else
            {
                // There is a PUnit row
                if ((((PUnitRow)FMainDS.PUnit.Rows[0]).OutreachCostCurrencyCode != ((PcConferenceRow)FMainDS.PcConference.Rows[0]).CurrencyCode) &&
                    (((PUnitRow)FMainDS.PUnit.Rows[0]).OutreachCostCurrencyCode != String.Empty))
                {
                    // It is probably more up to date
                    cmbCurrency.SetSelectedString(((PUnitRow)FMainDS.PUnit.Rows[0]).OutreachCostCurrencyCode, -1);
                }
                else
                {
                    cmbCurrency.SetSelectedString(((PcConferenceRow)FMainDS.PcConference.Rows[0]).CurrencyCode, -1);
                }
            }

            // set radio buttons and checkbox
            Boolean ChargeCampaign        = true;
            Boolean AddAccommodationCosts = false;

            foreach (PcConferenceOptionRow CurrentRow in FMainDS.PcConferenceOption.Rows)
            {
                if ((CurrentRow.OptionTypeCode == "COST_PER_NIGHT") && (CurrentRow.OptionSet == true))
                {
                    ChargeCampaign   = false;
                    rbtNight.Checked = true;
                }
                else if ((CurrentRow.OptionTypeCode == "COST_PER_DAY") && (CurrentRow.OptionSet == true))
                {
                    ChargeCampaign = false;
                    rbtDay.Checked = true;
                }
                else if ((CurrentRow.OptionTypeCode == "ADD_ACCOMM_COST_FOR_TOTAL") && (CurrentRow.OptionSet == true))
                {
                    AddAccommodationCosts = true;
                }
            }

            if (ChargeCampaign == true)
            {
                rbtCampaign.Checked = true;
                chkAddAccommodationCosts.Enabled = false;
            }
            else if (AddAccommodationCosts == true)
            {
                chkAddAccommodationCosts.Checked             = true;
                txtSpecialRolePreAccommodation.ReadOnly      = false;
                txtVolunteerPreAccommodation.ReadOnly        = false;
                txtParticipantPreAccommodation.ReadOnly      = false;
                txtSpecialRoleAccommodation.ReadOnly         = false;
                txtVolunteerAccommodation.ReadOnly           = false;
                txtSpecialRoleCampaignAccommodation.ReadOnly = false;

                txtSpecialRolePreAccommodation.TabStop      = true;
                txtVolunteerPreAccommodation.TabStop        = true;
                txtParticipantPreAccommodation.TabStop      = true;
                txtSpecialRoleAccommodation.TabStop         = true;
                txtVolunteerAccommodation.TabStop           = true;
                txtSpecialRoleCampaignAccommodation.TabStop = true;
            }

            // display conference discounts
            foreach (PcDiscountRow CurrentRow in FMainDS.PcDiscount.Rows)
            {
                if (CurrentRow.CostTypeCode == "CONFERENCE")
                {
                    if (CurrentRow.Validity == "PRE")
                    {
                        if (CurrentRow.DiscountCriteriaCode == "ROLE")
                        {
                            txtSpecialRolePreAttendance.NumberValueInt = (int)CurrentRow.Discount;
                        }
                        else if (CurrentRow.DiscountCriteriaCode == "VOL")
                        {
                            txtVolunteerPreAttendance.NumberValueInt = (int)CurrentRow.Discount;
                        }
                        else if (CurrentRow.DiscountCriteriaCode == "OTHER")
                        {
                            txtParticipantPreAttendance.NumberValueInt = (int)CurrentRow.Discount;
                        }
                    }
                    else if (CurrentRow.Validity == "CONF")
                    {
                        if (CurrentRow.DiscountCriteriaCode == "ROLE")
                        {
                            txtSpecialRoleAttendance.NumberValueInt = (int)CurrentRow.Discount;
                        }
                        else if (CurrentRow.DiscountCriteriaCode == "VOL")
                        {
                            txtVolunteerAttendance.NumberValueInt = (int)CurrentRow.Discount;
                        }
                    }
                    else if ((CurrentRow.Validity == "POST") && (CurrentRow.DiscountCriteriaCode == "ROLE"))
                    {
                        txtSpecialRoleCampaignAttendance.NumberValueInt = (int)CurrentRow.Discount;
                    }
                }
                else if (CurrentRow.CostTypeCode == "ACCOMMODATION")
                {
                    if (CurrentRow.Validity == "PRE")
                    {
                        if (CurrentRow.DiscountCriteriaCode == "ROLE")
                        {
                            txtSpecialRolePreAccommodation.NumberValueInt = (int)CurrentRow.Discount;
                        }
                        else if (CurrentRow.DiscountCriteriaCode == "VOL")
                        {
                            txtVolunteerPreAccommodation.NumberValueInt = (int)CurrentRow.Discount;
                        }
                        else if (CurrentRow.DiscountCriteriaCode == "OTHER")
                        {
                            txtParticipantPreAccommodation.NumberValueInt = (int)CurrentRow.Discount;
                        }
                    }
                    else if (CurrentRow.Validity == "CONF")
                    {
                        if (CurrentRow.DiscountCriteriaCode == "ROLE")
                        {
                            txtSpecialRoleAccommodation.NumberValueInt = (int)CurrentRow.Discount;
                        }
                        else if (CurrentRow.DiscountCriteriaCode == "VOL")
                        {
                            txtVolunteerAccommodation.NumberValueInt = (int)CurrentRow.Discount;
                        }
                    }
                    else if ((CurrentRow.Validity == "POST") && (CurrentRow.DiscountCriteriaCode == "ROLE"))
                    {
                        txtSpecialRoleCampaignAccommodation.NumberValueInt = (int)CurrentRow.Discount;
                    }
                }
            }

            // display grid containing venue details
            grdVenues.Columns.Clear();
            grdVenues.AddPartnerKeyColumn(Catalog.GetString("Venue Key"), FMainDS.PcConferenceVenue.ColumnVenueKey);
            grdVenues.AddTextColumn(Catalog.GetString("Venue Name"), FMainDS.PcConferenceVenue.ColumnVenueName);

            DataView MyDataView = FMainDS.PcConferenceVenue.DefaultView;

            MyDataView.Sort      = "p_venue_name_c ASC";
            MyDataView.AllowNew  = false;
            grdVenues.DataSource = new DevAge.ComponentModel.BoundDataView(MyDataView);

            FPetraUtilsObject.ApplySecurity(TSecurityChecks.SecurityPermissionsSetupScreensEditingAndSaving);
        }
        private void RunOnceOnActivationManual()
        {
            TRemote.MFinance.Setup.WebConnectors.LoadCostCentrePartnerLinks(FLedgerNumber, 0, out FPartnerCostCentreTbl);
            FLocalCostCentres = TRemote.MFinance.Setup.WebConnectors.LoadLocalCostCentres(FLedgerNumber);

            //Setup Cost Centre combo
            TFinanceControls.InitialiseLocalCostCentreList(ref cmbCostCentre, FLedgerNumber, false, FLocalCostCentres);
            cmbCostCentre.Width = 300;
            cmbCostCentre.AttachedLabel.Width = 150;

            //Setup Reports To combo
            TFinanceControls.InitialiseLocalCostCentreList(ref cmbReportsTo, FLedgerNumber, true, FLocalCostCentres);
            cmbReportsTo.Width = 300;
            cmbReportsTo.AttachedLabel.Width = 150;

            lblInvisible.Visible = false;

            FLinkedView           = new DataView(FPartnerCostCentreTbl);
            FLinkedView.RowFilter = "IsLinked <> '0'";
            FLinkedView.AllowNew  = false;

            FUnlinkedView           = new DataView(FPartnerCostCentreTbl);
            FUnlinkedView.RowFilter = "IsLinked = '0'";
            FUnlinkedView.AllowNew  = false;

            grdLinkedCCs.DataSource   = new DevAge.ComponentModel.BoundDataView(FLinkedView);
            grdUnlinkedCCs.DataSource = new DevAge.ComponentModel.BoundDataView(FUnlinkedView);

            grdLinkedCCs.Columns.Clear();
            grdLinkedCCs.AddTextColumn("Partner Name", FPartnerCostCentreTbl.Columns["ShortName"], 240);
            grdLinkedCCs.AddTextColumn("Partner Key", FPartnerCostCentreTbl.Columns["PartnerKey"], 90);
            grdLinkedCCs.AddTextColumn("Cost Centre", FPartnerCostCentreTbl.Columns["IsLinked"], 90);
            grdLinkedCCs.AddTextColumn("Reports To", FPartnerCostCentreTbl.Columns["ReportsTo"], 90);
            grdUnlinkedCCs.Enter += new EventHandler(grdLinkedCCs_Enter);
            grdLinkedCCs.Selection.FocusRowEntered += new SourceGrid.RowEventHandler(grdLinkedCCs_Click);

            grdUnlinkedCCs.Columns.Clear();
            grdUnlinkedCCs.AddTextColumn("Partner Name", FPartnerCostCentreTbl.Columns["ShortName"], 240);
            grdUnlinkedCCs.AddTextColumn("Partner Key", FPartnerCostCentreTbl.Columns["PartnerKey"], 90);
            grdUnlinkedCCs.Enter += new EventHandler(grdUnlinkedCCs_Enter);
            grdUnlinkedCCs.Selection.FocusRowEntered += new SourceGrid.RowEventHandler(grdUnlinkedCCs_Click);

            btnLink.Text      = "\u25B2 Link";
            btnLink.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            btnLink.Enabled   = false;

            btnUnlink.Text      = "\u25BC Unlink";
            btnUnlink.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            btnUnlink.Enabled   = false;

            btnRemove.Enabled = false;

            FPetraUtilsObject.ApplySecurity(TSecurityChecks.SecurityPermissionsSetupScreensEditingAndSaving);

            if (FPetraUtilsObject.SecurityReadOnly)
            {
                btnLink.Enabled   = false;
                btnUnlink.Enabled = false;
                btnRemove.Enabled = false;
            }
        }
        private void RunOnceOnActivationManual()
        {
            // AlanP March 2013:  Use a try/catch block because nUnit testing on this screen does not support Drag/Drop in multi-threaded model
            // It is easier to do this than to configure all the different test execution methods to use STA
            try
            {
                trvUnits.AllowDrop = true;
                trvUnits.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(treeView_ItemDrag);
                trvUnits.DragOver += new System.Windows.Forms.DragEventHandler(treeView_DragOver);
                trvUnits.DragDrop += new System.Windows.Forms.DragEventHandler(treeView_DragDrop);
            }
            catch (InvalidOperationException)
            {
                // ex.Message is: DragDrop registration did not succeed.
                // Inner exception is: Current thread must be set to single thread apartment (STA) mode before OLE calls can be made.
            }

            trvUnits.Click           += new EventHandler(UnitsClick);
            trvUnits.ShowNodeToolTips = true;
            trvUnits.MouseWheel      += new MouseEventHandler(treeView_MouseWheel);
            trvUnits.Focus();

            txtChild.TextChanged  += new EventHandler(EvaluateParentChange);
            txtParent.TextChanged += new EventHandler(EvaluateParentChange);

            FPetraUtilsObject.UnhookControl(pnlDetails, true); // I don't want changes in these values to cause SetChangedFlag.
            FPetraUtilsObject.UnhookControl(txtStatus, false);

            ArrayList UnitNodes = TRemote.MPersonnel.WebConnectors.GetUnitHeirarchy();
            //
            // The list of nodes returned by the above call are ordered to the extent that:
            //  * The root node appears first,
            //  * a parent appears before its child.
            UnitHierarchyNode RootData       = (UnitHierarchyNode)UnitNodes[0];
            UnitHierarchyNode UnassignedData = (UnitHierarchyNode)UnitNodes[1];

            // build up actual root node
            TreeNode RootNode = new TreeNode(RootData.Description);

            RootNode.Tag         = RootData;
            RootNode.ToolTipText = RootData.TypeCode;
            UnitNodes.RemoveAt(0);
            trvUnits.Nodes.Add(RootNode);
            AddChildren(RootNode, UnitNodes);

            // build up node for unassigned units
            TreeNode UnassignedNode = new TreeNode(UnassignedData.Description);

            UnassignedNode.Tag         = UnassignedData;
            UnassignedNode.ToolTipText = UnassignedData.TypeCode;
            UnitNodes.RemoveAt(0);
            trvUnits.Nodes.Add(UnassignedNode);
            AddChildren(UnassignedNode, UnitNodes);

            Int64 MySiteKey = TSystemDefaults.GetSiteKeyDefault();

            ShowThisUnit(MySiteKey);

            FPetraUtilsObject.ApplySecurity(TSecurityChecks.SecurityPermissionsSetupScreensEditingAndSaving);

            //Active the print menu item
            mniFilePrint.Enabled = true;
            mniFilePrint.Click  += new EventHandler(print);
        }