init
This commit is contained in:
@@ -0,0 +1,227 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Data.SqlClient;
|
||||
|
||||
namespace DatabaseImport
|
||||
{
|
||||
public class MMEFineLocations3 //: AbstractOLEDbWrapper
|
||||
{
|
||||
public string S_GUID { get; }
|
||||
|
||||
public string FINE_LOC_3 { get; }
|
||||
|
||||
public string Text_L1 { get; }
|
||||
|
||||
public string Text_L2 { get; }
|
||||
|
||||
public long Version { get; }
|
||||
|
||||
public DateTime Date { get; }
|
||||
|
||||
public string Remarks { get; }
|
||||
|
||||
public bool Expired { get; }
|
||||
|
||||
public string SortKey { get; }
|
||||
|
||||
public string Picture_ShortName { get; }
|
||||
|
||||
public DateTime Last_Change { get; }
|
||||
|
||||
public string Last_Change_Text { get; }
|
||||
|
||||
public string History { get; }
|
||||
|
||||
public MMEPossibleChannels.MMEChannelTypes RecordType { get; }
|
||||
public MMEFineLocations3(string sGuid, string fineLoc3, string textL1, string textL2, long version, DateTime date,
|
||||
string remarks, bool expired, string sortKey, DateTime lastChange, string lastChangeText, string history, string picturesShortName,
|
||||
MMEPossibleChannels.MMEChannelTypes type)
|
||||
{
|
||||
RecordType = type;
|
||||
S_GUID = sGuid;
|
||||
FINE_LOC_3 = fineLoc3;
|
||||
Text_L1 = textL1;
|
||||
Text_L2 = textL2;
|
||||
Version = version;
|
||||
Date = date;
|
||||
Remarks = remarks;
|
||||
Expired = expired;
|
||||
SortKey = sortKey;
|
||||
Last_Change = lastChange;
|
||||
Last_Change_Text = lastChangeText;
|
||||
History = history;
|
||||
Picture_ShortName = picturesShortName;
|
||||
}
|
||||
public static void DeleteFineLocations3()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var cmd = DbOperations.GetSQLCommand(true))
|
||||
{
|
||||
try
|
||||
{
|
||||
cmd.CommandType = CommandType.StoredProcedure;
|
||||
cmd.CommandText = DbOperationsEnum.StoredProcedure.sp_MMEFineLocations3Delete.ToString();
|
||||
cmd.Parameters.Add(new SqlParameter("@s_GUID", SqlDbType.UniqueIdentifier) { Value = null });
|
||||
var errorNumberParam =
|
||||
new SqlParameter("@errorNumber", SqlDbType.Int) { Direction = ParameterDirection.Output };
|
||||
cmd.Parameters.Add(errorNumberParam);
|
||||
var errorMessageParam =
|
||||
new SqlParameter("@errorMessage", SqlDbType.NVarChar, 250)
|
||||
{
|
||||
Direction = ParameterDirection.Output
|
||||
};
|
||||
cmd.Parameters.Add(errorMessageParam);
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
if (int.Parse(errorNumberParam.Value.ToString()) != 0)
|
||||
{
|
||||
//errorMessageParam.Value
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
cmd.Connection.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception) {/* APILogger.Log("failed to delete fine locations3, ", ex); */}
|
||||
}
|
||||
public static MMEFineLocations3[] GetFineLocations3()
|
||||
{
|
||||
var fineLocations3 = new List<MMEFineLocations3>();
|
||||
try
|
||||
{
|
||||
using (var cmd = DbOperations.GetSQLCommand(true))
|
||||
{
|
||||
try
|
||||
{
|
||||
cmd.CommandType = CommandType.StoredProcedure;
|
||||
cmd.CommandText = DbOperationsEnum.StoredProcedure.sp_MMEFineLocations3Get.ToString();
|
||||
cmd.Parameters.Add(new SqlParameter("@s_GUID", SqlDbType.NVarChar) { Value = null });
|
||||
//cmd.ExecuteNonQuery();
|
||||
using (var ds = DbOperations.Connection.QueryDataSet(cmd))
|
||||
{
|
||||
|
||||
if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
fineLocations3.AddRange(from DataRow dr in ds.Tables[0].Rows
|
||||
let date = Convert.ToDateTime(
|
||||
dr[DbOperations.MMETables.MMEFineLocations3Fields.DATE.ToString()])
|
||||
let expired = Convert.ToBoolean(
|
||||
dr[DbOperations.MMETables.MMEFineLocations3Fields.EXPIRED.ToString()])
|
||||
let fineLoc3 = Convert.ToString(dr[
|
||||
DbOperations.MMETables.MMEFineLocations3Fields.FINE_LOC_3.ToString()])
|
||||
let history = Convert.ToString(
|
||||
dr[DbOperations.MMETables.MMEFineLocations3Fields.HISTORY.ToString()])
|
||||
let lastChange = Convert.ToDateTime(dr[
|
||||
DbOperations.MMETables.MMEFineLocations3Fields.LAST_CHANGE.ToString()])
|
||||
let lastChangeText = Convert.ToString(dr[
|
||||
DbOperations.MMETables.MMEFineLocations3Fields.LAST_CHANGE_TEXT.ToString()])
|
||||
let pictureShortName = Convert.ToString(dr[
|
||||
DbOperations.MMETables.MMEFineLocations3Fields.PICTURE_SHORTNAME
|
||||
.ToString()])
|
||||
let remarks = Convert.ToString(
|
||||
dr[DbOperations.MMETables.MMEFineLocations3Fields.REMARKS.ToString()])
|
||||
let sGuid = Convert.ToString(
|
||||
dr[DbOperations.MMETables.MMEFineLocations3Fields.s_GUID.ToString()])
|
||||
let sortKey = Convert.ToString(
|
||||
dr[DbOperations.MMETables.MMEFineLocations3Fields.SORTKEY.ToString()])
|
||||
let text1 = Convert.ToString(
|
||||
dr[DbOperations.MMETables.MMEFineLocations3Fields.TEXT_L1.ToString()])
|
||||
let text2 = Convert.ToString(
|
||||
dr[DbOperations.MMETables.MMEFineLocations3Fields.TEXT_L2.ToString()])
|
||||
let version = Convert.ToInt32(
|
||||
dr[DbOperations.MMETables.MMEFineLocations3Fields.VERSION.ToString()])
|
||||
select new MMEFineLocations3(sGuid, fineLoc3, text1, text2,
|
||||
Convert.ToInt64(version), date, remarks, expired, sortKey, lastChange,
|
||||
lastChangeText, history, pictureShortName,
|
||||
MMEPossibleChannels.MMEChannelTypes.ISO13499_106));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//APILogger.Log("Failed to process fine locations3: ", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
cmd.Connection.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception) { /*APILogger.Log("failed to load fine locations3, ", ex);*/ }
|
||||
|
||||
try
|
||||
{
|
||||
using (var cmd = DbOperations.GetSQLCommand(true))
|
||||
{
|
||||
try
|
||||
{
|
||||
cmd.CommandType = CommandType.StoredProcedure;
|
||||
cmd.CommandText = DbOperationsEnum.StoredProcedure.sp_MMEFineLocations3GetCustom.ToString();
|
||||
cmd.Parameters.Add(new SqlParameter("@s_GUID", SqlDbType.NVarChar) { Value = null });
|
||||
using (var ds = DbOperations.Connection.QueryDataSet(cmd))
|
||||
{
|
||||
|
||||
if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
fineLocations3.AddRange(from DataRow dr in ds.Tables[0].Rows
|
||||
let date = Convert.ToDateTime(
|
||||
dr[DbOperations.MMETables.MMEFineLocations3Fields.DATE.ToString()])
|
||||
let expired = Convert.ToBoolean(
|
||||
dr[DbOperations.MMETables.MMEFineLocations3Fields.EXPIRED.ToString()])
|
||||
let fineLoc3 = Convert.ToString(dr[
|
||||
DbOperations.MMETables.MMEFineLocations3Fields.FINE_LOC_3.ToString()])
|
||||
let history = Convert.ToString(
|
||||
dr[DbOperations.MMETables.MMEFineLocations3Fields.HISTORY.ToString()])
|
||||
let lastChange = Convert.ToDateTime(dr[
|
||||
DbOperations.MMETables.MMEFineLocations3Fields.LAST_CHANGE.ToString()])
|
||||
let lastChangeText = Convert.ToString(dr[
|
||||
DbOperations.MMETables.MMEFineLocations3Fields.LAST_CHANGE_TEXT.ToString()])
|
||||
let pictureShortName = Convert.ToString(dr[
|
||||
DbOperations.MMETables.MMEFineLocations3Fields.PICTURE_SHORTNAME
|
||||
.ToString()])
|
||||
let remarks = Convert.ToString(
|
||||
dr[DbOperations.MMETables.MMEFineLocations3Fields.REMARKS.ToString()])
|
||||
let sGuid = Convert.ToString(
|
||||
dr[DbOperations.MMETables.MMEFineLocations3Fields.s_GUID.ToString()])
|
||||
let sortKey = Convert.ToString(
|
||||
dr[DbOperations.MMETables.MMEFineLocations3Fields.SORTKEY.ToString()])
|
||||
let text1 = Convert.ToString(
|
||||
dr[DbOperations.MMETables.MMEFineLocations3Fields.TEXT_L1.ToString()])
|
||||
let text2 = Convert.ToString(
|
||||
dr[DbOperations.MMETables.MMEFineLocations3Fields.TEXT_L2.ToString()])
|
||||
let version = Convert.ToInt32(
|
||||
dr[DbOperations.MMETables.MMEFineLocations3Fields.VERSION.ToString()])
|
||||
select new MMEFineLocations3(sGuid, fineLoc3, text1, text2,
|
||||
Convert.ToInt64(version), date, remarks, expired, sortKey, lastChange,
|
||||
lastChangeText, history, pictureShortName,
|
||||
MMEPossibleChannels.MMEChannelTypes.SQL));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//APILogger.Log("Failed to process custom fine locations3: ", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
cmd.Connection.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception) {/* APILogger.Log("failed to load custom fine locations3, ", ex); */}
|
||||
|
||||
return fineLocations3.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user