private void PrintGrid(TStandardFormPrint.TPrintUsing APrintApplication, bool APreviewMode) { PPartnerAttributeTypeTable typeTable = (PPartnerAttributeTypeTable)TDataCache.TMPartner. GetCacheablePartnerTable(TCacheablePartnerTablesEnum.ContactTypeList); DataView typeDataView = new DataView(typeTable); typeDataView.Sort = PPartnerAttributeTypeTable.GetCategoryCodeDBName(); TFormDataKeyDescriptionList recordList = new TFormDataKeyDescriptionList(); recordList.Title = "Contact Categories and Types"; recordList.KeyTitle = Catalog.GetString("Contact Category"); recordList.DescriptionTitle = Catalog.GetString("Contact Type"); recordList.Field3Title = Catalog.GetString("Description"); PPartnerAttributeTypeRow typeRow; foreach (DataRowView typeRowView in typeDataView) { TFormDataKeyDescription record = new TFormDataKeyDescription(); typeRow = (PPartnerAttributeTypeRow)typeRowView.Row; record.Key = typeRow.CategoryCode; record.Description = typeRow.AttributeType; record.Field3 = typeRow.Description; recordList.Add(record); } TStandardFormPrint.PrintRecordList(recordList, 3, APrintApplication, typeDataView.Count, typeDataView, "", APreviewMode); }
/// <summary> /// Specifies a new Filter and applies it, then selects the Row passed in with <paramref name="ACurrentRowIndex"/>. /// </summary> /// <param name="ANewCode">New Code to filter on.</param> /// <param name="ACurrentRowIndex">The index of the Row that should get displayed (the 'current' Row).</param> private void FilterOnCode(string ANewCode, int ACurrentRowIndex) { string FilterStr = String.Format("{0}='{1}'", PPartnerAttributeTypeTable.GetCategoryCodeDBName(), ANewCode); FFilterAndFindObject.FilterPanelControls.SetBaseFilter(FilterStr, true); FFilterAndFindObject.ApplyFilter(); grdDetails.SelectRowWithoutFocus(ACurrentRowIndex); }
/// <summary> /// Performs checks to determine whether a deletion of the current row is permissable /// </summary> /// <param name="ARowToDelete">the currently selected row to be deleted</param> /// <param name="ADeletionQuestion">can be changed to a context-sensitive deletion confirmation question</param> /// <returns>true if user is permitted and able to delete the current row</returns> private bool PreDeleteManual(PPartnerAttributeTypeRow ARowToDelete, ref string ADeletionQuestion) { // If the last Row in the Grid is to be deleted: check if there are added 'Detail' Rows in *other* 'Master' Rows, // and if any of those 'Master' Rows was added too, tell the user that data needs to be saved first before deletion // of the present 'Detail' Row can go ahead. // The reason for that is that the deletion of that last 'Detail' Row will cause the OnNoMoreDetailRecords Event to // be raised by the UserControl, which in turn will cause the Form to call the 'SaveChanges' Method of the // UserControl before the Form saves its own data. While this in itself is OK, saving in the 'SaveChanges' Method // of the UserControl would fail as a 'Master' Row itself was newly added AND it wouldn't be in the DB yet! return(TDeleteGridRows.MasterDetailFormsSpecialPreDeleteCheck(this.Count, FPartnerAttributeCategoryDT, FMainDS.PPartnerAttributeType, PPartnerAttributeCategoryTable.GetCategoryCodeDBName(), PPartnerAttributeTypeTable.GetCategoryCodeDBName())); }