Refactorization : BenchControl -> Rig
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using MySql.Data.MySqlClient;
|
||||
|
||||
namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
{
|
||||
public class WMPart
|
||||
{
|
||||
public string Name;
|
||||
public int ProcessId;
|
||||
public string OraDBType;
|
||||
public string Description;
|
||||
public string Code;
|
||||
public DateTime TimeStamp;
|
||||
public CodeType CodeType;
|
||||
public CodeForm CodeForm;
|
||||
public CodeLocation CodeLocation;
|
||||
public string UserName;
|
||||
public string Workplace;
|
||||
|
||||
public WMPart() {}
|
||||
|
||||
public static IList<WMPart> FindWMParts(MySqlConnection dbConn, string pcbNumber)
|
||||
{
|
||||
IList<WMPart> foundParts = new List<WMPart>(); /// initially empty
|
||||
|
||||
if (string.IsNullOrEmpty(pcbNumber)) return foundParts; /// return an empty list
|
||||
|
||||
try
|
||||
{
|
||||
dbConn.Open();
|
||||
|
||||
//IList<Entities.ReferenceRecord> referenceRecords = session
|
||||
// .QueryOver<Entities.ReferenceRecord>()
|
||||
// .Where(x => (x.Code == pcbNumber))
|
||||
// .OrderBy(x => x.TimeStamp).Desc
|
||||
// .List<Entities.ReferenceRecord>();
|
||||
|
||||
MySqlCommand cmd = dbConn.CreateCommand();
|
||||
cmd.CommandText = string.Format("SELECT Id, TimeStamp, UserName, Workplace, Result, Process_id, Workstep_id FROM ReferenceRecord WHERE Code = {0}", pcbNumber);
|
||||
cmd.ExecuteNonQuery();
|
||||
|
||||
MySqlDataReader dr = cmd.ExecuteReader();
|
||||
while (dr.Read())
|
||||
{
|
||||
foundParts.Add( new WMPart() { Code = pcbNumber, ProcessId = dr.GetInt32(5), /* etc */ } );
|
||||
}
|
||||
dr.Close();
|
||||
cmd.Dispose();
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
return foundParts;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user