public IEnumerable<TempBuffer> GetSequencingBuffer(SequencingStation station)
        {
            PartSequencingDataContext dbSeq = new PartSequencingDataContext();
            MesDataContext dbMes = new MesDataContext();
            SequencingDatabase db = new SequencingDatabase();

            List<TempBuffer> lineBuffer = null;

            string groupLine = station.SequencingLocation.LineGroup.Trim();
            int lineId = station.Line.Id;
            int locationId = station.SequencingLocation.Id;
            if (station.SequencingLocation.ParentId == null)
            {
                lineBuffer = (from s in dbMes.IWS_SP_GetSequencingBufferByLineId(station.Line.Id)
                              select new TempBuffer
                              {
                                  Group = groupLine,
                                  ItemNumber = s.ItemNumber.Trim(),
                                  ItemType = s.ItemType.Trim(),
                                  JobId = (int)s.JobId,
                                  OrderId = (int)s.OrderId,
                                  OrderStatus = (int)s.OrderStatus,
                                  Region = s.Region.Trim(),
                                  LineId = (int)s.LineId,
                                  OrderNumber = s.OrderNumber,
                                  BuildDTM = s.BuildDTM == null ? "" : s.BuildDTM.Value.ToString("mm/dd/yyyy hh:mm:ss tt")
                              }).ToList();

            }
            else
            {

                lineBuffer = (from s in dbSeq.IWS_GetSequencingStationQueueByLocationId(locationId)
                              select new TempBuffer
                              {
                                  ScheduleNum = (int)s.ScheduleNum,
                                  BoxNum = (int)s.BoxNum,
                                  OrderNumber = s.OrderNumber == null ? "" : s.OrderNumber.Trim(),
                                  Group = groupLine,
                                  ItemNumber = s.ItemNumber.Trim(),
                                  ItemType = s.ItemType.Trim(),
                                  JobId = (int)s.JobId,
                                  OrderId = (int)s.OrderId,
                                  OrderStatus = (int)s.OrderStatus,
                                  Region = s.Region.Trim(),
                                  LineId = lineId
                              }).ToList();

            }

            return lineBuffer;
        }
 public void DeleteMessageToken(int id)
 {
     SequencingDatabase db = new SequencingDatabase();
     db.DeleteMessageTokenById(id);
 }
 public IEnumerable<SideBySide> SequencingTracking2StationsByLineId(int lineId, int seqId1, int seqId2)
 {
     SequencingDatabase db = new SequencingDatabase();
     return db.GetSequencingTracking2StationsByLineId(lineId, seqId1, seqId2);
 }
 public void UpdateMessageToken([FromBody]MessageToken token)
 {
     SequencingDatabase db = new SequencingDatabase();
     db.UpdateMessageToken(token);
 }
 public IEnumerable<MessageToken> MessageTokensByLineId(int id)
 {
     SequencingDatabase db = new SequencingDatabase();
     var tokens = db.GetMessageTokensByLineId(id);
     return tokens;
 }
 public IEnumerable<SequencingLocation> SequencingLocations()
 {
     SequencingDatabase db = new SequencingDatabase();
     return db.GetSequencingLocations();
 }
 public IEnumerable<SequencingLocation> SequencingLocationsByType(string type)
 {
     SequencingDatabase db = new SequencingDatabase();
     return db.GetSequencingLocationsByType(type);
 }
 public IEnumerable<Line> Lines()
 {
     SequencingDatabase db = new SequencingDatabase();
     var lines = db.GetLines();
     return lines;
 }