/// <summary> /// Open a dialog to select Contact Attributes /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void SelectAttributes(object sender, EventArgs e) { TFrmContactAttributesDialog ContactAttributesDialog = new TFrmContactAttributesDialog(FPetraUtilsObject.GetForm()); ContactAttributesDialog.ContactID = FContactDR.ContactLogId; ContactAttributesDialog.SelectedContactAttributeTable = FMainDS.PPartnerContactAttribute; if (ContactAttributesDialog.ShowDialog() == DialogResult.OK) { PPartnerContactAttributeTable Changes = ContactAttributesDialog.SelectedContactAttributeTable.GetChangesTyped(); // if changes were made or a previously added row (unsaved) was deleted if ((Changes != null) || ContactAttributesDialog.AddedAttributeDeleted) { FMainDS.PPartnerContactAttribute.Clear(); FMainDS.PPartnerContactAttribute.Merge(ContactAttributesDialog.SelectedContactAttributeTable); FGridTableDV = ContactAttributesLogic.SetupContactAttributesGrid(ref grdSelectedAttributes, FMainDS.PPartnerContactAttribute, true, FContactDR.ContactLogId); // only enable save if there are actual changes from the original datatable if (Changes != null) { FPetraUtilsObject.SetChangedFlag(); } } } }
private void FillTempTable() { DataView UnselectedContactAttributeTableDV; DataRow TheNewRow; Int16 RowCounter; FGridTable.Rows.Clear(); FGridTable.AcceptChanges(); UnselectedContactAttributeTableDV = FContactAttributeDetailTableDV; // first add Contact Attributes which are already selected for partner for (RowCounter = 0; RowCounter < FSelectedContactAttributeTableDV.Count; RowCounter++) { TheNewRow = FGridTable.NewRow(); TheNewRow["Checked"] = (System.Object)true; TheNewRow["AttributeCode"] = FSelectedContactAttributeTableDV[RowCounter][PPartnerContactAttributeTable.GetContactAttributeCodeDBName()]; TheNewRow["AttributeDescription"] = ContactAttributesLogic.GetContactAttributeDesciption( FSelectedContactAttributeTableDV[RowCounter][PPartnerContactAttributeTable.GetContactAttributeCodeDBName()].ToString(), FContactAttributeTableDV); TheNewRow["AttributeDetailCode"] = FSelectedContactAttributeTableDV[RowCounter][PPartnerContactAttributeTable.GetContactAttrDetailCodeDBName()]; TheNewRow["AttributeDetailDescription"] = ContactAttributesLogic.GetContactAttributeDetailDesciption( FSelectedContactAttributeTableDV[RowCounter][PPartnerContactAttributeTable.GetContactAttributeCodeDBName()].ToString(), FSelectedContactAttributeTableDV[RowCounter][PPartnerContactAttributeTable.GetContactAttrDetailCodeDBName()].ToString(), FContactAttributeDetailTableDV); FGridTable.Rows.Add(TheNewRow); } // second add the rest of the Special Types in db for (RowCounter = 0; RowCounter < UnselectedContactAttributeTableDV.Count; RowCounter++) { // only add row if it has not already been added as a checked row if (FSelectedContactAttributeTableDV.Find(new object[] { UnselectedContactAttributeTableDV[RowCounter][PContactAttributeDetailTable.GetContactAttributeCodeDBName()], UnselectedContactAttributeTableDV[RowCounter][PContactAttributeDetailTable.GetContactAttrDetailCodeDBName()] }) == -1) { TheNewRow = FGridTable.NewRow(); TheNewRow["Checked"] = (System.Object)false; TheNewRow["AttributeCode"] = UnselectedContactAttributeTableDV[RowCounter][PContactAttributeDetailTable.GetContactAttributeCodeDBName()]; TheNewRow["AttributeDescription"] = ContactAttributesLogic.GetContactAttributeDesciption( UnselectedContactAttributeTableDV[RowCounter][PContactAttributeDetailTable.GetContactAttributeCodeDBName()].ToString(), FContactAttributeTableDV); TheNewRow["AttributeDetailCode"] = UnselectedContactAttributeTableDV[RowCounter][PContactAttributeDetailTable.GetContactAttrDetailCodeDBName()]; TheNewRow["AttributeDetailDescription"] = ContactAttributesLogic.GetContactAttributeDetailDesciption( UnselectedContactAttributeTableDV[RowCounter][PContactAttributeDetailTable.GetContactAttributeCodeDBName()].ToString(), UnselectedContactAttributeTableDV[RowCounter][PContactAttributeDetailTable.GetContactAttrDetailCodeDBName()].ToString(), FContactAttributeDetailTableDV); FGridTable.Rows.Add(TheNewRow); } } }
/// <summary> /// Display data in control based on data from ARow /// </summary> /// <param name="ARow"></param> public void ShowDetails(PContactLogRow ARow) { FInitializationRunning = true; FContactDR = ARow; ShowData(ARow); // if this is the first row to be showing then we need to set up the grid if ((FGridTableDV == null) && (FMainDS.PPartnerContactAttribute != null) && (FMainDS.PPartnerContactAttribute.Count > 0)) { ContactAttributesLogic.SetupContactAttributesGrid(ref grdSelectedAttributes, FMainDS.PPartnerContactAttribute, true, FContactDR.ContactLogId); } if (FGridTableDV != null) { FGridTableDV.RowFilter = PPartnerContactAttributeTable.GetContactIdDBName() + " = " + ARow.ContactLogId; } FInitializationRunning = false; }
/// <summary> /// Open a dialog to select Contact Attributes /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void SelectAttributes(object sender, EventArgs e) { // open the contact attributes dialog TFrmContactAttributesDialog ContactAttributesDialog = new TFrmContactAttributesDialog(FPetraUtilsObject.GetForm()); ContactAttributesDialog.ContactID = -1; ContactAttributesDialog.SelectedContactAttributeTable = FAttributeTable; if (ContactAttributesDialog.ShowDialog() == DialogResult.OK) { PPartnerContactAttributeTable Changes = ContactAttributesDialog.SelectedContactAttributeTable.GetChangesTyped(); // if changes were made if (Changes != null) { FAttributeTable = ContactAttributesDialog.SelectedContactAttributeTable; // we do not need the deleted rows FAttributeTable.AcceptChanges(); ContactAttributesLogic.SetupContactAttributesGrid(ref grdSelectedAttributes, FAttributeTable, false); } } }