本文整理汇总了C#中ResultSet类的典型用法代码示例。如果您正苦于以下问题:C# ResultSet类的具体用法?C# ResultSet怎么用?C# ResultSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ResultSet类属于命名空间,在下文中一共展示了ResultSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MapRow
private static void MapRow(DbDataReader dr, int numberOfColumns, ResultSet table) {
var row = new object[numberOfColumns];
for (int i = 0; i < numberOfColumns; i++) {
row[i] = (DBNull.Value.Equals(dr[i])) ? null : dr[i];
}
table.AddRow(row);
}
示例2: DataHandler
public JsonResult DataHandler(DTParameters param)
{
try
{
var dtsource = new List<Customer>();
using (dataSetEntities dc = new dataSetEntities())
{
dtsource = dc.Customers.ToList();
}
List<String> columnSearch = new List<string>();
foreach (var col in param.Columns)
{
columnSearch.Add(col.Search.Value);
}
List<Customer> data = new ResultSet().GetResult(param.Search.Value, param.SortOrder, param.Start, param.Length, dtsource, columnSearch);
int count = new ResultSet().Count(param.Search.Value, dtsource, columnSearch);
DTResult<Customer> result = new DTResult<Customer>
{
draw = param.Draw,
data = data,
recordsFiltered = count,
recordsTotal = count
};
return Json(result);
}
catch (Exception ex)
{
return Json(new { error = ex.Message });
}
}
示例3: ReportForm
private ResultSet reportedResultSet; // Stores the result set that is reported by this report
#endregion Fields
#region Constructors
// Create a new report form with a Variable Number of column names
public ReportForm(ResultSet reportedResults, params string[] names)
{
InitializeComponent();
reportedResultSet = reportedResults; // Store the result set
columnNames = names; // Store the column names
CreateTable(); // Create the table from the column names and the result set
}
示例4: DataReader
internal DataReader(ResultSet resultSet)
{
ResultIndex = -1;
m_resultSet = resultSet;
NextResult();
}
示例5: Constructor_ResultsModifiedAfter_ResultSetNotModified
public void Constructor_ResultsModifiedAfter_ResultSetNotModified()
{
ResultSet<PalasoTestItem> resultSet = new ResultSet<PalasoTestItem>(_dataMapper, _results);
_results.Add(new RecordToken<PalasoTestItem>(_dataMapper, _resultSet[2].Id));
Assert.AreNotEqual(_results.Count, resultSet.Count);
}
示例6: ChangeBooking
private void ChangeBooking(string customerName)
{
bookingResults = new ResultSet(dal.GetDataReader("BookingTable", "CustomerID = " + CustomerIDComboBox.Text));
ClearExpensesLabels(); // Remove any labels explaining expenses
//Obtain prices from all aspect of the database. Calculating price through C# prevents data duplication / redundancy
float equipmentLoansPrice = dal.ReadPrice("EquipmentLoansTable JOIN EquipmentTable ON EquipmentLoansTable.EquipmentID = EquipmentTable.EquipmentID", "CustomerID = " + CustomerIDComboBox.Text, "(RentalPrice * Duration)");
float sightseeingBusPrice = dal.ReadPrice("[Customer-BusTripTable]", "CustomerID = " + CustomerIDComboBox.Text, "Price");
float cyclingTourPrice = dal.ReadPrice("[Customer-CyclingTourTable]", "CustomerID = " + CustomerIDComboBox.Text, "Price");
float cyclingLessonPrice = dal.ReadPrice("[Child-CyclingLessonTable] JOIN [ChildTable] ON [Child-CyclingLessonTable].ChildID = ChildTable.ChildID", "ChildTable.CustomerID = " + CustomerIDComboBox.Text, "[Child-CyclingLessonTable].Price");
float cyclingCertificationPrice = dal.ReadPrice("CertificationBookingsTable JOIN ChildTable ON CertificationBookingsTable.ChildID = ChildTable.ChildID", "ChildTable.CustomerID = " + CustomerIDComboBox.Text, "[CertificationBookingsTable].Price");
dal.OpenConnection(); // Connection is opened and closed manually for a GetCount call because this can save on lag caused by connecting to database.
float cyclingAwardPrice = dal.GetCount("[CyclingAwardsTable] JOIN ChildTable ON CyclingAwardsTable.ChildID = ChildTable.ChildID", "CustomerID = " + CustomerIDComboBox.Text) * 20.0f;
dal.CloseConnection();
// For each expense, if it is relevant display a label explaining the expense
if (equipmentLoansPrice > 0)
{
AddExpensesLabel("Charge for Hiring Equipment: £" + Program.ToCurrency(equipmentLoansPrice));
}
if (sightseeingBusPrice > 0)
{
AddExpensesLabel("Charge for Sightseeing Trip(s): £" + Program.ToCurrency(sightseeingBusPrice));
}
if (cyclingTourPrice > 0)
{
AddExpensesLabel("Charge for Cycling Tour(s): £" + Program.ToCurrency(cyclingTourPrice));
}
if (cyclingLessonPrice > 0)
{
AddExpensesLabel("Charge for Cycling Lesson(s): £" + Program.ToCurrency(cyclingLessonPrice));
}
if (cyclingCertificationPrice > 0)
{
AddExpensesLabel("Charge for Cycling Certification(s): £" + Program.ToCurrency(cyclingCertificationPrice));
}
if (cyclingAwardPrice > 0)
{
AddExpensesLabel("Charge for Cycling Award(s): £" + Program.ToCurrency(cyclingAwardPrice));
}
//Set the chosen customer name and id straight from the SuggestiveTextBox and ComboBox
CustomerNameLabel.Text = "Customer Name: " + customerName;
CustomerIDLabel.Text = "Customer ID: " + CustomerIDComboBox.Text + "";
try
{
BookingIDLabel.Text = "Booking ID: " + bookingResults.GetData<int>(0, 0); // Retrieve and display the bookingID
}
catch (Exception e)
{
Console.WriteLine("No data found for this customer. Check "); // Should never be called.
}
// Sum all of the prices to give a total price
float totalPrice = equipmentLoansPrice + sightseeingBusPrice + cyclingTourPrice + cyclingLessonPrice + cyclingCertificationPrice + cyclingAwardPrice;
TotalPriceLabel.Text = "Total Price: £" + Program.ToCurrency(totalPrice);
}
示例7: FromResultSet
internal static MessagePagingInfo FromResultSet(ResultSet resultSet)
{
return new MessagePagingInfo
{
PagingCookig = resultSet.PagingCookie,
HasMoreRecords = Convert.ToBoolean(resultSet.MoreRecords, CultureInfo.InvariantCulture)
};
}
示例8: CancelBookingButton_Click
// When the cancel booking button is pressed
private void CancelBookingButton_Click(object sender, EventArgs e)
{
bookingDAL.MoveBookingToHistory(bookingID); // Move the cancelled booking to history
bookingResults = UpdateResultSet("[dbo].[BookingTable]");
UpdateDisplayedResults(UpdateResultSet("BookingTable JOIN CustomerTable ON BookingTable.CustomerID = CustomerTable.CustomerID", "1=1", "BookingID, BookingTable.CustomerID, CustomerName, StartDate, NightsStayed, PricePerNight, TotalPrice")); // Display all of the booking results as we are not yet filtering them
CustomerNameSuggestingTextBox.Text = ""; // Reset the display to show all booking still not cancelled
ShowRecord(0);
}
示例9: CampingBookingsHistoryReport_Click
private void CampingBookingsHistoryReport_Click(object sender, EventArgs e)
{
ResultSet rs = new ResultSet(dal.GetDataReader("BookingHistoryTable JOIN CustomerTable ON BookingHistoryTable.CustomerID = CustomerTable.CustomerID", "1=1", "BookingID, CustomerTable.CustomerID, CustomerName, StartDate, GroupSize, PricePerNight, TotalPrice, NightsStayed"));
ReportForm reportForm = new ReportForm(rs, "Booking ID", "Customer ID", "Customer Name", "Start Date", "Group Size", "Price per Night", "Total Price", "Nights Stayed");
reportForm.SetFormTitle("Booking History Report");
reportForm.SetDateFilterColumn(3);
OpenForm(reportForm);
}
示例10: Map
public static ResultSet Map(DbDataReader dr) {
int numberOfColumns = dr.FieldCount;
string[] colNames = GetColumnNames(dr, numberOfColumns);
var table = new ResultSet(colNames);
while (dr.Read()) {
MapRow(dr, numberOfColumns, table);
}
return table;
}
示例11: ExecuteReader
public DataReader ExecuteReader()
{
var cursor = MongoConnection.MongoDatabase.GetCollection(CollectionName).FindAll();
Result result = new Result(cursor);
ResultSet resultSet = new ResultSet();
resultSet.Add(result);
DataReader reader = new DataReader(resultSet);
return reader;
}
示例12: Yahoo_PlaceFinder_ResultSetQualityCategory_ShouldBeArea_WhenQualityIsLessThan70
public void Yahoo_PlaceFinder_ResultSetQualityCategory_ShouldBeArea_WhenQualityIsLessThan70()
{
var model = new ResultSet
{
Quality = 69,
};
model.QualityCategory().ShouldEqual(QualityCategory.Area);
}
示例13: Item
/// <summary>
/// Create a new Item with a result set from the database
/// </summary>
/// <param name="set"></param>
public Item(ResultSet set)
{
this.Id = set.Read<Int32>("ItemId");
this.CreatorId = set.Read<Int32>("CreatorId");
this.Slot = (Byte)set.Read<Int32>("Slot");
this.Quantity = (UInt32)set.Read<Int32>("Quantity");
this.Equiped = set.Read<Boolean>("Equiped");
Attributes = new Byte[17];
Attributes[0] = 0x40;
}
示例14: ResultSetToStringArrayList
/// <summary>
/// Gets the result set as list of string arrays.
/// </summary>
/// <param name="resultSet">The result set to convert to a string array list.</param>
/// <returns>A list of string arrays representing the result set.</returns>
public static List<String[]> ResultSetToStringArrayList(ResultSet resultSet) {
List<string[]> stringArrayList = new List<string[]>();
stringArrayList.Add(GetColumnLabels(resultSet));
if (resultSet.rows != null) {
foreach (Row row in resultSet.rows) {
stringArrayList.Add(GetRowStringValues(row));
}
}
return stringArrayList;
}
示例15: Handle
internal void Handle(GetTrafficEvents input) {
var output = new ResultSet<TrafficEvent>();
BplCollection<TrafficEventInfo> dbEvents;
using (var dbConn = DatabaseManager.DbConn()) {
if ((input.Region == null) || (input.Region.IsEmpty)) {
dbEvents = dbConn.ExecuteBpl(new TrafficEventGetByOperator { Operator = input.Operator });
} else {
dbEvents = dbConn.ExecuteBpl(
new TrafficEventGetByOperatorRegion {
Operator = input.Operator,
North = input.Region.North,
South = input.Region.South,
West = input.Region.West,
East = input.Region.East
});
}
foreach (var ei in dbEvents) {
var oe = new Mpcr.Model.Vehicles.TrafficEvent();
oe.Id = ei.EventId;
oe.Codes = ei.Codes;
oe.Direction = ei.Direction;
oe.Extent = ei.Extent;
oe.IsTwoWay = ei.IsTwoWay;
oe.Origin = new TrafficLocation();
oe.Origin.LocationCode = ei.OriginLocationCode;
oe.Origin.CountryCode = ei.OriginCountryCode;
oe.Origin.LocationTableNumber = ei.OriginLocationTableNumber;
oe.Origin.Location = ei.OriginLocation;
if (ei.DestinationLocation != ei.OriginLocation) {
oe.Destination = new TrafficLocation();
oe.Destination.LocationCode = ei.DestinationLocationCode;
oe.Destination.CountryCode = ei.DestinationCountryCode;
oe.Destination.LocationTableNumber = ei.DestinationLocationTableNumber;
oe.Destination.Location = ei.DestinationLocation;
}
oe.ApproximatedDelay = ei.ApproximatedDelay;
oe.ApproximatedSpeed = ei.ApproximatedSpeed;
oe.LastUpdate = ei.LastUpdate.DateTime;
oe.Length = ei.Length;
oe.Load = ei.Load;
output.result.Add(oe);
}
}
Reply(output);
}