private void ShowDataManual(PUnitRow UnitRow) { lblParentName.Left = 250; btnOrganise.Left = 430; if ((FMainDS.UmUnitStructure != null) && (FMainDS.UmUnitStructure.Rows.Count > 0)) { txtParentKey.Text = FMainDS.UmUnitStructure[0].ParentUnitKey.ToString("D10"); SetParentLabel(FMainDS.UmUnitStructure[0].ParentUnitKey); btnOrganise.Enabled = true; } else { btnOrganise.Enabled = false; } // If this unit has a corresponding conference in the database then the user should not be able to change the currency code from // the partner edit screen. They can change it in the Conference Master Settings screen. if (TRemote.MPartner.Partner.WebConnectors.IsPUnitAConference(UnitRow.PartnerKey)) { cmbOutreachCostCurrencyCode.Enabled = false; FPetraUtilsObject.SetStatusBarText(txtOutreachCost, Catalog.GetString("Enter the cost of this outreach" + Catalog.GetString(" (The currency can be modified in 'Conference Master Settings' in the the Conference module)"))); } }
/// create a new unit public static PPartnerRow CreateNewUnitPartner(PartnerEditTDS AMainDS) { PPartnerRow PartnerRow = CreateNewPartner(AMainDS); PartnerRow.PartnerClass = MPartnerConstants.PARTNERCLASS_UNIT; PartnerRow.PartnerShortName = PartnerRow.PartnerKey.ToString() + ", TestUnit"; PUnitRow UnitRow = AMainDS.PUnit.NewRowTyped(); UnitRow.PartnerKey = PartnerRow.PartnerKey; UnitRow.UnitName = "TestUnit"; AMainDS.PUnit.Rows.Add(UnitRow); return(PartnerRow); }
/// <summary> /// Get the units which start with the same outreach code as given with the prefix. /// </summary> /// <param name="AUnitKey">Partner Key of the unit from which the outreach options are retrieved</param> /// <param name="AConferenceTable">A table with all the units</param> /// <returns></returns> private static System.Boolean GetOutreachOptions(long AUnitKey, out System.Data.DataTable AConferenceTable) { AConferenceTable = new DataTable(); AConferenceTable.Columns.Add("Partner Key", Type.GetType("System.Int64")); AConferenceTable.Columns.Add("Outreach Code"); AConferenceTable.Columns.Add("Unit Name"); String ConferenceCodePrefix = ""; PUnitTable UnitTable = new PUnitTable(); PUnitRow TemplateRow = UnitTable.NewRowTyped(false); TLogging.LogAtLevel(9, "TConferenceOptions.GetOutreachOptions called!"); TDBTransaction Transaction = new TDBTransaction(); DBAccess.ReadTransaction(ref Transaction, delegate { /* Load data */ UnitTable = PUnitAccess.LoadByPrimaryKey(AUnitKey, Transaction); if (UnitTable.Rows.Count > 0) { ConferenceCodePrefix = ((PUnitRow)UnitTable.Rows[0]).OutreachCode.Substring(0, 5); UnitTable = PUnitAccess.LoadUsingTemplate(TemplateRow, null, null, Transaction); } }); foreach (PUnitRow UnitRow in UnitTable.Rows) { if (!UnitRow.OutreachCode.StartsWith(ConferenceCodePrefix, true, null)) { continue; } DataRow NewRow = AConferenceTable.NewRow(); NewRow["Partner Key"] = UnitRow.PartnerKey; NewRow["Outreach Code"] = UnitRow.OutreachCode; NewRow["Unit Name"] = UnitRow.UnitName; AConferenceTable.Rows.Add(NewRow); } return(true); }
/// create a new unit public static PPartnerRow CreateNewUnitPartnerWithTypeCode(PartnerEditTDS AMainDS, string AUnitType, TDataBase ADataBase = null) { PPartnerRow PartnerRow = CreateNewPartner(AMainDS, ADataBase); PartnerRow.PartnerClass = MPartnerConstants.PARTNERCLASS_UNIT; PartnerRow.PartnerShortName = PartnerRow.PartnerKey.ToString() + ", TestUnit"; PUnitRow UnitRow = AMainDS.PUnit.NewRowTyped(); UnitRow.PartnerKey = PartnerRow.PartnerKey; UnitRow.UnitName = "TestUnit"; UnitRow.UnitTypeCode = AUnitType; AMainDS.PUnit.Rows.Add(UnitRow); return(PartnerRow); }
public static PUnitTable GetOutreachOptions(Int64 AUnitKey) { String ConferenceCodePrefix = ""; PUnitTable UnitTable = new PUnitTable(); PUnitRow TemplateRow = UnitTable.NewRowTyped(false); TDBTransaction ReadTransaction; Boolean NewTransaction = false; TLogging.LogAtLevel(9, "TConferenceOptions.GetOutreachOptions called!"); TDataBase db = DBAccess.Connect("GetOutreachOptions"); ReadTransaction = db.GetNewOrExistingTransaction(IsolationLevel.RepeatableRead, out NewTransaction); try { /* Load data */ UnitTable = PUnitAccess.LoadByPrimaryKey(AUnitKey, ReadTransaction); if (UnitTable.Rows.Count > 0) { String ConferenceCode = ((PUnitRow)UnitTable.Rows[0]).OutreachCode; if (ConferenceCode.Length >= 5) { ConferenceCodePrefix = ConferenceCode.Substring(0, 5) + "%"; } StringCollection operators = new StringCollection(); operators.Add("LIKE"); TemplateRow.OutreachCode = ConferenceCodePrefix; UnitTable = PUnitAccess.LoadUsingTemplate(TemplateRow, operators, null, ReadTransaction); } } finally { if (NewTransaction) { ReadTransaction.Commit(); TLogging.LogAtLevel(7, "TConferenceOptions.GetOutreachOptions: committed own transaction."); } } return(UnitTable); }
/// <summary> /// generate the key ministries /// </summary> /// <param name="AKeyMinCSVFile"></param> public static void GenerateKeyMinistries(string AKeyMinCSVFile) { XmlDocument doc = TCsv2Xml.ParseCSVFile2Xml(AKeyMinCSVFile, ","); XmlNode RecordNode = doc.FirstChild.NextSibling.FirstChild; PartnerImportExportTDS PartnerDS = new PartnerImportExportTDS(); TDataBase db = DBAccess.Connect("GenerateKeyMinistries"); TDBTransaction Transaction = db.BeginTransaction(IsolationLevel.ReadCommitted); // get a list of fields (all class UNIT, with unit type F) string sqlGetFieldPartnerKeys = "SELECT p_partner_key_n, p_unit_name_c FROM PUB_p_unit WHERE u_unit_type_code_c = 'F'"; DataTable FieldKeys = db.SelectDT(sqlGetFieldPartnerKeys, "keys", Transaction); Transaction.Rollback(); Int32 NumberOfPartnerKeysReserved = 100; Int64 NextPartnerKey = TNewPartnerKey.ReservePartnerKeys(-1, ref NumberOfPartnerKeysReserved); while (RecordNode != null) { int FieldID = Convert.ToInt32(TXMLParser.GetAttribute(RecordNode, "field")) % FieldKeys.Rows.Count; long FieldPartnerKey = Convert.ToInt64(FieldKeys.Rows[FieldID].ItemArray[0]); PUnitRow UnitRow = PartnerDS.PUnit.NewRowTyped(); if (NumberOfPartnerKeysReserved == 0) { NumberOfPartnerKeysReserved = 100; NextPartnerKey = TNewPartnerKey.ReservePartnerKeys(-1, ref NumberOfPartnerKeysReserved); } long UnitPartnerKey = NextPartnerKey; NextPartnerKey++; NumberOfPartnerKeysReserved--; UnitRow.PartnerKey = UnitPartnerKey; UnitRow.UnitName = FieldKeys.Rows[FieldID].ItemArray[1].ToString() + " - " + TXMLParser.GetAttribute(RecordNode, "KeyMinName"); UnitRow.UnitTypeCode = "KEY-MIN"; PartnerDS.PUnit.Rows.Add(UnitRow); PPartnerRow PartnerRow = PartnerDS.PPartner.NewRowTyped(); PartnerRow.PartnerKey = UnitRow.PartnerKey; PartnerRow.PartnerShortName = UnitRow.UnitName; PartnerRow.PartnerClass = MPartnerConstants.PARTNERCLASS_UNIT; PartnerRow.StatusCode = MPartnerConstants.PARTNERSTATUS_ACTIVE; PartnerDS.PPartner.Rows.Add(PartnerRow); // add empty location so that the partner can be found in the Partner Find screen PPartnerLocationRow PartnerLocationRow = PartnerDS.PPartnerLocation.NewRowTyped(); PartnerLocationRow.PartnerKey = UnitRow.PartnerKey; PartnerLocationRow.LocationKey = 0; PartnerLocationRow.SiteKey = 0; PartnerDS.PPartnerLocation.Rows.Add(PartnerLocationRow); // create unit hierarchy UmUnitStructureRow UnitStructureRow = PartnerDS.UmUnitStructure.NewRowTyped(); UnitStructureRow.ParentUnitKey = FieldPartnerKey; UnitStructureRow.ChildUnitKey = UnitRow.PartnerKey; PartnerDS.UmUnitStructure.Rows.Add(UnitStructureRow); RecordNode = RecordNode.NextSibling; } PartnerImportExportTDSAccess.SubmitChanges(PartnerDS); }
/// <summary> /// Get recursively all the child units of a unit and puts them into the /// results list. /// </summary> /// <param name="AUnitKey">Parent unit to get the child unit from</param> /// <param name="AChildLevel">Indicates how deep we are in the recursion</param> /// <param name="AWithOutreaches">Indicates if outreaches and conferences should /// be included in the result</param> /// <param name="AChildRow">the number of the row</param> /// <returns>False if the parent unit is not active. /// Otherwise true</returns> private bool GetChildUnits(long AUnitKey, int AChildLevel, bool AWithOutreaches, ref int AChildRow) { UmUnitStructureTable UnitStructure; PUnitTable UnitTable; PPartnerTable PartnerTable; UUnitTypeTable UnitType; PartnerTable = PPartnerAccess.LoadByPrimaryKey(AUnitKey, situation.GetDatabaseConnection().Transaction); if ((PartnerTable.Rows.Count > 0) && (((PPartnerRow)PartnerTable.Rows[0]).StatusCode != "ACTIVE")) { return(false); } string PreceedingWhiteSpaces = new string(' ', AChildLevel * 2); UnitStructure = UmUnitStructureAccess.LoadViaPUnitParentUnitKey(AUnitKey, situation.GetDatabaseConnection().Transaction); // Add this unit to the results UnitTable = PUnitAccess.LoadByPrimaryKey(AUnitKey, situation.GetDatabaseConnection().Transaction); if (UnitTable.Rows.Count > 0) { PUnitRow UnitRow = (PUnitRow)UnitTable.Rows[0]; string UnitTypeName = UnitRow.UnitTypeCode; UnitType = UUnitTypeAccess.LoadByPrimaryKey(UnitRow.UnitTypeCode, situation.GetDatabaseConnection().Transaction); if (UnitType.Rows.Count > 0) { UnitTypeName = ((UUnitTypeRow)UnitType.Rows[0]).UnitTypeName; } string UnitKeyString = FormatAsUnitKey(UnitRow.PartnerKey); TVariant[] Header = { new TVariant(), new TVariant(), new TVariant(), new TVariant() }; TVariant[] Description = { new TVariant(), new TVariant() }; TVariant[] Columns = { new TVariant(PreceedingWhiteSpaces + UnitKeyString), new TVariant(PreceedingWhiteSpaces + UnitTypeName), new TVariant(PreceedingWhiteSpaces + UnitRow.UnitName), new TVariant(UnitRow.PartnerKey) }; situation.GetResults().AddRow(0, AChildRow++, true, 1, "", "", false, Header, Description, Columns); } // // Add the children to the results // SortedList <string, long> ChildList = new SortedList <string, long>(); AChildLevel++; foreach (DataRow Row in UnitStructure.Rows) { // Add the name and the key into a sorted list // so we can sort the result alphabetically long ChildUnitKey = (long)Row[UmUnitStructureTable.GetChildUnitKeyDBName()]; if (ChildUnitKey == AUnitKey) { continue; } UnitTable = PUnitAccess.LoadByPrimaryKey(ChildUnitKey, situation.GetDatabaseConnection().Transaction); if (UnitTable.Rows.Count < 1) { continue; } PUnitRow UnitRow = (PUnitRow)UnitTable.Rows[0]; string UnitName = UnitRow.UnitName; string UnitTypeName = UnitRow.UnitTypeCode; if (!AWithOutreaches && ((UnitTypeName.StartsWith("GA")) || (UnitTypeName.StartsWith("GC")) || (UnitTypeName.StartsWith("TN")) || (UnitTypeName.StartsWith("TS")))) { continue; } // use as key UnitName (for sorting) plus UnitKey so that it is // unique. We might have two units with the same name ChildList.Add(UnitName + ChildUnitKey.ToString(), ChildUnitKey); } foreach (KeyValuePair <string, long> kvp in ChildList) { GetChildUnits(kvp.Value, AChildLevel, AWithOutreaches, ref AChildRow); } return(true); }
public static ArrayList GetUnitHeirarchy() { const Int64 THE_ORGANISATION = 1000000; ArrayList Ret = new ArrayList(); try { TDBTransaction Transaction = DBAccess.GDBAccessObj.BeginTransaction(IsolationLevel.ReadCommitted); PUnitTable UnitTbl = PUnitAccess.LoadAll(Transaction); UUnitTypeTable UnitTypeTbl = UUnitTypeAccess.LoadAll(Transaction); UnitTypeTbl.DefaultView.Sort = UUnitTypeTable.GetUnitTypeCodeDBName(); UmUnitStructureTable HierarchyTbl = UmUnitStructureAccess.LoadAll(Transaction); HierarchyTbl.DefaultView.Sort = UmUnitStructureTable.GetChildUnitKeyDBName(); UnitTbl.DefaultView.Sort = PUnitTable.GetPartnerKeyDBName(); UnitHierarchyNode RootNode = new UnitHierarchyNode(); RootNode.MyUnitKey = THE_ORGANISATION; RootNode.ParentUnitKey = THE_ORGANISATION; RootNode.Description = "The Organisation"; RootNode.TypeCode = "Root"; Int32 RootUnitIdx = UnitTbl.DefaultView.Find(THE_ORGANISATION); if (RootUnitIdx >= 0) { RootNode.Description = ((PUnitRow)UnitTbl.DefaultView[RootUnitIdx].Row).UnitName; UnitTbl.DefaultView.Delete(RootUnitIdx); } Ret.Add(RootNode); foreach (DataRowView rv in UnitTbl.DefaultView) { PUnitRow UnitRow = (PUnitRow)rv.Row; UnitHierarchyNode Node = new UnitHierarchyNode(); Node.Description = UnitRow.UnitName + " " + UnitRow.Description; if (Node.Description == "") { Node.Description = "[" + UnitRow.PartnerKey.ToString("D10") + "]"; } Node.MyUnitKey = UnitRow.PartnerKey; // // Retrieve parent.. Int32 HierarchyTblIdx = HierarchyTbl.DefaultView.Find(Node.MyUnitKey); if (HierarchyTblIdx >= 0) { Node.ParentUnitKey = ((UmUnitStructureRow)HierarchyTbl.DefaultView[HierarchyTblIdx].Row).ParentUnitKey; } else { Node.ParentUnitKey = THE_ORGANISATION; } // // Retrieve TypeCode.. Int32 TypeTblIndex = UnitTypeTbl.DefaultView.Find(UnitRow.UnitTypeCode); if (TypeTblIndex >= 0) { Node.TypeCode = ((UUnitTypeRow)UnitTypeTbl.DefaultView[TypeTblIndex].Row).UnitTypeName; } else { Node.TypeCode = "Type: " + UnitRow.UnitTypeCode; } Ret.Add(Node); } } finally { DBAccess.GDBAccessObj.RollbackTransaction(); } return(Ret); }
public static Boolean GetMotivationGroupAndDetail(Int64 APartnerKey, ref String AMotivationGroup, ref String AMotivationDetail) { Boolean PartnerKeyIsValid = false; if (APartnerKey != 0) { string MotivationGroup = MFinanceConstants.MOTIVATION_GROUP_GIFT; string MotivationDetail = AMotivationDetail; TDBTransaction readTransaction = null; DBAccess.GDBAccessObj.GetNewOrExistingAutoReadTransaction(IsolationLevel.ReadCommitted, TEnforceIsolationLevel.eilMinimum, ref readTransaction, delegate { PPartnerTable myPPartnerTable = null; myPPartnerTable = PPartnerAccess.LoadByPrimaryKey(APartnerKey, readTransaction); if (myPPartnerTable.Rows.Count == 1) { // Entry for partnerKey is valid PartnerKeyIsValid = true; PPartnerRow partnerRow = null; partnerRow = (PPartnerRow)myPPartnerTable.Rows[0]; // Change motivationDetail if ColumnPartnerClass is UNIT if (partnerRow.PartnerClass.Equals(MPartnerConstants.PARTNERCLASS_UNIT)) { // AND KEY-MIN bool KeyMinFound = false; // first check if a motivation detail is linked to this potential key min AMotivationDetailTable MotivationDetailTable = null; MotivationDetailTable = AMotivationDetailAccess.LoadViaPPartner(APartnerKey, readTransaction); if ((MotivationDetailTable != null) && (MotivationDetailTable.Rows.Count > 0)) { foreach (AMotivationDetailRow Row in MotivationDetailTable.Rows) { if (Row.MotivationStatus) { MotivationGroup = MotivationDetailTable[0].MotivationGroupCode; MotivationDetail = MotivationDetailTable[0].MotivationDetailCode; KeyMinFound = true; break; } } } // second check to see if this is a key min if (!KeyMinFound) { PUnitTable pUnitTable = null; pUnitTable = PUnitAccess.LoadByPrimaryKey(APartnerKey, readTransaction); if (pUnitTable.Rows.Count == 1) { PUnitRow unitRow = null; unitRow = (PUnitRow)pUnitTable.Rows[0]; if (unitRow.UnitTypeCode.Equals(MPartnerConstants.UNIT_TYPE_KEYMIN)) { MotivationDetail = MFinanceConstants.GROUP_DETAIL_KEY_MIN; } else { MotivationDetail = TSystemDefaults.GetStringDefault(SharedConstants.SYSDEFAULT_DEFAULTFIELDMOTIVATION, MFinanceConstants.GROUP_DETAIL_FIELD); // if system default is empty then set to FIELD if (string.IsNullOrEmpty(MotivationDetail)) { MotivationDetail = MFinanceConstants.GROUP_DETAIL_FIELD; } } } } } else { MotivationDetail = MFinanceConstants.GROUP_DETAIL_SUPPORT; } } }); AMotivationGroup = MotivationGroup; AMotivationDetail = MotivationDetail; } return(PartnerKeyIsValid); }
// get data from screen and ammend/add to dataset private void GetDataFromControlsManual(PcConferenceRow ARow) { PcConferenceRow ConferenceData = (PcConferenceRow)FMainDS.PcConference.Rows[0]; PPartnerLocationRow PartnerLocationData = (PPartnerLocationRow)FMainDS.PPartnerLocation.Rows[0]; PUnitRow UnitData = (PUnitRow)FMainDS.PUnit.Rows[0]; // do not save currency if it is blank but instead change the combo box to display original value if (cmbCurrency.GetSelectedString() != "") { ConferenceData.CurrencyCode = cmbCurrency.GetSelectedString(); UnitData.OutreachCostCurrencyCode = cmbCurrency.GetSelectedString(); } else { cmbCurrency.SetSelectedString(ConferenceData.CurrencyCode); } ConferenceData.Start = dtpStartDate.Date; ConferenceData.End = dtpEndDate.Date; PartnerLocationData.DateEffective = dtpStartDate.Date; PartnerLocationData.DateGoodUntil = dtpEndDate.Date; // get data from radio buttons and check button for PcConferenceOption string[] OptionTypeCodes = { "COST_PER_NIGHT", "COST_PER_DAY", "ADD_ACCOMM_COST_FOR_TOTAL" }; Boolean[] OptionSet = { rbtNight.Checked, rbtDay.Checked, chkAddAccommodationCosts.Checked }; for (int i = 0; i < 3; i++) { DataRow RowExists = FMainDS.PcConferenceOption.Rows.Find(new object[] { FPartnerKey, OptionTypeCodes[i] }); // create new row if needed if ((RowExists == null) && OptionSet[i]) { PcConferenceOptionRow RowToAdd = FMainDS.PcConferenceOption.NewRowTyped(true); RowToAdd.ConferenceKey = FPartnerKey; RowToAdd.OptionTypeCode = OptionTypeCodes[i]; RowToAdd.OptionSet = true; FMainDS.PcConferenceOption.Rows.Add(RowToAdd); } // update existing record else if ((RowExists != null) && OptionSet[i]) { ((PcConferenceOptionRow)RowExists).OptionSet = true; } // delete existing record if discount is 0 else if ((RowExists != null) && !OptionSet[i]) { RowExists.Delete(); } } // reset the Accommodation text boxs to 0 if no longer needed if (!chkAddAccommodationCosts.Checked) { txtSpecialRolePreAccommodation.NumberValueInt = 0; txtVolunteerPreAccommodation.NumberValueInt = 0; txtParticipantPreAccommodation.NumberValueInt = 0; txtSpecialRoleAccommodation.NumberValueInt = 0; txtVolunteerAccommodation.NumberValueInt = 0; txtSpecialRoleCampaignAccommodation.NumberValueInt = 0; } // get data from discount text boxes for PcDiscount string[, ] Discounts = { { "ROLE", "CONFERENCE", "PRE", txtSpecialRolePreAttendance.Text.TrimEnd(new char[] { ' ', '%' }) }, { "VOL", "CONFERENCE", "PRE", txtVolunteerPreAttendance.Text.TrimEnd(new char[] { ' ', '%' }) }, { "OTHER", "CONFERENCE", "PRE", txtParticipantPreAttendance.Text.TrimEnd(new char[] { ' ', '%' }) }, { "ROLE", "CONFERENCE", "CONF", txtSpecialRoleAttendance.Text.TrimEnd(new char[] { ' ', '%' }) }, { "VOL", "CONFERENCE", "CONF", txtVolunteerAttendance.Text.TrimEnd(new char[] { ' ', '%' }) }, { "ROLE", "CONFERENCE", "POST", txtSpecialRoleCampaignAttendance.Text.TrimEnd(new char[] { ' ', '%' }) }, { "ROLE", "ACCOMMODATION", "PRE", txtSpecialRolePreAccommodation.Text.TrimEnd(new char[] { ' ', '%' }) }, { "VOL", "ACCOMMODATION", "PRE", txtVolunteerPreAccommodation.Text.TrimEnd(new char[] { ' ', '%' }) }, { "OTHER", "ACCOMMODATION", "PRE", txtParticipantPreAccommodation.Text.TrimEnd(new char[] { ' ', '%' }) }, { "ROLE", "ACCOMMODATION", "CONF", txtSpecialRoleAccommodation.Text.TrimEnd(new char[] { ' ', '%' }) }, { "VOL", "ACCOMMODATION", "CONF", txtVolunteerAccommodation.Text.TrimEnd(new char[] { ' ', '%' }) }, { "ROLE", "ACCOMMODATION", "POST", txtSpecialRoleCampaignAccommodation.Text.TrimEnd(new char[] { ' ', '%' }) } }; for (int i = 0; i < 12; i++) { DataRow RowExists = FMainDS.PcDiscount.Rows.Find(new object[] { FPartnerKey, Discounts[i, 0], Discounts[i, 1], Discounts[i, 2], -1 }); if (Discounts[i, 3] == "") { Discounts[i, 3] = "0"; } // create new row if needed if ((RowExists == null) && (Convert.ToInt32(Discounts[i, 3]) != 0)) { PcDiscountRow RowToAdd = FMainDS.PcDiscount.NewRowTyped(true); RowToAdd.ConferenceKey = FPartnerKey; RowToAdd.DiscountCriteriaCode = Discounts[i, 0]; RowToAdd.CostTypeCode = Discounts[i, 1]; RowToAdd.Validity = Discounts[i, 2]; RowToAdd.UpToAge = -1; RowToAdd.Percentage = true; RowToAdd.Discount = Convert.ToInt32(Discounts[i, 3]); FMainDS.PcDiscount.Rows.Add(RowToAdd); } // update existing record else if ((RowExists != null) && (Convert.ToInt32(Discounts[i, 3]) != 0)) { ((PcDiscountRow)RowExists).Discount = Convert.ToInt32(Discounts[i, 3]); } // delete existing record if discount is 0 else if ((RowExists != null) && (Convert.ToInt32(Discounts[i, 3]) == 0)) { RowExists.Delete(); } } }
private static void GenerateRegistrationOffices(string ACountryName, Int64 APartnerKey, string ACountryCode) { if (PUnitAccess.Exists(APartnerKey, null)) { TLogging.Log("Office with key " + APartnerKey.ToString() + " already exists."); return; } PartnerEditTDS MainDS = new PartnerEditTDS(); PPartnerRow partnerRow = MainDS.PPartner.NewRowTyped(true); partnerRow.PartnerKey = APartnerKey; partnerRow.PartnerShortName = ACountryName; partnerRow.PartnerClass = MPartnerConstants.PARTNERCLASS_UNIT; partnerRow.StatusCode = MPartnerConstants.PARTNERSTATUS_ACTIVE; partnerRow.AddresseeTypeCode = MPartnerConstants.ADDRESSEETYPE_ORGANISATION; MainDS.PPartner.Rows.Add(partnerRow); PUnitRow unitRow = MainDS.PUnit.NewRowTyped(true); unitRow.PartnerKey = partnerRow.PartnerKey; unitRow.UnitName = partnerRow.PartnerShortName; unitRow.CountryCode = ACountryCode; unitRow.UnitTypeCode = MPartnerConstants.UNIT_TYPE_FIELD; MainDS.PUnit.Rows.Add(unitRow); PLocationRow locationRow = MainDS.PLocation.NewRowTyped(); locationRow.SiteKey = partnerRow.PartnerKey; locationRow.LocationKey = 0; locationRow.StreetName = "No valid address on file"; locationRow.CountryCode = ACountryCode; MainDS.PLocation.Rows.Add(locationRow); PPartnerLocationRow partnerlocationRow = MainDS.PPartnerLocation.NewRowTyped(); partnerlocationRow.PartnerKey = partnerRow.PartnerKey; partnerlocationRow.SiteKey = locationRow.SiteKey; partnerlocationRow.LocationKey = locationRow.LocationKey; MainDS.PPartnerLocation.Rows.Add(partnerlocationRow); PPartnerTypeRow partnertypeRow = MainDS.PPartnerType.NewRowTyped(); partnertypeRow.PartnerKey = partnerRow.PartnerKey; partnertypeRow.TypeCode = MPartnerConstants.PARTNERTYPE_LEDGER; MainDS.PPartnerType.Rows.Add(partnertypeRow); UmUnitStructureRow unitStructureRow = MainDS.UmUnitStructure.NewRowTyped(); unitStructureRow.ParentUnitKey = 1000000; unitStructureRow.ChildUnitKey = partnerRow.PartnerKey; MainDS.UmUnitStructure.Rows.Add(unitStructureRow); PartnerEditTDSAccess.SubmitChanges(MainDS); string sqlInsertModule = String.Format("INSERT INTO PUB_{0}({1}, {2}) VALUES ('REG-{3:0000000000}','Registration {4}')", SModuleTable.GetTableDBName(), SModuleTable.GetModuleIdDBName(), SModuleTable.GetModuleNameDBName(), APartnerKey, ACountryName); string sqlInsertModulePermissions = String.Format("INSERT INTO PUB_{0}({1}, {2}, {3}) VALUES ('DEMO', 'REG-{4:0000000000}',true)", SUserModuleAccessPermissionTable.GetTableDBName(), SUserModuleAccessPermissionTable.GetUserIdDBName(), SUserModuleAccessPermissionTable.GetModuleIdDBName(), SUserModuleAccessPermissionTable.GetCanAccessDBName(), APartnerKey); TDBTransaction Transaction = DBAccess.GDBAccessObj.BeginTransaction(IsolationLevel.Serializable); try { DBAccess.GDBAccessObj.ExecuteNonQuery(sqlInsertModule, Transaction); DBAccess.GDBAccessObj.ExecuteNonQuery(sqlInsertModulePermissions, Transaction); DBAccess.GDBAccessObj.CommitTransaction(); } catch (Exception e) { TLogging.Log(e.ToString()); DBAccess.GDBAccessObj.RollbackTransaction(); } }
public static ArrayList GetUnitHeirarchy() { const Int64 THE_ORGANISATION = 1000000; ArrayList Ret = new ArrayList(); TDBTransaction Transaction = null; DBAccess.GDBAccessObj.BeginAutoReadTransaction(IsolationLevel.ReadCommitted, ref Transaction, delegate { PPartnerTable PartnerTbl = PPartnerAccess.LoadViaPPartnerClasses("UNIT", Transaction); PartnerTbl.DefaultView.RowFilter = "p_status_code_c <> 'MERGED'"; PartnerTbl.DefaultView.Sort = PPartnerTable.GetPartnerKeyDBName(); PUnitTable UnitTbl = PUnitAccess.LoadAll(Transaction); UUnitTypeTable UnitTypeTbl = UUnitTypeAccess.LoadAll(Transaction); UnitTypeTbl.DefaultView.Sort = UUnitTypeTable.GetUnitTypeCodeDBName(); UmUnitStructureTable HierarchyTbl = UmUnitStructureAccess.LoadAll(Transaction); HierarchyTbl.DefaultView.Sort = UmUnitStructureTable.GetChildUnitKeyDBName(); UnitTbl.DefaultView.Sort = PUnitTable.GetPartnerKeyDBName(); UnitHierarchyNode RootNode = new UnitHierarchyNode(); UnitHierarchyNode UnassignedNode = new UnitHierarchyNode(); RootNode.MyUnitKey = THE_ORGANISATION; RootNode.ParentUnitKey = THE_ORGANISATION; RootNode.Description = "The Organisation"; RootNode.TypeCode = "Root"; Int32 RootUnitIdx = UnitTbl.DefaultView.Find(THE_ORGANISATION); if (RootUnitIdx >= 0) { RootNode.Description = ((PUnitRow)UnitTbl.DefaultView[RootUnitIdx].Row).UnitName; UnitTbl.DefaultView.Delete(RootUnitIdx); } Ret.Add(RootNode); UnassignedNode.MyUnitKey = 0; UnassignedNode.ParentUnitKey = 0; UnassignedNode.Description = Catalog.GetString("Unassigned Units"); Ret.Add(UnassignedNode); foreach (DataRowView rv in UnitTbl.DefaultView) { PUnitRow UnitRow = (PUnitRow)rv.Row; if (PartnerTbl.DefaultView.Find(UnitRow.PartnerKey) < 0) { // skip all merged units continue; } UnitHierarchyNode Node = new UnitHierarchyNode(); Node.Description = UnitRow.UnitName + " " + UnitRow.Description; if (Node.Description == "") { Node.Description = "[" + UnitRow.PartnerKey.ToString("D10") + "]"; } Node.MyUnitKey = UnitRow.PartnerKey; // // Retrieve parent.. Int32 HierarchyTblIdx = HierarchyTbl.DefaultView.Find(Node.MyUnitKey); if (HierarchyTblIdx >= 0) { Node.ParentUnitKey = ((UmUnitStructureRow)HierarchyTbl.DefaultView[HierarchyTblIdx].Row).ParentUnitKey; } else { Node.ParentUnitKey = UnassignedNode.MyUnitKey; } // // Retrieve TypeCode.. Int32 TypeTblIndex = UnitTypeTbl.DefaultView.Find(UnitRow.UnitTypeCode); if (TypeTblIndex >= 0) { Node.TypeCode = ((UUnitTypeRow)UnitTypeTbl.DefaultView[TypeTblIndex].Row).UnitTypeName; } else { Node.TypeCode = "Type: " + UnitRow.UnitTypeCode; } Ret.Add(Node); } }); return(Ret); }
public static Boolean GetMotivationGroupAndDetail(Int64 APartnerKey, ref String AMotivationGroup, ref String AMotivationDetail) { Boolean PartnerKeyIsValid = false; if (APartnerKey != 0) { AMotivationGroup = MFinanceConstants.MOTIVATION_GROUP_GIFT; string MotivationDetail = AMotivationDetail; TDBTransaction readTransaction = null; DBAccess.GDBAccessObj.GetNewOrExistingAutoReadTransaction(IsolationLevel.ReadCommitted, TEnforceIsolationLevel.eilMinimum, ref readTransaction, delegate { PPartnerTable myPPartnerTable = PPartnerAccess.LoadByPrimaryKey(APartnerKey, readTransaction); if (myPPartnerTable.Rows.Count == 1) { // Entry for partnerKey is valid PartnerKeyIsValid = true; PPartnerRow partnerRow = (PPartnerRow)myPPartnerTable.Rows[0]; // Change motivationDetail if ColumnPartnerClass is UNIT if (partnerRow.PartnerClass.Equals(MPartnerConstants.PARTNERCLASS_UNIT)) { // AND KEY-MIN PUnitTable pUnitTable = PUnitAccess.LoadByPrimaryKey(APartnerKey, readTransaction); if (pUnitTable.Rows.Count == 1) { PUnitRow unitRow = (PUnitRow)pUnitTable.Rows[0]; if (unitRow.UnitTypeCode.Equals(MPartnerConstants.UNIT_TYPE_KEYMIN)) { MotivationDetail = MFinanceConstants.GROUP_DETAIL_KEY_MIN; } else { MotivationDetail = TSystemDefaults.GetSystemDefault(SharedConstants.SYSDEFAULT_DEFAULTFIELDMOTIVATION, MFinanceConstants.GROUP_DETAIL_FIELD); // if system default is empty then set to FIELD if (string.IsNullOrEmpty(MotivationDetail)) { MotivationDetail = MFinanceConstants.GROUP_DETAIL_FIELD; } } } } else { MotivationDetail = MFinanceConstants.GROUP_DETAIL_SUPPORT; } } }); AMotivationDetail = MotivationDetail; } return(PartnerKeyIsValid); }
/// <summary> /// generate the units /// </summary> /// <param name="AFieldCSVFile"></param> public static void GenerateFields(string AFieldCSVFile) { XmlDocument doc = TCsv2Xml.ParseCSVFile2Xml(AFieldCSVFile, ","); XmlNode RecordNode = doc.FirstChild.NextSibling.FirstChild; PartnerImportExportTDS PartnerDS = new PartnerImportExportTDS(); GLSetupTDS GLSetupDS = new GLSetupTDS(); PCountryTable CountryTable = null; TDBTransaction Transaction = new TDBTransaction(); DBAccess.ReadTransaction( ref Transaction, delegate { CountryTable = PCountryAccess.LoadAll(Transaction); }); while (RecordNode != null) { PUnitRow UnitRow = PartnerDS.PUnit.NewRowTyped(); long id = 100 + Convert.ToInt64(TXMLParser.GetAttribute(RecordNode, "id")); UnitRow.PartnerKey = id * 1000000; string CountryCode = TXMLParser.GetAttribute(RecordNode, "Name"); UnitRow.UnitName = ((PCountryRow)CountryTable.Rows.Find(CountryCode)).CountryName; UnitRow.UnitTypeCode = "F"; PartnerDS.PUnit.Rows.Add(UnitRow); PPartnerRow PartnerRow = PartnerDS.PPartner.NewRowTyped(); PartnerRow.PartnerKey = UnitRow.PartnerKey; PartnerRow.PartnerShortName = UnitRow.UnitName; PartnerRow.PartnerClass = MPartnerConstants.PARTNERCLASS_UNIT; PartnerRow.StatusCode = MPartnerConstants.PARTNERSTATUS_ACTIVE; PartnerDS.PPartner.Rows.Add(PartnerRow); // add empty location so that the partner can be found in the Partner Find screen PPartnerLocationRow PartnerLocationRow = PartnerDS.PPartnerLocation.NewRowTyped(); PartnerLocationRow.PartnerKey = UnitRow.PartnerKey; PartnerLocationRow.LocationKey = 0; PartnerLocationRow.SiteKey = 0; PartnerDS.PPartnerLocation.Rows.Add(PartnerLocationRow); // create unit hierarchy UmUnitStructureRow UnitStructureRow = PartnerDS.UmUnitStructure.NewRowTyped(); UnitStructureRow.ParentUnitKey = 1000000; UnitStructureRow.ChildUnitKey = UnitRow.PartnerKey; PartnerDS.UmUnitStructure.Rows.Add(UnitStructureRow); // create special type PPartnerTypeRow PartnerTypeRow = PartnerDS.PPartnerType.NewRowTyped(); PartnerTypeRow.PartnerKey = UnitRow.PartnerKey; PartnerTypeRow.TypeCode = MPartnerConstants.PARTNERTYPE_LEDGER; PartnerDS.PPartnerType.Rows.Add(PartnerTypeRow); // create cost centre ACostCentreRow CostCentreRow = GLSetupDS.ACostCentre.NewRowTyped(); CostCentreRow.LedgerNumber = FLedgerNumber; CostCentreRow.CostCentreCode = (id * 100).ToString("0000"); CostCentreRow.CostCentreName = UnitRow.UnitName; CostCentreRow.CostCentreToReportTo = MFinanceConstants.INTER_LEDGER_HEADING; CostCentreRow.CostCentreType = MFinanceConstants.FOREIGN_CC_TYPE; GLSetupDS.ACostCentre.Rows.Add(CostCentreRow); // create foreign ledger, cost centre link validledgernumber AValidLedgerNumberRow ValidLedgerNumber = GLSetupDS.AValidLedgerNumber.NewRowTyped(); ValidLedgerNumber.LedgerNumber = FLedgerNumber; ValidLedgerNumber.PartnerKey = UnitRow.PartnerKey; ValidLedgerNumber.CostCentreCode = CostCentreRow.CostCentreCode; ValidLedgerNumber.IltProcessingCentre = Convert.ToInt64(MFinanceConstants.ICH_COST_CENTRE) * 10000; GLSetupDS.AValidLedgerNumber.Rows.Add(ValidLedgerNumber); RecordNode = RecordNode.NextSibling; } PartnerImportExportTDSAccess.SubmitChanges(PartnerDS); GLSetupTDSAccess.SubmitChanges(GLSetupDS); }
public static Boolean GetMotivationGroupAndDetailForPartner(Int64 APartnerKey, ref String AMotivationGroup, ref String AMotivationDetail) { Boolean PartnerKeyIsValid = false; if (APartnerKey != 0) { string motivationGroup = MFinanceConstants.MOTIVATION_GROUP_GIFT; string motivationDetail = AMotivationDetail; TDBTransaction readTransaction = null; DBAccess.GDBAccessObj.GetNewOrExistingAutoReadTransaction(IsolationLevel.ReadCommitted, TEnforceIsolationLevel.eilMinimum, ref readTransaction, delegate { PPartnerTable myPPartnerTable = PPartnerAccess.LoadByPrimaryKey(APartnerKey, readTransaction); if (myPPartnerTable.Rows.Count == 1) { // partnerKey is valid PartnerKeyIsValid = true; PPartnerRow partnerRow = myPPartnerTable[0]; // Change motivationDetail if PartnerClass is UNIT if (partnerRow.PartnerClass.Equals(MPartnerConstants.PARTNERCLASS_UNIT)) { // AND KEY-MIN bool KeyMinFound = false; // first check if a specific motivation detail is linked to this partner AMotivationDetailTable MotivationDetailTable = AMotivationDetailAccess.LoadViaPPartner(APartnerKey, readTransaction); if ((MotivationDetailTable != null) && (MotivationDetailTable.Rows.Count > 0)) { foreach (AMotivationDetailRow Row in MotivationDetailTable.Rows) { if (Row.MotivationStatus) { motivationGroup = MotivationDetailTable[0].MotivationGroupCode; motivationDetail = MotivationDetailTable[0].MotivationDetailCode; KeyMinFound = true; break; // Go with the first entry found. } } } if (!KeyMinFound) { // Is this is a key min, or a field? PUnitTable pUnitTable = PUnitAccess.LoadByPrimaryKey(APartnerKey, readTransaction); if (pUnitTable.Rows.Count == 1) { PUnitRow unitRow = pUnitTable[0]; switch (unitRow.UnitTypeCode) { case MPartnerConstants.UNIT_TYPE_AREA: case MPartnerConstants.UNIT_TYPE_FUND: case MPartnerConstants.UNIT_TYPE_FIELD: motivationDetail = MFinanceConstants.GROUP_DETAIL_FIELD; break; case MPartnerConstants.UNIT_TYPE_KEYMIN: motivationDetail = MFinanceConstants.GROUP_DETAIL_KEY_MIN; break; case MPartnerConstants.UNIT_TYPE_COUNTRY: case MPartnerConstants.UNIT_TYPE_CONFERENCE: case MPartnerConstants.UNIT_TYPE_OTHER: case MPartnerConstants.UNIT_TYPE_ROOT: case MPartnerConstants.UNIT_TYPE_TEAM: case MPartnerConstants.UNIT_TYPE_WORKING_GROUP: default: motivationDetail = MFinanceConstants.GROUP_DETAIL_SUPPORT; break; } } } } else { motivationDetail = MFinanceConstants.GROUP_DETAIL_SUPPORT; } } }); AMotivationGroup = motivationGroup; AMotivationDetail = motivationDetail; } return(PartnerKeyIsValid); }
/// <summary> /// return an XmlDocument with all partner info; /// the partners are grouped by class, country, status, and sitekey /// </summary> /// <returns></returns> public static string ExportPartners() { PartnerEditTDS MainDS = new PartnerEditTDS(); LoadDataFromDB(ref MainDS); // Group partners into categories. // // A partner's category is defined by his: class, country, status, and sitekey // It is stored as a string e.g. "FAMILY,DE,ACTIVE,0". // SortedList <string, List <long> > PartnerCategories = GroupPartnersIntoCategories(MainDS); // create XML structure for each category XmlDocument PartnerData = TYml2Xml.CreateXmlDocument(); XmlNode rootNode = PartnerData.FirstChild.NextSibling; Int32 groupCounter = 0; foreach (string category in PartnerCategories.Keys) { // get category data groupCounter++; XmlElement groupNode = PartnerData.CreateElement("PartnerGroup" + groupCounter.ToString()); rootNode.AppendChild(groupNode); Int32 partnerCounter = 0; string[] categoryDetails = category.Split(new char[] { ',' }); // may want to skip the categories with sitekey = -1 // right now, we still export them and ignore the partners 0 and 1000000 later groupNode.SetAttribute("class", categoryDetails[0]); groupNode.SetAttribute("Country", categoryDetails[1]); groupNode.SetAttribute("status", categoryDetails[2]); groupNode.SetAttribute("SiteKey", categoryDetails[3]); List <long> partnerKeys = PartnerCategories[category]; foreach (long partnerKey in partnerKeys) { if ((partnerKey != 0) && (partnerKey != 1000000)) // skip organization root and the 0 when exporting { MainDS.PPartner.DefaultView.RowFilter = PPartnerTable.GetPartnerKeyDBName() + "=" + partnerKey.ToString(); PPartnerRow partnerRow = (PPartnerRow)MainDS.PPartner.DefaultView[0].Row; PFamilyRow familyRow = null; if (partnerRow.PartnerClass == MPartnerConstants.PARTNERCLASS_FAMILY) { MainDS.PFamily.DefaultView.RowFilter = PFamilyTable.GetPartnerKeyDBName() + "=" + partnerKey.ToString(); familyRow = (PFamilyRow)MainDS.PFamily.DefaultView[0].Row; } PPersonRow personRow = null; if (partnerRow.PartnerClass == MPartnerConstants.PARTNERCLASS_PERSON) { MainDS.PPerson.DefaultView.RowFilter = PPersonTable.GetPartnerKeyDBName() + "=" + partnerKey.ToString(); personRow = (PPersonRow)MainDS.PPerson.DefaultView[0].Row; } POrganisationRow organisationRow = null; if (partnerRow.PartnerClass == MPartnerConstants.PARTNERCLASS_ORGANISATION) { MainDS.POrganisation.DefaultView.RowFilter = POrganisationTable.GetPartnerKeyDBName() + "=" + partnerKey.ToString(); organisationRow = (POrganisationRow)MainDS.POrganisation.DefaultView[0].Row; } PUnitRow unitRow = null; UmUnitStructureRow unitStructureRow = null; if (partnerRow.PartnerClass == MPartnerConstants.PARTNERCLASS_UNIT) { MainDS.PUnit.DefaultView.RowFilter = PUnitTable.GetPartnerKeyDBName() + "=" + partnerKey.ToString(); unitRow = (PUnitRow)MainDS.PUnit.DefaultView[0].Row; MainDS.UmUnitStructure.DefaultView.RowFilter = UmUnitStructureTable.GetChildUnitKeyDBName() + " = " + partnerKey.ToString(); long numParents = MainDS.UmUnitStructure.DefaultView.Count; if (numParents == 1) { unitStructureRow = (UmUnitStructureRow)MainDS.UmUnitStructure.DefaultView[0].Row; } else { throw new Exception( "Units must have exactly one ParentUnit. " + "The unit with partnerKey " + partnerKey.ToString() + " has " + numParents.ToString() + "."); } } PBankRow BankRow = null; if (partnerRow.PartnerClass == MPartnerConstants.PARTNERCLASS_BANK) { MainDS.PBank.DefaultView.RowFilter = PBankTable.GetPartnerKeyDBName() + "=" + partnerKey.ToString(); BankRow = (PBankRow)MainDS.PBank.DefaultView[0].Row; } partnerCounter++; XmlElement partnerNode = PartnerData.CreateElement("Partner" + partnerCounter.ToString()); groupNode.AppendChild(partnerNode); partnerNode.SetAttribute("PartnerKey", partnerRow.PartnerKey.ToString()); //groupNode.SetAttribute("ShortName", partnerRow.PartnerShortName.ToString()); if (personRow != null) { partnerNode.SetAttribute("FirstName", personRow.FirstName.ToString()); partnerNode.SetAttribute("LastName", personRow.FamilyName.ToString()); partnerNode.SetAttribute("Title", personRow.Title.ToString()); } else if (familyRow != null) { partnerNode.SetAttribute("FirstName", familyRow.FirstName.ToString()); partnerNode.SetAttribute("LastName", familyRow.FamilyName.ToString()); partnerNode.SetAttribute("Title", familyRow.Title.ToString()); } else if (organisationRow != null) { partnerNode.SetAttribute("Name", organisationRow.OrganisationName.ToString()); } else if (unitRow != null) { partnerNode.SetAttribute("Name", unitRow.UnitName.ToString()); partnerNode.SetAttribute("UnitTypeCode", unitRow.UnitTypeCode.ToString()); if (unitStructureRow != null) { partnerNode.SetAttribute("ParentUnitKey", unitStructureRow.ParentUnitKey.ToString()); } } if (BankRow != null) { partnerNode.SetAttribute("BranchName", BankRow.BranchName); partnerNode.SetAttribute("BranchCode", BankRow.BranchCode); partnerNode.SetAttribute("BranchBic", BankRow.Bic); partnerNode.SetAttribute("EpFormatFile", BankRow.EpFormatFile); } partnerNode.SetAttribute("CreatedAt", partnerRow.DateCreated.Value.ToString("yyyy-MM-dd HH:mm:ss")); // special types string specialTypes = ""; MainDS.PPartnerType.DefaultView.RowFilter = PPartnerTypeTable.GetPartnerKeyDBName() + "=" + partnerKey.ToString(); foreach (DataRowView rv in MainDS.PPartnerType.DefaultView) { if (specialTypes.Length > 0) { specialTypes += ", "; } specialTypes += ((PPartnerTypeRow)rv.Row).TypeCode; } if (specialTypes.Length > 0) { partnerNode.SetAttribute("SpecialTypes", specialTypes); } // addresses DataView partnerLocationView = MainDS.PPartnerLocation.DefaultView; partnerLocationView.RowFilter = PPartnerLocationTable.GetPartnerKeyDBName() + " = " + partnerRow.PartnerKey.ToString() + "AND " + PPartnerLocationTable.GetLocationKeyDBName() + " <> 0 "; // ignore invalid addresses Int32 addressCounter = 0; foreach (DataRowView rv in partnerLocationView) { XmlElement addressNode = PartnerData.CreateElement("Address" + (addressCounter > 0 ? addressCounter.ToString() : "")); addressCounter++; partnerNode.AppendChild(addressNode); PPartnerLocationRow partnerLocationRow = (PPartnerLocationRow)rv.Row; DataView locationView = MainDS.PLocation.DefaultView; locationView.RowFilter = PLocationTable.GetSiteKeyDBName() + "=" + partnerLocationRow.SiteKey.ToString() + " AND " + PLocationTable.GetLocationKeyDBName() + "=" + partnerLocationRow.LocationKey.ToString(); if (locationView.Count > 0) { PLocationRow locationRow = (PLocationRow)locationView[0].Row; addressNode.SetAttribute("Street", locationRow.StreetName); addressNode.SetAttribute("City", locationRow.City); addressNode.SetAttribute("PostCode", locationRow.PostalCode); } addressNode.SetAttribute("Email", partnerLocationRow.EmailAddress); addressNode.SetAttribute("Phone", partnerLocationRow.TelephoneNumber); addressNode.SetAttribute("MobilePhone", partnerLocationRow.MobileNumber); } // TODO: notes // TODO: This doesn't export as much data as it should? } } } return(TXMLParser.XmlToString(PartnerData)); }