IDataStore.GetItemTime(int row, short column, DwBuffer bufferType = DwBuffer.Primary, bool isOriginalValue = false) Method
.NET Standard 2.x
Gets data whose type is TimeSpan
for the specified row and column from the specified buffer of the DataStore. You can obtain the data that was originally retrieved and stored in the database, as well as the current value in the primary, delete, or filter buffers.
Namespace: DWNet.Data
Assembly: DWNet.Data.dll
Syntax
public TimeSpan? GetItemTime(int row, short column, DwBuffer bufferType = DwBuffer.Primary, bool isOriginalValue = false);
Parameters
row
System.Int32
The zero-based row number to get data.
column
System.Int16
The zero-based column number to get data.
bufferType
DWNet.Data.DwBuffer
The specified buffer of the DataStore. The default is DwBuffer.Primary
.
isOriginalValue
System.Boolean
Whether to obtain the data that was originally retrieved.
True
: to obtain the data that was originally retrieved;
False
(default): to obtain the current data.
Returns
System.TimeSpan?
Returns the TimeSpan?
value in the specified row and column.
Remarks
Use GetItemTime
to get information from the DataWindow buffer
. When you specify true
for isOriginalValue
, the method gets the original data for that row.
Examples
The following code example demonstrates how to use the GetItemTime
method to get the time-type value in the specified row and column.
using DWNet.Data;
using System;
namespace Appeon.ApiDoc.IDataStoreExamples
{
public class GetItemTimeExample
{
private readonly SchoolContext _context;
public GetItemTimeExample(SchoolContext dataContext)
{
// Sets the data context
_context = dataContext;
}
public void Example1()
{
// Instantiates a DataStore object with datawindow: d_coursedescription.
var datastore = new DataStore("d_coursedescription", _context);
datastore.Retrieve();
// Sets the "inputtime" column in the first row to "12:12:12".
datastore.SetItem(0, "inputtime", TimeSpan.Parse("12:12:12"));
// Gets the original value in the first row and in columns (1st to 7th) of DataStore
// Column 7 (Column name is 'Inputtime') is time type
Console.WriteLine(
"Original value: Description: {0};\n" +
"inputtime: {1}",
datastore.GetItem<string>(0, 1),
datastore.GetItemTime(0, 6, DwBuffer.Primary, true));
// Gets the modified value in the first row and in columns (1st to 7th) of DataStore
// Column 7 is time type
Console.WriteLine(
"Modified value: Description: {0};\n" +
"inputtime: {1}",
datastore.GetItem<string>(0, 1),
datastore.GetItemTime(0, 6, DwBuffer.Primary, false));
/*This code produces the following output:
Original value: Description: Calculus Description;
inputtime: 08:08:08
Modified value: Description: Calculus Description;
inputtime: 12:12:12
*/
}
}
}
Example Refer To
Model Class: D_Coursedescription
DataWindow File: d_coursedescription
Applies to
.NET Standard
2.x