Пример #1
0
        /// <summary>
        /// todoComment
        /// </summary>
        /// <param name="AGrid"></param>
        /// <param name="tmpDT"></param>
        /// <param name="IsNew"></param>
        public void RefreshDataGrid(ref TSgrdDataGrid AGrid, DataTable tmpDT, Boolean IsNew)
        {
            DataRow             TheNewRow;
            PPartnerInterestRow tmpPartnerInterestRow;
            PInterestRow        tmpInterestRow = null; // todo: this needs to be assigned? says Timo while converting from delphi
            TRecalculateScreenPartsEventArgs RecalculateScreenPartsEventArgs;
            Int32            counter;
            StringCollection ACollection = new StringCollection();
            StringCollection SortedCollection;

            // AInterestRow : PInterestRow;
            MessageBox.Show("TmpDT count:" + tmpDT.Rows.Count.ToString());
            tmpPartnerInterestRow =
                ((PPartnerInterestRow)FMultiTableDS.PPartnerInterest.Rows.Find(new Object[] { FMultiTableDS.PPartner[0].PartnerKey, FInterestNumber }));

            // tmpPartnerInterestRow := tmpDT.rows[tmpDT.rows.count1] as PPartnerInterestRow;
            // tmpInterestRow := tmpDT.rows[tmpDT.rows.count1] as PInterestRow;
            // MessageBox.Show('Refreshgrid: '+tmpPartnerInterestRow.Interest);
            // AInterestRow := (FMultiTableDS.PInterest.Rows.Find(new Object[]{[tmpPartnerInterestRow.Interest]}) as PinterestRow);
            FPartnerInterestsGridTable = new DataTable();
            TheNewRow = FPartnerInterestsGridTable.NewRow();

            // TheNewRow['Category'] := AInterestROw.Category as System.Object;
            // TheNewRow['Category'] := 'DOG';
            TheNewRow["Interest"] = (System.Object)tmpPartnerInterestRow.Interest;
            TheNewRow["Country"]  = (System.Object)tmpPartnerInterestRow.Country;
            TheNewRow["Field"]    = (System.Object)tmpPartnerInterestRow.FieldKey;
            TheNewRow["Level"]    = (System.Object)tmpPartnerInterestRow.Level;
            TheNewRow["Comment"]  = (System.Object)tmpPartnerInterestRow.Comment;
            FPartnerInterestsGridTable.Rows.Add(TheNewRow);
            AGrid.DataSource = new DevAge.ComponentModel.BoundDataView(FPartnerInterestsGridTable.DefaultView);
            counter          = 0;

            foreach (DataRow tmpRow in FPartnerInterestsGridTable.Rows)
            {
                ACollection.Add(tmpRow[PInterestTable.GetCategoryDBName()].ToString());
            }

            SortedCollection = StringHelper.StrSort(ACollection);

            foreach (String AInterestString in SortedCollection)
            {
                counter = counter + 1;

                if (AInterestString == tmpInterestRow.Interest.ToString())
                {
                    break;
                }
            }

            RecalculateScreenPartsEventArgs            = new TRecalculateScreenPartsEventArgs();
            RecalculateScreenPartsEventArgs.ScreenPart = TScreenPartEnum.spCounters;
            OnRecalculateScreenParts(RecalculateScreenPartsEventArgs);
            AGrid.Selection.Focus(new Position(1, 1), true);
            AGrid.Selection.ResetSelection(false);
            AGrid.Selection.SelectRow(counter, true);
        }
        private void FilterInterestCombo(object sender, EventArgs e)
        {
            PInterestCategoryTable CategoryTable;
            PInterestCategoryRow   CategoryRow;
            string SelectedCategory = cmbPPartnerInterestInterestCategory.GetSelectedString();
            string SelectedInterest = cmbPPartnerInterestInterest.GetSelectedString();

            cmbPPartnerInterestInterest.Filter = PInterestTable.GetCategoryDBName() + " = '" + SelectedCategory + "'";

            // reset text to previous value or (if not found) empty text field
            if (cmbPPartnerInterestInterest.GetSelectedString() != String.Empty)
            {
                if (!cmbPPartnerInterestInterest.SetSelectedString(SelectedInterest))
                {
                    cmbPPartnerInterestInterest.SetSelectedString("", -1);
                }
            }

            CategoryTable = (PInterestCategoryTable)TDataCache.TMPartner.GetCacheablePartnerTable(TCacheablePartnerTablesEnum.InterestCategoryList);
            CategoryRow   = (PInterestCategoryRow)CategoryTable.Rows.Find(new object[] { SelectedCategory });

            // reset list of levels
            cmbPPartnerInterestLevel.Text = "";
            cmbPPartnerInterestLevel.Items.Clear();

            if ((CategoryRow != null) &&
                !CategoryRow.IsLevelRangeLowNull() &&
                !CategoryRow.IsLevelRangeHighNull())
            {
                // fill the combobox with valid values
                for (int ii = CategoryRow.LevelRangeLow; ii <= CategoryRow.LevelRangeHigh; ii++)
                {
                    cmbPPartnerInterestLevel.Items.Add(ii);
                }

                txtInterestLevelExplanation.Text = CategoryRow.LevelDescriptions;
            }
            else
            {
                txtInterestLevelExplanation.Text = "";
            }

            if ((GetSelectedDetailRow() != null) &&
                !GetSelectedDetailRow().IsLevelNull())
            {
                cmbPPartnerInterestLevel.SetSelectedInt32(GetSelectedDetailRow().Level);
            }
        }
Пример #3
0
        /// <summary>
        /// todoComment
        /// </summary>
        /// <param name="ADataView"></param>
        /// <param name="tmpInterest"></param>
        /// <returns></returns>
        public DataRowView DetermineRecordToSelect(DataView ADataView, String tmpInterest)
        {
            DataRowView ReturnValue = null;
            DataRowView TmpDataRowView;

            ADataView.RowFilter = PInterestTable.GetInterestDBName() + " = '" + tmpInterest + "'";
            TmpDataRowView      = ADataView[0];
            try
            {
                ReturnValue = TmpDataRowView;
            }
            catch (Exception)
            {
            }
            ADataView.RowFilter = "";
            return(ReturnValue);
        }
Пример #4
0
        private PInterestTable GetInterestsInternal(out Int32 ACount, Boolean ACountOnly)
        {
            TDBTransaction ReadTransaction;
            Boolean NewTransaction = false;
            PInterestTable InterestDT;

            ACount = 0;
            InterestDT = new PInterestTable();

            try
            {
                ReadTransaction = DBAccess.GDBAccessObj.GetNewOrExistingTransaction(IsolationLevel.RepeatableRead,
                    TEnforceIsolationLevel.eilMinimum,
                    out NewTransaction);

                if (ACountOnly)
                {
                }
                // ACount := PInterestAccess.LoadAll(
                // FPartnerKey, ReadTransaction);
                else
                {
//                  TLogging.LogAtLevel(7, "TPartnerEditUIConnector.GetInterestsInternal: loading Interests for Partner " + FPartnerKey.ToString() + "...");
                    try
                    {
                        InterestDT = PInterestAccess.LoadAll(ReadTransaction);
                    }
                    catch (Exception)
                    {
                        throw;
                    }
                    ACount = InterestDT.Rows.Count;
                }
            }
            finally
            {
                if (NewTransaction)
                {
                    DBAccess.GDBAccessObj.CommitTransaction();
                    TLogging.LogAtLevel(7, "TPartnerEditUIConnector.GetInterestsInternal: committed own transaction.");
                }
            }
            return InterestDT;
        }
Пример #5
0
 /// <summary>
 /// todoComment
 /// </summary>
 /// <param name="Category"></param>
 /// <returns></returns>
 public String GetInterestCategory(String Category)
 {
     DataRowView[] Ar;
     Ar = this.FInterestDV.FindRows(Category);
     return(Ar[0][PInterestTable.GetCategoryDBName()].ToString());
 }