188 lines
8.6 KiB
C#
188 lines
8.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
|
|
namespace DatabaseImport
|
|
{
|
|
public class MMEFigures //: AbstractOLEDbWrapper
|
|
{
|
|
public long ID { get; }
|
|
|
|
public string TxtShortName { get; }
|
|
|
|
public string TxtDescription { get; }
|
|
|
|
public string TxtRemarks { get; }
|
|
|
|
public DateTime DatRevision { get; }
|
|
|
|
public long IntAuthor { get; }
|
|
|
|
public ushort IntPage { get; }
|
|
|
|
public ushort IntPages { get; }
|
|
|
|
public string TxtImageFile { get; }
|
|
|
|
public long IntVersion { get; }
|
|
|
|
public bool BolExpired { get; }
|
|
|
|
public string TxtSortKey { get; }
|
|
|
|
public bool BitStdPath { get; }
|
|
|
|
public long IntIDStdPath { get; }
|
|
|
|
public string TxtPath { get; }
|
|
|
|
public DateTime Last_Change { get; }
|
|
|
|
public string Last_Change_Text { get; }
|
|
|
|
public string History { get; }
|
|
|
|
public MMEFigures(long id, string txtShortName, string txtDescription, string txtRemarks, DateTime datRevision, long intAuthor,
|
|
ushort intPage, ushort intPages, string txtImageFile, long version, bool bExpired, string txtSortKey,
|
|
bool bitStdPath, long intIDStdPath, string txtPath, DateTime lastChange, string lastChangeText, string history)
|
|
{
|
|
ID = id;
|
|
TxtShortName = txtShortName;
|
|
TxtDescription = txtDescription;
|
|
TxtRemarks = txtRemarks;
|
|
DatRevision = datRevision;
|
|
IntAuthor = intAuthor;
|
|
IntPage = intPage;
|
|
IntPages = intPages;
|
|
TxtImageFile = txtImageFile;
|
|
IntVersion = version;
|
|
BolExpired = bExpired;
|
|
TxtSortKey = txtSortKey;
|
|
BitStdPath = bitStdPath;
|
|
IntIDStdPath = intIDStdPath;
|
|
TxtPath = txtPath;
|
|
Last_Change = lastChange;
|
|
Last_Change_Text = lastChangeText;
|
|
History = history;
|
|
}
|
|
public static void DeleteFigures()
|
|
{
|
|
return;//nothing to do
|
|
}
|
|
public static MMEFigures[] GetFigures()
|
|
{
|
|
var figures = new List<MMEFigures>();
|
|
|
|
try
|
|
{
|
|
using (var cmd = DbOperations.GetSQLCommand(true))
|
|
{
|
|
try
|
|
{
|
|
cmd.CommandType = CommandType.StoredProcedure;
|
|
cmd.CommandText = DbOperationsEnum.StoredProcedure.sp_MMEFiguresGet.ToString();
|
|
cmd.Parameters.Add(new SqlParameter("@Id", SqlDbType.NVarChar) { Value = null });
|
|
using (var reader = cmd.ExecuteReader())
|
|
{
|
|
while (reader.Read())
|
|
{
|
|
var id = Convert.ToInt64(reader["ID"]);
|
|
var txtShortName = reader["txtShortName"].ToString();
|
|
var txtDescription = reader["txtDescription"].ToString();
|
|
var txtRemarks = reader["txtRemarks"].ToString();
|
|
var datRevision = DateTime.MinValue;
|
|
if (!DBNull.Value.Equals(reader["datRevision"]))
|
|
{
|
|
datRevision = (DateTime)reader["datRevision"];
|
|
}
|
|
var intAuthor = Convert.ToInt64(reader["intAuthor"]);
|
|
var intPage = Convert.ToUInt16(reader["intPage"]);
|
|
var intPages = Convert.ToUInt16(reader["intPages"]);
|
|
var txtImageFile = reader["txtImageFile"].ToString();
|
|
var version = Convert.ToInt64(reader["intVersion"]);
|
|
var bExpired = (bool)reader["bolExpired"];
|
|
var txtSortKey = reader["txtSortKey"].ToString();
|
|
var bitStdPath = (bool)reader["bitStdPath"];
|
|
var intIDStdPath = Convert.ToInt64(reader["IntIDStdPath"]);
|
|
var txtPath = reader["txtPath"].ToString();
|
|
var lastChange = DBNull.Value != reader["LAST_CHANGE"]
|
|
? DateTime.MinValue
|
|
: (DateTime)reader["LAST_CHANGE"];
|
|
var lastChangeText = reader["LAST_CHANGE_TEXT"].ToString();
|
|
var history = reader["HISTORY"].ToString();
|
|
figures.Add(new MMEFigures(id, txtShortName, txtDescription, txtRemarks,
|
|
datRevision, intAuthor, intPage,
|
|
intPages, txtImageFile, version, bExpired, txtSortKey, bitStdPath, intIDStdPath,
|
|
txtPath, lastChange, lastChangeText, history));
|
|
}
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
cmd.Connection.Dispose();
|
|
}
|
|
}
|
|
}
|
|
catch (Exception)
|
|
{
|
|
//APILogger.Log("Problem loading figures - ", ex);
|
|
}
|
|
|
|
try
|
|
{
|
|
using (var cmd = DbOperations.GetSQLCommand(true))
|
|
{
|
|
try
|
|
{
|
|
cmd.CommandType = CommandType.StoredProcedure;
|
|
cmd.CommandText = DbOperationsEnum.StoredProcedure.sp_MMEFiguresGetCustom.ToString();
|
|
cmd.Parameters.Add(new SqlParameter("@Id", SqlDbType.NVarChar) { Value = null });
|
|
using (var reader = cmd.ExecuteReader())
|
|
{
|
|
while (reader.Read())
|
|
{
|
|
var id = Convert.ToInt64(reader["ID"]);
|
|
var txtShortName = reader["txtShortName"].ToString();
|
|
var txtDescription = reader["txtDescription"].ToString();
|
|
var txtRemarks = reader["txtRemarks"].ToString();
|
|
var datRevision = DateTime.MinValue;
|
|
if (!DBNull.Value.Equals(reader["datRevision"]))
|
|
{
|
|
datRevision = (DateTime)reader["datRevision"];
|
|
}
|
|
var intAuthor = Convert.ToInt64(reader["intAuthor"]);
|
|
var intPage = Convert.ToUInt16(reader["intPage"]);
|
|
var intPages = Convert.ToUInt16(reader["intPages"]);
|
|
var txtImageFile = reader["txtImageFile"].ToString();
|
|
var version = Convert.ToInt64(reader["intVersion"]);
|
|
var bExpired = (bool)reader["bolExpired"];
|
|
var txtSortKey = reader["txtSortKey"].ToString();
|
|
var bitStdPath = (bool)reader["bitStdPath"];
|
|
var intIDStdPath = Convert.ToInt64(reader["IntIDStdPath"]);
|
|
var txtPath = reader["txtPath"].ToString();
|
|
var lastChange = DBNull.Value != reader["LAST_CHANGE"]
|
|
? DateTime.MinValue
|
|
: (DateTime)reader["LAST_CHANGE"];
|
|
var lastChangeText = reader["LAST_CHANGE_TEXT"].ToString();
|
|
var history = reader["HISTORY"].ToString();
|
|
figures.Add(new MMEFigures(id, txtShortName, txtDescription, txtRemarks, datRevision,
|
|
intAuthor, intPage,
|
|
intPages, txtImageFile, version, bExpired, txtSortKey, bitStdPath, intIDStdPath,
|
|
txtPath, lastChange, lastChangeText, history));
|
|
}
|
|
}
|
|
}
|
|
finally { cmd.Connection.Dispose(); }
|
|
}
|
|
}
|
|
catch (Exception)
|
|
{
|
|
//APILogger.Log("Problem loading custom figures - ", ex);
|
|
}
|
|
|
|
return figures.ToArray();
|
|
}
|
|
}
|
|
}
|