示例#1
0
        /// <summary>
        /// Useful if the user happens to add an interest number that is already listed */
        /// </summary>
        /// <returns>void</returns>
        public void DetermineNewPrimaryKeys(out Int64 Partnerkey, out Int32 InterestNumber)
        {
            InterestNumber = -1;

            // tmpRow : DataRow;
            Partnerkey = FMultiTableDS.PPartner[0].PartnerKey;

            foreach (PPartnerInterestRow ARow in FPartnerInterestsGridTableDV.Table.Rows)
            {
                if ((ARow.InterestNumber.ToString() == PPartnerInterestTable.GetInterestNumberDBName()) || (ARow.InterestNumber == 0))
                {
                    MessageBox.Show("MJ " + PPartnerInterestTable.GetInterestNumberDBName());
                    MessageBox.Show("Marta BB " + ARow.InterestNumber.ToString());

                    // No interests exists for this partner (partner doesn't exist in the database)
                    InterestNumber = 0;
                }
                else
                {
                    // This partner has interests already (exists in the database)
                    InterestNumber = InterestNumber + 1;
                    MessageBox.Show("Marta BBB " + ARow.InterestNumber.ToString());

                    // Find the first Interest that the Partner does not have yet.
                    // tmpRow := FMultiTableDS.PPartnerInterest.Rows.Find(new Object[]{[PartnerKey, InterestNumber]});
                    // if tmpRow = nil then
                    // begin
                    // InterestNumber := ARow.InterestNumber;
                    // break;
                    // end;
                }
            }
        }
示例#2
0
        /// <summary>
        /// todoComment
        /// </summary>
        /// <param name="InterestNumber"></param>
        /// <param name="Interest"></param>
        /// <param name="Category"></param>
        public void DetermineNextInterest(Int32 InterestNumber, out String Interest, out String Category)
        {
            DataRow tmpRow;

            Interest = "";
            Category = "";

            if (InterestNumber.ToString() == PPartnerInterestTable.GetInterestNumberDBName())
            {
                // This partner has no interests and therefore the first one is picked up
                // as a starting point. Will be edited later.
                foreach (PInterestRow ARow in FInterestDV.Table.Rows)
                {
                    tmpRow = FMultiTableDS.PInterest.Rows.Find(new Object[] { ARow.Interest });

                    if (tmpRow == null)
                    {
                    }
                    else
                    {
                        Interest = ARow.Interest;
                        Category = ARow.Category;
                        break;
                    }
                }

                // MessageBox.Show('TUCPartnerInterestsLogic.DetermineNewInterest: interest determined');
            }
            else
            {
            }

            // This partner has interests already.
        }
示例#3
0
        /// <summary>
        /// todoComment
        /// </summary>
        /// <param name="AGrid"></param>
        /// <param name="ARow"></param>
        /// <returns></returns>
        public String DetermineCurrentInterest(TSgrdDataGrid AGrid, Int32 ARow)
        {
            DataRowView TheDataRowView;

            TheDataRowView = (DataRowView)AGrid.Rows.IndexToDataSourceRow(ARow);
            try
            {
                FInterestRow    = TheDataRowView.Row;
                FInterest       = FInterestRow[PPartnerInterestTable.GetInterestDBName()].ToString();
                FInterestNumber = Convert.ToInt32(FInterestRow[PPartnerInterestTable.GetInterestNumberDBName()]);
            }
            catch (NullReferenceException)
            {
            }

            // no interests: to do?
            // MessageBox.Show('FInterest of currently selected Grid Row: ' + FInterest);
            return(FInterest);
        }