Beispiel #1
0
        /// <summary>
        /// Exports a single Partner to OpenPetra or Petra.
        /// </summary>
        /// <param name="AParentForm"></param>
        /// <param name="AOldPetraFormat"></param>
        public static void ExportSinglePartner(Form AParentForm, bool AOldPetraFormat)
        {
            Int64         PartnerKey = -1;
            String        ShortName;
            TPartnerClass?PartnerClass;
            TLocationPK   ResultLocationPK;

            if (TPartnerFindScreenManager.OpenModalForm("",
                                                        out PartnerKey,
                                                        out ShortName,
                                                        out PartnerClass,
                                                        out ResultLocationPK,
                                                        AParentForm))
            {
                TPartnerExportLogic.ExportSinglePartner(PartnerKey, PartnerClass.ToString(), 0, 0, AOldPetraFormat);
            }
        }
        // Called with Add button. Adds new venue to conference.
        private void AddVenue(object sender, EventArgs e)
        {
            long          ResultVenueKey;
            String        ResultVenueName;
            TPartnerClass?PartnerClass;
            TLocationPK   ResultLocationPK;

            DataRow[] ExistingVenueDataRows;

            // the user has to select an existing venue to make that venue a conference venue
            try
            {
                // launches partner find screen and returns true if a venue is selected
                if (TPartnerFindScreenManager.OpenModalForm("VENUE", out ResultVenueKey, out ResultVenueName, out PartnerClass, out ResultLocationPK,
                                                            this))
                {
                    // search for selected venue in dataset
                    ExistingVenueDataRows = FMainDS.PcConferenceVenue.Select(ConferenceSetupTDSPcConferenceVenueTable.GetVenueKeyDBName() +
                                                                             " = " + ResultVenueKey.ToString());

                    // if venue does not already exist for venue
                    if (ExistingVenueDataRows.Length == 0)
                    {
                        ConferenceSetupTDSPcConferenceVenueRow AddedVenue = FMainDS.PcConferenceVenue.NewRowTyped(true);
                        AddedVenue.ConferenceKey = FPartnerKey;
                        AddedVenue.VenueKey      = ResultVenueKey;
                        AddedVenue.VenueName     = ResultVenueName;
                        FMainDS.PcConferenceVenue.Rows.Add(AddedVenue);
                        FPetraUtilsObject.SetChangedFlag();
                    }
                    // if venue does already exist for venue
                    else
                    {
                        MessageBox.Show(Catalog.GetString("This venue is already included for this conference"),
                                        Catalog.GetString("Add Venue to Conference"),
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Information);
                    }
                }
            }
            catch (Exception exp)
            {
                throw new EOPAppException("Exception occured while calling VenueFindScreen!", exp);
            }
        }
        private void FindUnit(System.Object sender, EventArgs e)
        {
            Int64         PartnerKey = -1;
            String        ResultStringLbl;
            TPartnerClass?PartnerClass;
            TLocationPK   ResultLocationPK;

            // the user has to select an existing partner to make that partner a supplier
            if (TPartnerFindScreenManager.OpenModalForm("UNIT",
                                                        out PartnerKey,
                                                        out ResultStringLbl,
                                                        out PartnerClass,
                                                        out ResultLocationPK,
                                                        this))
            {
                txtPartnerKey.Text = PartnerKey.ToString();
            }
        }
Beispiel #4
0
        /// <summary>
        /// delete partner selected with the Partner Find Screen
        /// </summary>
        public static Boolean DeletePartnerRecord(Form AParentForm)
        {
            Boolean       ResultValue = false;
            Int64         PartnerKey  = -1;
            String        ShortName;
            TPartnerClass?PartnerClass;
            TLocationPK   ResultLocationPK;

            // the user has to select an existing partner to make that partner a supplier
            if (TPartnerFindScreenManager.OpenModalForm("",
                                                        out PartnerKey,
                                                        out ShortName,
                                                        out PartnerClass,
                                                        out ResultLocationPK,
                                                        AParentForm))
            {
                ResultValue = DeletePartner(PartnerKey, AParentForm);
            }

            return(ResultValue);
        }
Beispiel #5
0
        /// <summary>
        /// create a new supplier
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void NewSupplier(object sender, EventArgs e)
        {
            Int64         PartnerKey = -1;
            String        ResultStringLbl;
            TPartnerClass?PartnerClass;
            TLocationPK   ResultLocationPK;

            // the user has to select an existing partner to make that partner a supplier
            if (TPartnerFindScreenManager.OpenModalForm("",
                                                        TPartnerClass.ORGANISATION,
                                                        out PartnerKey,
                                                        out ResultStringLbl,
                                                        out PartnerClass,
                                                        out ResultLocationPK,
                                                        FMainForm))
            {
                TFrmAPEditSupplier frm = new TFrmAPEditSupplier(FMainForm);
                frm.LedgerNumber = FMainForm.LedgerNumber;
                frm.CreateNewSupplier(PartnerKey);
                frm.Show();
            }
        }
Beispiel #6
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;
                    }
                }
            }
        }