- installation.zip
- Makanan2
- John Kenedy DAL.pdf
- JohnKenedy.DataAccess
- JohnKenedy.DataAccessModule
- MenuMakanan
- ProgramTools.sln
- SetupMakanan
- Debug
- Release
- SetupMakanan.vdproj
|
#region MasterHistoryModuleExtend
public string GetMasterHistory{Table}SQLEntityCollectionLatestDate()
{
string _sql = @"select b.* FROM
(
select " + {RecordIDColumn} + @", MAX(" + {EffectiveDateColumn} + ") as EffectiveDate from {Table} GROUP BY " + {RecordIDColumn} + @"
) a
LEFT JOIN
{Table} b
ON a." + {RecordIDColumn} + @" = b." + {RecordIDColumn} + @" AND a." + {EffectiveDateColumn} + @" = b." + {EffectiveDateColumn} + "";
return _sql;
}
public string GetMasterHistory{Table}SQLEntityLatestDateByRecordID(object _value, ref IDbDataParameter[] _params)
{
string _sql = "SELECT TOP 1 * FROM {Table} WHERE " + {RecordIDColumn} + "=@HistoryParam1 ORDER BY " + {EffectiveDateColumn} + " DESC";
_params = new IDbDataParameter[1];
_params[0] = Filler.Definition.DALLayer.GetCommand().CreateParameter();
_params[0].ParameterName = "@HistoryParam1";
_params[0].Value = _value;
return _sql;
}
public string GetMasterHistory{Table}SQLEntityCollectionByEffectiveDate(DateTime _effectiveDate, ref IDbDataParameter[] _params)
{
string _sql = @"select b.* FROM
(
select " + {RecordIDColumn} + @", MAX(" + {EffectiveDateColumn} + ") as EffectiveDate from {Table} WHERE " + {EffectiveDateColumn} + "<=@HistoryCollectionParam1 GROUP BY " + {RecordIDColumn} + @"
) a
LEFT JOIN
{Table} b
ON a." + {RecordIDColumn} + @" = b." + {RecordIDColumn} + @" AND a." + {EffectiveDateColumn} + @" = b." + {EffectiveDateColumn} + "";
_params = new IDbDataParameter[1];
_params[0] = Filler.Definition.DALLayer.GetCommand().CreateParameter();
_params[0].ParameterName = "@HistoryCollectionParam1";
_params[0].Value = _effectiveDate;
return _sql;
}
public string GetMasterHistory{Table}SQLEntityLatestDateByRecordIDEffectiveDate(object _value, DateTime _effectiveDate, ref IDbDataParameter[] _params)
{
string _sql = "SELECT TOP 1 * FROM {Table} WHERE " + {RecordIDColumn} + "=@HistoryParam1 AND " + {EffectiveDateColumn} + "<=@HistoryParam2 ORDER BY " + {EffectiveDateColumn} + " DESC";
_params = new IDbDataParameter[2];
_params[0] = Filler.Definition.DALLayer.GetCommand().CreateParameter();
_params[0].ParameterName = "@HistoryParam1";
_params[0].Value = _value;
_params[1] = Filler.Definition.DALLayer.GetCommand().CreateParameter();
_params[1].ParameterName = "@HistoryParam2";
_params[1].Value = _effectiveDate;
return _sql;
}
public {Table}Entity GetMasterHistory{Table}EntityLatestDateByRecordID(object _value)
{
{Table}EntityCollection _collection = new {Table}EntityCollection();
IDbDataParameter[] _params = null;
string _sql = GetMasterHistory{Table}SQLEntityLatestDateByRecordID(_value, ref _params);
_collection.GetDataByManual(_sql, _params);
if (_collection.Collection.Count > 0) return _collection[0];
return null;
}
public {Table}EntityCollection GetMasterHistory{Table}EntityCollectionLatestDate()
{
{Table}EntityCollection _collection = new {Table}EntityCollection();
string _sql = GetMasterHistory{Table}SQLEntityCollectionLatestDate();
_collection.GetDataByManual(_sql, null);
return _collection;
}
public {Table}Entity GetMasterHistory{Table}EntityByRecordIDEffectiveDate(object _value, DateTime _effectiveDate)
{
{Table}EntityCollection _collection = new {Table}EntityCollection();
IDbDataParameter[] _params = null;
string _sql = GetMasterHistory{Table}SQLEntityLatestDateByRecordIDEffectiveDate(_value, _effectiveDate, ref _params);
_collection.GetDataByManual(_sql, _params);
if (_collection.Collection.Count > 0) return _collection[0];
return null;
}
public {Table}EntityCollection GetMasterHistory{Table}EntityCollectionByDate(DateTime _effectiveDate)
{
{Table}EntityCollection _collection = new {Table}EntityCollection();
IDbDataParameter[] _params = null;
string _sql = GetMasterHistory{Table}SQLEntityCollectionByEffectiveDate(_effectiveDate, ref _params);
_collection.GetDataByManual(_sql, _params);
return _collection;
}
#endregion
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.