188 lines
6.2 KiB
C#
188 lines
6.2 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Data;
|
|||
|
|
|
|||
|
|
namespace DatabaseExport.ISO
|
|||
|
|
{
|
|||
|
|
[Serializable()]
|
|||
|
|
public class TestEngineerDetails //: ISerializableFile
|
|||
|
|
{
|
|||
|
|
private enum Fields
|
|||
|
|
{
|
|||
|
|
Name,
|
|||
|
|
TestEngineerName,
|
|||
|
|
TestEngineerPhone,
|
|||
|
|
TestEngineerFax,
|
|||
|
|
TestEngineerEmail,
|
|||
|
|
LocalOnly,
|
|||
|
|
LastModified,
|
|||
|
|
LastModifiedBy,
|
|||
|
|
Version
|
|||
|
|
}
|
|||
|
|
public Dictionary<string, string> GetValues()
|
|||
|
|
{
|
|||
|
|
var elementNameValuePairs = new Dictionary<string, string>();
|
|||
|
|
|
|||
|
|
elementNameValuePairs[Fields.Name.ToString()] = Name;
|
|||
|
|
elementNameValuePairs[Fields.TestEngineerName.ToString()] = TestEngineerName;
|
|||
|
|
elementNameValuePairs[Fields.TestEngineerPhone.ToString()] = TestEngineerPhone;
|
|||
|
|
elementNameValuePairs[Fields.TestEngineerFax.ToString()] = TestEngineerFax;
|
|||
|
|
elementNameValuePairs[Fields.TestEngineerEmail.ToString()] = TestEngineerEmail;
|
|||
|
|
elementNameValuePairs[Fields.LocalOnly.ToString()] = LocalOnly.ToString();
|
|||
|
|
elementNameValuePairs[Fields.LastModified.ToString()] = LastModified.ToString(System.Globalization.CultureInfo.InvariantCulture);
|
|||
|
|
elementNameValuePairs[Fields.LastModifiedBy.ToString()] = LastModifiedBy;
|
|||
|
|
elementNameValuePairs[Fields.Version.ToString()] = Version.ToString(System.Globalization.CultureInfo.InvariantCulture);
|
|||
|
|
|
|||
|
|
return elementNameValuePairs;
|
|||
|
|
}
|
|||
|
|
private string _testEngineerName = "NOVALUE";
|
|||
|
|
public string TestEngineerName
|
|||
|
|
{
|
|||
|
|
get => _testEngineerName;
|
|||
|
|
set
|
|||
|
|
{
|
|||
|
|
if (value != string.Empty)
|
|||
|
|
{
|
|||
|
|
_testEngineerName = value;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private string _testEngineerPhone = "NOVALUE";
|
|||
|
|
public string TestEngineerPhone
|
|||
|
|
{
|
|||
|
|
get => _testEngineerPhone;
|
|||
|
|
set
|
|||
|
|
{
|
|||
|
|
if (value != string.Empty)
|
|||
|
|
{
|
|||
|
|
_testEngineerPhone = value;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private string _testEngineerFax = "NOVALUE";
|
|||
|
|
public string TestEngineerFax
|
|||
|
|
{
|
|||
|
|
get => _testEngineerFax;
|
|||
|
|
set
|
|||
|
|
{
|
|||
|
|
if (value != string.Empty)
|
|||
|
|
{
|
|||
|
|
_testEngineerFax = value;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private string _testEngineerEmail = "NOVALUE";
|
|||
|
|
public string TestEngineerEmail
|
|||
|
|
{
|
|||
|
|
get => _testEngineerEmail;
|
|||
|
|
set
|
|||
|
|
{
|
|||
|
|
if (value != string.Empty)
|
|||
|
|
{
|
|||
|
|
_testEngineerEmail = value;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private bool _localOnly = false;
|
|||
|
|
public bool LocalOnly
|
|||
|
|
{
|
|||
|
|
get => _localOnly;
|
|||
|
|
set => _localOnly = value;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private string _name = "";
|
|||
|
|
public string Name
|
|||
|
|
{
|
|||
|
|
get => _name;
|
|||
|
|
set => _name = value;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private DateTime _lastModified;
|
|||
|
|
public DateTime LastModified
|
|||
|
|
{
|
|||
|
|
get => _lastModified;
|
|||
|
|
set => _lastModified = value;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private string _lastModifiedBy;
|
|||
|
|
public string LastModifiedBy
|
|||
|
|
{
|
|||
|
|
get => _lastModifiedBy;
|
|||
|
|
set => _lastModifiedBy = value;
|
|||
|
|
}
|
|||
|
|
private int _version = 1;
|
|||
|
|
public int Version
|
|||
|
|
{
|
|||
|
|
get => _version;
|
|||
|
|
set => _version = value;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public TestEngineerDetails()
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public TestEngineerDetails(DataRow dr)
|
|||
|
|
{
|
|||
|
|
_name = (string)dr["Name"];
|
|||
|
|
TestEngineerName = (string)dr["TestEngineerName"];
|
|||
|
|
TestEngineerPhone = (string)dr["TestEngineerPhone"];
|
|||
|
|
TestEngineerFax = (string)dr["TestEngineerFax"];
|
|||
|
|
TestEngineerEmail = (string)dr["TestEngineerEmail"];
|
|||
|
|
_localOnly = Convert.ToBoolean(dr["LocalOnly"]);
|
|||
|
|
_lastModified = Convert.ToDateTime(dr["LastModified"]);
|
|||
|
|
_lastModifiedBy = (string)dr["LastModifiedBy"];
|
|||
|
|
_version = Convert.ToInt32(dr["Version"]);
|
|||
|
|
}
|
|||
|
|
public TestEngineerDetails(TestEngineerDetails copy)
|
|||
|
|
{
|
|||
|
|
_name = copy.Name;
|
|||
|
|
TestEngineerName = copy.TestEngineerName;
|
|||
|
|
TestEngineerPhone = copy.TestEngineerPhone;
|
|||
|
|
TestEngineerFax = copy.TestEngineerFax;
|
|||
|
|
TestEngineerEmail = copy.TestEngineerEmail;
|
|||
|
|
_localOnly = copy.LocalOnly;
|
|||
|
|
_lastModified = copy.LastModified;
|
|||
|
|
_lastModifiedBy = copy.LastModifiedBy;
|
|||
|
|
_version = copy.Version;
|
|||
|
|
}
|
|||
|
|
public static TestEngineerDetails[] GetAllTestEngineerDetails()
|
|||
|
|
{
|
|||
|
|
var list = new List<TestEngineerDetails>();
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
using (var sql = DbOperations.GetCommand())
|
|||
|
|
{
|
|||
|
|
sql.CommandText = "SELECT * from [tblTestEngineerDetails]";
|
|||
|
|
|
|||
|
|
using (var ds = DbOperations.Connection.QueryDataSet(sql))
|
|||
|
|
{
|
|||
|
|
if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
|
|||
|
|
{
|
|||
|
|
foreach (DataRow dr in ds.Tables[0].Rows)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
list.Add(new TestEngineerDetails(dr));
|
|||
|
|
}
|
|||
|
|
catch (Exception)
|
|||
|
|
{
|
|||
|
|
//DTS.Utilities.Logging.APILogger.Log("failed to get test engineer details", ex);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception)
|
|||
|
|
{
|
|||
|
|
//DTS.Utilities.Logging.APILogger.Log("Failed to retrieve test engineer details", ex);
|
|||
|
|
}
|
|||
|
|
return list.ToArray();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|