public static void Delete(NodeViewRow pNodeViewRow, CustomerAcctDto pCustomerAcct) { using (Rbr_Db _db = new Rbr_Db()) { using (Transaction _tx = new Transaction(_db, pNodeViewRow, pCustomerAcct)) { LoadBalancingMapRow _loadBalancingMapRow = LoadBalancingMapManager.Get(_db, pNodeViewRow.Node_id, pCustomerAcct.CustomerAcctId); LoadBalancingMapManager.Delete(_db, _loadBalancingMapRow); _tx.Commit(); } } }
/// <summary> /// Converts <see cref="System.Data.DataRow"/> to <see cref="NodeViewRow"/>. /// </summary> /// <param name="row">The <see cref="System.Data.DataRow"/> object to be mapped.</param> /// <returns>A reference to the <see cref="NodeViewRow"/> object.</returns> protected virtual NodeViewRow MapRow(DataRow row) { NodeViewRow mappedObject = new NodeViewRow(); DataTable dataTable = row.Table; DataColumn dataColumn; // Column "Node_id" dataColumn = dataTable.Columns["Node_id"]; if (!row.IsNull(dataColumn)) { mappedObject.Node_id = (short)row[dataColumn]; } // Column "Platform_id" dataColumn = dataTable.Columns["Platform_id"]; if (!row.IsNull(dataColumn)) { mappedObject.Platform_id = (short)row[dataColumn]; } // Column "Description" dataColumn = dataTable.Columns["Description"]; if (!row.IsNull(dataColumn)) { mappedObject.Description = (string)row[dataColumn]; } // Column "Node_config" dataColumn = dataTable.Columns["Node_config"]; if (!row.IsNull(dataColumn)) { mappedObject.Node_config = (int)row[dataColumn]; } // Column "Transport_type" dataColumn = dataTable.Columns["Transport_type"]; if (!row.IsNull(dataColumn)) { mappedObject.Transport_type = (byte)row[dataColumn]; } // Column "User_name" dataColumn = dataTable.Columns["User_name"]; if (!row.IsNull(dataColumn)) { mappedObject.User_name = (string)row[dataColumn]; } // Column "Password" dataColumn = dataTable.Columns["Password"]; if (!row.IsNull(dataColumn)) { mappedObject.Password = (string)row[dataColumn]; } // Column "Ip_address" dataColumn = dataTable.Columns["Ip_address"]; if (!row.IsNull(dataColumn)) { mappedObject.Ip_address = (int)row[dataColumn]; } // Column "Port" dataColumn = dataTable.Columns["Port"]; if (!row.IsNull(dataColumn)) { mappedObject.Port = (int)row[dataColumn]; } // Column "Dot_ip_address" dataColumn = dataTable.Columns["Dot_ip_address"]; if (!row.IsNull(dataColumn)) { mappedObject.Dot_ip_address = (string)row[dataColumn]; } // Column "Node_status" dataColumn = dataTable.Columns["Node_status"]; if (!row.IsNull(dataColumn)) { mappedObject.Node_status = (byte)row[dataColumn]; } // Column "Billing_export_frequency" dataColumn = dataTable.Columns["Billing_export_frequency"]; if (!row.IsNull(dataColumn)) { mappedObject.Billing_export_frequency = (int)row[dataColumn]; } // Column "Cdr_publishing_frequency" dataColumn = dataTable.Columns["Cdr_publishing_frequency"]; if (!row.IsNull(dataColumn)) { mappedObject.Cdr_publishing_frequency = (int)row[dataColumn]; } // Column "Platform_location" dataColumn = dataTable.Columns["Platform_location"]; if (!row.IsNull(dataColumn)) { mappedObject.Platform_location = (string)row[dataColumn]; } // Column "Platform_status" dataColumn = dataTable.Columns["Platform_status"]; if (!row.IsNull(dataColumn)) { mappedObject.Platform_status = (byte)row[dataColumn]; } // Column "Platform_config" dataColumn = dataTable.Columns["Platform_config"]; if (!row.IsNull(dataColumn)) { mappedObject.Platform_config = (int)row[dataColumn]; } return(mappedObject); }
/// <summary> /// Reads data from the provided data reader and returns /// an array of mapped objects. /// </summary> /// <param name="reader">The <see cref="System.Data.IDataReader"/> object to read data from the view.</param> /// <param name="startIndex">The index of the first record to map.</param> /// <param name="length">The number of records to map.</param> /// <param name="totalRecordCount">A reference parameter that returns the total number /// of records in the reader object if 0 was passed into the method; otherwise it returns -1.</param> /// <returns>An array of <see cref="NodeViewRow"/> objects.</returns> protected virtual NodeViewRow[] MapRecords(IDataReader reader, int startIndex, int length, ref int totalRecordCount) { if (0 > startIndex) { throw new ArgumentOutOfRangeException("startIndex", startIndex, "StartIndex cannot be less than zero."); } if (0 > length) { throw new ArgumentOutOfRangeException("length", length, "Length cannot be less than zero."); } int node_idColumnIndex = reader.GetOrdinal("node_id"); int platform_idColumnIndex = reader.GetOrdinal("platform_id"); int descriptionColumnIndex = reader.GetOrdinal("description"); int node_configColumnIndex = reader.GetOrdinal("node_config"); int transport_typeColumnIndex = reader.GetOrdinal("transport_type"); int user_nameColumnIndex = reader.GetOrdinal("user_name"); int passwordColumnIndex = reader.GetOrdinal("password"); int ip_addressColumnIndex = reader.GetOrdinal("ip_address"); int portColumnIndex = reader.GetOrdinal("port"); int dot_ip_addressColumnIndex = reader.GetOrdinal("dot_ip_address"); int node_statusColumnIndex = reader.GetOrdinal("node_status"); int billing_export_frequencyColumnIndex = reader.GetOrdinal("billing_export_frequency"); int cdr_publishing_frequencyColumnIndex = reader.GetOrdinal("cdr_publishing_frequency"); int platform_locationColumnIndex = reader.GetOrdinal("platform_location"); int platform_statusColumnIndex = reader.GetOrdinal("platform_status"); int platform_configColumnIndex = reader.GetOrdinal("platform_config"); System.Collections.ArrayList recordList = new System.Collections.ArrayList(); int ri = -startIndex; while (reader.Read()) { ri++; if (ri > 0 && ri <= length) { NodeViewRow record = new NodeViewRow(); recordList.Add(record); record.Node_id = Convert.ToInt16(reader.GetValue(node_idColumnIndex)); record.Platform_id = Convert.ToInt16(reader.GetValue(platform_idColumnIndex)); record.Description = Convert.ToString(reader.GetValue(descriptionColumnIndex)); record.Node_config = Convert.ToInt32(reader.GetValue(node_configColumnIndex)); record.Transport_type = Convert.ToByte(reader.GetValue(transport_typeColumnIndex)); record.User_name = Convert.ToString(reader.GetValue(user_nameColumnIndex)); record.Password = Convert.ToString(reader.GetValue(passwordColumnIndex)); record.Ip_address = Convert.ToInt32(reader.GetValue(ip_addressColumnIndex)); record.Port = Convert.ToInt32(reader.GetValue(portColumnIndex)); if (!reader.IsDBNull(dot_ip_addressColumnIndex)) { record.Dot_ip_address = Convert.ToString(reader.GetValue(dot_ip_addressColumnIndex)); } record.Node_status = Convert.ToByte(reader.GetValue(node_statusColumnIndex)); record.Billing_export_frequency = Convert.ToInt32(reader.GetValue(billing_export_frequencyColumnIndex)); record.Cdr_publishing_frequency = Convert.ToInt32(reader.GetValue(cdr_publishing_frequencyColumnIndex)); record.Platform_location = Convert.ToString(reader.GetValue(platform_locationColumnIndex)); record.Platform_status = Convert.ToByte(reader.GetValue(platform_statusColumnIndex)); record.Platform_config = Convert.ToInt32(reader.GetValue(platform_configColumnIndex)); if (ri == length && 0 != totalRecordCount) { break; } } } totalRecordCount = 0 == totalRecordCount ? ri + startIndex : -1; return((NodeViewRow[])(recordList.ToArray(typeof(NodeViewRow)))); }