private void InitializeManualCode()
        {
            if (!FMainDS.Tables.Contains(PartnerEditTDSPPartnerInterestTable.GetTableName()))
            {
                FMainDS.Tables.Add(new PartnerEditTDSPPartnerInterestTable());
            }

            FMainDS.InitVars();
        }
        private void InitializeManualCode()
        {
            FLogic = new TUCPartnerRelationshipsLogic();

            if (!FMainDS.Tables.Contains(PartnerEditTDSPPartnerRelationshipTable.GetTableName()))
            {
                FMainDS.Tables.Add(new PartnerEditTDSPPartnerRelationshipTable());
            }

            FMainDS.InitVars();
        }
        /// <summary>
        ///
        /// </summary>
        private void InitializeManualCode()
        {
            if (!FMainDS.Tables.Contains(PSubscriptionTable.GetTableName()))
            {
                FMainDS.Tables.Add(new PSubscriptionTable());
            }

            FMainDS.InitVars();

            ucoDetails.SpecialInitUserControl();
        }
Exemple #4
0
        /// <summary>
        /// Loads Extract Master Data from Petra Server into FMainDS.
        /// </summary>
        /// <param name="AExtractNameFilter"></param>
        /// <param name="AAllUsers"></param>
        /// <param name="ACreatedByUser"></param>
        /// <param name="AModifiedByUser"></param>
        /// <returns>true if successful, otherwise false.</returns>
        private Boolean LoadData(String AExtractNameFilter, Boolean AAllUsers,
                                 String ACreatedByUser, String AModifiedByUser)
        {
            Boolean ReturnValue;

            // Load Extract Headers, if not already loaded
            try
            {
                // Make sure that Typed DataTables are already there at Client side
                if (FMainDS.MExtractMaster == null)
                {
                    FMainDS.Tables.Add(new MExtractMasterTable());
                    FMainDS.InitVars();
                }
                else
                {
                    // clear table so a load also works if records on the server have been removed
                    FMainDS.MExtractMaster.Clear();
                }

                // add filter data
                FMainDS.Merge(TRemote.MPartner.Partner.WebConnectors.GetAllExtractHeaders(AExtractNameFilter,
                                                                                          AAllUsers, ACreatedByUser, AModifiedByUser));

                // Make DataRows unchanged
                if (FMainDS.MExtractMaster.Rows.Count > 0)
                {
                    FMainDS.MExtractMaster.AcceptChanges();
                    FMainDS.AcceptChanges();
                }

                if (FMainDS.MExtractMaster.Rows.Count != 0)
                {
                    ReturnValue = true;
                }
                else
                {
                    ReturnValue = false;
                }
            }
            catch (System.NullReferenceException)
            {
                return(false);
            }
            catch (Exception)
            {
                throw;
            }

            return(ReturnValue);
        }
Exemple #5
0
        private void InitializeManualCode()
        {
            if (!FMainDS.Tables.Contains(PContactLogTable.GetTableName()))
            {
                FMainDS.Merge(TRemote.MPartner.Partner.WebConnectors.GetPartnerContactLogData(FMainDS.PPartner[0].PartnerKey));
                FMainDS.PContactLog.DefaultView.AllowNew = false;
            }

            FMainDS.InitVars();

            OnHookupDataChange(new THookupPartnerEditDataChangeEventArgs(TPartnerEditTabPageEnum.petpContacts));
            //Hook up DataSavingStarted Event to be able to run code before SaveChanges is doing anything
            FPetraUtilsObject.DataSavingStarted += new TDataSavingStartHandler(this.DataSavingStarted);
            ucoDetails.SpecialInitUserControl();
        }
        /// <summary>
        /// Loads Job Assignment Data from Petra Server into FMainDS, if not already loaded.
        /// </summary>
        /// <returns>true if successful, otherwise false.</returns>
        private Boolean LoadDataOnDemand()
        {
            Boolean ReturnValue;

            try
            {
                // Make sure that Typed DataTables are already there at Client side
                if (FMainDS.PmJobAssignment == null)
                {
                    FMainDS.Tables.Add(new PmJobAssignmentTable());
                    FMainDS.InitVars();
                }

                if (TClientSettings.DelayedDataLoading &&
                    (FMainDS.PmJobAssignment.Rows.Count == 0))
                {
                    FMainDS.Merge(FPartnerEditUIConnector.GetDataPersonnelIndividualData(TIndividualDataItemEnum.idiJobAssignments));

                    // Make DataRows unchanged
                    if (FMainDS.PmJobAssignment.Rows.Count > 0)
                    {
                        if (FMainDS.PmJobAssignment.Rows[0].RowState != DataRowState.Added)
                        {
                            FMainDS.PmJobAssignment.AcceptChanges();
                        }
                    }
                }

                if (FMainDS.PmJobAssignment.Rows.Count != 0)
                {
                    ReturnValue = true;
                }
                else
                {
                    ReturnValue = false;
                }
            }
            catch (System.NullReferenceException)
            {
                return(false);
            }
            catch (Exception)
            {
                throw;
            }

            return(ReturnValue);
        }
        /// <summary>
        /// Loads Partner Interest Data from Petra Server into FMainDS.
        /// </summary>
        /// <returns>true if successful, otherwise false.</returns>
        private Boolean LoadDataOnDemand()
        {
            Boolean ReturnValue;

            // Load Partner Types, if not already loaded
            try
            {
                // Make sure that Typed DataTables are already there at Client side
                if (FMainDS.PPartnerInterest == null)
                {
                    FMainDS.Tables.Add(new PartnerEditTDSPPartnerInterestTable());
                    FMainDS.InitVars();
                }

                if (TClientSettings.DelayedDataLoading)
                {
                    FMainDS.Merge(FPartnerEditUIConnector.GetDataPartnerInterests());

                    // Make DataRows unchanged
                    if (FMainDS.PPartnerInterest.Rows.Count > 0)
                    {
                        FMainDS.PPartnerInterest.AcceptChanges();
                    }
                }

                if (FMainDS.PPartnerInterest.Rows.Count != 0)
                {
                    ReturnValue = true;
                }
                else
                {
                    ReturnValue = false;
                }
            }
            catch (System.NullReferenceException)
            {
                return(false);
            }
            catch (Exception)
            {
                throw;
            }
            return(ReturnValue);
        }
        /// <summary>
        /// Loads Extract Master Data from Petra Server into FMainDS.
        /// </summary>
        /// <returns>true if successful, otherwise false.</returns>
        private Boolean LoadData()
        {
            Boolean ReturnValue;

            // Load Extract Headers, if not already loaded
            try
            {
                // Make sure that MasterTyped DataTables are already there at Client side
                if (FMainDS.MExtract == null)
                {
                    FMainDS.Tables.Add(new ExtractTDSMExtractTable());
                    FMainDS.InitVars();
                }

                FMainDS.Merge(TRemote.MPartner.Partner.WebConnectors.GetExtractRowsWithPartnerData(FExtractId));

                // Make DataRows unchanged
                if (FMainDS.MExtract.Rows.Count > 0)
                {
                    FMainDS.MExtract.AcceptChanges();
                    FMainDS.AcceptChanges();
                }

                if (FMainDS.MExtract.Rows.Count != 0)
                {
                    ReturnValue = true;
                }
                else
                {
                    ReturnValue = false;
                }
            }
            catch (System.NullReferenceException)
            {
                return(false);
            }
            catch (Exception)
            {
                throw;
            }
            return(ReturnValue);
        }
Exemple #9
0
        /// <summary>
        /// Loads Partner Types Data from Petra Server into FMainDS.
        /// </summary>
        /// <returns>true if successful, otherwise false.</returns>
        private Boolean LoadDataOnDemand()
        {
            Boolean ReturnValue = true;

            // Load Partner Types, if not already loaded
            try
            {
                // Make sure that Typed DataTables are already there at Client side
                if (FMainDS.PDataLabelValuePartner == null)
                {
                    FMainDS.Tables.Add(new PDataLabelValuePartnerTable());
                    FMainDS.InitVars();
                }

                if (TClientSettings.DelayedDataLoading)
                {
                    FMainDS.Merge(FPartnerEditUIConnector.GetDataPersonnelIndividualData(TIndividualDataItemEnum.idiLocalPersonnelData));

                    // Make DataRows unchanged
                    if (FMainDS.PDataLabelValuePartner.Rows.Count > 0)
                    {
                        FMainDS.PDataLabelValuePartner.AcceptChanges();
                    }
                }

                if (FMainDS.PDataLabelValuePartner == null)
                {
                    ReturnValue = false;
                }
            }
            catch (System.NullReferenceException)
            {
                return(false);
            }
            catch (Exception)
            {
                throw;
            }
            return(ReturnValue);
        }
Exemple #10
0
        private Boolean PartnerStatusCodeChangePromotion(string ANewPartnerStatusCode)
        {
            Boolean ReturnValue;
            String  FamilyMembersText;
            PartnerEditTDSFamilyMembersTable FamilyMembersDT;
            Int32 Counter;
            Int32 Counter2;
            PartnerEditTDSFamilyMembersRow FamilyMembersDR;
            PartnerEditTDSFamilyMembersInfoForStatusChangeRow FamilyMembersInfoDR;
            DialogResult FamilyMembersResult;
            DataView     FamilyMembersDV;

            ReturnValue       = true;
            FamilyMembersText = "";

            /* Retrieve Family Members from the PetraServer */
            FamilyMembersDT = FPartnerEditUIConnector.GetDataFamilyMembers(FMainDS.PPartner[0].PartnerKey, "");
            FamilyMembersDV = new DataView(FamilyMembersDT, "", PPersonTable.GetFamilyIdDBName() + " ASC", DataViewRowState.CurrentRows);

            /* Build a formatted String of Family Members' PartnerKeys and ShortNames */
            for (Counter = 0; Counter <= FamilyMembersDV.Count - 1; Counter += 1)
            {
                FamilyMembersDR   = (PartnerEditTDSFamilyMembersRow)FamilyMembersDV[Counter].Row;
                FamilyMembersText = FamilyMembersText + "   " + StringHelper.FormatStrToPartnerKeyString(FamilyMembersDR.PartnerKey.ToString()) +
                                    "   " + FamilyMembersDR.PartnerShortName + Environment.NewLine;
            }

            /* If there are Family Members, ... */
            if (FamilyMembersText != "")
            {
                /* show MessageBox with Family Members to the user, asking whether to promote. */
                FamilyMembersResult =
                    MessageBox.Show(
                        String.Format(
                            Catalog.GetString("Partner Status change to '{0}': \r\n" +
                                              "Should OpenPetra apply this change to all Family Members of this Family?"),
                            ANewPartnerStatusCode) + Environment.NewLine + Environment.NewLine +
                        Catalog.GetString("The Family has the following Family Members:") + Environment.NewLine +
                        FamilyMembersText + Environment.NewLine +
                        Catalog.GetString("(Choose 'Cancel' to cancel the change of the Partner Status\r\n" +
                                          "for this Partner)."),
                        Catalog.GetString("Promote Partner Status Change to All Family Members?"),
                        MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);

                /* Check User's response */
                switch (FamilyMembersResult)
                {
                case System.Windows.Forms.DialogResult.Yes:

                    /*
                     * User wants to promote the Partner StatusCode change to Family
                     * Members: add new DataTable for that purpose if it doesn't exist yet.
                     */
                    if (FMainDS.FamilyMembersInfoForStatusChange == null)
                    {
                        FMainDS.Tables.Add(new PartnerEditTDSFamilyMembersInfoForStatusChangeTable());
                        FMainDS.InitVars();
                    }

                    /*
                     * Remove any existing DataRows so we start from a 'clean slate'
                     * (the user could change the Partner StatusCode more than once...)
                     */
                    FMainDS.FamilyMembersInfoForStatusChange.Rows.Clear();

                    /*
                     * Add the PartnerKeys of the Family Members that we have just displayed
                     * to the user to the DataTable.
                     *
                     * Note: This DataTable will be sent to the PetraServer when the user
                     * saves the Partner. The UIConnector will pick it up and process it.
                     */
                    for (Counter2 = 0; Counter2 <= FamilyMembersDV.Count - 1; Counter2 += 1)
                    {
                        FamilyMembersDR                = (PartnerEditTDSFamilyMembersRow)FamilyMembersDV[Counter2].Row;
                        FamilyMembersInfoDR            = FMainDS.FamilyMembersInfoForStatusChange.NewRowTyped(false);
                        FamilyMembersInfoDR.PartnerKey = FamilyMembersDR.PartnerKey;
                        FMainDS.FamilyMembersInfoForStatusChange.Rows.Add(FamilyMembersInfoDR);
                    }

                    break;

                case System.Windows.Forms.DialogResult.No:

                    /* no promotion wanted > nothing to do */
                    /* (StatusCode will be changed only for the Family) */
                    break;

                case System.Windows.Forms.DialogResult.Cancel:
                    ReturnValue = false;
                    break;
                }
            }
            else
            {
            }

            /* no promotion needed since there are no Family Members */
            /* (StatusCode will be changed only for the Family) */
            return(ReturnValue);
        }