init
This commit is contained in:
@@ -0,0 +1,305 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.OleDb;
|
||||
|
||||
namespace DatabaseExport
|
||||
{
|
||||
/// <summary>
|
||||
/// this is a "possible" channel, once we know what iso object we are dealing with there can be a number of channels
|
||||
/// defined for the object. We might not care about all of them ...
|
||||
/// this is also a template channel, in that some fields will not be known yet (direction, dimension maybe, position, etc)
|
||||
/// TestObjectChannel will consume this channel and then allow setting the locations as needed
|
||||
/// </summary>
|
||||
public class MMEPossibleChannels : AbstractOLEDbWrapper
|
||||
{
|
||||
public long Id { get; private set; }
|
||||
|
||||
public void ClearId() { Id = -1; }
|
||||
public void SetId(long id) { Id = id; }
|
||||
|
||||
public string Type { get; private set; }
|
||||
|
||||
public void SetType(string type) { Type = type; }
|
||||
|
||||
public string Test_Object { get; private set; }
|
||||
|
||||
public void Set_Test_Object(string val)
|
||||
{
|
||||
Test_Object = val;
|
||||
}
|
||||
|
||||
public string Position { get; private set; }
|
||||
|
||||
public void Set_Position(string val)
|
||||
{
|
||||
Position = val;
|
||||
}
|
||||
|
||||
public string Trans_Main_Loc { get; private set; }
|
||||
|
||||
public void Set_Main_Loc(string val)
|
||||
{
|
||||
Trans_Main_Loc = val;
|
||||
}
|
||||
|
||||
public string Fine_Loc_1 { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sets the fine location 1
|
||||
/// the property doesn't seem to have a set
|
||||
/// so not sure if it was omitted or on purpose
|
||||
/// See all othe "Set_*" functions
|
||||
/// </summary>
|
||||
/// <param name="val"></param>
|
||||
public void Set_Fine_Loc_1(string val)
|
||||
{
|
||||
Fine_Loc_1 = val;
|
||||
}
|
||||
|
||||
|
||||
public string Fine_Loc_2 { get; private set; }
|
||||
|
||||
public void Set_Fine_Loc_2(string val)
|
||||
{
|
||||
Fine_Loc_2 = val;
|
||||
}
|
||||
|
||||
public string Fine_Loc_3 { get; private set; }
|
||||
|
||||
public void Set_Fine_Loc_3(string val)
|
||||
{
|
||||
Fine_Loc_3 = val;
|
||||
}
|
||||
|
||||
public string Physical_Dimension { get; private set; }
|
||||
|
||||
public void Set_Physical_Dimension(string val)
|
||||
{
|
||||
Physical_Dimension = val;
|
||||
}
|
||||
|
||||
public string Direction { get; private set; }
|
||||
|
||||
public void Set_Direction(string val)
|
||||
{
|
||||
Direction = val;
|
||||
}
|
||||
|
||||
public string Default_Filter_Class { get; private set; }
|
||||
|
||||
public void Set_Default_Filter_Class(string val)
|
||||
{
|
||||
Default_Filter_Class = val;
|
||||
}
|
||||
|
||||
public string Text_L1 { get; private set; }
|
||||
|
||||
public void SetText1(string text1) { Text_L1 = text1; }
|
||||
|
||||
public string Text_L2 { get; private set; }
|
||||
|
||||
public void SetText2(string text2) { Text_L2 = text2; }
|
||||
|
||||
public long Version { get; }
|
||||
|
||||
public DateTime Date { get; }
|
||||
|
||||
public string Remarks { get; private set; }
|
||||
|
||||
public void SetRemarks(string remarks) { Remarks = remarks; }
|
||||
|
||||
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 int MMEChannelType { get; }
|
||||
|
||||
public MMEPossibleChannels(MMEPossibleChannels copy)
|
||||
{
|
||||
Id = copy.Id;
|
||||
Type = copy.Type;
|
||||
Test_Object = copy.Test_Object;
|
||||
Position = copy.Position;
|
||||
Trans_Main_Loc = copy.Trans_Main_Loc;
|
||||
Fine_Loc_1 = copy.Fine_Loc_1;
|
||||
Fine_Loc_2 = copy.Fine_Loc_2;
|
||||
Fine_Loc_3 = copy.Fine_Loc_3;
|
||||
Physical_Dimension = copy.Physical_Dimension;
|
||||
Direction = copy.Direction;
|
||||
Default_Filter_Class = copy.Default_Filter_Class;
|
||||
Text_L1 = copy.Text_L1;
|
||||
Text_L2 = copy.Text_L2;
|
||||
Version = copy.Version;
|
||||
Date = copy.Date;
|
||||
Remarks = copy.Remarks;
|
||||
Expired = copy.Expired;
|
||||
SortKey = copy.SortKey;
|
||||
Picture_ShortName = copy.Picture_ShortName;
|
||||
Last_Change = copy.Last_Change;
|
||||
Last_Change_Text = copy.Last_Change_Text;
|
||||
History = copy.History;
|
||||
MMEChannelType = copy.MMEChannelType;
|
||||
}
|
||||
public MMEPossibleChannels(long id, string type, string textObject, string position, string transMainLoc,
|
||||
string fineLoc1, string fineLoc2, string fineLoc3, string physicalDimension, string direction, string defaultFilterClass,
|
||||
string textL1, string textL2, long version, DateTime date, string remarks, bool expired, string sortkey,
|
||||
string pictureShortName, DateTime lastChange, string lastChangeText, string history, int mmeChannelType)
|
||||
{
|
||||
Id = id;
|
||||
Type = type;
|
||||
Test_Object = textObject;
|
||||
Position = position;
|
||||
Trans_Main_Loc = transMainLoc;
|
||||
Fine_Loc_1 = fineLoc1;
|
||||
Fine_Loc_2 = fineLoc2;
|
||||
Fine_Loc_3 = fineLoc3;
|
||||
Physical_Dimension = physicalDimension;
|
||||
Direction = direction;
|
||||
Default_Filter_Class = defaultFilterClass;
|
||||
Text_L1 = textL1;
|
||||
Text_L2 = textL2;
|
||||
Version = version;
|
||||
Date = date;
|
||||
Remarks = remarks;
|
||||
Expired = expired;
|
||||
SortKey = sortkey;
|
||||
Picture_ShortName = pictureShortName;
|
||||
Last_Change = lastChange;
|
||||
Last_Change_Text = lastChangeText;
|
||||
History = history;
|
||||
MMEChannelType = mmeChannelType;
|
||||
}
|
||||
public enum MMEChannelTypes
|
||||
{
|
||||
ISO13499_106,
|
||||
SQL
|
||||
}
|
||||
public static MMEPossibleChannels[] GetPossibleChannels()
|
||||
{
|
||||
var possibleChannels = new List<MMEPossibleChannels>();
|
||||
try
|
||||
{
|
||||
using (var cmd = DbOperations.GetISOCommand())
|
||||
{
|
||||
cmd.CommandText = "SELECT * FROM MMEPossibleChannels";
|
||||
cmd.CommandType = CommandType.Text;
|
||||
try
|
||||
{
|
||||
using (var ISOReader = cmd.ExecuteReader())
|
||||
{
|
||||
while (ISOReader.Read())
|
||||
{
|
||||
try
|
||||
{
|
||||
long id = GetLong(ISOReader, "ID");
|
||||
string type = ISOReader["TYPE"].ToString();
|
||||
string testObject = ISOReader["TEST_OBJECT"].ToString();
|
||||
string position = ISOReader["POSITION"].ToString();
|
||||
string transMainLoc = ISOReader["TRANS_MAIN_LOC"].ToString();
|
||||
string fineLoc1 = ISOReader["FINE_LOC_1"].ToString();
|
||||
string fineLoc2 = ISOReader["FINE_LOC_2"].ToString();
|
||||
string fineLoc3 = ISOReader["FINE_LOC_3"].ToString();
|
||||
string physicalDimension = ISOReader["PHYSICAL_DIMENSION"].ToString();
|
||||
string direction = ISOReader["DIRECTION"].ToString();
|
||||
string defaultFilterClass = ISOReader["DEFAULT_FILTER_CLASS"].ToString();
|
||||
string textL1 = ISOReader["TEXT_L1"].ToString();
|
||||
string textL2 = ISOReader["TEXT_L2"].ToString();
|
||||
long version = GetLong(ISOReader, "VERSION");
|
||||
DateTime date = GetDate(ISOReader, "DATE");
|
||||
string remarks = ISOReader["REMARKS"].ToString();
|
||||
bool expired = (bool)ISOReader["EXPIRED"];
|
||||
string sortkey = ISOReader["SORTKEY"].ToString();
|
||||
string pictureShortName = ISOReader["PICTURE_SHORTNAME"].ToString();
|
||||
DateTime lastChange = GetDate(ISOReader, "LAST_CHANGE");
|
||||
string lastChangeText = ISOReader["LAST_CHANGE_TEXT"].ToString();
|
||||
string history = ISOReader["HISTORY"].ToString();
|
||||
|
||||
possibleChannels.Add(new MMEPossibleChannels(id, type, testObject, position,
|
||||
transMainLoc, fineLoc1, fineLoc2,
|
||||
fineLoc3, physicalDimension, direction, defaultFilterClass, textL1, textL2,
|
||||
version, date, remarks, expired, sortkey, pictureShortName, lastChange,
|
||||
lastChangeText, history, (int)MMEChannelTypes.ISO13499_106));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
cmd.Connection.Dispose();
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
using (var cmd = DbOperations.GetCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
cmd.CommandText = "SELECT * from [tblMMEPossibleChannels]";
|
||||
using (var ds = DbOperations.Connection.QueryDataSet(cmd))
|
||||
{
|
||||
if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
foreach (System.Data.DataRow dr in ds.Tables[0].Rows)
|
||||
{
|
||||
var id = Convert.ToInt64(dr["ID"]);
|
||||
var type = Convert.ToString(dr["TYPE"]);
|
||||
var testobject = Convert.ToString(dr["TEST_OBJECT"]);
|
||||
var position = Convert.ToString(dr["POSITION"]);
|
||||
var mainloc = Convert.ToString(dr["TRANS_MAIN_LOC"]);
|
||||
var fineloc1 = Convert.ToString(dr["FINE_LOC_1"]);
|
||||
var fineloc2 = Convert.ToString(dr["FINE_LOC_2"]);
|
||||
var fineloc3 = Convert.ToString(dr["FINE_LOC_3"]);
|
||||
var dimension = Convert.ToString(dr["PHYSICAL_DIMENSION"]);
|
||||
var direction = Convert.ToString(dr["DIRECTION"]);
|
||||
var filter = Convert.ToString(dr["DEFAULT_FILTER_CLASS"]);
|
||||
var textL1 = Convert.ToString(dr["TEXT_L1"]);
|
||||
var textL2 = Convert.ToString(dr["TEXT_L2"]);
|
||||
var version = Convert.ToInt32(dr["VERSION"]);
|
||||
var date = Convert.ToDateTime(dr["DATE"]);
|
||||
var remarks = Convert.ToString(dr["REMARKS"]);
|
||||
var expired = Convert.ToBoolean(dr["EXPIRED"]);
|
||||
var sortkey = Convert.ToString(dr["SORTKEY"]);
|
||||
var pictureShortName = Convert.ToString(dr["PICTURE_SHORTNAME"]);
|
||||
var lastChange = Convert.ToDateTime(dr["LAST_CHANGE"]);
|
||||
var lastChangeText = Convert.ToString(dr["LAST_CHANGE_TEXT"]);
|
||||
var history = Convert.ToString(dr["HISTORY"]);
|
||||
possibleChannels.Add(new MMEPossibleChannels(id, type, testobject, position, mainloc, fineloc1, fineloc2,
|
||||
fineloc3, dimension, direction, filter, textL1, textL2,
|
||||
Convert.ToInt64(version), date, remarks, expired, sortkey, pictureShortName, lastChange, lastChangeText, history, (int)MMEChannelTypes.SQL));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
cmd.Connection.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//ignore
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//ignore
|
||||
}
|
||||
return possibleChannels.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user