private void ChangeFamily(Int64 APersonKey, Int64 AOldFamilyKey, Boolean AChangeToThisFamily)
        {
            String mResultStringLbl = "";
            TPartnerClass? mPartnerClass;

            System.Int64 NewFamilyKey = 0;
            String ProblemMessage;
            TLocationPK mResultLocationPK;

            if (FDelegateIsNewPartner != null)
            {
                if (FDelegateIsNewPartner(FMainDS))
                {
                    MessageBox.Show(MPartnerResourcestrings.StrErrorNeedToSavePartner1 + MPartnerResourcestrings.StrErrorChangeFamily2,
                        MPartnerResourcestrings.StrErrorNeedToSavePartnerTitle);
                    return;
                }

                if (PersonnelChecks.WarnAboutFamilyChange(APersonKey,
                        RetrievePartnerShortName(APersonKey),
                        AOldFamilyKey,
                        RetrievePartnerShortName(AOldFamilyKey),
                        0,
                        "",
                        TRemote.MPersonnel.WebConnectors.HasCurrentCommitmentRecord(APersonKey),
                        @ShowFamilyChangeWarning))
                {
                    // If the delegate is defined, the host form will launch a Modal Partner Find screen for us
                    if (TCommonScreensForwarding.OpenPartnerFindScreen != null)
                    {
                        // delegate IS defined
                        try
                        {
                            TCommonScreensForwarding.OpenPartnerFindScreen.Invoke
                                (SharedTypes.PartnerClassEnumToString(TPartnerClass.FAMILY),
                                out NewFamilyKey,
                                out mResultStringLbl,
                                out mPartnerClass,
                                out mResultLocationPK,
                                this.ParentForm);

                            if (NewFamilyKey != -1)
                            {
                                if (AOldFamilyKey == NewFamilyKey)
                                {
                                    MessageBox.Show(Catalog.GetString("You are trying to move the Person to their existing Family!\r\n" +
                                            "This is not allowed. Select a different Family in the Find Screen."),
                                        Catalog.GetString("Moving to Same Family is Not Allowed"));

                                    return;
                                }

                                // call the server to perform the actual family database change
                                if (TRemote.MPartner.Partner.WebConnectors.ChangeFamily(APersonKey,
                                        AOldFamilyKey,
                                        NewFamilyKey,
                                        out ProblemMessage))
                                {
                                    // even in case of success there might still be a warning message that needs display
                                    if (ProblemMessage != "")
                                    {
                                        MessageBox.Show(ProblemMessage, Catalog.GetString("Change Family"));
                                    }
                                }
                                else
                                {
                                    // can't continue after error
                                    MessageBox.Show("Change of family failed!");
                                    MessageBox.Show(ProblemMessage, Catalog.GetString("Change Family"));
                                    return;
                                }

                                // update family key on display
                                if (FMainDS.PPartner[0].PartnerClass == SharedTypes.PartnerClassEnumToString(TPartnerClass.PERSON))
                                {
                                    FMainDS.PPerson[0].FamilyKey = NewFamilyKey;

                                    /* Update Family GroupBox */
                                    txtFamilyPartnerKey.Text = String.Format("{0:0000000000}", NewFamilyKey);
                                }

                                if (MessageBox.Show(Catalog.GetString("The Family Change is done.\r\n\r\n" +
                                            "Do you want to see the updated list of Family Members of the Family " +
                                            "to which the Partner was moved to?"),
                                        Catalog.GetString("Family ID Change"),
                                        MessageBoxButtons.YesNo) == DialogResult.Yes)
                                {
                                    this.Cursor = Cursors.WaitCursor;

                                    try
                                    {
                                        TFrmPartnerEdit frm = new TFrmPartnerEdit(FPetraUtilsObject.GetForm());

                                        frm.SetParameters(TScreenMode.smEdit, NewFamilyKey, TPartnerEditTabPageEnum.petpFamilyMembers);
                                        frm.Show();
                                    }
                                    finally
                                    {
                                        this.Cursor = Cursors.Default;
                                    }
                                }

                                /* Refresh DataGrid to show the changed Family Members */
                                RefreshFamilyMembersList(this, null);
                            }
                        }
                        catch (Exception exp)
                        {
                            throw new EOPAppException("Exception occured while calling PartnerFindScreen Delegate!", exp);
                        }
                        // end try
                    }
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Opens the Partner Find screen (or activates it in case a non-modal instance was already open and
        /// ARestrictToPartnerClasses is null). If ARestrictToPartnerClasses isn't null then the screen is opened modally.
        /// </summary>
        /// <remarks>
        /// For NUnit tests that just try to open the Partner Find screen but which don't instantiate a Main Form
        /// we need to ignore the <paramref name="AParentForm" /> Argument as it will be null in those cases!
        /// </remarks>
        /// <returns>void</returns>
        public static void FindPartnerOfClass(Form AParentForm,
            string ARestrictToPartnerClasses = null,
            TPartnerEditTabPageEnum APreferredInitialTabPage = TPartnerEditTabPageEnum.petpAddresses)
        {
            if (ARestrictToPartnerClasses == null)
            {
                // No Cursor change if run from within NUnit Test without Main Form instance...
                if (AParentForm != null)
                {
                    AParentForm.Cursor = Cursors.WaitCursor;
                }

                TPartnerFindScreen PartnerFindForm = new TPartnerFindScreen(AParentForm);
                PartnerFindForm.SetParameters(false, -1);
                PartnerFindForm.Show();

                // No Cursor change if run from within NUnit Test without Main Form instance...
                if (AParentForm != null)
                {
                    AParentForm.Cursor = Cursors.Default;
                }
            }
            else
            {
                long PartnerKey;
                string ShortName;
                TPartnerClass? PartnerClass;
                TLocationPK LocationPK;

                if (TPartnerFindScreenManager.OpenModalForm(ARestrictToPartnerClasses, out PartnerKey, out ShortName, out PartnerClass,
                        out LocationPK, AParentForm))
                {
                    // Open the Partner Edit screen
                    TFrmPartnerEdit PartnerEditForm;

                    // No Cursor change if run from within NUnit Test without Main Form instance...
                    if (AParentForm != null)
                    {
                        AParentForm.Cursor = Cursors.WaitCursor;
                    }

                    PartnerEditForm = new TFrmPartnerEdit(AParentForm);

                    if (APreferredInitialTabPage == TPartnerEditTabPageEnum.petpAddresses)
                    {
                        PartnerEditForm.SetParameters(TScreenMode.smEdit, PartnerKey, LocationPK.SiteKey, LocationPK.LocationKey);
                    }
                    else
                    {
                        PartnerEditForm.SetParameters(TScreenMode.smEdit, PartnerKey, APreferredInitialTabPage);
                    }

                    PartnerEditForm.Show();

                    if (ARestrictToPartnerClasses.Split(new Char[] { (',') })[0] == "PERSON")
                    {
                        TUserDefaults.SetDefault(TUserDefaults.USERDEFAULT_LASTPERSONPERSONNEL, PartnerKey);
                    }
                    else
                    {
                        TUserDefaults.SetDefault(TUserDefaults.USERDEFAULT_LASTPARTNERMAILROOM, PartnerKey);
                    }

                    // No Cursor change if run from within NUnit Test without Main Form instance...
                    if (AParentForm != null)
                    {
                        AParentForm.Cursor = Cursors.Default;
                    }
                }
            }
        }
        private void FPetraUtilsObject_DataSaved_NewDonorWarning(object Sender, TDataSavedEventArgs e)
        {
            // if data successfully saved then look for new donors and warn the user
            if (e.Success && (FGiftDetailTable != null) && FNewDonorWarning)
            {
                // this list contains a list of all new donors that were entered onto form
                List <Int64>NewDonorsList = ucoTransactions.NewDonorsList;

                foreach (GiftBatchTDSAGiftDetailRow Row in FGiftDetailTable.Rows)
                {
                    // check changed data is either added or modified and that it is by a new donor
                    if (((Row.RowState == DataRowState.Added) || (Row.RowState == DataRowState.Modified))
                        && (!Row.IsDonorKeyNull() && NewDonorsList.Contains(Row.DonorKey)))
                    {
                        if (MessageBox.Show(string.Format(Catalog.GetString(
                                        "{0} ({1}) is a new Donor.{2}Do you want to add subscriptions for them?{2}" +
                                        "(Note: this message can be disabled in the 'File' menu by unselecting the 'New Donor Warning' item.)"),
                                    Row.DonorName, Row.DonorKey, "\n\n"),
                                Catalog.GetString("New Donor"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            // Open the donor's Edit screen so subscriptions can be added
                            TFrmPartnerEdit frm = new TFrmPartnerEdit(FPetraUtilsObject.GetForm());

                            frm.SetParameters(TScreenMode.smEdit, Row.DonorKey, TPartnerEditTabPageEnum.petpSubscriptions);
                            frm.ShowDialog();
                        }

                        // ensures message is not displayed twice for one new donor with two gifts
                        NewDonorsList.Remove(Row.DonorKey);
                    }
                }

                ucoTransactions.NewDonorsList.Clear();
            }
        }
Exemple #4
0
        /// create a new Person
        public static void NewPartner_Person(Form AParentForm)
        {
            TFrmPartnerEdit frm = new TFrmPartnerEdit(AParentForm);

            frm.SetParameters(TScreenMode.smNew, "PERSON", -1, -1, String.Empty, String.Empty, false);

            frm.Show();
        }
Exemple #5
0
        /// create a new Venue
        public static void NewPartner_Venue(Form AParentForm)
        {
            TFrmPartnerEdit frm = new TFrmPartnerEdit(AParentForm);

            frm.SetParameters(TScreenMode.smNew, "VENUE", -1, -1, "");
            frm.Show();
        }
        // Open Partner Edit screen for the selected bank
        private void EditSelectedPartner(System.Object sender, EventArgs e)
        {
            // Open the selected Bank's Partner Edit screen
            TFrmPartnerEdit frm = new TFrmPartnerEdit(FPetraUtilsObject.GetForm());

            frm.SetParameters(TScreenMode.smEdit, FBankPartnerKey);
            frm.Show();
        }
Exemple #7
0
        /// <summary>
        /// create a new Family
        /// </summary>
        public static void NewPartner_Family(Form AParentForm)
        {
            TFrmPartnerEdit frm = new TFrmPartnerEdit(AParentForm);

            frm.SetParameters(TScreenMode.smNew, "FAMILY", -1, -1, "");
            frm.Show();
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MovePersonToThisFamily(System.Object sender, EventArgs e)
        {
            String mResultStringLbl = "";
            TPartnerClass? mPartnerClass;
            TLocationPK mResultLocationPK;

            System.Int64 NewPersonKey = 0;
            System.Int64 OtherFamilyKey = 0;
            String ProblemMessage;

            if (GridEdited)
            {
                MessageBox.Show(MPartnerResourcestrings.StrErrorNeedToSavePartner1 +
                    MPartnerResourcestrings.StrErrorMaintainFamilyMembers2);
            }
            else
            {
                if (FDelegateIsNewPartner != null)
                {
                    if (FDelegateIsNewPartner(FMainDS))
                    {
                        MessageBox.Show(MPartnerResourcestrings.StrErrorNeedToSavePartner1 +
                            MPartnerResourcestrings.StrErrorChangeFamily2,
                            MPartnerResourcestrings.StrErrorNeedToSavePartnerTitle);
                        return;
                    }

                    // If the delegate is defined, the host form will launch a Modal Partner Find screen for us
                    if (TCommonScreensForwarding.OpenPartnerFindScreen != null)
                    {
                        // delegate IS defined
                        try
                        {
                            TCommonScreensForwarding.OpenPartnerFindScreen.Invoke
                                (SharedTypes.PartnerClassEnumToString(TPartnerClass.PERSON),
                                out NewPersonKey,
                                out mResultStringLbl,
                                out mPartnerClass,
                                out mResultLocationPK,
                                this.ParentForm);

                            if (NewPersonKey != -1)
                            {
                                OtherFamilyKey = TRemote.MPartner.Partner.ServerLookups.WebConnectors.GetFamilyKeyForPerson(NewPersonKey);

                                if (OtherFamilyKey == GetFamilyKey())
                                {
                                    MessageBox.Show(Catalog.GetString("You are trying to move the Person to their existing Family!\r\n" +
                                            "This is not allowed. Select a different Person in the Find Screen."),
                                        Catalog.GetString("Moving to Same Family is Not Allowed"));

                                    return;
                                }

                                if (!PersonnelChecks.WarnAboutFamilyChange(NewPersonKey,
                                        RetrievePartnerShortName(NewPersonKey),
                                        OtherFamilyKey,
                                        RetrievePartnerShortName(OtherFamilyKey),
                                        0,
                                        "",
                                        TRemote.MPersonnel.WebConnectors.HasCurrentCommitmentRecord(NewPersonKey),
                                        @ShowFamilyChangeWarning))
                                {
                                    // user chose not to continue
                                    return;
                                }

                                // call the server to perform the actual family database change
                                if (TRemote.MPartner.Partner.WebConnectors.ChangeFamily(NewPersonKey,
                                        OtherFamilyKey,
                                        GetFamilyKey(),
                                        out ProblemMessage))
                                {
                                    // even in case of success there might still be a warning message that needs display
                                    if (ProblemMessage != "")
                                    {
                                        MessageBox.Show(ProblemMessage, Catalog.GetString("Change Family"));
                                    }
                                }
                                else
                                {
                                    // can't continue after error
                                    MessageBox.Show("Change of family failed!");
                                    MessageBox.Show(ProblemMessage, Catalog.GetString("Change Family"));
                                    return;
                                }

                                if (MessageBox.Show(Catalog.GetString("The Family Change is done.\r\n\r\n" +
                                            "Do you want to see the updated list of Family Members of the Family " +
                                            "from where the Person record was moved from?"),
                                        Catalog.GetString("Family ID Change"),
                                        MessageBoxButtons.YesNo) == DialogResult.Yes)
                                {
                                    this.Cursor = Cursors.WaitCursor;

                                    try
                                    {
                                        TFrmPartnerEdit frm = new TFrmPartnerEdit(FPetraUtilsObject.GetForm());

                                        frm.SetParameters(TScreenMode.smEdit, OtherFamilyKey, TPartnerEditTabPageEnum.petpFamilyMembers);
                                        frm.Show();

                                        // Set Partner to be the "Last Used Partner"
                                        TUserDefaults.NamedDefaults.SetLastPartnerWorkedWith(OtherFamilyKey,
                                            TLastPartnerUse.lpuMailroomPartner,
                                            TPartnerClass.FAMILY);
                                    }
                                    finally
                                    {
                                        this.Cursor = Cursors.Default;
                                    }
                                }

                                /* Refresh DataGrid to show the changed Family Members */
                                RefreshFamilyMembersList(this, null);
                            }
                        }
                        catch (Exception exp)
                        {
                            throw new EOPAppException("Exception occured while calling PartnerFindScreen Delegate!", exp);
                        }
                        // end try
                    }
                }
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddNewPersonToThisFamily(System.Object sender, EventArgs e)
        {
            Int32 FamilysCurrentLocationKey;
            Int64 FamilysCurrentSiteKey;

            if (GridEdited)
            {
                MessageBox.Show(MPartnerResourcestrings.StrErrorNeedToSavePartner1 + MPartnerResourcestrings.StrErrorMaintainFamilyMembers2);
            }
            else
            {
                if (FDelegateIsNewPartner(FMainDS))
                {
                    MessageBox.Show(MPartnerResourcestrings.StrErrorNeedToSavePartner1 + MPartnerResourcestrings.StrErrorChangeFamily2,
                        MPartnerResourcestrings.StrErrorNeedToSavePartnerTitle);
                    return;
                }

                if (FDelegateGetPartnerLocationRowOfCurrentlySelectedAddress != null)
                {
                    FamilysCurrentLocationKey = FDelegateGetPartnerLocationRowOfCurrentlySelectedAddress().LocationKey;
                    FamilysCurrentSiteKey = FDelegateGetPartnerLocationRowOfCurrentlySelectedAddress().SiteKey;
                }
                else
                {
                    throw new EOPAppException("Delegate FGetLocationKeyOfCurrentlySelectedAddress is not set up");
                }

                TFrmPartnerEdit frm = new TFrmPartnerEdit(FPetraUtilsObject.GetForm());

                frm.SetParameters(TScreenMode.smNew, "PERSON", -1, -1, "", "", false,
                    FMainDS.PFamily[0].PartnerKey, FamilysCurrentLocationKey, FamilysCurrentSiteKey);
                frm.Show();
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void EditFamily(System.Object sender, EventArgs e)
        {
            if (FMainDS.PPerson[0].FamilyKey == 0)
            {
                return;
            }

            this.Cursor = Cursors.WaitCursor;

            try
            {
                TFrmPartnerEdit frm = new TFrmPartnerEdit(FPetraUtilsObject.GetForm());

                frm.SetParameters(TScreenMode.smEdit, FMainDS.PPerson[0].FamilyKey);
                frm.Show();

                // Set Partner to be the "Last Used Partner"
                TUserDefaults.NamedDefaults.SetLastPartnerWorkedWith(FMainDS.PPerson[0].FamilyKey,
                    TLastPartnerUse.lpuMailroomPartner,
                    TPartnerClass.FAMILY);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void EditPerson(System.Object sender, EventArgs e)
        {
            if (GridEdited)
            {
                MessageBox.Show(MPartnerResourcestrings.StrErrorNeedToSavePartner1 + MPartnerResourcestrings.StrErrorMaintainFamilyMembers2);
            }
            else
            {
                if (FMainDS.PPartner[0].PartnerKey == GetPartnerKeySelected())
                {
                    MessageBox.Show(Catalog.GetString("Partner is already open in this Partner Edit screen."),
                        Catalog.GetString("Partner is already open"),
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Information,
                        MessageBoxDefaultButton.Button1);
                }
                else
                {
                    this.Cursor = Cursors.WaitCursor;

                    try
                    {
                        TFrmPartnerEdit frm = new TFrmPartnerEdit(FPetraUtilsObject.GetForm());

                        frm.SetParameters(TScreenMode.smEdit, GetPartnerKeySelected());
                        frm.Show();
                    }
                    finally
                    {
                        this.Cursor = Cursors.Default;
                    }
                }
            }
        }
        private void EditPartner(System.Object sender, EventArgs e)
        {
            if (CountSelectedRows() > 1)
            {
                MessageBox.Show(Catalog.GetString("Please select only one partner record that you want to edit"),
                    Catalog.GetString("Edit Partner"),
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Warning);
                return;
            }

            ExtractTDSMExtractRow SelectedRow = GetSelectedDetailRow();

            // TODO: private partners
            // Check if partner is has "restricted" field set to be private and in that
            // case only let the owner access that partner.
            // Make use of SharedConstants.PARTNER_PRIVATE_USER while running the query.

            // Open Partner Edit Screen for selected partner
            if (SelectedRow != null)
            {
                bool CurrentOrMailingAddress;

                this.Cursor = Cursors.WaitCursor;

                try
                {
                    TFrmPartnerEdit frm = new TFrmPartnerEdit(FPetraUtilsObject.GetForm());

                    if (!TRemote.MPartner.Partner.ServerLookups.WebConnectors.VerifyPartnerAtLocation(
                            SelectedRow.PartnerKey,
                            new TLocationPK(SelectedRow.SiteKey, SelectedRow.LocationKey),
                            out CurrentOrMailingAddress))
                    {
                        MessageBox.Show(Catalog.GetString("Cannot find the location that was stored for this partner." +
                                "\r\n" + "Will use any known location for this partner." +
                                "\r\n" + "\r\n" + "(Fix with 'Verify and Update Extract')"),
                            Catalog.GetString("Edit Partner"),
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Warning);

                        frm.SetParameters(TScreenMode.smEdit,
                            SelectedRow.PartnerKey);
                    }
                    else
                    {
                        frm.SetParameters(TScreenMode.smEdit,
                            SelectedRow.PartnerKey,
                            SelectedRow.SiteKey,
                            SelectedRow.LocationKey);
                    }

                    frm.Show();
                }
                finally
                {
                    this.Cursor = Cursors.Default;
                }
            }
        }
        // display the partner edit screen, open to the Contact Log tab and display the contact log that has been selected in the grid
        private void ViewPartner(object Sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;

            // get data for contact log to display
            DataRow CurrentRow = GetCurrentDataRow();
            Int64 PartnerKey = Convert.ToInt64(CurrentRow["p_partner_key_n"]);
            string ContactLogID = CurrentRow["p_contact_log_id_i"].ToString();

            TFrmPartnerEdit frm = new TFrmPartnerEdit(FPetraUtilsObject.GetForm());

            frm.SetParameters(TScreenMode.smEdit, PartnerKey, TPartnerEditTabPageEnum.petpContacts);
            frm.Show();
            frm.SelectContactLog(ContactLogID);

            this.Cursor = Cursors.Default;
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void EditFamily(System.Object sender, EventArgs e)
        {
            if (FMainDS.PPerson[0].FamilyKey == 0)
            {
                return;
            }

            this.Cursor = Cursors.WaitCursor;

            try
            {
                TFrmPartnerEdit frm = new TFrmPartnerEdit(FPetraUtilsObject.GetForm());

                frm.SetParameters(TScreenMode.smEdit, FMainDS.PPerson[0].FamilyKey);
                frm.Show();
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
        /// <summary>
        /// Opens the Partner Edit Screen.
        /// </summary>
        /// <param name="AShowTabPage">Tab Page to open the Partner Edit screen on.</param>
        /// <param name="APartnerKey">PartnerKey for which the Partner Edit screen should be openened.</param>
        /// <param name="AOpenOnBestLocation">Set to true to open the Partner with the 'Best Address' selected (affects the Addresses Tab only).</param>
        public void OpenPartnerEditScreen(TPartnerEditTabPageEnum AShowTabPage, Int64 APartnerKey, bool AOpenOnBestLocation)
        {
            FPetraUtilsObject.WriteToStatusBar("Opening Partner in Partner Edit screen...");

            if (grdResult != null)
            {
                FPetraUtilsObject.SetStatusBarText(grdResult, "Opening Partner in Partner Edit screen...");
            }

            this.Cursor = Cursors.WaitCursor;

            try
            {
                TFrmPartnerEdit frm = new TFrmPartnerEdit(FPetraUtilsObject.GetForm());

                if (!AOpenOnBestLocation)
                {
                    frm.SetParameters(TScreenMode.smEdit, APartnerKey,
                        FLogic.DetermineCurrentLocationPK().SiteKey, FLogic.DetermineCurrentLocationPK().LocationKey, AShowTabPage);
                }
                else
                {
                    frm.SetParameters(TScreenMode.smEdit, APartnerKey);
                }

                frm.Show();

                // Set Partner to be the "Last Used Partner"
                TUserDefaults.NamedDefaults.SetLastPartnerWorkedWith(APartnerKey, TLastPartnerUse.lpuMailroomPartner, frm.PartnerClass);
            }
            finally
            {
                this.Cursor = Cursors.Default;

                if (grdResult != null)
                {
                    if (!FBankDetailsTab)
                    {
                        FPetraUtilsObject.SetStatusBarText(grdResult,
                            MPartnerResourcestrings.StrResultGridHelpText + MPartnerResourcestrings.StrPartnerFindSearchTargetText);
                    }
                    else
                    {
                        FPetraUtilsObject.SetStatusBarText(grdResult,
                            MPartnerResourcestrings.StrResultGridHelpText + MPartnerResourcestrings.StrPartnerFindByBankDetailsSearchTargetText);
                    }
                }
            }
        }
        /// <summary>
        /// Opens an instance of the Partner Edit Screen
        /// </summary>
        /// <param name="APartnerKey"></param>
        /// <param name="AParentForm"></param>
        /// <returns></returns>
        public static void OpenForm(long APartnerKey,
            Form AParentForm)
        {
            TFrmPartnerEdit frm = new TFrmPartnerEdit(AParentForm);

            frm.SetParameters(TScreenMode.smEdit, APartnerKey);
            frm.Show();
        }
        /// <summary>
        /// Create a new bank
        /// </summary>
        public void NewBank(System.Object sender, EventArgs e)
        {
            TFrmPartnerEdit frm = new TFrmPartnerEdit(FPetraUtilsObject.GetForm());

            frm.SetParameters(TScreenMode.smNew, "BANK");
            frm.Show();
        }
        /// <summary>
        ///
        /// </summary>
        private void OpenSharingPartner(System.Object sender, EventArgs e)
        {
            if ((FAccountSharedWith != null) && (FAccountSharedWith.Rows.Count > 0)
                && (grdAccountSharedWith.SelectedDataRows != null) && (grdAccountSharedWith.SelectedDataRows.Length > 0))
            {
                long SharingPartnerKey =
                    Convert.ToInt64(((DataRowView)grdAccountSharedWith.SelectedDataRows[0]).Row[PPartnerTable.GetPartnerKeyDBName()]);

                // Open the selected partner's Partner Edit screen at Personnel Applications
                TFrmPartnerEdit frm = new TFrmPartnerEdit(FPetraUtilsObject.GetForm());

                frm.SetParameters(TScreenMode.smEdit, SharingPartnerKey, TPartnerEditTabPageEnum.petpFinanceDetails);
                frm.Show();
            }
        }
Exemple #19
0
        /// create a new Person
        public static void NewPartner_Person(Form AParentForm)
        {
            TFrmPartnerEdit frm = new TFrmPartnerEdit(AParentForm);

            System.Int64 FamilyKey = GetLastUsedFamilyKey();
            TLocationPK LocationSiteKey = TRemote.MPartner.Partner.WebConnectors.DetermineBestAddress(FamilyKey);

            frm.SetParameters(TScreenMode.smNew, "PERSON", -1, -1, "", "", false,
                FamilyKey, LocationSiteKey.LocationKey, LocationSiteKey.SiteKey);

            frm.Show();
        }
 private void ValidateRecipientLedgerNumber()
 {
     // if no gift destination exists for Family parter then give the user the option to open Gift Destination maintenance screen
     if (FInEditMode
         && (FPreviouslySelectedDetailRow != null)
         && (Convert.ToInt64(txtDetailRecipientLedgerNumber.Text) == 0)
         && (FPreviouslySelectedDetailRow.RecipientKey != 0)
         && (cmbDetailMotivationGroupCode.GetSelectedString() == MFinanceConstants.MOTIVATION_GROUP_GIFT))
     {
         if ((txtDetailRecipientKey.CurrentPartnerClass == TPartnerClass.FAMILY)
             && (MessageBox.Show(Catalog.GetString("No valid Gift Destination exists for ") +
                     FPreviouslySelectedDetailRow.RecipientDescription +
                     " (" + FPreviouslySelectedDetailRow.RecipientKey + ").\n\n" +
                     string.Format(Catalog.GetString("A Gift Destination will need to be assigned to this Partner before" +
                             " this gift can be saved with the Motivation Group '{0}'." +
                             " Would you like to do this now?"), MFinanceConstants.MOTIVATION_GROUP_GIFT),
                     Catalog.GetString("No valid Gift Destination"),
                     MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes))
         {
             OpenGiftDestination(this, null);
         }
         // if no recipient ledger number for Unit partner
         else if ((txtDetailRecipientKey.CurrentPartnerClass == TPartnerClass.UNIT)
                  && (MessageBox.Show(string.Format(Catalog.GetString(
                                  "The Unit Partner {0} has not been allocated a Parent Field that can receive gifts. " +
                                  "This will need to be changed before this gift can be saved with the Motivation Group '{1}'.\n\n" +
                                  "Would you like to do this now?"),
                              "'" + FPreviouslySelectedDetailRow.RecipientDescription + "' (" + FPreviouslySelectedDetailRow.RecipientKey +
                              ")",
                              MFinanceConstants.MOTIVATION_GROUP_GIFT),
                          Catalog.GetString("Problem with Unit's Parent Field"),
                          MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes))
         {
             TFrmPartnerEdit frm = new TFrmPartnerEdit(FPetraUtilsObject.GetForm());
             frm.SetParameters(TScreenMode.smEdit,
                 FPreviouslySelectedDetailRow.RecipientKey,
                 Ict.Petra.Shared.MPartner.TPartnerEditTabPageEnum.petpDetails);
             frm.Show();
         }
     }
 }
Exemple #21
0
        /// create a new Organisation (eg. supplier)
        public static void NewPartner_Organisation(Form AParentForm)
        {
            TFrmPartnerEdit frm = new TFrmPartnerEdit(AParentForm);

            frm.SetParameters(TScreenMode.smNew, "ORGANISATION", -1, -1, "");
            frm.Show();
        }
        /// <summary>
        /// button was pressed to edit other partner in relationship record
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void EditOtherPartner(System.Object sender, EventArgs e)
        {
            long RelationPartnerKey;

            if (GetSelectedDetailRow() == null)
            {
                return;
            }

            // depending on the relation select other partner to be edited
            if (GetSelectedDetailRow().PartnerKey == ((PPartnerRow)FMainDS.PPartner.Rows[0]).PartnerKey)
            {
                RelationPartnerKey = GetSelectedDetailRow().RelationKey;
            }
            else
            {
                RelationPartnerKey = GetSelectedDetailRow().PartnerKey;
            }

            if (RelationPartnerKey == 0)
            {
                return;
            }

            this.Cursor = Cursors.WaitCursor;

            try
            {
                TFrmPartnerEdit frm = new TFrmPartnerEdit(FPetraUtilsObject.GetForm());

                frm.SetParameters(TScreenMode.smEdit, RelationPartnerKey);
                frm.Show();
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
Exemple #23
0
        /// <summary>
        /// create a new Church
        /// </summary>
        public static void NewPartner_Church(Form AParentForm)
        {
            TFrmPartnerEdit frm = new TFrmPartnerEdit(AParentForm);

            frm.SetParameters(TScreenMode.smNew, "CHURCH", -1, -1, "");
            frm.Show();
        }
        private void EditApplication(System.Object sender, EventArgs e)
        {
            PmGeneralApplicationRow SelectedRow = GetSelectedApplication();

            // Open the selected partner's Partner Edit screen at Personnel Applications
            TFrmPartnerEdit frm = new TFrmPartnerEdit(FPetraUtilsObject.GetForm());

            frm.SetParameters(TScreenMode.smEdit, SelectedRow.PartnerKey, TPartnerEditTabPageEnum.petpPersonnelApplications);
            frm.Show();
            frm.SelectApplication(SelectedRow.ApplicationKey, SelectedRow.RegistrationOffice);
        }
Exemple #25
0
        /// <summary>
        /// Opens the partner edit screen with the last partner worked on.
        /// Checks if the partner is merged.
        /// </summary>
        public static void OpenLastUsedPartnerEditScreenByContext(Form AParentForm, string AContext = null)
        {
            string ValidContexts;
            string Context;
            long MergedPartnerKey = 0;
            long LastPartnerKey;
            string NoPartnerAvailableStr = Catalog.GetString("You have not edited a Partner yet.");

            if (AContext != null)
            {
                ValidContexts = TUserDefaults.USERDEFAULT_LASTPARTNERMAILROOM + ";" + TUserDefaults.USERDEFAULT_LASTPERSONPERSONNEL + ";" +
                                TUserDefaults.USERDEFAULT_LASTUNITPERSONNEL + ";" + TUserDefaults.USERDEFAULT_LASTPERSONCONFERENCE + ";";

                if (!ValidContexts.Contains(AContext + ";"))
                {
                    throw new ArgumentException("AContext \"" + AContext + "\" is not a valid context. Valid contexts: " + ValidContexts);
                }
                else
                {
                    Context = AContext;
                }
            }
            else
            {
                Context = TUserDefaults.USERDEFAULT_LASTPARTNERMAILROOM;
            }

            LastPartnerKey = TUserDefaults.GetInt64Default(Context, 0);

            // we don't need to validate the partner key
            // because it's done in the mnuFile_Popup function.
            // If we don't have a valid partner key, this code can't be called from the file menu.

            // now that this function is called from the main menu, we need to check for LastPartnerKey != 0
            if (LastPartnerKey == 0)
            {
                if (Context == TUserDefaults.USERDEFAULT_LASTPERSONPERSONNEL)
                {
                    NoPartnerAvailableStr = Catalog.GetString("You have not yet worked with a Person in the Personnel Module.");
                }

                MessageBox.Show(Catalog.GetString(NoPartnerAvailableStr),
                    Catalog.GetString("No Last Partner"),
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information);
                return;
            }

            if (MergedPartnerHandling(LastPartnerKey, out MergedPartnerKey))
            {
                // work with the merged partner
                LastPartnerKey = MergedPartnerKey;
            }
            else if (MergedPartnerKey > 0)
            {
                // The partner is merged but user cancelled the action
                return;
            }

            // Open the Partner Edit screen
            TFrmPartnerEdit frmPEDS;

            AParentForm.Cursor = Cursors.WaitCursor;

            frmPEDS = new TFrmPartnerEdit(AParentForm);

            if (Context == TUserDefaults.USERDEFAULT_LASTPERSONPERSONNEL)
            {
                frmPEDS.SetParameters(TScreenMode.smEdit, LastPartnerKey, TPartnerEditTabPageEnum.petpPersonnelIndividualData);
            }
            else
            {
                frmPEDS.SetParameters(TScreenMode.smEdit, LastPartnerKey);
            }

            frmPEDS.Show();

            AParentForm.Cursor = Cursors.Default;
        }
        private void ValidateRecipientLedgerNumber()
        {
            if (!FInEditMode || (FPreviouslySelectedDetailRow.RecipientKey == 0))
            {
                return;
            }
            // if no gift destination exists for Family parter then give the user the option to open Gift Destination maintenance screen
            else if ((FPreviouslySelectedDetailRow != null)
                     && (Convert.ToInt64(txtDetailRecipientLedgerNumber.Text) == 0)
                     && (cmbDetailMotivationGroupCode.GetSelectedString() == MFinanceConstants.MOTIVATION_GROUP_GIFT))
            {
                if ((txtDetailRecipientKey.CurrentPartnerClass == TPartnerClass.FAMILY)
                    && (MessageBox.Show(Catalog.GetString("No valid Gift Destination exists for ") +
                            FPreviouslySelectedDetailRow.RecipientDescription +
                            " (" + FPreviouslySelectedDetailRow.RecipientKey + ").\n\n" +
                            string.Format(Catalog.GetString("A Gift Destination will need to be assigned to this Partner before" +
                                    " this gift can be saved with the Motivation Group '{0}'." +
                                    " Would you like to do this now?"), MFinanceConstants.MOTIVATION_GROUP_GIFT),
                            Catalog.GetString("No valid Gift Destination"),
                            MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes))
                {
                    OpenGiftDestination(this, null);
                }
                // if no recipient ledger number for Unit partner
                else if ((txtDetailRecipientKey.CurrentPartnerClass == TPartnerClass.UNIT)
                         && (MessageBox.Show(string.Format(Catalog.GetString(
                                         "The Unit Partner {0} has not been allocated a Parent Field that can receive gifts. " +
                                         "This will need to be changed before this gift can be saved with the Motivation Group '{1}'.\n\n" +
                                         "Would you like to do this now?"),
                                     "'" + FPreviouslySelectedDetailRow.RecipientDescription + "' (" + FPreviouslySelectedDetailRow.RecipientKey +
                                     ")",
                                     MFinanceConstants.MOTIVATION_GROUP_GIFT),
                                 Catalog.GetString("Problem with Unit's Parent Field"),
                                 MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes))
                {
                    TFrmPartnerEdit frm = new TFrmPartnerEdit(FPetraUtilsObject.GetForm());
                    frm.SetParameters(TScreenMode.smEdit,
                        FPreviouslySelectedDetailRow.RecipientKey,
                        Ict.Petra.Shared.MPartner.TPartnerEditTabPageEnum.petpDetails);
                    frm.Show();
                }
            }
            // if recipient ledger number belongs to a different ledger then check that it is set up for inter-ledger transfers
            else if ((FPreviouslySelectedDetailRow != null)
                     && (Convert.ToInt64(txtDetailRecipientLedgerNumber.Text) != 0)
                     && ((int)Convert.ToInt64(txtDetailRecipientLedgerNumber.Text) / 1000000 != FLedgerNumber))
            {
                TVerificationResultCollection VerificationResults;

                if (!TRemote.MFinance.Gift.WebConnectors.IsRecipientLedgerNumberSetupForILT(
                        FLedgerNumber, FPreviouslySelectedDetailRow.RecipientKey, Convert.ToInt64(txtDetailRecipientLedgerNumber.Text),
                        out VerificationResults))
                {
                    MessageBox.Show(VerificationResults.BuildVerificationResultString(), Catalog.GetString("Invalid Data Entered"),
                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
        /// <summary>
        /// open the Partner Edit screen for the supplier
        /// </summary>
        private void EditPartner(object sender, EventArgs e)
        {
            FPetraUtilsObject.WriteToStatusBar("Opening Partner in Partner Edit screen...");
            this.Cursor = Cursors.WaitCursor;

            try
            {
                TFrmPartnerEdit frm = new TFrmPartnerEdit(this);
                frm.SetParameters(TScreenMode.smEdit, FMainDS.AApSupplier[0].PartnerKey);
                frm.Show();
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
        private void OpenDonorFinanceDetails(System.Object sender, EventArgs e)
        {
            TFrmPartnerEdit frmPartner = new TFrmPartnerEdit(FPetraUtilsObject.GetForm());

            frmPartner.SetParameters(TScreenMode.smEdit,
                FPreviouslySelectedDetailRow.DonorKey,
                Shared.MPartner.TPartnerEditTabPageEnum.petpFinanceDetails);
            frmPartner.Show();
        }
        private void EditApplication(System.Object sender, EventArgs e)
        {
            // Open the selected partner's Partner Edit screen at Personnel Applications
            TFrmPartnerEdit frm = new TFrmPartnerEdit(FPetraUtilsObject.GetForm());

            frm.SetParameters(TScreenMode.smEdit, GetPartnerKeySelected(), TPartnerEditTabPageEnum.petpPersonnelApplications);
            frm.Show();
        }
Exemple #30
0
        /// <summary>
        /// Shows the Partner Edit screen for a new Partner.
        ///
        /// </summary>
        /// <returns>void</returns>
        public void ShowForNewPartner(Form AParentForm)
        {
            TFrmPartnerEdit frmPEDS;

            // MessageBox.Show('From Thread: about to show PartnerEdit screen for new Partner...');
            try
            {
                frmPEDS = new TFrmPartnerEdit(AParentForm);
                frmPEDS.SetParameters(FScreenMode,
                    FNewPartnerPartnerClass,
                    FNewPartnerSiteKey,
                    FNewPartnerPartnerKey,
                    FNewPartnerCountryCode,
                    FNewPartnerAcquisitionCode,
                    FNewPartnerPrivatePartner,
                    FNewPartnerFamilyPartnerKey,
                    FNewPartnerFamilyLocationKey,
                    FNewPartnerFamilySiteKey,
                    FNewPartnerShowNewPartnerDialog);

                // MessageBox.Show('From Thread: now showing PartnerEdit screen!');
                frmPEDS.Show();
            }
            catch (Exception Exp)
            {
                MessageBox.Show("Exception in TThreadedOpenPartnerEditScreen.ShowForNewPartner:" + Exp.ToString());
            }
        }