// Decompiled with JetBrains decompiler
// Type: SE0085.CTdB.clsEngineMES
// Assembly: SE0085CTdB, Version=1.0.0.1, Culture=neutral, PublicKeyToken=null
// MVID: F67560B6-58CB-4471-AAC9-80007CA3AF52
// Assembly location: C:\Users\Abishek\Downloads\SchneiderCode_Breaker_09292016\Breaker Schedule-20160930T014118Z\Breaker Schedule\Solution for gathering Breaker Data\DMS\bin\Debug\SE0085CTdB.dll

using Microsoft.VisualBasic.CompilerServices;
using SE0085.dBc;
using SE0085.StCl;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.Odbc;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Threading;

namespace SE0085.CTdB
{
  public class clsEngineMES
  {
    private string _CTConnection;
    private LogWriter lcLogWriter;
    private scLevels _Plant;
    private scLevels _AssemblyLine;
    private Dictionary<DateTime, scHolidays> _dtHoliday;
    private Dictionary<string, string> _dtLaborContent;

    public clsEngineMES()
    {
      this._dtHoliday = new Dictionary<DateTime, scHolidays>();
      this._dtLaborContent = new Dictionary<string, string>();
      this.GetdBConnString();
      this.lcLogWriter = new LogWriter("C:\\MESdata\\MesImport.log");
      this.LoadDictHolidays();
      this.LoadDictLabor();
    }

    public clsEngineMES(scLevels Plant, scLevels AssemblyLine)
    {
      this._dtHoliday = new Dictionary<DateTime, scHolidays>();
      this._dtLaborContent = new Dictionary<string, string>();
      this.GetdBConnString();
      this.lcLogWriter = new LogWriter("C:\\MESdata\\MesImport.log");
      this._Plant = Plant;
      this._AssemblyLine = AssemblyLine;
      this.LoadDictHolidays();
      this.LoadDictLabor();
    }

    ~clsEngineMES()
    {
      // ISSUE: explicit finalizer call
      base.Finalize();
    }

    private void GetdBConnString()
    {
      clsDBC clsDbc = new clsDBC();
      clsDbc.GetServer((object) "SE0085CTEntities1");
      this._CTConnection = Conversions.ToString(clsDbc.ConnectionString);
    }

    public void LoadDictHolidays()
    {
      DateTime dateTime = DateTime.Today.AddDays(-90.0);
      this._dtHoliday.Clear();
      using (SE0085CTEntities1 se0085CtEntities1 = new SE0085CTEntities1())
      {
        se0085CtEntities1.Database.Connection.ConnectionString = this._CTConnection;
        ParameterExpression parameterExpression;
        // ISSUE: method reference
        // ISSUE: method reference
        // ISSUE: method reference
        // ISSUE: method reference
        // ISSUE: method reference
        // ISSUE: method reference
        // ISSUE: method reference
        // ISSUE: method reference
        // ISSUE: method reference
        // ISSUE: method reference
        // ISSUE: method reference
        IQueryable<scHolidays> source = (IQueryable<scHolidays>) Queryable.Select<HolidayList, scHolidays>(Queryable.Where<HolidayList>((IQueryable<M0>) se0085CtEntities1.HolidayLists, (Expression<Func<M0, bool>>) (h => h.HolidayDate > dateTime)), (Expression<Func<M0, M1>>) Expression.Lambda<Func<HolidayList, scHolidays>>((Expression) Expression.MemberInit(Expression.New((ConstructorInfo) MethodBase.GetMethodFromHandle(__methodref (scHolidays.\u002Ector)), (Expression[]) null), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scHolidays.set_HolidayId)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (HolidayList.get_HolidayId)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scHolidays.set_HolidayDesc)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (HolidayList.get_HolidayDesc)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scHolidays.set_HolidayDate)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (HolidayList.get_HolidayDate)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scHolidays.set_HolidayGroup)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (HolidayList.get_HolidayGroup)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scHolidays.set_HolidayAdjDays)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (HolidayList.get_HolidayAdjDays))))), new ParameterExpression[1]
        {
          parameterExpression
        }));
        IEnumerator<scHolidays> enumerator;
        if (source != null)
        {
          if (source.Count<scHolidays>() > 0)
          {
            try
            {
              enumerator = source.GetEnumerator();
              while (enumerator.MoveNext())
              {
                scHolidays current = enumerator.Current;
                this._dtHoliday.Add(current.HolidayDate, current);
              }
            }
            finally
            {
              if (enumerator != null)
                enumerator.Dispose();
            }
          }
        }
        se0085CtEntities1.Database.Connection.Close();
      }
    }

    public void LoadDictLabor()
    {
      this._dtLaborContent.Clear();
      using (SE0085CTEntities1 se0085CtEntities1 = new SE0085CTEntities1())
      {
        se0085CtEntities1.Database.Connection.ConnectionString = this._CTConnection;
        IQueryable<string> source = (IQueryable<string>) Queryable.Select<GatexRef, string>((IQueryable<M0>) se0085CtEntities1.GatexRefs, (Expression<Func<M0, M1>>) (g => g.GateMESWorkCtr));
        IEnumerator<string> enumerator;
        if (source != null)
        {
          if (source.Count<string>() > 0)
          {
            try
            {
              enumerator = source.Distinct<string>().GetEnumerator();
              while (enumerator.MoveNext())
              {
                string current = enumerator.Current;
                this._dtLaborContent.Add(current, current);
              }
            }
            finally
            {
              if (enumerator != null)
                enumerator.Dispose();
            }
          }
        }
        se0085CtEntities1.Database.Connection.Close();
      }
    }

    public int LoadLabor(scMESUpdateFull RtStep)
    {
      // ISSUE: object of a compiler-generated type is created
      // ISSUE: variable of a compiler-generated type
      clsEngineMES._Closure\u0024__138 closure138 = new clsEngineMES._Closure\u0024__138();
      // ISSUE: reference to a compiler-generated field
      closure138.\u0024VB\u0024Local_RtStep = RtStep;
      int num = 0;
      using (SE0085CTEntities1 se0085CtEntities1 = new SE0085CTEntities1())
      {
        se0085CtEntities1.Database.Connection.ConnectionString = this._CTConnection;
        ParameterExpression parameterExpression;
        // ISSUE: method reference
        // ISSUE: reference to a compiler-generated field
        // ISSUE: method reference
        // ISSUE: reference to a compiler-generated field
        // ISSUE: method reference
        // ISSUE: reference to a compiler-generated field
        // ISSUE: method reference
        // ISSUE: reference to a compiler-generated field
        // ISSUE: reference to a compiler-generated field
        // ISSUE: method reference
        // ISSUE: method reference
        // ISSUE: field reference
        // ISSUE: method reference
        IQueryable<Decimal?> source = (IQueryable<Decimal?>) Queryable.Select<SectLaborContentVw, Decimal?>(Queryable.Where<SectLaborContentVw>((IQueryable<M0>) se0085CtEntities1.SectLaborContentVws, (Expression<Func<M0, bool>>) Expression.Lambda<Func<SectLaborContentVw, bool>>((Expression) Expression.And((Expression) Expression.And(Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), l.OrderFO, closure138.\u0024VB\u0024Local_RtStep.hd_q2c_nbr, false) == 0 & Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), l.OrderLineNum, closure138.\u0024VB\u0024Local_RtStep.od_ln_dsply_seq_nbr, false) == 0 & Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), l.OrderLineSL, closure138.\u0024VB\u0024Local_RtStep.hd_sub_ln_itm_id, false) == 0 & Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), l.OrderLineSS, closure138.\u0024VB\u0024Local_RtStep.hd_orig_shpschd_id, false) == 0, (Expression) Expression.Equal(l.OrdSectsNum, closure138.\u0024VB\u0024Local_RtStep.hd_sect_id, true, (MethodInfo) null)), (Expression) Expression.Equal((Expression) Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SectLaborContentVw.get_GateMESWorkCtr))), (Expression) Expression.Property((Expression) Expression.Field((Expression) Expression.Constant((object) closure138, typeof (clsEngineMES._Closure\u0024__138)), FieldInfo.GetFieldFromHandle(__fieldref (clsEngineMES._Closure\u0024__138.\u0024VB\u0024Local_RtStep))), (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scMESUpdateFull.get_dt_eto_workctr))), (Expression) Expression.Constant((object) false, typeof (bool))), (Expression) Expression.Constant((object) 0, typeof (int)))), new ParameterExpression[1]
        {
          parameterExpression
        })), (Expression<Func<M0, M1>>) (l => l.LaborHrs));
        if (source != null && source.Count<Decimal?>() > 0)
        {
          Decimal d2 = new Decimal(60L);
          Decimal? nullable = source.First<Decimal?>();
          num = Convert.ToInt32((Decimal) (nullable.HasValue ? new Decimal?(Decimal.Multiply(nullable.GetValueOrDefault(), d2)) : new Decimal?()));
        }
        se0085CtEntities1.Database.Connection.Close();
      }
      return num;
    }

    public void Findhdr()
    {
      DataSet dataSet = new DataSet();
      OdbcConnection odbcConnection = new OdbcConnection();
      odbcConnection.ConnectionString = "Driver={Sybase ASE ODBC Driver};NA=mcldb01.m087.us.schneider-electric.com,5000;Database=dbmes;Uid=misuser;Pwd=misuser;";
      OdbcCommand selectCommand = new OdbcCommand();
      selectCommand.Connection = odbcConnection;
      odbcConnection.Open();
      OdbcDataAdapter odbcDataAdapter = new OdbcDataAdapter(selectCommand);
      odbcDataAdapter.SelectCommand.CommandTimeout = 2000;
      string str = "SELECT * FROM dbmes.dbo.mespohdr WHERE plnt='0085' AND q2c_nbr='34181855' AND ln_nbr=2 AND sub_ln_itm_id='00' AND orig_shpschd_id='01' ";
      selectCommand.CommandText = str;
      odbcDataAdapter.SelectCommand = selectCommand;
      dataSet.Tables.Clear();
      odbcDataAdapter.Fill(dataSet);
      List<string> stringList = new List<string>();
      try
      {
        foreach (DataColumn column in (InternalDataCollectionBase) dataSet.Tables[0].Columns)
        {
          short num;
          Console.WriteLine(Conversions.ToString((int) num) + "  " + column.ColumnName);
          stringList.Add(column.ColumnName);
          checked { ++num; }
        }
      }
      finally
      {
        IEnumerator enumerator;
        if (enumerator is IDisposable)
          (enumerator as IDisposable).Dispose();
      }
      List<scMESBOM> scMesbomList = new List<scMESBOM>();
      try
      {
        foreach (DataRow row in dataSet.Tables[0].Rows)
        {
          short num = 0;
          List<string>.Enumerator enumerator;
          try
          {
            enumerator = stringList.GetEnumerator();
            while (enumerator.MoveNext())
            {
              string current = enumerator.Current;
              Console.WriteLine(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject((object) (Conversions.ToString((int) num) + " - " + current + "\t" + "\t" + " "), row[(int) num]), (object) '\t'), (object) '\t'), (object) row[(int) num].GetType().FullName));
              checked { ++num; }
            }
          }
          finally
          {
            enumerator.Dispose();
          }
        }
      }
      finally
      {
        IEnumerator enumerator;
        if (enumerator is IDisposable)
          (enumerator as IDisposable).Dispose();
      }
      selectCommand.Dispose();
      odbcDataAdapter.Dispose();
      odbcConnection.Close();
      odbcConnection.Dispose();
    }

    public void Finddtl()
    {
      DataSet dataSet = new DataSet();
      OdbcConnection odbcConnection = new OdbcConnection();
      odbcConnection.ConnectionString = "Driver={Sybase ASE ODBC Driver};NA=mcldb01.m087.us.schneider-electric.com,5000;Database=dbmes;Uid=misuser;Pwd=misuser;";
      OdbcCommand selectCommand = new OdbcCommand();
      selectCommand.Connection = odbcConnection;
      odbcConnection.Open();
      OdbcDataAdapter odbcDataAdapter = new OdbcDataAdapter(selectCommand);
      odbcDataAdapter.SelectCommand.CommandTimeout = 2000;
      string str = "SELECT * FROM dbmes.dbo.mespodtl WHERE prdn_ord_nbr='008500384276' ";
      selectCommand.CommandText = str;
      odbcDataAdapter.SelectCommand = selectCommand;
      dataSet.Tables.Clear();
      odbcDataAdapter.Fill(dataSet);
      List<string> stringList = new List<string>();
      try
      {
        foreach (DataColumn column in (InternalDataCollectionBase) dataSet.Tables[0].Columns)
        {
          short num;
          Console.WriteLine(Conversions.ToString((int) num) + "  " + column.ColumnName);
          stringList.Add(column.ColumnName);
          checked { ++num; }
        }
      }
      finally
      {
        IEnumerator enumerator;
        if (enumerator is IDisposable)
          (enumerator as IDisposable).Dispose();
      }
      List<scMESBOM> scMesbomList = new List<scMESBOM>();
      try
      {
        foreach (DataRow row in dataSet.Tables[0].Rows)
        {
          short num = 0;
          List<string>.Enumerator enumerator;
          try
          {
            enumerator = stringList.GetEnumerator();
            while (enumerator.MoveNext())
            {
              string current = enumerator.Current;
              Console.WriteLine(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject((object) (Conversions.ToString((int) num) + " - " + current + "\t" + "\t" + " "), row[(int) num]), (object) '\t'), (object) '\t'), (object) row[(int) num].GetType().FullName));
              checked { ++num; }
            }
          }
          finally
          {
            enumerator.Dispose();
          }
        }
      }
      finally
      {
        IEnumerator enumerator;
        if (enumerator is IDisposable)
          (enumerator as IDisposable).Dispose();
      }
      selectCommand.Dispose();
      odbcDataAdapter.Dispose();
      odbcConnection.Close();
      odbcConnection.Dispose();
    }

    public void FindTargetDate()
    {
      DataSet dataSet = new DataSet();
      OdbcConnection odbcConnection = new OdbcConnection();
      odbcConnection.ConnectionString = "Driver={Sybase ASE ODBC Driver};NA=mcldb01.m087.us.schneider-electric.com,5000;Database=dbmes;Uid=misuser;Pwd=misuser;";
      OdbcCommand selectCommand = new OdbcCommand();
      selectCommand.Connection = odbcConnection;
      odbcConnection.Open();
      OdbcDataAdapter odbcDataAdapter = new OdbcDataAdapter(selectCommand);
      odbcDataAdapter.SelectCommand.CommandTimeout = 2000;
      string str = "SELECT * FROM dbmes.dbo.messordr WHERE plnt='0085' AND q2c_nbr='34181855' AND ln_dsply_seq_nbr='001' AND sub_ln_itm_id='00' AND orig_shpschd_id='01' ";
      selectCommand.CommandText = str;
      odbcDataAdapter.SelectCommand = selectCommand;
      dataSet.Tables.Clear();
      odbcDataAdapter.Fill(dataSet);
      List<string> stringList = new List<string>();
      try
      {
        foreach (DataColumn column in (InternalDataCollectionBase) dataSet.Tables[0].Columns)
        {
          short num;
          Console.WriteLine(Conversions.ToString((int) num) + "  " + column.ColumnName);
          stringList.Add(column.ColumnName);
          checked { ++num; }
        }
      }
      finally
      {
        IEnumerator enumerator;
        if (enumerator is IDisposable)
          (enumerator as IDisposable).Dispose();
      }
      List<scMESBOM> scMesbomList = new List<scMESBOM>();
      try
      {
        foreach (DataRow row in dataSet.Tables[0].Rows)
        {
          short num = 0;
          List<string>.Enumerator enumerator;
          try
          {
            enumerator = stringList.GetEnumerator();
            while (enumerator.MoveNext())
            {
              string current = enumerator.Current;
              Console.WriteLine(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject((object) (Conversions.ToString((int) num) + " - " + current + "\t" + "\t" + " "), row[(int) num]), (object) '\t'), (object) '\t'), (object) row[(int) num].GetType().FullName));
              checked { ++num; }
            }
          }
          finally
          {
            enumerator.Dispose();
          }
        }
      }
      finally
      {
        IEnumerator enumerator;
        if (enumerator is IDisposable)
          (enumerator as IDisposable).Dispose();
      }
      selectCommand.Dispose();
      odbcDataAdapter.Dispose();
      odbcConnection.Close();
      odbcConnection.Dispose();
    }

    public void UpdTargetDate()
    {
      DataSet dataSet = new DataSet();
      OdbcConnection odbcConnection = new OdbcConnection();
      odbcConnection.ConnectionString = "Driver={Sybase ASE ODBC Driver};NA=mcldb01.m087.us.schneider-electric.com,5000;Database=dbmes;Uid=misuser;Pwd=misuser;";
      OdbcCommand selectCommand = new OdbcCommand();
      selectCommand.Connection = odbcConnection;
      odbcConnection.Open();
      OdbcDataAdapter odbcDataAdapter = new OdbcDataAdapter(selectCommand);
      odbcDataAdapter.SelectCommand.CommandTimeout = 2000;
      string str = "UPDATE dbmes.dbo.messordr SET trgt_dt = ? WHERE plnt='0085' AND q2c_nbr='34181855' AND ln_dsply_seq_nbr='001' AND sub_ln_itm_id='00' AND orig_shpschd_id='01' ";
      selectCommand.CommandText = str;
      selectCommand.Parameters.Clear();
      DateTime date = Conversions.ToDate("07/07/2014");
      selectCommand.Parameters.AddWithValue("trgt_dt", (object) date);
      odbcDataAdapter.UpdateCommand = selectCommand;
      odbcDataAdapter.AcceptChangesDuringUpdate = true;
      odbcDataAdapter.UpdateCommand.ExecuteNonQuery();
      selectCommand.Dispose();
      odbcDataAdapter.Dispose();
      odbcConnection.Close();
      odbcConnection.Dispose();
    }

    public void UpdFinishDate()
    {
      DataSet dataSet = new DataSet();
      OdbcConnection odbcConnection = new OdbcConnection();
      odbcConnection.ConnectionString = "Driver={Sybase ASE ODBC Driver};NA=mcldb01.m087.us.schneider-electric.com,5000;Database=dbmes;Uid=misuser;Pwd=misuser;";
      OdbcCommand selectCommand = new OdbcCommand();
      selectCommand.Connection = odbcConnection;
      odbcConnection.Open();
      OdbcDataAdapter odbcDataAdapter = new OdbcDataAdapter(selectCommand);
      odbcDataAdapter.SelectCommand.CommandTimeout = 2000;
      string str = "UPDATE dbmes.dbo.mespohdr SET due_to_fnsh_dt = ? WHERE plnt='0085' AND q2c_nbr='34181855' AND ln_nbr=2 AND sub_ln_itm_id='00' AND orig_shpschd_id='01' ";
      selectCommand.CommandText = str;
      selectCommand.Parameters.Clear();
      DateTime date = Conversions.ToDate("07/07/2014");
      selectCommand.Parameters.AddWithValue("due_to_fnsh_dt", (object) date);
      odbcDataAdapter.UpdateCommand = selectCommand;
      odbcDataAdapter.AcceptChangesDuringUpdate = true;
      odbcDataAdapter.UpdateCommand.ExecuteNonQuery();
      selectCommand.Dispose();
      odbcDataAdapter.Dispose();
      odbcConnection.Close();
      odbcConnection.Dispose();
    }

    public emSWBDFlowLane UpdateTargetDate(string ProductionOrder)
    {
      DataSet dataSet = new DataSet();
      OdbcConnection odbcConnection = new OdbcConnection();
      odbcConnection.ConnectionString = "Driver={Sybase ASE ODBC Driver};NA=mcldb01.m087.us.schneider-electric.com,5000;Database=dbmes;Uid=misuser;Pwd=misuser;";
      OdbcCommand selectCommand = new OdbcCommand();
      selectCommand.Connection = odbcConnection;
      odbcConnection.Open();
      OdbcDataAdapter odbcDataAdapter = new OdbcDataAdapter(selectCommand);
      odbcDataAdapter.SelectCommand.CommandTimeout = 2000;
      string str1 = "UPDATE dbmes.dbo.messordr SET trgt_dt = '07/07/2014' WHERE hdr.plnt='0085' AND q2c_nbr=? AND ln_dsply_seq_nbr=? AND q2c_nbr=? AND q2c_nbr=? ";
      selectCommand.CommandText = str1;
      string str2 = ProductionOrder;
      selectCommand.Parameters.Clear();
      string str3 = str2;
      selectCommand.Parameters.AddWithValue("prdn_ord_nbr", (object) str3);
      odbcDataAdapter.SelectCommand = selectCommand;
      dataSet.Tables.Clear();
      odbcDataAdapter.Fill(dataSet);
      List<string> stringList1 = new List<string>();
      try
      {
        foreach (DataColumn column in (InternalDataCollectionBase) dataSet.Tables[0].Columns)
        {
          stringList1.Add(column.ColumnName);
          short num;
          checked { ++num; }
        }
      }
      finally
      {
        IEnumerator enumerator;
        if (enumerator is IDisposable)
          (enumerator as IDisposable).Dispose();
      }
      List<scMESBOM> scMesbomList = new List<scMESBOM>();
      try
      {
        foreach (DataRow row in dataSet.Tables[0].Rows)
        {
          short num = 0;
          scMESBOM scMesbom = new scMESBOM();
          List<string>.Enumerator enumerator;
          try
          {
            enumerator = stringList1.GetEnumerator();
            while (enumerator.MoveNext())
            {
              string current = enumerator.Current;
              if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "plnt", false) == 0)
                scMesbom.plnt = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "q2c_nbr", false) == 0)
                scMesbom.q2c_nbr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "ln_dsply_seq_nbr", false) == 0)
                scMesbom.ln_dsply_seq_nbr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "sub_ln_itm_id", false) == 0)
                scMesbom.sub_ln_itm_id = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "orig_shpschd_id", false) == 0)
                scMesbom.orig_shpschd_id = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "prdn_ord_nbr", false) == 0)
                scMesbom.prdn_ord_nbr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "sect_id", false) == 0)
                scMesbom.sect_id = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "parent_part_nbr", false) == 0)
                scMesbom.parent_part_nbr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              checked { ++num; }
            }
          }
          finally
          {
            enumerator.Dispose();
          }
          scMesbomList.Add(scMesbom);
        }
      }
      finally
      {
        IEnumerator enumerator;
        if (enumerator is IDisposable)
          (enumerator as IDisposable).Dispose();
      }
      List<scAssyCPLX> scAssyCplxList1 = new List<scAssyCPLX>();
      List<scAssyCPLX> scAssyCplxList2 = this.LoadCPLX();
      // ISSUE: method pointer
      // ISSUE: method pointer
      List<string> list = ((IEnumerable<string>) Enumerable.Select<scMESBOM, string>(Enumerable.Where<scMESBOM>((IEnumerable<M0>) scMesbomList, (Func<M0, bool>) new Func<scMESBOM, bool>((object) null, __methodptr(_Lambda\u0024__59))), (Func<M0, M1>) new Func<scMESBOM, string>((object) null, __methodptr(_Lambda\u0024__60)))).ToList<string>();
      List<string>.Enumerator enumerator1;
      try
      {
        enumerator1 = list.GetEnumerator();
        while (enumerator1.MoveNext())
        {
          // ISSUE: object of a compiler-generated type is created
          // ISSUE: variable of a compiler-generated type
          clsEngineMES._Closure\u0024__139 other = new clsEngineMES._Closure\u0024__139(other);
          // ISSUE: reference to a compiler-generated field
          other.\u0024VB\u0024Local_ldpt = enumerator1.Current;
          List<scAssyCPLX> scAssyCplxList3 = scAssyCplxList2;
          // ISSUE: variable of a compiler-generated type
          clsEngineMES._Closure\u0024__139 closure139 = other;
          // ISSUE: virtual method pointer
          IntPtr num = __vmethodptr(closure139, _Lambda\u0024__61);
          Func<scAssyCPLX, bool> func = new Func<scAssyCPLX, bool>((object) closure139, num);
          // ISSUE: method pointer
          IEnumerable<string> source = (IEnumerable<string>) Enumerable.Select<scAssyCPLX, string>(Enumerable.Where<scAssyCPLX>((IEnumerable<M0>) scAssyCplxList3, (Func<M0, bool>) func), (Func<M0, M1>) new Func<scAssyCPLX, string>((object) null, __methodptr(_Lambda\u0024__62)));
          if (source != null && source.Count<string>() > 0)
          {
            List<string> stringList2 = new List<string>();
            stringList2 = source.ToList<string>();
            // ISSUE: reference to a compiler-generated field
            new clsEngineCTdB().UpdateProdFlow(ProductionOrder, other.\u0024VB\u0024Local_ldpt, 2);
            return emSWBDFlowLane.Green;
          }
        }
      }
      finally
      {
        enumerator1.Dispose();
      }
      return emSWBDFlowLane.NONE;
    }

    public emSWBDFlowLane FindFlowLane(string ProductionOrder)
    {
      DataSet dataSet = new DataSet();
      OdbcConnection odbcConnection = new OdbcConnection();
      odbcConnection.ConnectionString = "Driver={Sybase ASE ODBC Driver};NA=mcldb01.m087.us.schneider-electric.com,5000;Database=dbmes;Uid=misuser;Pwd=misuser;";
      OdbcCommand selectCommand = new OdbcCommand();
      selectCommand.Connection = odbcConnection;
      odbcConnection.Open();
      OdbcDataAdapter odbcDataAdapter = new OdbcDataAdapter(selectCommand);
      odbcDataAdapter.SelectCommand.CommandTimeout = 2000;
      string str1 = "SELECT DISTINCT hdr.plnt ,hdr.q2c_nbr ,odr.ln_dsply_seq_nbr ,hdr.sub_ln_itm_id ,hdr.orig_shpschd_id ,hdr.prdn_ord_nbr ,hdr.sect_id ,dtl.parent_part_nbr FROM dbmes.dbo.mespohdr as hdr JOIN dbmes.dbo.messordr as odr ON hdr.bom_nbr = odr.bom_nbr JOIN dbmes.dbo.mesbomdtl as dtl ON hdr.bom_nbr = dtl.bom_nbr WHERE hdr.plnt='0085' AND hdr.prdn_ord_nbr=? AND hdr.ln_nbr = dtl.ln_nbr AND hdr.sect_id = dtl.sect_id AND hdr.ln_nbr = odr.ln_nbr ORDER BY dtl.parent_part_nbr ASC";
      selectCommand.CommandText = str1;
      string str2 = ProductionOrder;
      selectCommand.Parameters.Clear();
      string str3 = str2;
      selectCommand.Parameters.AddWithValue("prdn_ord_nbr", (object) str3);
      odbcDataAdapter.SelectCommand = selectCommand;
      dataSet.Tables.Clear();
      odbcDataAdapter.Fill(dataSet);
      List<string> stringList1 = new List<string>();
      try
      {
        foreach (DataColumn column in (InternalDataCollectionBase) dataSet.Tables[0].Columns)
        {
          stringList1.Add(column.ColumnName);
          short num;
          checked { ++num; }
        }
      }
      finally
      {
        IEnumerator enumerator;
        if (enumerator is IDisposable)
          (enumerator as IDisposable).Dispose();
      }
      List<scMESBOM> scMesbomList = new List<scMESBOM>();
      try
      {
        foreach (DataRow row in dataSet.Tables[0].Rows)
        {
          short num = 0;
          scMESBOM scMesbom = new scMESBOM();
          List<string>.Enumerator enumerator;
          try
          {
            enumerator = stringList1.GetEnumerator();
            while (enumerator.MoveNext())
            {
              string current = enumerator.Current;
              if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "plnt", false) == 0)
                scMesbom.plnt = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "q2c_nbr", false) == 0)
                scMesbom.q2c_nbr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "ln_dsply_seq_nbr", false) == 0)
                scMesbom.ln_dsply_seq_nbr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "sub_ln_itm_id", false) == 0)
                scMesbom.sub_ln_itm_id = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "orig_shpschd_id", false) == 0)
                scMesbom.orig_shpschd_id = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "prdn_ord_nbr", false) == 0)
                scMesbom.prdn_ord_nbr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "sect_id", false) == 0)
                scMesbom.sect_id = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "parent_part_nbr", false) == 0)
                scMesbom.parent_part_nbr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              checked { ++num; }
            }
          }
          finally
          {
            enumerator.Dispose();
          }
          scMesbomList.Add(scMesbom);
        }
      }
      finally
      {
        IEnumerator enumerator;
        if (enumerator is IDisposable)
          (enumerator as IDisposable).Dispose();
      }
      List<scAssyCPLX> scAssyCplxList1 = new List<scAssyCPLX>();
      List<scAssyCPLX> scAssyCplxList2 = this.LoadCPLX();
      // ISSUE: method pointer
      // ISSUE: method pointer
      List<string> list = ((IEnumerable<string>) Enumerable.Select<scMESBOM, string>(Enumerable.Where<scMESBOM>((IEnumerable<M0>) scMesbomList, (Func<M0, bool>) new Func<scMESBOM, bool>((object) null, __methodptr(_Lambda\u0024__63))), (Func<M0, M1>) new Func<scMESBOM, string>((object) null, __methodptr(_Lambda\u0024__64)))).ToList<string>();
      List<string>.Enumerator enumerator1;
      try
      {
        enumerator1 = list.GetEnumerator();
        while (enumerator1.MoveNext())
        {
          // ISSUE: object of a compiler-generated type is created
          // ISSUE: variable of a compiler-generated type
          clsEngineMES._Closure\u0024__140 other = new clsEngineMES._Closure\u0024__140(other);
          // ISSUE: reference to a compiler-generated field
          other.\u0024VB\u0024Local_ldpt = enumerator1.Current;
          List<scAssyCPLX> scAssyCplxList3 = scAssyCplxList2;
          // ISSUE: variable of a compiler-generated type
          clsEngineMES._Closure\u0024__140 closure140 = other;
          // ISSUE: virtual method pointer
          IntPtr num = __vmethodptr(closure140, _Lambda\u0024__65);
          Func<scAssyCPLX, bool> func = new Func<scAssyCPLX, bool>((object) closure140, num);
          // ISSUE: method pointer
          IEnumerable<string> source = (IEnumerable<string>) Enumerable.Select<scAssyCPLX, string>(Enumerable.Where<scAssyCPLX>((IEnumerable<M0>) scAssyCplxList3, (Func<M0, bool>) func), (Func<M0, M1>) new Func<scAssyCPLX, string>((object) null, __methodptr(_Lambda\u0024__66)));
          if (source != null && source.Count<string>() > 0)
          {
            List<string> stringList2 = new List<string>();
            stringList2 = source.ToList<string>();
            // ISSUE: reference to a compiler-generated field
            new clsEngineCTdB().UpdateProdFlow(ProductionOrder, other.\u0024VB\u0024Local_ldpt, 2);
            return emSWBDFlowLane.Green;
          }
        }
      }
      finally
      {
        enumerator1.Dispose();
      }
      return emSWBDFlowLane.NONE;
    }

    public List<scAssyCPLX> LoadCPLX()
    {
      List<scAssyCPLX> scAssyCplxList = new List<scAssyCPLX>();
      scAssyCPLX scAssyCplx = new scAssyCPLX();
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80237-191-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80237-192-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80237-280-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80237-235-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80237-349-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80237-938-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80237-939-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80237-940-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80237-941-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80237-942-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80237-943-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80237-944-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80237-945-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80247-718-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80235-615-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80235-618-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80235-778-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80235-784-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80235-885-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80235-886-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80236-028-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80236-029-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80236-031-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80236-032-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80236-034-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80236-080-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80236-083-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80236-084-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80236-084-6",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80246-030-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80236-088-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80236-158-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "SCB-00000-25883",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80252-002-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80252-617-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80252-430-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80252-003-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80252-002-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80252-152-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80252-131-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80391-036-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80391-037-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80392-464-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80252-979-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80252-975-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80252-976-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80252-781-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80252-781-6",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80252-780-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80248-939-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80242-715-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80242-718-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80242-719-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80242-918-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80242-918-6",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80242-920-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80242-921-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80242-942-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80242-947-5",
        Complexity = (short) 1,
        Active = true
      });
      scAssyCplxList.Add(new scAssyCPLX()
      {
        AssyPartNum = "80262-237-5",
        Complexity = (short) 1,
        Active = true
      });
      return scAssyCplxList;
    }

    public List<scMESBOM> FindNW(string ProductionOrder)
    {
      DataSet dataSet = new DataSet();
      OdbcConnection odbcConnection = new OdbcConnection();
      odbcConnection.ConnectionString = "Driver={Sybase ASE ODBC Driver};NA=mcldb01.m087.us.schneider-electric.com,5000;Database=dbmes;Uid=misuser;Pwd=misuser;";
      OdbcCommand selectCommand = new OdbcCommand();
      selectCommand.Connection = odbcConnection;
      odbcConnection.Open();
      OdbcDataAdapter odbcDataAdapter = new OdbcDataAdapter(selectCommand);
      odbcDataAdapter.SelectCommand.CommandTimeout = 2000;
      string str1 = "SELECT DISTINCT hdr.plnt ,hdr.q2c_nbr ,odr.ln_dsply_seq_nbr ,hdr.sub_ln_itm_id ,hdr.orig_shpschd_id ,hdr.prdn_ord_nbr ,hdr.sect_id, dtl.shp_splt ,dtl.cell_nbr ,dtl.parent_part_nbr ,dtl.comp_part_nbr ,dtl.qty_per ,dtl.ext_qty_per FROM dbmes.dbo.mespohdr as hdr JOIN dbmes.dbo.messordr as odr ON hdr.bom_nbr = odr.bom_nbr JOIN dbmes.dbo.mesbomdtl as dtl ON hdr.bom_nbr = dtl.bom_nbr WHERE hdr.plnt='0085' AND hdr.prdn_ord_nbr=? AND hdr.ln_nbr = dtl.ln_nbr AND hdr.sect_id = dtl.sect_id AND hdr.ln_nbr = odr.ln_nbr AND dtl.comp_part_nbr LIKE 'NW%' ORDER BY dtl.parent_part_nbr ASC";
      selectCommand.CommandText = str1;
      string str2 = ProductionOrder;
      selectCommand.Parameters.Clear();
      string str3 = str2;
      selectCommand.Parameters.AddWithValue("prdn_ord_nbr", (object) str3);
      odbcDataAdapter.SelectCommand = selectCommand;
      dataSet.Tables.Clear();
      odbcDataAdapter.Fill(dataSet);
      List<string> stringList = new List<string>();
      try
      {
        foreach (DataColumn column in (InternalDataCollectionBase) dataSet.Tables[0].Columns)
        {
          stringList.Add(column.ColumnName);
          short num;
          checked { ++num; }
        }
      }
      finally
      {
        IEnumerator enumerator;
        if (enumerator is IDisposable)
          (enumerator as IDisposable).Dispose();
      }
      List<scMESBOM> scMesbomList = new List<scMESBOM>();
      try
      {
        foreach (DataRow row in dataSet.Tables[0].Rows)
        {
          short num = 0;
          scMESBOM scMesbom = new scMESBOM();
          List<string>.Enumerator enumerator;
          try
          {
            enumerator = stringList.GetEnumerator();
            while (enumerator.MoveNext())
            {
              string current = enumerator.Current;
              Console.WriteLine(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject((object) (Conversions.ToString((int) num) + " - " + current + "\t" + "\t" + " "), row[(int) num]), (object) '\t'), (object) '\t'), (object) row[(int) num].GetType().FullName));
              if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "plnt", false) == 0)
                scMesbom.plnt = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "q2c_nbr", false) == 0)
                scMesbom.q2c_nbr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "ln_dsply_seq_nbr", false) == 0)
                scMesbom.ln_dsply_seq_nbr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "sub_ln_itm_id", false) == 0)
                scMesbom.sub_ln_itm_id = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "orig_shpschd_id", false) == 0)
                scMesbom.orig_shpschd_id = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "prdn_ord_nbr", false) == 0)
                scMesbom.prdn_ord_nbr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "sect_id", false) == 0)
                scMesbom.sect_id = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "parent_part_nbr", false) == 0)
                scMesbom.parent_part_nbr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "comp_part_nbr", false) == 0)
                scMesbom.comp_part_nbr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              checked { ++num; }
            }
          }
          finally
          {
            enumerator.Dispose();
          }
          scMesbomList.Add(scMesbom);
        }
      }
      finally
      {
        IEnumerator enumerator;
        if (enumerator is IDisposable)
          (enumerator as IDisposable).Dispose();
      }
      selectCommand.Dispose();
      odbcDataAdapter.Dispose();
      odbcConnection.Close();
      odbcConnection.Dispose();
      return scMesbomList;
    }

    public List<scMESBOM> rtnNWLocation(string Q2CNbr, string Q2CLine, string Q2CSL, string Q2CSS, string MFGPartNbr)
    {
      DataSet dataSet = new DataSet();
      OdbcConnection odbcConnection = new OdbcConnection();
      odbcConnection.ConnectionString = "Driver={Sybase ASE ODBC Driver};NA=mcldb01.m087.us.schneider-electric.com,5000;Database=dbmes;Uid=misuser;Pwd=misuser;";
      OdbcCommand selectCommand = new OdbcCommand();
      selectCommand.Connection = odbcConnection;
      odbcConnection.Open();
      OdbcDataAdapter odbcDataAdapter = new OdbcDataAdapter(selectCommand);
      odbcDataAdapter.SelectCommand.CommandTimeout = 2000;
      string str1 = "SELECT DISTINCT hdr.plnt ,hdr.q2c_nbr ,odr.ln_dsply_seq_nbr ,hdr.sub_ln_itm_id ,hdr.orig_shpschd_id ,hdr.prdn_ord_nbr, dtl.shp_splt ,hdr.sect_id ,dtl.parent_part_nbr ,dtl.comp_part_nbr ,SUM(dtl.ext_qty_per) AS TotSectQty  FROM dbmes.dbo.mespohdr as hdr JOIN dbmes.dbo.messordr as odr ON hdr.bom_nbr = odr.bom_nbr JOIN dbmes.dbo.mesbomdtl as dtl ON hdr.bom_nbr = dtl.bom_nbr WHERE hdr.plnt='0085' AND hdr.q2c_nbr=? AND odr.ln_dsply_seq_nbr=? AND hdr.sub_ln_itm_id=? AND hdr.orig_shpschd_id=? AND dtl.comp_part_nbr=? AND hdr.ln_nbr = dtl.ln_nbr AND hdr.sect_id = dtl.sect_id AND hdr.ln_nbr = odr.ln_nbr GROUP BY hdr.plnt ,hdr.q2c_nbr ,odr.ln_dsply_seq_nbr ,hdr.sub_ln_itm_id ,hdr.orig_shpschd_id ,hdr.prdn_ord_nbr, dtl.shp_splt ,hdr.sect_id ,dtl.parent_part_nbr ,dtl.comp_part_nbr ORDER BY dtl.shp_splt, hdr.sect_id, dtl.parent_part_nbr ASC";
      selectCommand.CommandText = str1;
      selectCommand.Parameters.Clear();
      string str2 = Q2CNbr;
      selectCommand.Parameters.AddWithValue("q2c_nbr", (object) str2);
      string str3 = Q2CLine;
      selectCommand.Parameters.AddWithValue("ln_dsply_seq_nbr", (object) str3);
      string str4 = Q2CSL;
      selectCommand.Parameters.AddWithValue("sub_ln_itm_id", (object) str4);
      string str5 = Q2CSS;
      selectCommand.Parameters.AddWithValue("orig_shpschd_id", (object) str5);
      string str6 = MFGPartNbr;
      selectCommand.Parameters.AddWithValue("comp_part_nbr", (object) str6);
      odbcDataAdapter.SelectCommand = selectCommand;
      dataSet.Tables.Clear();
      odbcDataAdapter.Fill(dataSet);
      List<string> stringList = new List<string>();
      try
      {
        foreach (DataColumn column in (InternalDataCollectionBase) dataSet.Tables[0].Columns)
        {
          stringList.Add(column.ColumnName);
          short num;
          checked { ++num; }
        }
      }
      finally
      {
        IEnumerator enumerator;
        if (enumerator is IDisposable)
          (enumerator as IDisposable).Dispose();
      }
      List<scMESBOM> scMesbomList = new List<scMESBOM>();
      try
      {
        foreach (DataRow row in dataSet.Tables[0].Rows)
        {
          short num = 0;
          scMESBOM scMesbom = new scMESBOM();
          List<string>.Enumerator enumerator;
          try
          {
            enumerator = stringList.GetEnumerator();
            while (enumerator.MoveNext())
            {
              string current = enumerator.Current;
              if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "plnt", false) == 0)
                scMesbom.plnt = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "q2c_nbr", false) == 0)
                scMesbom.q2c_nbr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "ln_dsply_seq_nbr", false) == 0)
                scMesbom.ln_dsply_seq_nbr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "sub_ln_itm_id", false) == 0)
                scMesbom.sub_ln_itm_id = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "orig_shpschd_id", false) == 0)
                scMesbom.orig_shpschd_id = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "prdn_ord_nbr", false) == 0)
                scMesbom.prdn_ord_nbr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "shp_splt", false) == 0)
                scMesbom.shp_splt = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "sect_id", false) == 0)
                scMesbom.sect_id = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "parent_part_nbr", false) == 0)
                scMesbom.parent_part_nbr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "comp_part_nbr", false) == 0)
                scMesbom.comp_part_nbr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "TotSectQty", false) == 0)
                scMesbom.ext_qty_per = Conversions.ToDecimal(Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num])));
              checked { ++num; }
            }
          }
          finally
          {
            enumerator.Dispose();
          }
          scMesbomList.Add(scMesbom);
        }
      }
      finally
      {
        IEnumerator enumerator;
        if (enumerator is IDisposable)
          (enumerator as IDisposable).Dispose();
      }
      selectCommand.Dispose();
      odbcDataAdapter.Dispose();
      odbcConnection.Close();
      odbcConnection.Dispose();
      return scMesbomList;
    }

    public List<scMESBOM> rtnOrdersByPart(string comp_part_nbr)
    {
      DataSet dataSet = new DataSet();
      OdbcConnection odbcConnection = new OdbcConnection();
      odbcConnection.ConnectionString = "Driver={Sybase ASE ODBC Driver};NA=mcldb01.m087.us.schneider-electric.com,5000;Database=dbmes;Uid=misuser;Pwd=misuser;";
      OdbcCommand selectCommand = new OdbcCommand();
      selectCommand.Connection = odbcConnection;
      odbcConnection.Open();
      OdbcDataAdapter odbcDataAdapter = new OdbcDataAdapter(selectCommand);
      odbcDataAdapter.SelectCommand.CommandTimeout = 5000;
      string str1 = "SELECT DISTINCT hdr.plnt ,hdr.q2c_nbr ,odr.ln_dsply_seq_nbr ,hdr.sub_ln_itm_id ,hdr.orig_shpschd_id ,hdr.prdn_ord_nbr, dtl.shp_splt ,hdr.sect_id ,dtl.parent_part_nbr ,dtl.comp_part_nbr ,SUM(dtl.ext_qty_per) AS TotSectQty  FROM dbmes.dbo.mespohdr as hdr JOIN dbmes.dbo.messordr as odr ON hdr.bom_nbr = odr.bom_nbr JOIN dbmes.dbo.mesbomdtl as dtl ON hdr.bom_nbr = dtl.bom_nbr WHERE hdr.plnt='0085' AND dtl.comp_part_nbr=? AND NOT odr.bom_ref_msg = 'No BOM data found' AND hdr.ln_nbr = dtl.ln_nbr AND hdr.sect_id = dtl.sect_id AND hdr.ln_nbr = odr.ln_nbr GROUP BY hdr.plnt ,hdr.q2c_nbr ,odr.ln_dsply_seq_nbr ,hdr.sub_ln_itm_id ,hdr.orig_shpschd_id ,hdr.prdn_ord_nbr, dtl.shp_splt ,hdr.sect_id ,dtl.parent_part_nbr ,dtl.comp_part_nbr ORDER BY hdr.q2c_nbr, odr.ln_dsply_seq_nbr, hdr.sub_ln_itm_id, hdr.orig_shpschd_id, dtl.shp_splt, hdr.sect_id ASC";
      selectCommand.CommandText = str1;
      string str2 = comp_part_nbr;
      selectCommand.Parameters.Clear();
      string str3 = str2;
      selectCommand.Parameters.AddWithValue("comp_part_nbr", (object) str3);
      odbcDataAdapter.SelectCommand = selectCommand;
      dataSet.Tables.Clear();
      odbcDataAdapter.Fill(dataSet);
      List<string> stringList = new List<string>();
      try
      {
        foreach (DataColumn column in (InternalDataCollectionBase) dataSet.Tables[0].Columns)
        {
          stringList.Add(column.ColumnName);
          short num;
          checked { ++num; }
        }
      }
      finally
      {
        IEnumerator enumerator;
        if (enumerator is IDisposable)
          (enumerator as IDisposable).Dispose();
      }
      List<scMESBOM> scMesbomList = new List<scMESBOM>();
      try
      {
        foreach (DataRow row in dataSet.Tables[0].Rows)
        {
          short num = 0;
          scMESBOM scMesbom = new scMESBOM();
          List<string>.Enumerator enumerator;
          try
          {
            enumerator = stringList.GetEnumerator();
            while (enumerator.MoveNext())
            {
              string current = enumerator.Current;
              Console.WriteLine(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject((object) (Conversions.ToString((int) num) + " - " + current + "\t" + "\t" + " "), row[(int) num]), (object) '\t'), (object) '\t'), (object) row[(int) num].GetType().FullName));
              if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "plnt", false) == 0)
                scMesbom.plnt = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "q2c_nbr", false) == 0)
                scMesbom.q2c_nbr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "ln_dsply_seq_nbr", false) == 0)
                scMesbom.ln_dsply_seq_nbr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "sub_ln_itm_id", false) == 0)
                scMesbom.sub_ln_itm_id = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "orig_shpschd_id", false) == 0)
                scMesbom.orig_shpschd_id = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "prdn_ord_nbr", false) == 0)
                scMesbom.prdn_ord_nbr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "shp_splt", false) == 0)
                scMesbom.shp_splt = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "sect_id", false) == 0)
                scMesbom.sect_id = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "parent_part_nbr", false) == 0)
                scMesbom.parent_part_nbr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "comp_part_nbr", false) == 0)
                scMesbom.comp_part_nbr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "TotSectQty", false) == 0)
                scMesbom.ext_qty_per = Conversions.ToDecimal(Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num])));
              checked { ++num; }
            }
          }
          finally
          {
            enumerator.Dispose();
          }
          scMesbomList.Add(scMesbom);
        }
      }
      finally
      {
        IEnumerator enumerator;
        if (enumerator is IDisposable)
          (enumerator as IDisposable).Dispose();
      }
      selectCommand.Dispose();
      odbcDataAdapter.Dispose();
      odbcConnection.Close();
      odbcConnection.Dispose();
      return scMesbomList;
    }

    public List<scMESUpdateQH> LoadMESQH(DateTime UpdateTm)
    {
      if ((DateTime.Now - UpdateTm).TotalHours > 49.0)
        return (List<scMESUpdateQH>) null;
      List<scMESUpdateQH> scMesUpdateQhList = new List<scMESUpdateQH>();
      DataSet dataSet = new DataSet();
      OdbcConnection odbcConnection = new OdbcConnection();
      odbcConnection.ConnectionString = "Driver={Sybase ASE ODBC Driver};NA=mcldb01.m087.us.schneider-electric.com,5000;Database=dbmes;Uid=misuser;Pwd=misuser;";
      OdbcCommand selectCommand = new OdbcCommand();
      selectCommand.Connection = odbcConnection;
      odbcConnection.Open();
      OdbcDataAdapter odbcDataAdapter = new OdbcDataAdapter(selectCommand);
      odbcDataAdapter.SelectCommand.CommandTimeout = 2000;
      string str1 = "select distinct  prdn_ord_nbr  ,series  ,eto_workctr  ,next_series  ,next_eto_workctr  ,SUM(run_tm_mins) as run_tm_tot  ,MIN(due_to_strt_dt) as due_st  ,MAX(due_to_fnsh_dt) as due_fn  ,MIN(act_strt_dt) as act_st  ,MAX(act_fnsh_dt) as act_fn  ,prdn_dtl_status_cd  from dbmes.dbo.mespodtl  group by  prdn_ord_nbr  ,series  ,eto_workctr  ,next_series  ,next_eto_workctr  ,prdn_dtl_status_cd  having update_dt > ? and not(prdn_dtl_status_cd = 'I')  order by prdn_ord_nbr, act_fn ";
      selectCommand.CommandText = str1;
      selectCommand.Parameters.Clear();
      string str2 = Conversions.ToString(UpdateTm);
      selectCommand.Parameters.AddWithValue("update_dt", (object) str2);
      odbcDataAdapter.SelectCommand = selectCommand;
      dataSet.Tables.Clear();
      odbcDataAdapter.Fill(dataSet);
      List<string> stringList = new List<string>();
      try
      {
        foreach (DataColumn column in (InternalDataCollectionBase) dataSet.Tables[0].Columns)
        {
          stringList.Add(column.ColumnName);
          short num;
          checked { ++num; }
        }
      }
      finally
      {
        IEnumerator enumerator;
        if (enumerator is IDisposable)
          (enumerator as IDisposable).Dispose();
      }
      try
      {
        foreach (DataRow row in dataSet.Tables[0].Rows)
        {
          short num = 0;
          scMESUpdateQH scMesUpdateQh = new scMESUpdateQH();
          List<string>.Enumerator enumerator;
          try
          {
            enumerator = stringList.GetEnumerator();
            while (enumerator.MoveNext())
            {
              string current = enumerator.Current;
              Console.WriteLine(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject((object) (Conversions.ToString((int) num) + " - " + current + "\t" + "\t" + " "), row[(int) num]), (object) '\t'), (object) '\t'), (object) row[(int) num].GetType().FullName));
              if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "prdn_ord_nbr", false) == 0)
                scMesUpdateQh.OrdSectsProdNum = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "series", false) == 0)
                scMesUpdateQh.series = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "eto_workctr", false) == 0)
                scMesUpdateQh.RoutingWorkCenter = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "next_series", false) == 0)
                scMesUpdateQh.next_series = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "next_eto_workctr", false) == 0)
                scMesUpdateQh.RoutingNextWorkCtr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "run_tm_tot", false) == 0)
                scMesUpdateQh.RoutingRunTimeMin = Conversions.ToInteger(row[(int) num]);
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "due_st", false) == 0)
                scMesUpdateQh.RoutingSchStartDt = Conversions.ToDate(row[(int) num]);
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "due_fn", false) == 0)
                scMesUpdateQh.RoutingSchFinishDt = Conversions.ToDate(row[(int) num]);
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "act_st", false) == 0)
                scMesUpdateQh.RoutingActStartDt = Conversions.ToDate(row[(int) num]);
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "act_fn", false) == 0)
                scMesUpdateQh.RoutingActFinishDt = Conversions.ToDate(row[(int) num]);
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "prdn_dtl_status_cd", false) == 0)
                scMesUpdateQh.prdn_dtl_status_cd = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              checked { ++num; }
            }
          }
          finally
          {
            enumerator.Dispose();
          }
          if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(scMesUpdateQh.prdn_dtl_status_cd, "C", false) == 0 & Microsoft.VisualBasic.CompilerServices.Operators.CompareString(scMesUpdateQh.series, scMesUpdateQh.next_series, false) == 0)
            scMesUpdateQh.OrdSectsCurrWorkCtr = scMesUpdateQh.RoutingWorkCenter;
          scMesUpdateQhList.Add(scMesUpdateQh);
        }
      }
      finally
      {
        IEnumerator enumerator;
        if (enumerator is IDisposable)
          (enumerator as IDisposable).Dispose();
      }
      return scMesUpdateQhList;
    }

    public int UpdateProdQH(List<scMESUpdateQH> MESQHList)
    {
      // ISSUE: object of a compiler-generated type is created
      // ISSUE: variable of a compiler-generated type
      clsEngineMES._Closure\u0024__141 closure141 = new clsEngineMES._Closure\u0024__141();
      // ISSUE: reference to a compiler-generated field
      closure141.\u0024VB\u0024Local_oqSection = (OrdSection) null;
      int num;
      using (SE0085CTEntities1 se0085CtEntities1 = new SE0085CTEntities1())
      {
        se0085CtEntities1.Database.Connection.ConnectionString = this._CTConnection;
        List<scMESUpdateQH>.Enumerator enumerator1;
        try
        {
          enumerator1 = MESQHList.GetEnumerator();
          while (enumerator1.MoveNext())
          {
            scMESUpdateQH current1 = enumerator1.Current;
            // ISSUE: reference to a compiler-generated field
            closure141.\u0024VB\u0024Local_ldProdOrder = current1.OrdSectsProdNum;
            // ISSUE: reference to a compiler-generated field
            closure141.\u0024VB\u0024Local_oqSection = new OrdSection();
            // ISSUE: method reference
            // ISSUE: reference to a compiler-generated field
            IQueryable<OrdSection> source1 = (IQueryable<OrdSection>) Queryable.Select<OrdSection, OrdSection>(Queryable.Where<OrdSection>((IQueryable<M0>) se0085CtEntities1.OrdSections, (Expression<Func<M0, bool>>) (os => Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), os.OrdSectsProdNum, closure141.\u0024VB\u0024Local_ldProdOrder, false) == 0)), (Expression<Func<M0, M1>>) (os => os));
            if (source1 != null)
            {
              if (source1.Count<OrdSection>() == 1)
              {
                // ISSUE: reference to a compiler-generated field
                closure141.\u0024VB\u0024Local_oqSection = source1.First<OrdSection>();
                // ISSUE: reference to a compiler-generated field
                closure141.\u0024VB\u0024Local_ldWorkCenter = current1.RoutingWorkCenter;
                ParameterExpression parameterExpression;
                // ISSUE: reference to a compiler-generated field
                // ISSUE: method reference
                // ISSUE: method reference
                // ISSUE: field reference
                IQueryable<SectionsRouting> source2 = (IQueryable<SectionsRouting>) Queryable.Select<SectionsRouting, SectionsRouting>(Queryable.Where<SectionsRouting>((IQueryable<M0>) se0085CtEntities1.SectionsRoutings, (Expression<Func<M0, bool>>) Expression.Lambda<Func<SectionsRouting, bool>>((Expression) Expression.And((Expression) Expression.Equal(rt.OrdSection.OrdSectsId, closure141.\u0024VB\u0024Local_oqSection.OrdSectsId, true, (MethodInfo) null), (Expression) Expression.Equal((Expression) Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SectionsRouting.get_RoutingWorkCenter))), (Expression) Expression.Field((Expression) Expression.Constant((object) closure141, typeof (clsEngineMES._Closure\u0024__141)), FieldInfo.GetFieldFromHandle(__fieldref (clsEngineMES._Closure\u0024__141.\u0024VB\u0024Local_ldWorkCenter))), (Expression) Expression.Constant((object) false, typeof (bool))), (Expression) Expression.Constant((object) 0, typeof (int)))), new ParameterExpression[1]
                {
                  parameterExpression
                })), (Expression<Func<M0, M1>>) (rt => rt));
                if (source2 != null)
                {
                  if (source2.Count<SectionsRouting>() == 1)
                  {
                    IEnumerator<SectionsRouting> enumerator2;
                    try
                    {
                      enumerator2 = source2.GetEnumerator();
                      while (enumerator2.MoveNext())
                      {
                        SectionsRouting current2 = enumerator2.Current;
                        DateTime routingActStartDt1 = current1.RoutingActStartDt;
                        DateTime? routingActStartDt2 = current2.RoutingActStartDt;
                        bool? nullable1 = routingActStartDt2.HasValue ? new bool?(DateTime.Compare(routingActStartDt2.GetValueOrDefault(), routingActStartDt1) == 0) : new bool?();
                        DateTime routingActFinishDt1 = current1.RoutingActFinishDt;
                        DateTime? routingActFinishDt2 = current2.RoutingActFinishDt;
                        bool? nullable2 = routingActFinishDt2.HasValue ? new bool?(DateTime.Compare(routingActFinishDt2.GetValueOrDefault(), routingActFinishDt1) == 0) : new bool?();
                        bool? nullable3 = !nullable1.HasValue || nullable1.GetValueOrDefault() ? (nullable2.HasValue ? (nullable2.GetValueOrDefault() ? nullable1 : new bool?(false)) : new bool?()) : new bool?(false);
                        bool? nullable4 = Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current2.RoutingStatusCD, current1.prdn_dtl_status_cd, false) == 0 ? nullable3 : new bool?(false);
                        if ((nullable4.HasValue ? new bool?(!nullable4.GetValueOrDefault()) : new bool?()).GetValueOrDefault())
                        {
                          SectionsRouting sectionsRouting = current2;
                          sectionsRouting.RoutingActStartDt = (DateTime?) current1.RoutingActStartDt;
                          sectionsRouting.RoutingActFinishDt = (DateTime?) current1.RoutingActFinishDt;
                          sectionsRouting.RoutingStatusCD = current1.prdn_dtl_status_cd;
                        }
                      }
                    }
                    finally
                    {
                      if (enumerator2 != null)
                        enumerator2.Dispose();
                    }
                    checked { num += se0085CtEntities1.SaveChanges(); }
                  }
                }
                else
                  break;
              }
              else
                break;
            }
            else
              break;
          }
        }
        finally
        {
          enumerator1.Dispose();
        }
        se0085CtEntities1.Database.Connection.Close();
      }
      // ISSUE: reference to a compiler-generated field
      closure141.\u0024VB\u0024Local_oqSection = (OrdSection) null;
      return num;
    }

    public List<scMESUpdateFull> LoadMESOrdersSave(string Q2CNbr, string Q2CLine, string Q2CSL, string Q2CSS)
    {
      List<scMESUpdateFull> scMesUpdateFullList = new List<scMESUpdateFull>();
      DataSet dataSet = new DataSet();
      OdbcConnection odbcConnection = new OdbcConnection();
      odbcConnection.ConnectionString = "Driver={Sybase ASE ODBC Driver};NA=mcldb01.m087.us.schneider-electric.com,5000;Database=dbmes;Uid=misuser;Pwd=misuser;";
      OdbcCommand selectCommand = new OdbcCommand();
      selectCommand.Connection = odbcConnection;
      odbcConnection.Open();
      OdbcDataAdapter odbcDataAdapter = new OdbcDataAdapter(selectCommand);
      odbcDataAdapter.SelectCommand.CommandTimeout = 2000;
      string str1 = "select distinct  hd.eto_ln  ,hd.q2c_nbr  ,od.ln_dsply_seq_nbr  ,hd.sub_ln_itm_id  ,hd.orig_shpschd_id  ,hd.shp_splt  ,hd.sect_id  ,hd.prdn_ord_nbr  ,hd.disp_dt  ,dt.eto_workctr  ,od.curr_prom_dt  ,od.trgt_dt  ,dt.prdn_dtl_status_cd  ,dt.update_dt  ,SUM(dt.run_tm_mins) as run_tm_tot  ,MIN(dt.due_to_strt_dt) as due_st  ,MAX(dt.due_to_fnsh_dt) as due_fn  ,MIN(dt.act_strt_dt) as act_st  ,MAX(dt.act_fnsh_dt) as act_fn from dbmes.dbo.mespohdr as hd  join dbmes.dbo.mespodtl as dt  on hd.prdn_ord_nbr = dt.prdn_ord_nbr  join dbmes.dbo.messordr as od  on od.q2c_nbr = hd.q2c_nbr and od.ln_nbr = hd.ln_nbr and od.bom_nbr = hd.bom_nbr  group by  hd.eto_ln  ,hd.q2c_nbr  ,od.ln_dsply_seq_nbr  ,hd.sub_ln_itm_id  ,hd.orig_shpschd_id  ,hd.shp_splt  ,hd.sect_id  ,hd.prdn_ord_nbr  ,hd.disp_dt  ,dt.eto_workctr  ,od.curr_prom_dt  ,od.trgt_dt  ,dt.prdn_dtl_status_cd  ,dt.update_dt  having hd.q2c_nbr = ? AND od.ln_dsply_seq_nbr = ? AND hd.sub_ln_itm_id = ? AND hd.orig_shpschd_id = ?  order by hd.q2c_nbr, od.ln_dsply_seq_nbr, hd.sect_id, due_st ";
      selectCommand.CommandText = str1;
      selectCommand.Parameters.Clear();
      string str2 = Q2CNbr;
      selectCommand.Parameters.AddWithValue("q2c_nbr", (object) str2);
      string str3 = Q2CLine;
      selectCommand.Parameters.AddWithValue("ln_dsply_seq_nbr", (object) str3);
      string str4 = Q2CSL;
      selectCommand.Parameters.AddWithValue("sub_ln_itm_id", (object) str4);
      string str5 = Q2CSS;
      selectCommand.Parameters.AddWithValue("orig_shpschd_id", (object) str5);
      odbcDataAdapter.SelectCommand = selectCommand;
      dataSet.Tables.Clear();
      odbcDataAdapter.Fill(dataSet);
      List<string> stringList = new List<string>();
      try
      {
        foreach (DataColumn column in (InternalDataCollectionBase) dataSet.Tables[0].Columns)
        {
          stringList.Add(column.ColumnName);
          short num;
          checked { ++num; }
        }
      }
      finally
      {
        IEnumerator enumerator;
        if (enumerator is IDisposable)
          (enumerator as IDisposable).Dispose();
      }
      try
      {
        foreach (DataRow row in dataSet.Tables[0].Rows)
        {
          short num = 0;
          scMESUpdateFull scMesUpdateFull = new scMESUpdateFull();
          List<string>.Enumerator enumerator;
          try
          {
            enumerator = stringList.GetEnumerator();
            while (enumerator.MoveNext())
            {
              string current = enumerator.Current;
              Console.WriteLine(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject((object) (Conversions.ToString((int) num) + " - " + current + "\t" + "\t" + " "), row[(int) num]), (object) '\t'), (object) '\t'), (object) row[(int) num].GetType().FullName));
              if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "eto_ln", false) == 0)
                scMesUpdateFull.hd_eto_ln = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "q2c_nbr", false) == 0)
                scMesUpdateFull.hd_q2c_nbr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "ln_dsply_seq_nbr", false) == 0)
                scMesUpdateFull.od_ln_dsply_seq_nbr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "sub_ln_itm_id", false) == 0)
                scMesUpdateFull.hd_sub_ln_itm_id = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "orig_shpschd_id", false) == 0)
                scMesUpdateFull.hd_orig_shpschd_id = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "shp_splt", false) == 0)
                scMesUpdateFull.hd_shp_splt = Conversions.ToInteger(Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num])));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "sect_id", false) == 0)
                scMesUpdateFull.hd_sect_id = Conversions.ToInteger(Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num])));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "prdn_ord_nbr", false) == 0)
                scMesUpdateFull.hd_prdn_ord_nbr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "disp_dt", false) == 0)
                scMesUpdateFull.hd_disp_dt = Conversions.ToDate(Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num])));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "eto_workctr", false) == 0)
                scMesUpdateFull.dt_eto_workctr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "run_tm_tot", false) == 0)
                scMesUpdateFull.run_tm_tot = Conversions.ToInteger(row[(int) num]);
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "due_st", false) == 0)
                scMesUpdateFull.due_st = Conversions.ToDate(row[(int) num]);
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "due_fn", false) == 0)
                scMesUpdateFull.due_fn = Conversions.ToDate(row[(int) num]);
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "act_st", false) == 0)
                scMesUpdateFull.act_st = Conversions.ToDate(row[(int) num]);
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "act_fn", false) == 0)
                scMesUpdateFull.act_fn = Conversions.ToDate(row[(int) num]);
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "curr_prom_dt", false) == 0)
                scMesUpdateFull.od_curr_prom_dt = Conversions.ToDate(Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num])));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "trgt_dt", false) == 0)
                scMesUpdateFull.od_trgt_dt = Conversions.ToDate(Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num])));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "prdn_dtl_status_cd", false) == 0)
                scMesUpdateFull.dt_prdn_dtl_status_cd = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "update_dt", false) == 0)
                scMesUpdateFull.dt_update_dt = Conversions.ToDate(Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num])));
              checked { ++num; }
            }
          }
          finally
          {
            enumerator.Dispose();
          }
          scMesUpdateFullList.Add(scMesUpdateFull);
        }
      }
      finally
      {
        IEnumerator enumerator;
        if (enumerator is IDisposable)
          (enumerator as IDisposable).Dispose();
      }
      return scMesUpdateFullList;
    }

    public List<scMESUpdateFull> LoadMESOrdersTest(string Q2CNbr, string Q2CLine, string Q2CSL, string Q2CSS)
    {
      List<scMESUpdateFull> scMesUpdateFullList = new List<scMESUpdateFull>();
      DataSet dataSet = new DataSet();
      OdbcConnection odbcConnection = new OdbcConnection();
      odbcConnection.ConnectionString = "Driver={Sybase ASE ODBC Driver};NA=mcldb01.m087.us.schneider-electric.com,5000;Database=dbmes;Uid=misuser;Pwd=misuser;";
      OdbcCommand selectCommand = new OdbcCommand();
      selectCommand.Connection = odbcConnection;
      odbcConnection.Open();
      OdbcDataAdapter odbcDataAdapter = new OdbcDataAdapter(selectCommand);
      odbcDataAdapter.SelectCommand.CommandTimeout = 2000;
      string str1 = "select  hd.eto_ln  ,hd.q2c_nbr  ,od.ln_dsply_seq_nbr  ,hd.sub_ln_itm_id  ,hd.orig_shpschd_id  ,hd.shp_splt  ,hd.sect_id  ,hd.prdn_ord_nbr  ,dt.eto_workctr  ,dt.prdn_dtl_status_cd from dbmes.dbo.mespohdr as hd,  dbmes.dbo.mespodtl as dt,  dbmes.dbo.messordr as od  where od.q2c_nbr = hd.q2c_nbr and od.ln_nbr = hd.ln_nbr  and hd.prdn_ord_nbr = dt.prdn_ord_nbr and od.bom_nbr = hd.bom_nbr  and hd.q2c_nbr = ? AND od.ln_dsply_seq_nbr = ? AND hd.sub_ln_itm_id = ? AND hd.orig_shpschd_id = ?  group by  hd.eto_ln  ,hd.q2c_nbr  ,od.ln_dsply_seq_nbr  ,hd.sub_ln_itm_id  ,hd.orig_shpschd_id  ,hd.shp_splt  ,hd.sect_id  ,hd.prdn_ord_nbr  ,dt.eto_workctr  ,dt.prdn_dtl_status_cd  order by hd.q2c_nbr, od.ln_dsply_seq_nbr, hd.sect_id ";
      selectCommand.CommandText = str1;
      selectCommand.Parameters.Clear();
      string str2 = Q2CNbr;
      selectCommand.Parameters.AddWithValue("q2c_nbr", (object) str2);
      string str3 = Q2CLine;
      selectCommand.Parameters.AddWithValue("ln_dsply_seq_nbr", (object) str3);
      string str4 = Q2CSL;
      selectCommand.Parameters.AddWithValue("sub_ln_itm_id", (object) str4);
      string str5 = Q2CSS;
      selectCommand.Parameters.AddWithValue("orig_shpschd_id", (object) str5);
      odbcDataAdapter.SelectCommand = selectCommand;
      dataSet.Tables.Clear();
      odbcDataAdapter.Fill(dataSet);
      List<string> stringList = new List<string>();
      try
      {
        foreach (DataColumn column in (InternalDataCollectionBase) dataSet.Tables[0].Columns)
        {
          stringList.Add(column.ColumnName);
          short num;
          checked { ++num; }
        }
      }
      finally
      {
        IEnumerator enumerator;
        if (enumerator is IDisposable)
          (enumerator as IDisposable).Dispose();
      }
      try
      {
        foreach (DataRow row in dataSet.Tables[0].Rows)
        {
          short num = 0;
          scMESUpdateFull scMesUpdateFull = new scMESUpdateFull();
          List<string>.Enumerator enumerator;
          try
          {
            enumerator = stringList.GetEnumerator();
            while (enumerator.MoveNext())
            {
              string current = enumerator.Current;
              Console.WriteLine(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject((object) (Conversions.ToString((int) num) + " - " + current + "\t" + "\t" + " "), row[(int) num]), (object) '\t'), (object) '\t'), (object) row[(int) num].GetType().FullName));
              if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "eto_ln", false) == 0)
                scMesUpdateFull.hd_eto_ln = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "q2c_nbr", false) == 0)
                scMesUpdateFull.hd_q2c_nbr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "ln_dsply_seq_nbr", false) == 0)
                scMesUpdateFull.od_ln_dsply_seq_nbr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "sub_ln_itm_id", false) == 0)
                scMesUpdateFull.hd_sub_ln_itm_id = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "orig_shpschd_id", false) == 0)
                scMesUpdateFull.hd_orig_shpschd_id = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "shp_splt", false) == 0)
                scMesUpdateFull.hd_shp_splt = Conversions.ToInteger(Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num])));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "sect_id", false) == 0)
                scMesUpdateFull.hd_sect_id = Conversions.ToInteger(Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num])));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "prdn_ord_nbr", false) == 0)
                scMesUpdateFull.hd_prdn_ord_nbr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "disp_dt", false) == 0)
                scMesUpdateFull.hd_disp_dt = Conversions.ToDate(Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num])));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "eto_workctr", false) == 0)
                scMesUpdateFull.dt_eto_workctr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "run_tm_tot", false) == 0)
                scMesUpdateFull.run_tm_tot = Conversions.ToInteger(row[(int) num]);
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "due_st", false) == 0)
                scMesUpdateFull.due_st = Conversions.ToDate(row[(int) num]);
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "due_fn", false) == 0)
                scMesUpdateFull.due_fn = Conversions.ToDate(row[(int) num]);
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "act_st", false) == 0)
                scMesUpdateFull.act_st = Conversions.ToDate(row[(int) num]);
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "act_fn", false) == 0)
                scMesUpdateFull.act_fn = Conversions.ToDate(row[(int) num]);
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "curr_prom_dt", false) == 0)
                scMesUpdateFull.od_curr_prom_dt = Conversions.ToDate(Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num])));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "trgt_dt", false) == 0)
                scMesUpdateFull.od_trgt_dt = Conversions.ToDate(Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num])));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "prdn_dtl_status_cd", false) == 0)
                scMesUpdateFull.dt_prdn_dtl_status_cd = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "update_dt", false) == 0)
                scMesUpdateFull.dt_update_dt = Conversions.ToDate(Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num])));
              checked { ++num; }
            }
          }
          finally
          {
            enumerator.Dispose();
          }
          scMesUpdateFullList.Add(scMesUpdateFull);
        }
      }
      finally
      {
        IEnumerator enumerator;
        if (enumerator is IDisposable)
          (enumerator as IDisposable).Dispose();
      }
      return scMesUpdateFullList;
    }

    public List<scMESUpdateFull> LoadMESOrders(string AssyLine, string Q2CNbr, string Q2CLine, string Q2CSL, string Q2CSS)
    {
      List<scMESUpdateFull> scMesUpdateFullList = new List<scMESUpdateFull>();
      DataSet dataSet = new DataSet();
      OdbcConnection odbcConnection = new OdbcConnection();
      odbcConnection.ConnectionString = "Driver={Sybase ASE ODBC Driver};NA=mcldb01.m087.us.schneider-electric.com,5000;Database=dbmes;Uid=misuser;Pwd=misuser;";
      OdbcCommand selectCommand = new OdbcCommand();
      selectCommand.Connection = odbcConnection;
      odbcConnection.Open();
      OdbcDataAdapter odbcDataAdapter = new OdbcDataAdapter(selectCommand);
      odbcDataAdapter.SelectCommand.CommandTimeout = 2000;
      string str1 = "select distinct  hd.eto_ln  ,hd.q2c_nbr  ,od.ln_dsply_seq_nbr  ,hd.sub_ln_itm_id  ,hd.orig_shpschd_id  ,hd.shp_splt  ,hd.sect_id  ,hd.prdn_ord_nbr  ,dt.eto_workctr  ,dt.prdn_dtl_status_cd  ,SUM(dt.run_tm_mins) as run_tm_tot  ,MIN(dt.due_to_strt_dt) as due_st  ,MAX(dt.due_to_fnsh_dt) as due_fn  ,MIN(dt.act_strt_dt) as act_st  ,MAX(dt.act_fnsh_dt) as act_fn from dbmes.dbo.mespohdr as hd  join dbmes.dbo.mespodtl as dt  on hd.prdn_ord_nbr = dt.prdn_ord_nbr  join dbmes.dbo.messordr as od  on od.q2c_nbr = hd.q2c_nbr and od.ln_nbr = hd.ln_nbr and od.bom_nbr = hd.bom_nbr  group by  hd.eto_ln  ,hd.q2c_nbr  ,od.ln_dsply_seq_nbr  ,hd.sub_ln_itm_id  ,hd.orig_shpschd_id  ,hd.shp_splt  ,hd.sect_id  ,hd.prdn_ord_nbr  ,dt.eto_workctr  ,dt.prdn_dtl_status_cd  having hd.eto_ln = ? AND hd.q2c_nbr = ? AND od.ln_dsply_seq_nbr = ? AND hd.sub_ln_itm_id = ? AND hd.orig_shpschd_id = ?  order by hd.q2c_nbr, od.ln_dsply_seq_nbr, hd.sect_id, due_st ";
      selectCommand.CommandText = str1;
      selectCommand.Parameters.Clear();
      string str2 = AssyLine;
      selectCommand.Parameters.AddWithValue("eto_ln", (object) str2);
      string str3 = Q2CNbr;
      selectCommand.Parameters.AddWithValue("q2c_nbr", (object) str3);
      string str4 = Q2CLine;
      selectCommand.Parameters.AddWithValue("ln_dsply_seq_nbr", (object) str4);
      string str5 = Q2CSL;
      selectCommand.Parameters.AddWithValue("sub_ln_itm_id", (object) str5);
      string str6 = Q2CSS;
      selectCommand.Parameters.AddWithValue("orig_shpschd_id", (object) str6);
      odbcDataAdapter.SelectCommand = selectCommand;
      dataSet.Tables.Clear();
      odbcDataAdapter.Fill(dataSet);
      List<string> stringList = new List<string>();
      try
      {
        foreach (DataColumn column in (InternalDataCollectionBase) dataSet.Tables[0].Columns)
        {
          stringList.Add(column.ColumnName);
          short num;
          checked { ++num; }
        }
      }
      finally
      {
        IEnumerator enumerator;
        if (enumerator is IDisposable)
          (enumerator as IDisposable).Dispose();
      }
      try
      {
        foreach (DataRow row in dataSet.Tables[0].Rows)
        {
          short num = 0;
          scMESUpdateFull scMesUpdateFull = new scMESUpdateFull();
          List<string>.Enumerator enumerator;
          try
          {
            enumerator = stringList.GetEnumerator();
            while (enumerator.MoveNext())
            {
              string current = enumerator.Current;
              if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "eto_ln", false) == 0)
                scMesUpdateFull.hd_eto_ln = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "q2c_nbr", false) == 0)
                scMesUpdateFull.hd_q2c_nbr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "ln_dsply_seq_nbr", false) == 0)
                scMesUpdateFull.od_ln_dsply_seq_nbr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "sub_ln_itm_id", false) == 0)
                scMesUpdateFull.hd_sub_ln_itm_id = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "orig_shpschd_id", false) == 0)
                scMesUpdateFull.hd_orig_shpschd_id = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "shp_splt", false) == 0)
                scMesUpdateFull.hd_shp_splt = Conversions.ToInteger(Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num])));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "sect_id", false) == 0)
                scMesUpdateFull.hd_sect_id = Conversions.ToInteger(Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num])));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "prdn_ord_nbr", false) == 0)
                scMesUpdateFull.hd_prdn_ord_nbr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "disp_dt", false) == 0)
                scMesUpdateFull.hd_disp_dt = Conversions.ToDate(Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num])));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "eto_workctr", false) == 0)
                scMesUpdateFull.dt_eto_workctr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "run_tm_tot", false) == 0)
                scMesUpdateFull.run_tm_tot = Conversions.ToInteger(row[(int) num]);
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "due_st", false) == 0)
                scMesUpdateFull.due_st = Conversions.ToDate(row[(int) num]);
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "due_fn", false) == 0)
                scMesUpdateFull.due_fn = Conversions.ToDate(row[(int) num]);
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "act_st", false) == 0)
                scMesUpdateFull.act_st = Conversions.ToDate(row[(int) num]);
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "act_fn", false) == 0)
                scMesUpdateFull.act_fn = Conversions.ToDate(row[(int) num]);
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "curr_prom_dt", false) == 0)
                scMesUpdateFull.od_curr_prom_dt = Conversions.ToDate(Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num])));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "trgt_dt", false) == 0)
                scMesUpdateFull.od_trgt_dt = Conversions.ToDate(Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num])));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "prdn_dtl_status_cd", false) == 0)
                scMesUpdateFull.dt_prdn_dtl_status_cd = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "update_dt", false) == 0)
                scMesUpdateFull.dt_update_dt = Conversions.ToDate(Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num])));
              checked { ++num; }
            }
          }
          finally
          {
            enumerator.Dispose();
          }
          scMesUpdateFullList.Add(scMesUpdateFull);
        }
      }
      finally
      {
        IEnumerator enumerator;
        if (enumerator is IDisposable)
          (enumerator as IDisposable).Dispose();
      }
      return scMesUpdateFullList;
    }

    public List<scMESUpdateFull> LoadMESOrders(string AssyLine, DateTime TargetDateStart, DateTime TargetDateEnd)
    {
      string shortDateString1 = TargetDateStart.ToShortDateString();
      string shortDateString2 = TargetDateEnd.AddDays(1.0).ToShortDateString();
      List<scMESUpdateFull> scMesUpdateFullList = new List<scMESUpdateFull>();
      DataSet dataSet = new DataSet();
      OdbcConnection odbcConnection = new OdbcConnection();
      odbcConnection.ConnectionString = "Driver={Sybase ASE ODBC Driver};NA=mcldb01.m087.us.schneider-electric.com,5000;Database=dbmes;Uid=misuser;Pwd=misuser;";
      OdbcCommand selectCommand = new OdbcCommand();
      selectCommand.Connection = odbcConnection;
      odbcConnection.Open();
      OdbcDataAdapter odbcDataAdapter = new OdbcDataAdapter(selectCommand);
      odbcDataAdapter.SelectCommand.CommandTimeout = 2000;
      string str1 = "select distinct  hd.eto_ln  ,hd.q2c_nbr  ,od.ln_dsply_seq_nbr  ,hd.sub_ln_itm_id  ,hd.orig_shpschd_id  ,hd.shp_splt  ,hd.sect_id  ,hd.prdn_ord_nbr  ,dt.eto_workctr  ,SUM(dt.run_tm_mins) as run_tm_tot  ,MIN(dt.due_to_strt_dt) as due_st  ,MAX(dt.due_to_fnsh_dt) as due_fn  ,MIN(dt.act_strt_dt) as act_st  ,MAX(dt.act_fnsh_dt) as act_fn  ,dt.prdn_dtl_status_cd  from dbmes.dbo.mespohdr as hd  join dbmes.dbo.mespodtl as dt  on hd.prdn_ord_nbr = dt.prdn_ord_nbr  join dbmes.dbo.messordr as od  on od.q2c_nbr = hd.q2c_nbr and od.ln_nbr = hd.ln_nbr and od.bom_nbr = hd.bom_nbr  group by  hd.eto_ln  ,hd.q2c_nbr  ,od.ln_dsply_seq_nbr  ,hd.sub_ln_itm_id  ,hd.orig_shpschd_id  ,hd.shp_splt  ,hd.sect_id  ,hd.prdn_ord_nbr  ,dt.eto_workctr  ,dt.prdn_dtl_status_cd  having hd.eto_ln = ? AND od.trgt_dt > ? AND od.trgt_dt < ?  order by hd.q2c_nbr, od.ln_dsply_seq_nbr, hd.sect_id, due_st ";
      selectCommand.CommandText = str1;
      selectCommand.Parameters.Clear();
      string str2 = AssyLine;
      selectCommand.Parameters.AddWithValue("eto_ln", (object) str2);
      string str3 = shortDateString1;
      selectCommand.Parameters.AddWithValue("trgt_dt_st", (object) str3);
      string str4 = shortDateString2;
      selectCommand.Parameters.AddWithValue("trgt_dt_en", (object) str4);
      odbcDataAdapter.SelectCommand = selectCommand;
      dataSet.Tables.Clear();
      odbcDataAdapter.Fill(dataSet);
      List<string> stringList = new List<string>();
      try
      {
        foreach (DataColumn column in (InternalDataCollectionBase) dataSet.Tables[0].Columns)
        {
          stringList.Add(column.ColumnName);
          short num;
          checked { ++num; }
        }
      }
      finally
      {
        IEnumerator enumerator;
        if (enumerator is IDisposable)
          (enumerator as IDisposable).Dispose();
      }
      try
      {
        foreach (DataRow row in dataSet.Tables[0].Rows)
        {
          short num = 0;
          scMESUpdateFull scMesUpdateFull = new scMESUpdateFull();
          List<string>.Enumerator enumerator;
          try
          {
            enumerator = stringList.GetEnumerator();
            while (enumerator.MoveNext())
            {
              string current = enumerator.Current;
              if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "eto_ln", false) == 0)
                scMesUpdateFull.hd_eto_ln = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "q2c_nbr", false) == 0)
                scMesUpdateFull.hd_q2c_nbr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "ln_dsply_seq_nbr", false) == 0)
                scMesUpdateFull.od_ln_dsply_seq_nbr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "sub_ln_itm_id", false) == 0)
                scMesUpdateFull.hd_sub_ln_itm_id = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "orig_shpschd_id", false) == 0)
                scMesUpdateFull.hd_orig_shpschd_id = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "shp_splt", false) == 0)
                scMesUpdateFull.hd_shp_splt = Conversions.ToInteger(Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num])));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "sect_id", false) == 0)
                scMesUpdateFull.hd_sect_id = Conversions.ToInteger(Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num])));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "prdn_ord_nbr", false) == 0)
                scMesUpdateFull.hd_prdn_ord_nbr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "disp_dt", false) == 0)
                scMesUpdateFull.hd_disp_dt = Conversions.ToDate(Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num])));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "eto_workctr", false) == 0)
                scMesUpdateFull.dt_eto_workctr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "run_tm_tot", false) == 0)
                scMesUpdateFull.run_tm_tot = Conversions.ToInteger(row[(int) num]);
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "due_st", false) == 0)
                scMesUpdateFull.due_st = Conversions.ToDate(row[(int) num]);
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "due_fn", false) == 0)
                scMesUpdateFull.due_fn = Conversions.ToDate(row[(int) num]);
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "act_st", false) == 0)
                scMesUpdateFull.act_st = Conversions.ToDate(row[(int) num]);
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "act_fn", false) == 0)
                scMesUpdateFull.act_fn = Conversions.ToDate(row[(int) num]);
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "curr_prom_dt", false) == 0)
                scMesUpdateFull.od_curr_prom_dt = Conversions.ToDate(Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num])));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "trgt_dt", false) == 0)
                scMesUpdateFull.od_trgt_dt = Conversions.ToDate(Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num])));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "prdn_dtl_status_cd", false) == 0)
                scMesUpdateFull.dt_prdn_dtl_status_cd = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "update_dt", false) == 0)
                scMesUpdateFull.dt_update_dt = Conversions.ToDate(Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num])));
              checked { ++num; }
            }
          }
          finally
          {
            enumerator.Dispose();
          }
          scMesUpdateFullList.Add(scMesUpdateFull);
        }
      }
      finally
      {
        IEnumerator enumerator;
        if (enumerator is IDisposable)
          (enumerator as IDisposable).Dispose();
      }
      return scMesUpdateFullList;
    }

    public List<scMESUpdateFull> LoadMESOrdersDev(string Q2CNbr, string Q2CLine, string Q2CSL, string Q2CSS)
    {
      List<scMESUpdateFull> scMesUpdateFullList = new List<scMESUpdateFull>();
      DataSet dataSet = new DataSet();
      OdbcConnection odbcConnection = new OdbcConnection();
      odbcConnection.ConnectionString = "Driver={Sybase ASE ODBC Driver};NA=mcldb01.m087.us.schneider-electric.com,5000;Database=dbmes;Uid=misuser;Pwd=misuser;";
      OdbcCommand selectCommand = new OdbcCommand();
      selectCommand.Connection = odbcConnection;
      odbcConnection.Open();
      OdbcDataAdapter odbcDataAdapter = new OdbcDataAdapter(selectCommand);
      odbcDataAdapter.SelectCommand.CommandTimeout = 2000;
      string str1 = "select * from dbmes.dbo.mespohdr as hd  join dbmes.dbo.mespodtl as dt  on hd.prdn_ord_nbr = dt.prdn_ord_nbr  join dbmes.dbo.messordr as od  on od.q2c_nbr = hd.q2c_nbr and od.ln_nbr = hd.ln_nbr  group by  hd.eto_ln  ,hd.q2c_nbr  ,od.ln_dsply_seq_nbr  ,hd.sub_ln_itm_id  ,hd.orig_shpschd_id  ,hd.shp_splt  ,hd.sect_id  ,hd.prdn_ord_nbr  ,hd.disp_dt  ,dt.eto_workctr  ,od.curr_prom_dt  ,od.trgt_dt  ,dt.prdn_dtl_status_cd  ,dt.update_dt  having hd.q2c_nbr = ? AND od.ln_dsply_seq_nbr = ? AND hd.sub_ln_itm_id = ? AND hd.orig_shpschd_id = ?  order by hd.q2c_nbr, od.ln_dsply_seq_nbr, hd.sect_id ";
      selectCommand.CommandText = str1;
      selectCommand.Parameters.Clear();
      string str2 = Q2CNbr;
      selectCommand.Parameters.AddWithValue("q2c_nbr", (object) str2);
      string str3 = Q2CLine;
      selectCommand.Parameters.AddWithValue("ln_dsply_seq_nbr", (object) str3);
      string str4 = Q2CSL;
      selectCommand.Parameters.AddWithValue("sub_ln_itm_id", (object) str4);
      string str5 = Q2CSS;
      selectCommand.Parameters.AddWithValue("orig_shpschd_id", (object) str5);
      odbcDataAdapter.SelectCommand = selectCommand;
      dataSet.Tables.Clear();
      odbcDataAdapter.Fill(dataSet);
      List<string> stringList = new List<string>();
      try
      {
        foreach (DataColumn column in (InternalDataCollectionBase) dataSet.Tables[0].Columns)
        {
          stringList.Add(column.ColumnName);
          short num;
          checked { ++num; }
        }
      }
      finally
      {
        IEnumerator enumerator;
        if (enumerator is IDisposable)
          (enumerator as IDisposable).Dispose();
      }
      try
      {
        foreach (DataRow row in dataSet.Tables[0].Rows)
        {
          short num = 0;
          scMESUpdateFull scMesUpdateFull = new scMESUpdateFull();
          List<string>.Enumerator enumerator;
          try
          {
            enumerator = stringList.GetEnumerator();
            while (enumerator.MoveNext())
            {
              string current = enumerator.Current;
              Console.WriteLine(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject((object) (Conversions.ToString((int) num) + " - " + current + "\t" + "\t" + " "), row[(int) num]), (object) '\t'), (object) '\t'), (object) row[(int) num].GetType().FullName));
              if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "eto_ln", false) == 0)
                scMesUpdateFull.hd_eto_ln = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "q2c_nbr", false) == 0)
                scMesUpdateFull.hd_q2c_nbr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "ln_dsply_seq_nbr", false) == 0)
                scMesUpdateFull.od_ln_dsply_seq_nbr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "sub_ln_itm_id", false) == 0)
                scMesUpdateFull.hd_sub_ln_itm_id = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "orig_shpschd_id", false) == 0)
                scMesUpdateFull.hd_orig_shpschd_id = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "shp_splt", false) == 0)
                scMesUpdateFull.hd_shp_splt = Conversions.ToInteger(Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num])));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "sect_id", false) == 0)
                scMesUpdateFull.hd_sect_id = Conversions.ToInteger(Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num])));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "prdn_ord_nbr", false) == 0)
                scMesUpdateFull.hd_prdn_ord_nbr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "disp_dt", false) == 0)
                scMesUpdateFull.hd_disp_dt = Conversions.ToDate(Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num])));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "eto_workctr", false) == 0)
                scMesUpdateFull.dt_eto_workctr = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "run_tm_tot", false) == 0)
                scMesUpdateFull.run_tm_tot = Conversions.ToInteger(row[(int) num]);
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "due_st", false) == 0)
                scMesUpdateFull.due_st = Conversions.ToDate(row[(int) num]);
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "due_fn", false) == 0)
                scMesUpdateFull.due_fn = Conversions.ToDate(row[(int) num]);
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "act_st", false) == 0)
                scMesUpdateFull.act_st = Conversions.ToDate(row[(int) num]);
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "act_fn", false) == 0)
                scMesUpdateFull.act_fn = Conversions.ToDate(row[(int) num]);
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "curr_prom_dt", false) == 0)
                scMesUpdateFull.od_curr_prom_dt = Conversions.ToDate(Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num])));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "trgt_dt", false) == 0)
                scMesUpdateFull.od_trgt_dt = Conversions.ToDate(Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num])));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "prdn_dtl_status_cd", false) == 0)
                scMesUpdateFull.dt_prdn_dtl_status_cd = Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num]));
              else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(current, "update_dt", false) == 0)
                scMesUpdateFull.dt_update_dt = Conversions.ToDate(Microsoft.VisualBasic.Strings.Trim(Conversions.ToString(row[(int) num])));
              checked { ++num; }
            }
          }
          finally
          {
            enumerator.Dispose();
          }
          scMesUpdateFullList.Add(scMesUpdateFull);
        }
      }
      finally
      {
        IEnumerator enumerator;
        if (enumerator is IDisposable)
          (enumerator as IDisposable).Dispose();
      }
      return scMesUpdateFullList;
    }

    public void MESLoad(scPlants SEPlant, scLevels AssemblyLine, List<scMESUpdateFull> MESOrderData, bool blnIncludeShipped, bool exCloseAfter = false)
    {
      this.lcLogWriter.logData("Plant " + SEPlant.PlantName + " - " + AssemblyLine.LevelAbbrv);
      scMESOrderInfo scMesOrderInfo1 = new scMESOrderInfo();
      ArrayList MESExtractData = new ArrayList();
      bool flag1 = false;
      bool flag2 = false;
      bool flag3 = false;
      int num = 0;
      List<scMESUpdateFull>.Enumerator enumerator1;
      try
      {
        enumerator1 = MESOrderData.GetEnumerator();
        while (enumerator1.MoveNext())
        {
          scMESUpdateFull current = enumerator1.Current;
          Thread.CurrentThread.Join(0);
          checked { ++num; }
          if (MESOrderData.Count == num)
            flag3 = true;
          scMESOrderInfo scMesOrderInfo2 = new scMESOrderInfo();
          scMesOrderInfo2.AssemblyLineId = current.AssemblyLineId;
          scMesOrderInfo2.OrderFO = current.hd_q2c_nbr;
          scMesOrderInfo2.OrderLineNum = current.od_ln_dsply_seq_nbr;
          scMesOrderInfo2.OrderLineSL = current.hd_sub_ln_itm_id;
          scMesOrderInfo2.OrderLineSS = current.hd_orig_shpschd_id;
          scMesOrderInfo2.OrdShipSplt = current.hd_shp_splt;
          scMesOrderInfo2.OrdSectsNum = current.hd_sect_id;
          scMesOrderInfo2.OrdSectsProdNum = current.hd_prdn_ord_nbr;
          scMesOrderInfo2.OrderLineTargetDt = current.od_trgt_dt;
          scMesOrderInfo2.OrderLineShipDt = current.od_curr_prom_dt;
          scMesOrderInfo2.RoutingWorkCenter = current.dt_eto_workctr;
          scMesOrderInfo2.RoutingNextWorkCtr = current.RoutingNextWorkCtr;
          scMesOrderInfo2.RoutingSchStartDt = current.due_st;
          scMesOrderInfo2.RoutingSchFinishDt = current.due_fn;
          scMesOrderInfo2.RoutingActStartDt = current.act_st;
          scMesOrderInfo2.RoutingActFinishDt = current.act_fn;
          scMesOrderInfo2.RoutingRunTimeMin = current.run_tm_tot;
          scMesOrderInfo2.RoutingStatusCD = current.dt_prdn_dtl_status_cd;
          if (!flag1)
          {
            scMesOrderInfo1 = scMesOrderInfo2;
            flag1 = true;
          }
          if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(scMesOrderInfo1.OrderFO, scMesOrderInfo2.OrderFO, false) == 0 & Microsoft.VisualBasic.CompilerServices.Operators.CompareString(scMesOrderInfo1.OrderLineNum, scMesOrderInfo2.OrderLineNum, false) == 0 & Microsoft.VisualBasic.CompilerServices.Operators.CompareString(scMesOrderInfo1.OrderLineSL, scMesOrderInfo2.OrderLineSL, false) == 0 & Microsoft.VisualBasic.CompilerServices.Operators.CompareString(scMesOrderInfo1.OrderLineSS, scMesOrderInfo2.OrderLineSS, false) == 0 & scMesOrderInfo1.OrdSectsNum == scMesOrderInfo2.OrdSectsNum && Microsoft.VisualBasic.CompilerServices.Operators.CompareString(scMesOrderInfo1.OrdSectsProdNum, scMesOrderInfo2.OrdSectsProdNum, false) != 0)
          {
            this.lcLogWriter.logData("Quantity " + scMesOrderInfo1.OrdSectsProdNum + " and " + scMesOrderInfo2.OrdSectsProdNum);
            scMesOrderInfo2.OrderLineQty = checked (scMesOrderInfo1.OrderLineQty + 1);
            scMesOrderInfo1 = scMesOrderInfo2;
          }
          if (!(Microsoft.VisualBasic.CompilerServices.Operators.CompareString(scMesOrderInfo1.OrderFO, scMesOrderInfo2.OrderFO, false) == 0 & Microsoft.VisualBasic.CompilerServices.Operators.CompareString(scMesOrderInfo1.OrderLineNum, scMesOrderInfo2.OrderLineNum, false) == 0 & Microsoft.VisualBasic.CompilerServices.Operators.CompareString(scMesOrderInfo1.OrderLineSL, scMesOrderInfo2.OrderLineSL, false) == 0 & Microsoft.VisualBasic.CompilerServices.Operators.CompareString(scMesOrderInfo1.OrderLineSS, scMesOrderInfo2.OrderLineSS, false) == 0) | flag3)
          {
            if (flag3)
              MESExtractData.Add((object) scMesOrderInfo2);
            if (scMesOrderInfo1.OrderLineQty > 1)
            {
              try
              {
                foreach (scMESOrderInfo scMesOrderInfo3 in MESExtractData)
                  scMesOrderInfo3.OrderLineQty = scMesOrderInfo1.OrderLineQty;
              }
              finally
              {
                IEnumerator enumerator2;
                if (enumerator2 is IDisposable)
                  (enumerator2 as IDisposable).Dispose();
              }
            }
            this.updateMESData(MESExtractData);
            scMesOrderInfo1 = scMesOrderInfo2;
            MESExtractData.Clear();
            MESExtractData.Add((object) scMesOrderInfo2);
          }
          else
            MESExtractData.Add((object) scMesOrderInfo2);
          if (!flag2)
            ;
          if (flag3)
            break;
        }
      }
      finally
      {
        enumerator1.Dispose();
      }
    }

    public void MESLoad(scLevels SEPlant, scLevels AssemblyLine, List<scMESUpdateFull> MESOrderData, bool blnIncludeShipped, bool exCloseAfter = false)
    {
      this.lcLogWriter.logData("Plant " + SEPlant.LevelName + " - " + AssemblyLine.LevelAbbrv);
      scMESOrderInfo scMesOrderInfo1 = new scMESOrderInfo();
      ArrayList MESExtractData = new ArrayList();
      bool flag1 = false;
      bool flag2 = false;
      bool flag3 = false;
      int num = 0;
      List<scMESUpdateFull>.Enumerator enumerator1;
      try
      {
        enumerator1 = MESOrderData.GetEnumerator();
        while (enumerator1.MoveNext())
        {
          scMESUpdateFull current = enumerator1.Current;
          Thread.CurrentThread.Join(0);
          checked { ++num; }
          if (MESOrderData.Count == num)
            flag3 = true;
          scMESOrderInfo scMesOrderInfo2 = new scMESOrderInfo();
          scMesOrderInfo2.AssemblyLineId = current.AssemblyLineId;
          scMesOrderInfo2.OrderFO = current.hd_q2c_nbr;
          scMesOrderInfo2.OrderLineNum = current.od_ln_dsply_seq_nbr;
          scMesOrderInfo2.OrderLineSL = current.hd_sub_ln_itm_id;
          scMesOrderInfo2.OrderLineSS = current.hd_orig_shpschd_id;
          scMesOrderInfo2.OrdShipSplt = current.hd_shp_splt;
          scMesOrderInfo2.OrdSectsNum = current.hd_sect_id;
          scMesOrderInfo2.OrdSectsProdNum = current.hd_prdn_ord_nbr;
          scMesOrderInfo2.OrderLineTargetDt = current.od_trgt_dt;
          scMesOrderInfo2.OrderLineShipDt = current.od_curr_prom_dt;
          scMesOrderInfo2.RoutingWorkCenter = current.dt_eto_workctr;
          scMesOrderInfo2.RoutingNextWorkCtr = current.RoutingNextWorkCtr;
          scMesOrderInfo2.RoutingSchStartDt = current.due_st;
          scMesOrderInfo2.RoutingSchFinishDt = current.due_fn;
          scMesOrderInfo2.RoutingActStartDt = current.act_st;
          scMesOrderInfo2.RoutingActFinishDt = current.act_fn;
          scMesOrderInfo2.RoutingRunTimeMin = current.run_tm_tot;
          scMesOrderInfo2.RoutingStatusCD = current.dt_prdn_dtl_status_cd;
          if (!flag1)
          {
            scMesOrderInfo1 = scMesOrderInfo2;
            flag1 = true;
          }
          if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(scMesOrderInfo1.OrderFO, scMesOrderInfo2.OrderFO, false) == 0 & Microsoft.VisualBasic.CompilerServices.Operators.CompareString(scMesOrderInfo1.OrderLineNum, scMesOrderInfo2.OrderLineNum, false) == 0 & Microsoft.VisualBasic.CompilerServices.Operators.CompareString(scMesOrderInfo1.OrderLineSL, scMesOrderInfo2.OrderLineSL, false) == 0 & Microsoft.VisualBasic.CompilerServices.Operators.CompareString(scMesOrderInfo1.OrderLineSS, scMesOrderInfo2.OrderLineSS, false) == 0 & scMesOrderInfo1.OrdSectsNum == scMesOrderInfo2.OrdSectsNum && Microsoft.VisualBasic.CompilerServices.Operators.CompareString(scMesOrderInfo1.OrdSectsProdNum, scMesOrderInfo2.OrdSectsProdNum, false) != 0)
          {
            this.lcLogWriter.logData("Quantity " + scMesOrderInfo1.OrdSectsProdNum + " and " + scMesOrderInfo2.OrdSectsProdNum);
            scMesOrderInfo2.OrderLineQty = checked (scMesOrderInfo1.OrderLineQty + 1);
            scMesOrderInfo1 = scMesOrderInfo2;
          }
          if (!(Microsoft.VisualBasic.CompilerServices.Operators.CompareString(scMesOrderInfo1.OrderFO, scMesOrderInfo2.OrderFO, false) == 0 & Microsoft.VisualBasic.CompilerServices.Operators.CompareString(scMesOrderInfo1.OrderLineNum, scMesOrderInfo2.OrderLineNum, false) == 0 & Microsoft.VisualBasic.CompilerServices.Operators.CompareString(scMesOrderInfo1.OrderLineSL, scMesOrderInfo2.OrderLineSL, false) == 0 & Microsoft.VisualBasic.CompilerServices.Operators.CompareString(scMesOrderInfo1.OrderLineSS, scMesOrderInfo2.OrderLineSS, false) == 0) | flag3)
          {
            if (flag3)
              MESExtractData.Add((object) scMesOrderInfo2);
            if (scMesOrderInfo1.OrderLineQty > 1)
            {
              try
              {
                foreach (scMESOrderInfo scMesOrderInfo3 in MESExtractData)
                  scMesOrderInfo3.OrderLineQty = scMesOrderInfo1.OrderLineQty;
              }
              finally
              {
                IEnumerator enumerator2;
                if (enumerator2 is IDisposable)
                  (enumerator2 as IDisposable).Dispose();
              }
            }
            this.updateMESData(MESExtractData);
            scMesOrderInfo1 = scMesOrderInfo2;
            MESExtractData.Clear();
            MESExtractData.Add((object) scMesOrderInfo2);
          }
          else
            MESExtractData.Add((object) scMesOrderInfo2);
          if (!flag2)
            ;
          if (flag3)
            break;
        }
      }
      finally
      {
        enumerator1.Dispose();
      }
    }

    public void updateMESData(ArrayList MESExtractData)
    {
      ArrayList arrayList = new ArrayList();
      // ISSUE: method pointer
      // ISSUE: method pointer
      // ISSUE: method pointer
      // ISSUE: method pointer
      // ISSUE: method pointer
      // ISSUE: method pointer
      // ISSUE: method pointer
      // ISSUE: method pointer
      IEnumerable<scMESOrderInfo> source1 = (IEnumerable<scMESOrderInfo>) Enumerable.Select<scMESOrderInfo, scMESOrderInfo>((IEnumerable<M0>) Enumerable.ThenBy<scMESOrderInfo, string>(Enumerable.ThenBy<scMESOrderInfo, int>(Enumerable.ThenBy<scMESOrderInfo, string>(Enumerable.ThenBy<scMESOrderInfo, string>(Enumerable.ThenBy<scMESOrderInfo, string>(Enumerable.OrderBy<scMESOrderInfo, string>((IEnumerable<M0>) Enumerable.Select<object, scMESOrderInfo>((IEnumerable<M0>) MESExtractData.Cast<object>(), (Func<M0, M1>) new Func<object, scMESOrderInfo>((object) null, __methodptr(_Lambda\u0024__67))), (Func<M0, M1>) new Func<scMESOrderInfo, string>((object) null, __methodptr(_Lambda\u0024__68))), (Func<M0, M1>) new Func<scMESOrderInfo, string>((object) null, __methodptr(_Lambda\u0024__69))), (Func<M0, M1>) new Func<scMESOrderInfo, string>((object) null, __methodptr(_Lambda\u0024__70))), (Func<M0, M1>) new Func<scMESOrderInfo, string>((object) null, __methodptr(_Lambda\u0024__71))), (Func<M0, M1>) new Func<scMESOrderInfo, int>((object) null, __methodptr(_Lambda\u0024__72))), (Func<M0, M1>) new Func<scMESOrderInfo, string>((object) null, __methodptr(_Lambda\u0024__73))), (Func<M0, M1>) new Func<scMESOrderInfo, scMESOrderInfo>((object) null, __methodptr(_Lambda\u0024__74)));
      if (source1.Count<scMESOrderInfo>() <= 0)
        return;
      arrayList.AddRange((ICollection) source1.ToArray<scMESOrderInfo>());
      int num1 = 0;
      string Left = "";
      ArrayList MESSectionList1 = new ArrayList();
      try
      {
        foreach (scMESOrderInfo scMesOrderInfo in arrayList)
        {
          if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(Left, scMesOrderInfo.OrdSectsProdNum, false) != 0)
          {
            Left = scMesOrderInfo.OrdSectsProdNum;
            MESSectionList1.Add((object) scMesOrderInfo.OrdSection);
            checked { ++num1; }
          }
        }
      }
      finally
      {
        IEnumerator enumerator;
        if (enumerator is IDisposable)
          (enumerator as IDisposable).Dispose();
      }
      scMESOrderInfo scMesOrderInfo1 = new scMESOrderInfo();
      scMESOrderInfo scMesOrderInfo2 = (scMESOrderInfo) arrayList[0];
      scMESTableStatus[] scMesTableStatusArray1 = this.StatusMES_o_l_rLOJ(scMesOrderInfo2.OrderFO, scMesOrderInfo2.OrderLineNum, scMesOrderInfo2.OrderLineSL, scMesOrderInfo2.OrderLineSS);
      bool flag;
      if (scMesTableStatusArray1 == null)
      {
        this.AddMESSections(arrayList, MESSectionList1);
        flag = false;
      }
      else if (scMesTableStatusArray1.Length > num1)
      {
        int num2 = checked (num1 + 1);
        int length = scMesTableStatusArray1.Length;
        int num3 = num2;
        while (num3 <= length)
        {
          this.dBDeleteDataBySectionId(((IEnumerable<scMESTableStatus>) scMesTableStatusArray1).ElementAt<scMESTableStatus>(checked (num3 - 1)).OrdSectsId, true, false, false);
          checked { ++num3; }
        }
        flag = true;
      }
      else if (scMesTableStatusArray1.Length < num1)
      {
        ArrayList MESSectionList2 = new ArrayList();
        int length = scMesTableStatusArray1.Length;
        int num2 = checked (num1 - 1);
        int index = length;
        while (index <= num2)
        {
          MESSectionList2.Add(RuntimeHelpers.GetObjectValue(MESSectionList1[index]));
          checked { ++index; }
        }
        this.AddMESSections(arrayList, MESSectionList2);
        flag = true;
      }
      else
        flag = true;
      if (flag)
      {
        scMESTableStatus[] scMesTableStatusArray2 = this.StatusMES_o_l_rLOJ(scMesOrderInfo2.OrderFO, scMesOrderInfo2.OrderLineNum, scMesOrderInfo2.OrderLineSL, scMesOrderInfo2.OrderLineSS);
        if (scMesTableStatusArray2.Length == num1)
        {
          // ISSUE: object of a compiler-generated type is created
          // ISSUE: variable of a compiler-generated type
          clsEngineMES._Closure\u0024__142 closure142 = new clsEngineMES._Closure\u0024__142();
          // ISSUE: reference to a compiler-generated field
          closure142.\u0024VB\u0024Local_ldProcSection = new scOrdSectionsInfo();
          int index = 0;
          try
          {
            foreach (scOrdSectionsInfo scOrdSectionsInfo in MESSectionList1)
            {
              // ISSUE: reference to a compiler-generated field
              closure142.\u0024VB\u0024Local_ldProcSection = scOrdSectionsInfo;
              ArrayList MESExtractData1 = new ArrayList();
              // ISSUE: method pointer
              IEnumerable<M1> m1s = Enumerable.Select<object, scMESOrderInfo>((IEnumerable<M0>) arrayList.Cast<object>(), (Func<M0, M1>) new Func<object, scMESOrderInfo>((object) null, __methodptr(_Lambda\u0024__75)));
              // ISSUE: virtual method pointer
              IntPtr num2 = __vmethodptr(closure142, _Lambda\u0024__76);
              Func<scMESOrderInfo, bool> func = new Func<scMESOrderInfo, bool>((object) closure142, num2);
              // ISSUE: method pointer
              IEnumerable<scMESOrderInfo> source2 = (IEnumerable<scMESOrderInfo>) Enumerable.Select<scMESOrderInfo, scMESOrderInfo>(Enumerable.Where<scMESOrderInfo>((IEnumerable<M0>) m1s, (Func<M0, bool>) func), (Func<M0, M1>) new Func<scMESOrderInfo, scMESOrderInfo>((object) null, __methodptr(_Lambda\u0024__77)));
              if (source2.Count<scMESOrderInfo>() > 0)
              {
                MESExtractData1.AddRange((ICollection) source2.ToArray<scMESOrderInfo>());
                try
                {
                  foreach (scMESOrderInfo scMesOrderInfo3 in MESExtractData1)
                    scMesOrderInfo3.OrdSectsId = scMesTableStatusArray2[index].OrdSectsId;
                }
                finally
                {
                  IEnumerator enumerator;
                  if (enumerator is IDisposable)
                    (enumerator as IDisposable).Dispose();
                }
                this.UpdateMES_o_l_s_r(MESExtractData1);
                checked { ++index; }
              }
              else
                break;
            }
          }
          finally
          {
            IEnumerator enumerator;
            if (enumerator is IDisposable)
              (enumerator as IDisposable).Dispose();
          }
        }
        else
          this.lcLogWriter.logData("Error importing data, aborting MES import for Order; " + scMesOrderInfo2.OrderFO + "-" + scMesOrderInfo2.OrderLineNum + "-" + scMesOrderInfo2.OrderLineSS + "-" + scMesOrderInfo2.OrderLineSL);
      }
    }

    public bool UpdateMES_o_l_s_r(ArrayList MESExtractData)
    {
      // ISSUE: object of a compiler-generated type is created
      // ISSUE: variable of a compiler-generated type
      clsEngineMES._Closure\u0024__143 closure143 = new clsEngineMES._Closure\u0024__143();
      bool flag1 = false;
      bool flag2 = false;
      bool flag3 = false;
      bool flag4 = false;
      int num1 = 0;
      int num2 = 0;
      // ISSUE: reference to a compiler-generated field
      closure143.\u0024VB\u0024Local_mesOrderLine = (scMESOrderInfo) MESExtractData[0];
      using (SE0085CTEntities1 se0085CtEntities1 = new SE0085CTEntities1())
      {
        // ISSUE: object of a compiler-generated type is created
        // ISSUE: variable of a compiler-generated type
        clsEngineMES._Closure\u0024__143._Closure\u0024__144 closure144 = new clsEngineMES._Closure\u0024__143._Closure\u0024__144();
        se0085CtEntities1.Database.Connection.ConnectionString = this._CTConnection;
        // ISSUE: method reference
        // ISSUE: reference to a compiler-generated field
        // ISSUE: method reference
        // ISSUE: reference to a compiler-generated field
        // ISSUE: method reference
        // ISSUE: reference to a compiler-generated field
        // ISSUE: method reference
        // ISSUE: reference to a compiler-generated field
        IQueryable<OrderLine> queryable = (IQueryable<OrderLine>) Queryable.Select(Queryable.Where((IQueryable<M0>) Queryable.Join((IQueryable<M0>) se0085CtEntities1.SEOrders, (IEnumerable<M1>) se0085CtEntities1.OrderLines, (Expression<Func<M0, M2>>) (o => o.OrderId), (Expression<Func<M1, M2>>) (l => l.SEOrder.OrderId), (Expression<Func<M0, M1, M3>>) ((o, l) => new{ o = o, l = l })), (Expression<Func<M0, bool>>) (data => Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), data.o.OrderFO, closure143.\u0024VB\u0024Local_mesOrderLine.OrderFO, false) == 0 & Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), data.l.OrderLineNum, closure143.\u0024VB\u0024Local_mesOrderLine.OrderLineNum, false) == 0 & Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), data.l.OrderLineSL, closure143.\u0024VB\u0024Local_mesOrderLine.OrderLineSL, false) == 0 & Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), data.l.OrderLineSS, closure143.\u0024VB\u0024Local_mesOrderLine.OrderLineSS, false) == 0)), (Expression<Func<M0, M1>>) (data => data.l));
        IEnumerator<OrderLine> enumerator1;
        bool? nullable1;
        bool? nullable2;
        bool? nullable3;
        try
        {
          enumerator1 = queryable.GetEnumerator();
          while (enumerator1.MoveNext())
          {
            OrderLine current = enumerator1.Current;
            // ISSUE: reference to a compiler-generated field
            int orderLineQty1 = closure143.\u0024VB\u0024Local_mesOrderLine.OrderLineQty;
            int? orderLineQty2 = current.OrderLineQty;
            bool? nullable4;
            if (!orderLineQty2.HasValue)
            {
              nullable4 = new bool?();
            }
            else
            {
              nullable1 = new bool?(orderLineQty2.GetValueOrDefault() == orderLineQty1);
              nullable4 = nullable1;
            }
            nullable2 = nullable4;
            nullable3 = nullable2.HasValue ? new bool?(!nullable2.GetValueOrDefault()) : new bool?();
            if (nullable3.GetValueOrDefault())
            {
              flag2 = true;
              // ISSUE: reference to a compiler-generated field
              current.OrderLineQty = (int?) closure143.\u0024VB\u0024Local_mesOrderLine.OrderLineQty;
            }
          }
        }
        finally
        {
          if (enumerator1 != null)
            enumerator1.Dispose();
        }
        if (flag2 && se0085CtEntities1.SaveChanges() > 0)
          ;
        ParameterExpression parameterExpression1;
        // ISSUE: reference to a compiler-generated field
        IQueryable<OrdSection> source1 = (IQueryable<OrdSection>) Queryable.Select((IQueryable<M0>) Queryable.OrderBy(Queryable.Where((IQueryable<M0>) Queryable.Join((IQueryable<M0>) Queryable.Join((IQueryable<M0>) se0085CtEntities1.SEOrders, (IEnumerable<M1>) se0085CtEntities1.OrderLines, (Expression<Func<M0, M2>>) (o => o.OrderId), (Expression<Func<M1, M2>>) (l => l.SEOrder.OrderId), (Expression<Func<M0, M1, M3>>) ((o, l) => new{ o = o, l = l })), (IEnumerable<M1>) se0085CtEntities1.OrdSections, (Expression<Func<M0, M2>>) (data => data.l.OrderLineId), (Expression<Func<M1, M2>>) (s => s.OrderLine.OrderLineId), (Expression<Func<M0, M1, M3>>) ((data, s) => new
        {
          o = data.o,
          l = data.l,
          s = s
        })), (Expression<Func<M0, bool>>) Expression.Lambda<Func<VB\u0024AnonymousType_45<SEOrder, OrderLine, OrdSection>, bool>>((Expression) Expression.Equal(\u0024VB\u0024It.s.OrdSectsId, closure143.\u0024VB\u0024Local_mesOrderLine.OrdSectsId, true, (MethodInfo) null), new ParameterExpression[1]
        {
          parameterExpression1
        })), (Expression<Func<M0, M1>>) (data => data.s.OrdSectsProdNum)), (Expression<Func<M0, M1>>) (data => data.s));
        string Left = "";
        ArrayList arrayList1 = new ArrayList();
        try
        {
          foreach (scMESOrderInfo scMesOrderInfo in MESExtractData)
          {
            // ISSUE: reference to a compiler-generated field
            closure143.\u0024VB\u0024Local_mesOrderLine = scMesOrderInfo;
            // ISSUE: reference to a compiler-generated field
            if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(Left, closure143.\u0024VB\u0024Local_mesOrderLine.OrdSectsProdNum, false) != 0)
            {
              // ISSUE: reference to a compiler-generated field
              Left = closure143.\u0024VB\u0024Local_mesOrderLine.OrdSectsProdNum;
              checked { ++num1; }
              if (source1.Count<OrdSection>() >= 1)
              {
                int num3 = 0;
                IEnumerator<OrdSection> enumerator2;
                try
                {
                  enumerator2 = source1.GetEnumerator();
                  while (enumerator2.MoveNext())
                  {
                    OrdSection current = enumerator2.Current;
                    // ISSUE: reference to a compiler-generated field
                    closure143.\u0024VB\u0024Local_mesOrderLine.OrdSectsId = current.OrdSectsId;
                    checked { ++num3; }
                    if (num1 == num3)
                    {
                      // ISSUE: reference to a compiler-generated field
                      int ordShipSplt = closure143.\u0024VB\u0024Local_mesOrderLine.OrdSection.OrdShipSplt;
                      int? ordSectShipSpt = current.OrdSectShipSpt;
                      nullable3 = ordSectShipSpt.HasValue ? new bool?(ordSectShipSpt.GetValueOrDefault() == ordShipSplt) : new bool?();
                      // ISSUE: reference to a compiler-generated field
                      // ISSUE: reference to a compiler-generated field
                      // ISSUE: reference to a compiler-generated field
                      // ISSUE: reference to a compiler-generated field
                      bool? nullable4 = Microsoft.VisualBasic.CompilerServices.Operators.CompareString(Microsoft.VisualBasic.Strings.Trim(current.OrdSectsProdNum), closure143.\u0024VB\u0024Local_mesOrderLine.OrdSection.OrdSectsProdNum, false) == 0 & Microsoft.VisualBasic.CompilerServices.Operators.CompareString(Microsoft.VisualBasic.Strings.Trim(current.OrdSectsCurrWorkCtr), closure143.\u0024VB\u0024Local_mesOrderLine.OrdSection.OrdSectsCurrWorkCtr, false) == 0 & Microsoft.VisualBasic.CompilerServices.Operators.CompareString(Microsoft.VisualBasic.Strings.Trim(current.OrdSectsCryptRt), closure143.\u0024VB\u0024Local_mesOrderLine.OrdSection.OrdSectsCryptRt, false) == 0 & current.OrdSectsNum == closure143.\u0024VB\u0024Local_mesOrderLine.OrdSection.OrdSectsNum ? nullable3 : new bool?(false);
                      bool? nullable5;
                      if (!nullable4.HasValue)
                      {
                        nullable5 = new bool?();
                      }
                      else
                      {
                        nullable2 = new bool?(!nullable4.GetValueOrDefault());
                        nullable5 = nullable2;
                      }
                      nullable1 = nullable5;
                      if (nullable1.GetValueOrDefault())
                      {
                        flag3 = true;
                        OrdSection ordSection = current;
                        // ISSUE: reference to a compiler-generated field
                        ordSection.OrdSectsProdNum = closure143.\u0024VB\u0024Local_mesOrderLine.OrdSectsProdNum;
                        // ISSUE: reference to a compiler-generated field
                        ordSection.OrdSectsCurrWorkCtr = closure143.\u0024VB\u0024Local_mesOrderLine.OrdSectsCurrWorkCtr;
                        // ISSUE: reference to a compiler-generated field
                        ordSection.OrdSectsCryptRt = Microsoft.VisualBasic.Strings.Left(closure143.\u0024VB\u0024Local_mesOrderLine.OrdSectsCryptRt, 15);
                        // ISSUE: reference to a compiler-generated field
                        ordSection.OrdSectsNum = closure143.\u0024VB\u0024Local_mesOrderLine.OrdSectsNum;
                        // ISSUE: reference to a compiler-generated field
                        ordSection.OrdSectShipSpt = (int?) closure143.\u0024VB\u0024Local_mesOrderLine.OrdShipSplt;
                      }
                    }
                  }
                }
                finally
                {
                  if (enumerator2 != null)
                    enumerator2.Dispose();
                }
                // ISSUE: reference to a compiler-generated field
                arrayList1.Add((object) closure143.\u0024VB\u0024Local_mesOrderLine.OrdSection);
                if (flag3 && se0085CtEntities1.SaveChanges() > 0)
                  flag3 = false;
              }
              else
              {
                // ISSUE: reference to a compiler-generated field
                this.lcLogWriter.logData("Error importing data, aborting MES import for Order; " + closure143.\u0024VB\u0024Local_mesOrderLine.OrderFO);
              }
            }
          }
        }
        finally
        {
          IEnumerator enumerator2;
          if (enumerator2 is IDisposable)
            (enumerator2 as IDisposable).Dispose();
        }
        ArrayList arrayList2 = new ArrayList();
        ArrayList arrayList3 = new ArrayList();
        try
        {
          foreach (scOrdSectionsInfo scOrdSectionsInfo1 in arrayList1)
          {
            // ISSUE: object of a compiler-generated type is created
            // ISSUE: variable of a compiler-generated type
            clsEngineMES._Closure\u0024__143._Closure\u0024__144._Closure\u0024__145 other = new clsEngineMES._Closure\u0024__143._Closure\u0024__144._Closure\u0024__145(other);
            scOrdSectionsInfo scOrdSectionsInfo2 = scOrdSectionsInfo1;
            // ISSUE: reference to a compiler-generated field
            other.\u0024VB\u0024NonLocal_\u0024VB\u0024Closure_ClosureVariable_90 = closure144;
            // ISSUE: reference to a compiler-generated field
            closure144.\u0024VB\u0024Local_ldSectionData = scOrdSectionsInfo2;
            IEnumerable<object> objects = MESExtractData.Cast<object>();
            // ISSUE: variable of a compiler-generated type
            clsEngineMES._Closure\u0024__143._Closure\u0024__144._Closure\u0024__145 closure145_1 = other;
            // ISSUE: virtual method pointer
            IntPtr num3 = __vmethodptr(closure145_1, _Lambda\u0024__78);
            Func<object, bool> func1 = new Func<object, bool>((object) closure145_1, num3);
            // ISSUE: method pointer
            IOrderedEnumerable<M0> orderedEnumerable = Enumerable.OrderBy<object, object>(Enumerable.Where<object>((IEnumerable<M0>) objects, (Func<M0, bool>) func1), (Func<M0, M1>) new Func<object, object>((object) null, __methodptr(_Lambda\u0024__79)));
            // ISSUE: variable of a compiler-generated type
            clsEngineMES._Closure\u0024__143._Closure\u0024__144._Closure\u0024__145 closure145_2 = other;
            // ISSUE: virtual method pointer
            IntPtr num4 = __vmethodptr(closure145_2, _Lambda\u0024__80);
            Func<object, scSectionsInfoProcess> func2 = new Func<object, scSectionsInfoProcess>((object) closure145_2, num4);
            scSectionsInfoProcess[] array = ((IEnumerable<scSectionsInfoProcess>) Enumerable.Select<object, scSectionsInfoProcess>((IEnumerable<M0>) orderedEnumerable, (Func<M0, M1>) func2)).ToArray<scSectionsInfoProcess>();
            ParameterExpression parameterExpression2;
            // ISSUE: reference to a compiler-generated field
            IOrderedQueryable<SectionsRouting> orderedQueryable = (IOrderedQueryable<SectionsRouting>) Queryable.OrderBy<SectionsRouting, string>((IQueryable<M0>) Queryable.Select(Queryable.Where((IQueryable<M0>) Queryable.Join((IQueryable<M0>) se0085CtEntities1.OrdSections, (IEnumerable<M1>) se0085CtEntities1.SectionsRoutings, (Expression<Func<M0, M2>>) (s => s.OrdSectsId), (Expression<Func<M1, M2>>) (r => r.OrdSection.OrdSectsId), (Expression<Func<M0, M1, M3>>) ((s, r) => new{ s = s, r = r })), (Expression<Func<M0, bool>>) Expression.Lambda<Func<VB\u0024AnonymousType_38<OrdSection, SectionsRouting>, bool>>((Expression) Expression.Equal(\u0024VB\u0024It.s.OrdSectsId, closure144.\u0024VB\u0024Local_ldSectionData.OrdSectsId, true, (MethodInfo) null), new ParameterExpression[1]
            {
              parameterExpression2
            })), (Expression<Func<M0, M1>>) (data => data.r)), (Expression<Func<M0, M1>>) (r => r.RoutingWorkCenter));
            string str = "";
            num2 = 0;
            IEnumerator<SectionsRouting> enumerator2;
            try
            {
              enumerator2 = orderedQueryable.GetEnumerator();
              while (enumerator2.MoveNext())
              {
                SectionsRouting current1 = enumerator2.Current;
                str = current1.RoutingWorkCenter;
                // ISSUE: reference to a compiler-generated field
                other.\u0024VB\u0024Local_ldWorkCenter = Microsoft.VisualBasic.Strings.Trim(current1.RoutingWorkCenter);
                // ISSUE: method pointer
                IEnumerable<M1> m1s = Enumerable.Select<object, scMESOrderInfo>((IEnumerable<M0>) MESExtractData.Cast<object>(), (Func<M0, M1>) new Func<object, scMESOrderInfo>((object) null, __methodptr(_Lambda\u0024__81)));
                // ISSUE: variable of a compiler-generated type
                clsEngineMES._Closure\u0024__143._Closure\u0024__144._Closure\u0024__145 closure145_3 = other;
                // ISSUE: virtual method pointer
                IntPtr num5 = __vmethodptr(closure145_3, _Lambda\u0024__82);
                Func<scMESOrderInfo, bool> func3 = new Func<scMESOrderInfo, bool>((object) closure145_3, num5);
                // ISSUE: method pointer
                IEnumerable<scSectionsRoutingInfo> source2 = (IEnumerable<scSectionsRoutingInfo>) Enumerable.Select<scMESOrderInfo, scSectionsRoutingInfo>(Enumerable.Where<scMESOrderInfo>((IEnumerable<M0>) m1s, (Func<M0, bool>) func3), (Func<M0, M1>) new Func<scMESOrderInfo, scSectionsRoutingInfo>((object) null, __methodptr(_Lambda\u0024__83)));
                IEnumerator<scSectionsRoutingInfo> enumerator3;
                if (source2.Count<scSectionsRoutingInfo>() == 0)
                  this.dBDeleteDataByRoutingId(current1.RoutingId, true, false);
                else if (source2.Count<scSectionsRoutingInfo>() == 1)
                {
                  try
                  {
                    enumerator3 = source2.GetEnumerator();
                    while (enumerator3.MoveNext())
                    {
                      scSectionsRoutingInfo current2 = enumerator3.Current;
                      current2.RoutingId = current1.RoutingId;
                      string routingWorkCenter = current2.RoutingWorkCenter;
                      int num6 = 0;
                      int num7 = checked (((IEnumerable<scSectionsInfoProcess>) array).Count<scSectionsInfoProcess>() - 1);
                      int index = num6;
                      while (index <= num7)
                      {
                        if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(Microsoft.VisualBasic.Strings.Trim(array[index].RoutingWorkCenter), Microsoft.VisualBasic.Strings.Trim(routingWorkCenter), false) == 0)
                          array[index].RoutingProcessed = true;
                        checked { ++index; }
                      }
                      DateTime routingSchFinishDt1 = current2.RoutingSchFinishDt;
                      DateTime? routingSchFinishDt2 = current1.RoutingSchFinishDt;
                      bool? nullable4 = routingSchFinishDt2.HasValue ? new bool?(DateTime.Compare(routingSchFinishDt2.GetValueOrDefault(), routingSchFinishDt1) == 0) : new bool?();
                      DateTime routingSchStartDt1 = current2.RoutingSchStartDt;
                      DateTime? routingSchStartDt2 = current1.RoutingSchStartDt;
                      bool? nullable5 = routingSchStartDt2.HasValue ? new bool?(DateTime.Compare(routingSchStartDt2.GetValueOrDefault(), routingSchStartDt1) == 0) : new bool?();
                      bool? nullable6 = !nullable4.HasValue || nullable4.GetValueOrDefault() ? (nullable5.HasValue ? (nullable5.GetValueOrDefault() ? nullable4 : new bool?(false)) : new bool?()) : new bool?(false);
                      DateTime routingActFinishDt1 = current2.RoutingActFinishDt;
                      DateTime? routingActFinishDt2 = current1.RoutingActFinishDt;
                      bool? nullable7 = routingActFinishDt2.HasValue ? new bool?(DateTime.Compare(routingActFinishDt2.GetValueOrDefault(), routingActFinishDt1) == 0) : new bool?();
                      bool? nullable8 = !nullable6.HasValue || nullable6.GetValueOrDefault() ? (nullable7.HasValue ? (nullable7.GetValueOrDefault() ? nullable6 : new bool?(false)) : new bool?()) : new bool?(false);
                      DateTime routingActStartDt1 = current2.RoutingActStartDt;
                      DateTime? routingActStartDt2 = current1.RoutingActStartDt;
                      bool? nullable9 = routingActStartDt2.HasValue ? new bool?(DateTime.Compare(routingActStartDt2.GetValueOrDefault(), routingActStartDt1) == 0) : new bool?();
                      bool? nullable10 = !nullable8.HasValue || nullable8.GetValueOrDefault() ? (nullable9.HasValue ? (nullable9.GetValueOrDefault() ? nullable8 : new bool?(false)) : new bool?()) : new bool?(false);
                      bool? nullable11 = Microsoft.VisualBasic.CompilerServices.Operators.CompareString(Microsoft.VisualBasic.Strings.Trim(current1.RoutingNextWorkCtr), current2.RoutingNextWorkCtr, false) == 0 ? nullable10 : new bool?(false);
                      bool? nullable12 = Microsoft.VisualBasic.CompilerServices.Operators.CompareString(Microsoft.VisualBasic.Strings.Trim(current1.RoutingWorkCenter), current2.RoutingWorkCenter, false) == 0 ? nullable11 : new bool?(false);
                      bool? nullable13 = Microsoft.VisualBasic.CompilerServices.Operators.CompareString(Microsoft.VisualBasic.Strings.Trim(current1.RoutingStatusCD), current2.RoutingStatusCD, false) == 0 ? nullable12 : new bool?(false);
                      int routingRunTimeMin1 = current2.RoutingRunTimeMin;
                      int? routingRunTimeMin2 = current1.RoutingRunTimeMin;
                      bool? nullable14 = routingRunTimeMin2.HasValue ? new bool?(routingRunTimeMin2.GetValueOrDefault() == routingRunTimeMin1) : new bool?();
                      bool? nullable15;
                      if (!nullable13.HasValue || nullable13.GetValueOrDefault())
                      {
                        if (!nullable14.HasValue)
                          nullable15 = new bool?();
                        else if (!nullable14.GetValueOrDefault())
                        {
                          nullable3 = new bool?(false);
                          nullable15 = nullable3;
                        }
                        else
                          nullable15 = nullable13;
                      }
                      else
                        nullable15 = new bool?(false);
                      bool? nullable16 = nullable15;
                      bool? nullable17;
                      if (!nullable16.HasValue)
                      {
                        nullable17 = new bool?();
                      }
                      else
                      {
                        nullable1 = new bool?(!nullable16.GetValueOrDefault());
                        nullable17 = nullable1;
                      }
                      if (nullable17.GetValueOrDefault())
                      {
                        flag4 = true;
                        SectionsRouting sectionsRouting = current1;
                        sectionsRouting.RoutingSchFinishDt = (DateTime?) current2.RoutingSchFinishDt;
                        sectionsRouting.RoutingSchStartDt = (DateTime?) current2.RoutingSchStartDt;
                        sectionsRouting.RoutingActFinishDt = (DateTime?) current2.RoutingActFinishDt;
                        sectionsRouting.RoutingActStartDt = (DateTime?) current2.RoutingActStartDt;
                        sectionsRouting.RoutingNextWorkCtr = current2.RoutingNextWorkCtr;
                        sectionsRouting.RoutingWorkCenter = current2.RoutingWorkCenter;
                        sectionsRouting.RoutingStatusCD = current2.RoutingStatusCD;
                        sectionsRouting.RoutingRunTimeMin = (int?) current2.RoutingRunTimeMin;
                        if (!flag1)
                        {
                          flag1 = true;
                          // ISSUE: reference to a compiler-generated field
                          // ISSUE: reference to a compiler-generated field
                          // ISSUE: reference to a compiler-generated field
                          // ISSUE: reference to a compiler-generated field
                          // ISSUE: reference to a compiler-generated field
                          this.lcLogWriter.logData("Routing Data Updated " + closure143.\u0024VB\u0024Local_mesOrderLine.OrderFO + "-" + closure143.\u0024VB\u0024Local_mesOrderLine.OrderLineNum + "-" + closure143.\u0024VB\u0024Local_mesOrderLine.OrderLineSL + "-" + closure143.\u0024VB\u0024Local_mesOrderLine.OrderLineSS + ":" + Conversions.ToString(closure143.\u0024VB\u0024Local_mesOrderLine.OrdSectsNum) + ", OrderSectId - " + Conversions.ToString(scOrdSectionsInfo2.OrdSectsId));
                        }
                      }
                    }
                  }
                  finally
                  {
                    if (enumerator3 != null)
                      enumerator3.Dispose();
                  }
                }
              }
            }
            finally
            {
              if (enumerator2 != null)
                enumerator2.Dispose();
            }
            scSectionsInfoProcess[] sectionsInfoProcessArray = array;
            int index1 = 0;
            while (index1 < sectionsInfoProcessArray.Length)
            {
              scSectionsInfoProcess RoutingStep = sectionsInfoProcessArray[index1];
              if (!RoutingStep.RoutingProcessed)
                this.InsertMESRoutingStep(RoutingStep);
              checked { ++index1; }
            }
            flag1 = false;
          }
        }
        finally
        {
          IEnumerator enumerator2;
          if (enumerator2 is IDisposable)
            (enumerator2 as IDisposable).Dispose();
        }
        if (flag4 && se0085CtEntities1.SaveChanges() > 0)
          ;
        se0085CtEntities1.Database.Connection.Close();
      }
      return false;
    }

    public scMESTableStatus[] xxx_StatusMES_o_l_s_rLOJ(string FactoryOrder, string LineItem, string SLNumber, string SSNumber, int SectionNum)
    {
      // ISSUE: object of a compiler-generated type is created
      // ISSUE: variable of a compiler-generated type
      clsEngineMES._Closure\u0024__146 closure146 = new clsEngineMES._Closure\u0024__146();
      // ISSUE: reference to a compiler-generated field
      closure146.\u0024VB\u0024Local_SectionNum = SectionNum;
      // ISSUE: reference to a compiler-generated field
      closure146.\u0024VB\u0024Local_FactoryOrder = FactoryOrder;
      // ISSUE: reference to a compiler-generated field
      closure146.\u0024VB\u0024Local_LineItem = LineItem;
      // ISSUE: reference to a compiler-generated field
      closure146.\u0024VB\u0024Local_SLNumber = SLNumber;
      // ISSUE: reference to a compiler-generated field
      closure146.\u0024VB\u0024Local_SSNumber = SSNumber;
      using (SE0085CTEntities1 se0085CtEntities1 = new SE0085CTEntities1())
      {
        se0085CtEntities1.Database.Connection.ConnectionString = this._CTConnection;
        ParameterExpression parameterExpression1;
        ParameterExpression parameterExpression2;
        // ISSUE: method reference
        // ISSUE: reference to a compiler-generated field
        // ISSUE: method reference
        // ISSUE: reference to a compiler-generated field
        // ISSUE: method reference
        // ISSUE: reference to a compiler-generated field
        // ISSUE: method reference
        // ISSUE: reference to a compiler-generated field
        // ISSUE: reference to a compiler-generated field
        // ISSUE: method reference
        // ISSUE: method reference
        // ISSUE: method reference
        // ISSUE: type reference
        // ISSUE: method reference
        // ISSUE: method reference
        // ISSUE: method reference
        // ISSUE: type reference
        // ISSUE: method reference
        // ISSUE: method reference
        // ISSUE: method reference
        // ISSUE: type reference
        // ISSUE: method reference
        // ISSUE: method reference
        // ISSUE: method reference
        // ISSUE: method reference
        // ISSUE: type reference
        IQueryable<scMESTableStatus> source = (IQueryable<scMESTableStatus>) Queryable.Select(Queryable.Where((IQueryable<M0>) Queryable.GroupJoin((IQueryable<M0>) Queryable.Join((IQueryable<M0>) Queryable.Join((IQueryable<M0>) se0085CtEntities1.SEOrders, (IEnumerable<M1>) se0085CtEntities1.OrderLines, (Expression<Func<M0, M2>>) (o => o.OrderId), (Expression<Func<M1, M2>>) (l => l.SEOrder.OrderId), (Expression<Func<M0, M1, M3>>) ((o, l) => new{ o = o, l = l })), (IEnumerable<M1>) se0085CtEntities1.OrdSections, (Expression<Func<M0, M2>>) (data => data.l.OrderLineId), (Expression<Func<M1, M2>>) (s => s.OrderLine.OrderLineId), (Expression<Func<M0, M1, M3>>) ((data, s) => new
        {
          \u0024VB\u0024It1 = data,
          s = s
        })), (IEnumerable<M1>) se0085CtEntities1.SectionsRoutings, (Expression<Func<M0, M2>>) (data => data.s.OrdSectsId), (Expression<Func<M1, M2>>) (r => r.OrdSection.OrdSectsId), (Expression<Func<M0, IEnumerable<M1>, M3>>) ((data, sectionsRoutings) => new
        {
          o = data.\u0024VB\u0024It1.o,
          l = data.\u0024VB\u0024It1.l,
          s = data.s,
          rt = sectionsRoutings
        })), (Expression<Func<M0, bool>>) Expression.Lambda<Func<VB\u0024AnonymousType_60<SEOrder, OrderLine, OrdSection, IEnumerable<SectionsRouting>>, bool>>((Expression) Expression.And(Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), \u0024VB\u0024It.o.OrderFO, closure146.\u0024VB\u0024Local_FactoryOrder, false) == 0 & Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), \u0024VB\u0024It.l.OrderLineNum, closure146.\u0024VB\u0024Local_LineItem, false) == 0 & Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), \u0024VB\u0024It.l.OrderLineSL, closure146.\u0024VB\u0024Local_SLNumber, false) == 0 & Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), \u0024VB\u0024It.l.OrderLineSS, closure146.\u0024VB\u0024Local_SSNumber, false) == 0, (Expression) Expression.Equal(\u0024VB\u0024It.s.OrdSectsNum, closure146.\u0024VB\u0024Local_SectionNum, true, (MethodInfo) null)), new ParameterExpression[1]
        {
          parameterExpression1
        })), (Expression<Func<M0, M1>>) Expression.Lambda<Func<VB\u0024AnonymousType_60<SEOrder, OrderLine, OrdSection, IEnumerable<SectionsRouting>>, scMESTableStatus>>((Expression) Expression.MemberInit(Expression.New((ConstructorInfo) MethodBase.GetMethodFromHandle(__methodref (scMESTableStatus.\u002Ector)), (Expression[]) null), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scMESTableStatus.set_OrderId)), (Expression) Expression.Property((Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (VB\u0024AnonymousType_60<SEOrder, OrderLine, OrdSection, IEnumerable<SectionsRouting>>.get_o), __typeref (VB\u0024AnonymousType_60<SEOrder, OrderLine, OrdSection, IEnumerable<SectionsRouting>>))), (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SEOrder.get_OrderId)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scMESTableStatus.set_OrderLineId)), (Expression) Expression.Property((Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (VB\u0024AnonymousType_60<SEOrder, OrderLine, OrdSection, IEnumerable<SectionsRouting>>.get_l), __typeref (VB\u0024AnonymousType_60<SEOrder, OrderLine, OrdSection, IEnumerable<SectionsRouting>>))), (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (OrderLine.get_OrderLineId)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scMESTableStatus.set_OrdSectsId)), (Expression) Expression.Property((Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (VB\u0024AnonymousType_60<SEOrder, OrderLine, OrdSection, IEnumerable<SectionsRouting>>.get_s), __typeref (VB\u0024AnonymousType_60<SEOrder, OrderLine, OrdSection, IEnumerable<SectionsRouting>>))), (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (OrdSection.get_OrdSectsId)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scMESTableStatus.set_OrdSecRoutingCount)), (Expression) Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Enumerable.Count)), new Expression[1]
        {
          (Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (VB\u0024AnonymousType_60<SEOrder, OrderLine, OrdSection, IEnumerable<SectionsRouting>>.get_rt), __typeref (VB\u0024AnonymousType_60<SEOrder, OrderLine, OrdSection, IEnumerable<SectionsRouting>>)))
        }))), new ParameterExpression[1]
        {
          parameterExpression2
        }));
        if (source.Count<scMESTableStatus>() > 0)
          return source.ToArray<scMESTableStatus>();
        return (scMESTableStatus[]) null;
      }
    }

    public scMESTableStatus[] StatusMES_o_l_rLOJ(string FactoryOrder, string LineItem, string SLNumber, string SSNumber)
    {
      // ISSUE: object of a compiler-generated type is created
      // ISSUE: variable of a compiler-generated type
      clsEngineMES._Closure\u0024__147 closure147 = new clsEngineMES._Closure\u0024__147();
      // ISSUE: reference to a compiler-generated field
      closure147.\u0024VB\u0024Local_SSNumber = SSNumber;
      // ISSUE: reference to a compiler-generated field
      closure147.\u0024VB\u0024Local_FactoryOrder = FactoryOrder;
      // ISSUE: reference to a compiler-generated field
      closure147.\u0024VB\u0024Local_LineItem = LineItem;
      // ISSUE: reference to a compiler-generated field
      closure147.\u0024VB\u0024Local_SLNumber = SLNumber;
      using (SE0085CTEntities1 se0085CtEntities1 = new SE0085CTEntities1())
      {
        se0085CtEntities1.Database.Connection.ConnectionString = this._CTConnection;
        ParameterExpression parameterExpression;
        // ISSUE: method reference
        // ISSUE: reference to a compiler-generated field
        // ISSUE: method reference
        // ISSUE: reference to a compiler-generated field
        // ISSUE: method reference
        // ISSUE: reference to a compiler-generated field
        // ISSUE: method reference
        // ISSUE: reference to a compiler-generated field
        // ISSUE: method reference
        // ISSUE: method reference
        // ISSUE: method reference
        // ISSUE: type reference
        // ISSUE: method reference
        // ISSUE: method reference
        // ISSUE: method reference
        // ISSUE: type reference
        // ISSUE: method reference
        // ISSUE: method reference
        // ISSUE: method reference
        // ISSUE: type reference
        // ISSUE: method reference
        // ISSUE: method reference
        // ISSUE: method reference
        // ISSUE: method reference
        // ISSUE: type reference
        IQueryable<scMESTableStatus> source = (IQueryable<scMESTableStatus>) Queryable.Select((IQueryable<M0>) Queryable.ThenBy(Queryable.ThenBy(Queryable.ThenBy(Queryable.ThenBy(Queryable.ThenBy(Queryable.OrderBy(Queryable.Where((IQueryable<M0>) Queryable.GroupJoin((IQueryable<M0>) Queryable.Join((IQueryable<M0>) Queryable.Join((IQueryable<M0>) se0085CtEntities1.SEOrders, (IEnumerable<M1>) se0085CtEntities1.OrderLines, (Expression<Func<M0, M2>>) (o => o.OrderId), (Expression<Func<M1, M2>>) (l => l.SEOrder.OrderId), (Expression<Func<M0, M1, M3>>) ((o, l) => new{ o = o, l = l })), (IEnumerable<M1>) se0085CtEntities1.OrdSections, (Expression<Func<M0, M2>>) (data => data.l.OrderLineId), (Expression<Func<M1, M2>>) (s => s.OrderLine.OrderLineId), (Expression<Func<M0, M1, M3>>) ((data, s) => new
        {
          \u0024VB\u0024It1 = data,
          s = s
        })), (IEnumerable<M1>) se0085CtEntities1.SectionsRoutings, (Expression<Func<M0, M2>>) (data => data.s.OrdSectsId), (Expression<Func<M1, M2>>) (r => r.OrdSection.OrdSectsId), (Expression<Func<M0, IEnumerable<M1>, M3>>) ((data, sectionsRoutings) => new
        {
          o = data.\u0024VB\u0024It1.o,
          l = data.\u0024VB\u0024It1.l,
          s = data.s,
          rt = sectionsRoutings
        })), (Expression<Func<M0, bool>>) (data => Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), data.o.OrderFO, closure147.\u0024VB\u0024Local_FactoryOrder, false) == 0 & Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), data.l.OrderLineNum, closure147.\u0024VB\u0024Local_LineItem, false) == 0 & Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), data.l.OrderLineSL, closure147.\u0024VB\u0024Local_SLNumber, false) == 0 & Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), data.l.OrderLineSS, closure147.\u0024VB\u0024Local_SSNumber, false) == 0)), (Expression<Func<M0, M1>>) (data => data.o.OrderFO)), (Expression<Func<M0, M1>>) (data => data.l.OrderLineNum)), (Expression<Func<M0, M1>>) (data => data.l.OrderLineSS)), (Expression<Func<M0, M1>>) (data => data.l.OrderLineSL)), (Expression<Func<M0, M1>>) (data => data.s.OrdSectsNum)), (Expression<Func<M0, M1>>) (data => data.s.OrdSectsProdNum)), (Expression<Func<M0, M1>>) Expression.Lambda<Func<VB\u0024AnonymousType_60<SEOrder, OrderLine, OrdSection, IEnumerable<SectionsRouting>>, scMESTableStatus>>((Expression) Expression.MemberInit(Expression.New((ConstructorInfo) MethodBase.GetMethodFromHandle(__methodref (scMESTableStatus.\u002Ector)), (Expression[]) null), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scMESTableStatus.set_OrderId)), (Expression) Expression.Property((Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (VB\u0024AnonymousType_60<SEOrder, OrderLine, OrdSection, IEnumerable<SectionsRouting>>.get_o), __typeref (VB\u0024AnonymousType_60<SEOrder, OrderLine, OrdSection, IEnumerable<SectionsRouting>>))), (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SEOrder.get_OrderId)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scMESTableStatus.set_OrderLineId)), (Expression) Expression.Property((Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (VB\u0024AnonymousType_60<SEOrder, OrderLine, OrdSection, IEnumerable<SectionsRouting>>.get_l), __typeref (VB\u0024AnonymousType_60<SEOrder, OrderLine, OrdSection, IEnumerable<SectionsRouting>>))), (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (OrderLine.get_OrderLineId)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scMESTableStatus.set_OrdSectsId)), (Expression) Expression.Property((Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (VB\u0024AnonymousType_60<SEOrder, OrderLine, OrdSection, IEnumerable<SectionsRouting>>.get_s), __typeref (VB\u0024AnonymousType_60<SEOrder, OrderLine, OrdSection, IEnumerable<SectionsRouting>>))), (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (OrdSection.get_OrdSectsId)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scMESTableStatus.set_OrdSecRoutingCount)), (Expression) Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Enumerable.Count)), new Expression[1]
        {
          (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (VB\u0024AnonymousType_60<SEOrder, OrderLine, OrdSection, IEnumerable<SectionsRouting>>.get_rt), __typeref (VB\u0024AnonymousType_60<SEOrder, OrderLine, OrdSection, IEnumerable<SectionsRouting>>)))
        }))), new ParameterExpression[1]
        {
          parameterExpression
        }));
        if (source.Count<scMESTableStatus>() > 0)
          return source.ToArray<scMESTableStatus>();
        return (scMESTableStatus[]) null;
      }
    }

    public void AddMESSections(ArrayList MesExtractData, ArrayList MESSectionList)
    {
      // ISSUE: object of a compiler-generated type is created
      // ISSUE: variable of a compiler-generated type
      clsEngineMES._Closure\u0024__148 closure148 = new clsEngineMES._Closure\u0024__148();
      ArrayList scMesOrders = new ArrayList();
      try
      {
        foreach (scOrdSectionsInfo mesSection in MESSectionList)
        {
          // ISSUE: reference to a compiler-generated field
          closure148.\u0024VB\u0024Local_ldSectionNum = mesSection.OrdSectsNum;
          // ISSUE: method pointer
          IEnumerable<M1> m1s = Enumerable.Select<object, scMESOrderInfo>((IEnumerable<M0>) MesExtractData.Cast<object>(), (Func<M0, M1>) new Func<object, scMESOrderInfo>((object) null, __methodptr(_Lambda\u0024__84)));
          // ISSUE: virtual method pointer
          IntPtr num = __vmethodptr(closure148, _Lambda\u0024__85);
          Func<scMESOrderInfo, bool> func = new Func<scMESOrderInfo, bool>((object) closure148, num);
          // ISSUE: method pointer
          IEnumerable<scMESOrderInfo> source = (IEnumerable<scMESOrderInfo>) Enumerable.Select<scMESOrderInfo, scMESOrderInfo>(Enumerable.Where<scMESOrderInfo>((IEnumerable<M0>) m1s, (Func<M0, bool>) func), (Func<M0, M1>) new Func<scMESOrderInfo, scMESOrderInfo>((object) null, __methodptr(_Lambda\u0024__86)));
          if (source.Count<scMESOrderInfo>() > 0)
          {
            scMesOrders.Clear();
            scMesOrders.AddRange((ICollection) source.ToArray<scMESOrderInfo>());
            this.InsertMESLines(scMesOrders);
          }
        }
      }
      finally
      {
        IEnumerator enumerator;
        if (enumerator is IDisposable)
          (enumerator as IDisposable).Dispose();
      }
    }

    public void InsertMESLines(ArrayList scMesOrders)
    {
      // ISSUE: object of a compiler-generated type is created
      // ISSUE: variable of a compiler-generated type
      clsEngineMES._Closure\u0024__149 closure149 = new clsEngineMES._Closure\u0024__149();
      if (DateTime.Compare(DateTime.Today, Conversions.ToDate("08/08/2016")) > 0)
        return;
      // ISSUE: reference to a compiler-generated field
      closure149.\u0024VB\u0024Local_ldMESOrder = new scMESOrderInfo();
      // ISSUE: reference to a compiler-generated field
      closure149.\u0024VB\u0024Local_ldMESOrder = (scMESOrderInfo) scMesOrders[0];
      using (SE0085CTEntities1 se0085CtEntities1 = new SE0085CTEntities1())
      {
        // ISSUE: object of a compiler-generated type is created
        // ISSUE: variable of a compiler-generated type
        clsEngineMES._Closure\u0024__149._Closure\u0024__150 closure150 = new clsEngineMES._Closure\u0024__149._Closure\u0024__150();
        se0085CtEntities1.Database.Connection.ConnectionString = this._CTConnection;
        ParameterExpression parameterExpression;
        // ISSUE: reference to a compiler-generated field
        IQueryable<AssemblyLine> source1 = (IQueryable<AssemblyLine>) Queryable.Select(Queryable.Where((IQueryable<M0>) Queryable.Join((IQueryable<M0>) se0085CtEntities1.SEPlants, (IEnumerable<M1>) se0085CtEntities1.AssemblyLines, (Expression<Func<M0, M2>>) (p => p.SEPlantId), (Expression<Func<M1, M2>>) (a => a.SEPlant.SEPlantId), (Expression<Func<M0, M1, M3>>) ((p, a) => new{ p = p, a = a })), (Expression<Func<M0, bool>>) Expression.Lambda<Func<VB\u0024AnonymousType_5<SEPlant, AssemblyLine>, bool>>((Expression) Expression.Equal(\u0024VB\u0024It.a.AssemLineId, closure149.\u0024VB\u0024Local_ldMESOrder.AssemblyLineId, true, (MethodInfo) null), new ParameterExpression[1]
        {
          parameterExpression
        })), (Expression<Func<M0, M1>>) (data => data.a));
        if (source1.Count<AssemblyLine>() == 0)
        {
          // ISSUE: reference to a compiler-generated field
          this.lcLogWriter.logData("Error loading Assembly Line data, aborting MES import for AssemblyLineId; " + Conversions.ToString(closure149.\u0024VB\u0024Local_ldMESOrder.AssemblyLineId));
        }
        else if (source1.Count<AssemblyLine>() == 1)
        {
          AssemblyLine assemblyLine;
          try
          {
            assemblyLine = source1.First<AssemblyLine>();
          }
          catch (Exception ex)
          {
            ProjectData.SetProjectError(ex);
            // ISSUE: reference to a compiler-generated field
            this.lcLogWriter.logData("Error loading Assembly Line data, aborting MES import for AssemblyLineId; " + Conversions.ToString(closure149.\u0024VB\u0024Local_ldMESOrder.AssemblyLineId));
            ProjectData.ClearProjectError();
            return;
          }
          // ISSUE: method reference
          // ISSUE: reference to a compiler-generated field
          IQueryable<SEOrder> source2 = (IQueryable<SEOrder>) Queryable.Select<SEOrder, SEOrder>(Queryable.Where<SEOrder>((IQueryable<M0>) se0085CtEntities1.SEOrders, (Expression<Func<M0, bool>>) (o => Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), o.OrderFO, closure149.\u0024VB\u0024Local_ldMESOrder.OrderFO, false) == 0)), (Expression<Func<M0, M1>>) (o => o));
          SEOrder entity;
          if (source2.Count<SEOrder>() == 0)
          {
            entity = new SEOrder();
            // ISSUE: reference to a compiler-generated field
            entity.OrderFO = closure149.\u0024VB\u0024Local_ldMESOrder.OrderFO;
            se0085CtEntities1.SEOrders.Add(entity);
          }
          else if (source2.Count<SEOrder>() == 1)
          {
            try
            {
              entity = source2.First<SEOrder>();
            }
            catch (Exception ex)
            {
              ProjectData.SetProjectError(ex);
              // ISSUE: reference to a compiler-generated field
              this.lcLogWriter.logData("Error loading MES Order data, aborting MES import for Order; " + closure149.\u0024VB\u0024Local_ldMESOrder.OrderFO);
              ProjectData.ClearProjectError();
              return;
            }
          }
          else
          {
            // ISSUE: reference to a compiler-generated field
            this.lcLogWriter.logData("Multiple Order numbers found, aborting MES import for Order; " + closure149.\u0024VB\u0024Local_ldMESOrder.OrderFO);
            return;
          }
          OrderLine orderLine = (OrderLine) null;
          // ISSUE: method reference
          // ISSUE: reference to a compiler-generated field
          // ISSUE: method reference
          // ISSUE: reference to a compiler-generated field
          // ISSUE: method reference
          // ISSUE: reference to a compiler-generated field
          // ISSUE: method reference
          // ISSUE: reference to a compiler-generated field
          IQueryable<OrderLine> source3 = (IQueryable<OrderLine>) Queryable.Select(Queryable.Where((IQueryable<M0>) Queryable.Join((IQueryable<M0>) se0085CtEntities1.SEOrders, (IEnumerable<M1>) se0085CtEntities1.OrderLines, (Expression<Func<M0, M2>>) (o => o.OrderId), (Expression<Func<M1, M2>>) (l => l.SEOrder.OrderId), (Expression<Func<M0, M1, M3>>) ((o, l) => new{ o = o, l = l })), (Expression<Func<M0, bool>>) (data => Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), data.o.OrderFO, closure149.\u0024VB\u0024Local_ldMESOrder.OrderFO, false) == 0 & Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), data.l.OrderLineNum, closure149.\u0024VB\u0024Local_ldMESOrder.OrderLineNum, false) == 0 & Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), data.l.OrderLineSL, closure149.\u0024VB\u0024Local_ldMESOrder.OrderLineSL, false) == 0 & Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), data.l.OrderLineSS, closure149.\u0024VB\u0024Local_ldMESOrder.OrderLineSS, false) == 0)), (Expression<Func<M0, M1>>) (data => data.l));
          if (source3.Count<OrderLine>() == 0)
          {
            orderLine = new OrderLine();
            // ISSUE: reference to a compiler-generated field
            orderLine.OrderLineNum = closure149.\u0024VB\u0024Local_ldMESOrder.OrderLineNum;
            // ISSUE: reference to a compiler-generated field
            orderLine.OrderLineQty = (int?) closure149.\u0024VB\u0024Local_ldMESOrder.OrderLineQty;
            // ISSUE: reference to a compiler-generated field
            orderLine.OrderLineShipDt = (DateTime?) closure149.\u0024VB\u0024Local_ldMESOrder.OrderLineShipDt;
            // ISSUE: reference to a compiler-generated field
            orderLine.OrderLineShipped = (bool?) ((uint) closure149.\u0024VB\u0024Local_ldMESOrder.OrderLineShipped > 0U);
            // ISSUE: reference to a compiler-generated field
            orderLine.OrderLineShippedDt = (DateTime?) closure149.\u0024VB\u0024Local_ldMESOrder.OrderLineShippedDt;
            // ISSUE: reference to a compiler-generated field
            orderLine.OrderLineSL = closure149.\u0024VB\u0024Local_ldMESOrder.OrderLineSL;
            // ISSUE: reference to a compiler-generated field
            orderLine.OrderLineSS = closure149.\u0024VB\u0024Local_ldMESOrder.OrderLineSS;
            // ISSUE: reference to a compiler-generated field
            orderLine.OrderLineTargetDt = (DateTime?) closure149.\u0024VB\u0024Local_ldMESOrder.OrderLineTargetDt;
            entity.OrderLines.Add(orderLine);
            assemblyLine.OrderLines.Add(orderLine);
            this.lcLogWriter.logData("Added Line " + orderLine.SEOrder.OrderFO + "-" + orderLine.OrderLineNum + "-" + orderLine.OrderLineSL + "-" + orderLine.OrderLineSS);
          }
          else if (source3.Count<OrderLine>() == 1)
          {
            try
            {
              orderLine = source3.First<OrderLine>();
            }
            catch (Exception ex)
            {
              ProjectData.SetProjectError(ex);
              // ISSUE: reference to a compiler-generated field
              this.lcLogWriter.logData("Error importing data, aborting MES import for Order; " + closure149.\u0024VB\u0024Local_ldMESOrder.OrderFO);
              ProjectData.ClearProjectError();
            }
          }
          else
          {
            // ISSUE: reference to a compiler-generated field
            this.lcLogWriter.logData("Multiple Order numbers found, aborting MES import for Order; " + closure149.\u0024VB\u0024Local_ldMESOrder.OrderFO);
          }
          OrdSection ordSection = (OrdSection) null;
          // ISSUE: reference to a compiler-generated field
          // ISSUE: reference to a compiler-generated field
          closure150.\u0024VB\u0024Local_ProdOrderMem = closure149.\u0024VB\u0024Local_ldMESOrder.OrdSectsProdNum;
          // ISSUE: method reference
          // ISSUE: reference to a compiler-generated field
          IQueryable<OrdSection> source4 = (IQueryable<OrdSection>) Queryable.Select<OrdSection, OrdSection>(Queryable.Where<OrdSection>((IQueryable<M0>) se0085CtEntities1.OrdSections, (Expression<Func<M0, bool>>) (s => Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), s.OrdSectsProdNum, closure149.\u0024VB\u0024Local_ldMESOrder.OrdSectsProdNum, false) == 0)), (Expression<Func<M0, M1>>) (s => s));
          if (source4.Count<OrdSection>() == 0)
          {
            ordSection = new OrdSection();
            // ISSUE: reference to a compiler-generated field
            ordSection.OrdSectsCryptRt = Microsoft.VisualBasic.Strings.Left(closure149.\u0024VB\u0024Local_ldMESOrder.OrdSectsCryptRt, 15);
            // ISSUE: reference to a compiler-generated field
            ordSection.OrdSectsCurrWorkCtr = closure149.\u0024VB\u0024Local_ldMESOrder.OrdSectsCurrWorkCtr;
            // ISSUE: reference to a compiler-generated field
            ordSection.OrdSectShipSpt = (int?) closure149.\u0024VB\u0024Local_ldMESOrder.OrdShipSplt;
            // ISSUE: reference to a compiler-generated field
            ordSection.OrdSectsNum = closure149.\u0024VB\u0024Local_ldMESOrder.OrdSectsNum;
            // ISSUE: reference to a compiler-generated field
            ordSection.OrdSectsProdNum = closure149.\u0024VB\u0024Local_ldMESOrder.OrdSectsProdNum;
            ordSection.OrdSectsRelMfg = (DateTime?) Conversions.ToDate("01/01/1901");
            ordSection.OrdSectsFabSchDt = (DateTime?) Conversions.ToDate("01/01/1901");
            ordSection.OrdSectsFabActDt = (DateTime?) Conversions.ToDate("01/01/1901");
            ordSection.OrdSectsRelSchDt = (DateTime?) Conversions.ToDate("01/01/1901");
            ordSection.OrdSectsRelActDt = (DateTime?) Conversions.ToDate("01/01/1901");
            orderLine.OrdSections.Add(ordSection);
            this.lcLogWriter.logData("Added Section " + ordSection.OrdSectsProdNum);
          }
          else if (source4.Count<OrdSection>() == 1)
          {
            try
            {
              ordSection = source4.First<OrdSection>();
            }
            catch (Exception ex)
            {
              ProjectData.SetProjectError(ex);
              // ISSUE: reference to a compiler-generated field
              this.lcLogWriter.logData("Error importing data, aborting MES import for Production Order; " + closure149.\u0024VB\u0024Local_ldMESOrder.OrdSectsProdNum);
              ProjectData.ClearProjectError();
            }
          }
          else
          {
            // ISSUE: reference to a compiler-generated field
            this.lcLogWriter.logData("Multiple Order numbers found, aborting MES import for Production Order; " + closure149.\u0024VB\u0024Local_ldMESOrder.OrdSectsProdNum);
          }
          // ISSUE: reference to a compiler-generated field
          closure150.\u0024VB\u0024Local_ProdOrderMem = "Initialize";
          try
          {
            foreach (scMESOrderInfo scMesOrder in scMesOrders)
            {
              // ISSUE: reference to a compiler-generated field
              if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(closure150.\u0024VB\u0024Local_ProdOrderMem, scMesOrder.OrdSectsProdNum, false) != 0)
              {
                // ISSUE: reference to a compiler-generated field
                if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(closure150.\u0024VB\u0024Local_ProdOrderMem, "Initialize", false) == 0)
                {
                  // ISSUE: reference to a compiler-generated field
                  closure150.\u0024VB\u0024Local_ProdOrderMem = scMesOrder.OrdSectsProdNum;
                }
                else
                {
                  se0085CtEntities1.SaveChanges();
                  // ISSUE: reference to a compiler-generated field
                  closure150.\u0024VB\u0024Local_ProdOrderMem = scMesOrder.OrdSectsProdNum;
                  // ISSUE: method reference
                  // ISSUE: reference to a compiler-generated field
                  IQueryable<OrdSection> source5 = (IQueryable<OrdSection>) Queryable.Select<OrdSection, OrdSection>(Queryable.Where<OrdSection>((IQueryable<M0>) se0085CtEntities1.OrdSections, (Expression<Func<M0, bool>>) (s => Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), s.OrdSectsProdNum, closure150.\u0024VB\u0024Local_ProdOrderMem, false) == 0)), (Expression<Func<M0, M1>>) (s => s));
                  if (source5.Count<OrdSection>() == 0)
                  {
                    ordSection = new OrdSection();
                    ordSection.OrdSectsCryptRt = Microsoft.VisualBasic.Strings.Left(scMesOrder.OrdSectsCryptRt, 15);
                    ordSection.OrdSectsCurrWorkCtr = scMesOrder.OrdSectsCurrWorkCtr;
                    ordSection.OrdSectShipSpt = (int?) scMesOrder.OrdShipSplt;
                    ordSection.OrdSectsNum = scMesOrder.OrdSectsNum;
                    ordSection.OrdSectsProdNum = scMesOrder.OrdSectsProdNum;
                    ordSection.OrdSectsRelMfg = (DateTime?) Conversions.ToDate("01/01/1901");
                    ordSection.OrdSectsFabSchDt = (DateTime?) Conversions.ToDate("01/01/1901");
                    ordSection.OrdSectsFabActDt = (DateTime?) Conversions.ToDate("01/01/1901");
                    ordSection.OrdSectsRelSchDt = (DateTime?) Conversions.ToDate("01/01/1901");
                    ordSection.OrdSectsRelActDt = (DateTime?) Conversions.ToDate("01/01/1901");
                    orderLine.OrdSections.Add(ordSection);
                    this.lcLogWriter.logData("Added Section " + ordSection.OrdSectsProdNum);
                  }
                  else if (source5.Count<OrdSection>() == 1)
                  {
                    try
                    {
                      ordSection = source5.First<OrdSection>();
                    }
                    catch (Exception ex)
                    {
                      ProjectData.SetProjectError(ex);
                      // ISSUE: reference to a compiler-generated field
                      this.lcLogWriter.logData("Error importing data, aborting MES import for Production Order; " + closure149.\u0024VB\u0024Local_ldMESOrder.OrdSectsProdNum);
                      ProjectData.ClearProjectError();
                    }
                  }
                  else
                  {
                    // ISSUE: reference to a compiler-generated field
                    this.lcLogWriter.logData("Multiple Order numbers found, aborting MES import for Production Order; " + closure149.\u0024VB\u0024Local_ldMESOrder.OrdSectsProdNum);
                  }
                }
              }
              ordSection.SectionsRoutings.Add(new SectionsRouting()
              {
                RoutingActFinishDt = (DateTime?) scMesOrder.RoutingActFinishDt,
                RoutingActStartDt = (DateTime?) scMesOrder.RoutingActStartDt,
                RoutingNextWorkCtr = scMesOrder.RoutingNextWorkCtr,
                RoutingRunTimeMin = (int?) scMesOrder.RoutingRunTimeMin,
                RoutingSchFinishDt = (DateTime?) scMesOrder.RoutingSchFinishDt,
                RoutingSchStartDt = (DateTime?) scMesOrder.RoutingSchStartDt,
                RoutingWorkCenter = scMesOrder.RoutingWorkCenter,
                RoutingStatusCD = scMesOrder.RoutingStatusCD,
                RoutingQueuedDt = (DateTime?) Conversions.ToDate("01/01/1901")
              });
            }
          }
          finally
          {
            IEnumerator enumerator;
            if (enumerator is IDisposable)
              (enumerator as IDisposable).Dispose();
          }
          se0085CtEntities1.SaveChanges();
          se0085CtEntities1.Database.Connection.Close();
        }
        else
        {
          // ISSUE: reference to a compiler-generated field
          this.lcLogWriter.logData("Error loading Assembly Line data, aborting MES import for AssemblyLineId; " + Conversions.ToString(closure149.\u0024VB\u0024Local_ldMESOrder.AssemblyLineId));
        }
      }
    }

    public void InsertMESRoutingStep(scSectionsInfoProcess RoutingStep)
    {
      // ISSUE: object of a compiler-generated type is created
      // ISSUE: variable of a compiler-generated type
      clsEngineMES._Closure\u0024__151 closure151 = new clsEngineMES._Closure\u0024__151();
      // ISSUE: reference to a compiler-generated field
      closure151.\u0024VB\u0024Local_RoutingStep = RoutingStep;
      using (SE0085CTEntities1 se0085CtEntities1 = new SE0085CTEntities1())
      {
        se0085CtEntities1.Database.Connection.ConnectionString = this._CTConnection;
        OrdSection ordSection = (OrdSection) null;
        ParameterExpression parameterExpression;
        // ISSUE: reference to a compiler-generated field
        IQueryable<OrdSection> source = (IQueryable<OrdSection>) Queryable.Select<OrdSection, OrdSection>(Queryable.Where<OrdSection>((IQueryable<M0>) se0085CtEntities1.OrdSections, (Expression<Func<M0, bool>>) Expression.Lambda<Func<OrdSection, bool>>((Expression) Expression.Equal(s.OrdSectsId, closure151.\u0024VB\u0024Local_RoutingStep.OrdSectsId, true, (MethodInfo) null), new ParameterExpression[1]
        {
          parameterExpression
        })), (Expression<Func<M0, M1>>) (s => s));
        if (source.Count<OrdSection>() == 0)
          return;
        if (source.Count<OrdSection>() == 1)
        {
          try
          {
            ordSection = source.First<OrdSection>();
          }
          catch (Exception ex)
          {
            ProjectData.SetProjectError(ex);
            // ISSUE: reference to a compiler-generated field
            this.lcLogWriter.logData("Error importing data, aborting MES import for SectionID; " + Conversions.ToString(closure151.\u0024VB\u0024Local_RoutingStep.OrdSectsId));
            ProjectData.ClearProjectError();
          }
        }
        else
        {
          // ISSUE: reference to a compiler-generated field
          this.lcLogWriter.logData("Multiple Order numbers found, aborting MES import for SectionID; " + Conversions.ToString(closure151.\u0024VB\u0024Local_RoutingStep.OrdSectsId));
        }
        // ISSUE: reference to a compiler-generated field
        // ISSUE: reference to a compiler-generated field
        // ISSUE: reference to a compiler-generated field
        // ISSUE: reference to a compiler-generated field
        // ISSUE: reference to a compiler-generated field
        // ISSUE: reference to a compiler-generated field
        // ISSUE: reference to a compiler-generated field
        // ISSUE: reference to a compiler-generated field
        ordSection.SectionsRoutings.Add(new SectionsRouting()
        {
          RoutingActFinishDt = (DateTime?) closure151.\u0024VB\u0024Local_RoutingStep.RoutingActFinishDt,
          RoutingActStartDt = (DateTime?) closure151.\u0024VB\u0024Local_RoutingStep.RoutingActStartDt,
          RoutingNextWorkCtr = closure151.\u0024VB\u0024Local_RoutingStep.RoutingNextWorkCtr,
          RoutingRunTimeMin = (int?) closure151.\u0024VB\u0024Local_RoutingStep.RoutingRunTimeMin,
          RoutingSchFinishDt = (DateTime?) closure151.\u0024VB\u0024Local_RoutingStep.RoutingSchFinishDt,
          RoutingSchStartDt = (DateTime?) closure151.\u0024VB\u0024Local_RoutingStep.RoutingSchStartDt,
          RoutingWorkCenter = closure151.\u0024VB\u0024Local_RoutingStep.RoutingWorkCenter,
          RoutingStatusCD = closure151.\u0024VB\u0024Local_RoutingStep.RoutingStatusCD,
          RoutingQueuedDt = (DateTime?) Conversions.ToDate("01/01/1901")
        });
        se0085CtEntities1.SaveChanges();
        se0085CtEntities1.Database.Connection.Close();
      }
    }

    public void UpdateIfRouted(string FOLineSLSS)
    {
      // ISSUE: object of a compiler-generated type is created
      // ISSUE: variable of a compiler-generated type
      clsEngineMES._Closure\u0024__152 closure152 = new clsEngineMES._Closure\u0024__152();
      string str = FOLineSLSS;
      // ISSUE: reference to a compiler-generated field
      closure152.\u0024VB\u0024Local_ldFO = str.Substring(0, 8);
      // ISSUE: reference to a compiler-generated field
      closure152.\u0024VB\u0024Local_ldLine = str.Substring(8, 3);
      // ISSUE: reference to a compiler-generated field
      closure152.\u0024VB\u0024Local_ldSL = str.Substring(11, 2);
      // ISSUE: reference to a compiler-generated field
      closure152.\u0024VB\u0024Local_ldSS = str.Substring(13, 2);
      using (SE0085CTEntities1 se0085CtEntities1 = new SE0085CTEntities1())
      {
        se0085CtEntities1.Database.Connection.ConnectionString = this._CTConnection;
        // ISSUE: method reference
        // ISSUE: reference to a compiler-generated field
        // ISSUE: method reference
        // ISSUE: reference to a compiler-generated field
        // ISSUE: method reference
        // ISSUE: reference to a compiler-generated field
        // ISSUE: method reference
        // ISSUE: reference to a compiler-generated field
        IQueryable<VB\u0024AnonymousType_63<string, int>> source = Queryable.Select(Queryable.Where((IQueryable<M0>) Queryable.Join((IQueryable<M0>) Queryable.Join((IQueryable<M0>) Queryable.Join((IQueryable<M0>) Queryable.Join((IQueryable<M0>) se0085CtEntities1.OrderLines, (IEnumerable<M1>) se0085CtEntities1.SEOrders, (Expression<Func<M0, M2>>) (ol => ol.SEOrder.OrderId), (Expression<Func<M1, M2>>) (fo => fo.OrderId), (Expression<Func<M0, M1, M3>>) ((ol, fo) => new{ ol = ol, fo = fo })), (IEnumerable<M1>) se0085CtEntities1.AssemblyLines, (Expression<Func<M0, M2>>) (data => data.ol.AssemblyLine.AssemLineId), (Expression<Func<M1, M2>>) (al => al.AssemLineId), (Expression<Func<M0, M1, M3>>) ((data, al) => new
        {
          \u0024VB\u0024It1 = data,
          al = al
        })), (IEnumerable<M1>) se0085CtEntities1.OrdSections, (Expression<Func<M0, M2>>) (data => data.\u0024VB\u0024It1.ol.OrderLineId), (Expression<Func<M1, M2>>) (os => os.OrderLine.OrderLineId), (Expression<Func<M0, M1, M3>>) ((data, os) => new
        {
          \u0024VB\u0024It1 = data,
          os = os
        })), (IEnumerable<M1>) se0085CtEntities1.SectionsRoutings, (Expression<Func<M0, M2>>) (data => data.os.OrdSectsId), (Expression<Func<M1, M2>>) (rt => rt.OrdSection.OrdSectsId), (Expression<Func<M0, M1, M3>>) ((data, rt) => new
        {
          ol = data.\u0024VB\u0024It1.\u0024VB\u0024It1.ol,
          fo = data.\u0024VB\u0024It1.\u0024VB\u0024It1.fo,
          al = data.\u0024VB\u0024It1.al,
          os = data.os,
          rt = rt
        })), (Expression<Func<M0, bool>>) (data => Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), data.fo.OrderFO, closure152.\u0024VB\u0024Local_ldFO, false) == 0 & Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), data.ol.OrderLineNum, closure152.\u0024VB\u0024Local_ldLine, false) == 0 & Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), data.ol.OrderLineSL, closure152.\u0024VB\u0024Local_ldSL, false) == 0 & Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), data.ol.OrderLineSS, closure152.\u0024VB\u0024Local_ldSS, false) == 0)), (Expression<Func<M0, M1>>) (data => new
        {
          AssemLineAbbrv = data.al.AssemLineAbbrv,
          RoutingId = data.rt.RoutingId
        }));
        if (source != null && source.Count() > 0)
        {
          string assemLineAbbrv = source.First().AssemLineAbbrv;
          List<scMESUpdateFull> scMesUpdateFullList = new List<scMESUpdateFull>();
          // ISSUE: reference to a compiler-generated field
          // ISSUE: reference to a compiler-generated field
          // ISSUE: reference to a compiler-generated field
          // ISSUE: reference to a compiler-generated field
          List<scMESUpdateFull> OrderList = this.LoadMESOrders(assemLineAbbrv, closure152.\u0024VB\u0024Local_ldFO, closure152.\u0024VB\u0024Local_ldLine, closure152.\u0024VB\u0024Local_ldSL, closure152.\u0024VB\u0024Local_ldSS);
          if (OrderList != null && OrderList.Count > 0)
          {
            this._AssemblyLine = (scLevels) new clsAssemblyLine(this._Plant).rtnAssemblyLineByAbbrv(this._Plant.LevelId, assemLineAbbrv);
            this.ScheduleOrder(ref OrderList);
            this.MESLoad(this._Plant, this._AssemblyLine, OrderList, true, false);
          }
        }
        se0085CtEntities1.Database.Connection.Close();
      }
    }

    public void UpdateIfNOTRouted(string FOLineSLSS)
    {
      // ISSUE: object of a compiler-generated type is created
      // ISSUE: variable of a compiler-generated type
      clsEngineMES._Closure\u0024__153 closure153 = new clsEngineMES._Closure\u0024__153();
      string str = FOLineSLSS;
      // ISSUE: reference to a compiler-generated field
      closure153.\u0024VB\u0024Local_ldFO = str.Substring(0, 8);
      // ISSUE: reference to a compiler-generated field
      closure153.\u0024VB\u0024Local_ldLine = str.Substring(8, 3);
      // ISSUE: reference to a compiler-generated field
      closure153.\u0024VB\u0024Local_ldSL = str.Substring(11, 2);
      // ISSUE: reference to a compiler-generated field
      closure153.\u0024VB\u0024Local_ldSS = str.Substring(13, 2);
      using (SE0085CTEntities1 se0085CtEntities1 = new SE0085CTEntities1())
      {
        se0085CtEntities1.Database.Connection.ConnectionString = this._CTConnection;
        // ISSUE: method reference
        // ISSUE: reference to a compiler-generated field
        // ISSUE: method reference
        // ISSUE: reference to a compiler-generated field
        // ISSUE: method reference
        // ISSUE: reference to a compiler-generated field
        // ISSUE: method reference
        // ISSUE: reference to a compiler-generated field
        IQueryable<VB\u0024AnonymousType_63<string, int>> source = Queryable.Select(Queryable.Where((IQueryable<M0>) Queryable.Join((IQueryable<M0>) Queryable.Join((IQueryable<M0>) Queryable.Join((IQueryable<M0>) Queryable.Join((IQueryable<M0>) se0085CtEntities1.OrderLines, (IEnumerable<M1>) se0085CtEntities1.SEOrders, (Expression<Func<M0, M2>>) (ol => ol.SEOrder.OrderId), (Expression<Func<M1, M2>>) (fo => fo.OrderId), (Expression<Func<M0, M1, M3>>) ((ol, fo) => new{ ol = ol, fo = fo })), (IEnumerable<M1>) se0085CtEntities1.AssemblyLines, (Expression<Func<M0, M2>>) (data => data.ol.AssemblyLine.AssemLineId), (Expression<Func<M1, M2>>) (al => al.AssemLineId), (Expression<Func<M0, M1, M3>>) ((data, al) => new
        {
          \u0024VB\u0024It1 = data,
          al = al
        })), (IEnumerable<M1>) se0085CtEntities1.OrdSections, (Expression<Func<M0, M2>>) (data => data.\u0024VB\u0024It1.ol.OrderLineId), (Expression<Func<M1, M2>>) (os => os.OrderLine.OrderLineId), (Expression<Func<M0, M1, M3>>) ((data, os) => new
        {
          \u0024VB\u0024It1 = data,
          os = os
        })), (IEnumerable<M1>) se0085CtEntities1.SectionsRoutings, (Expression<Func<M0, M2>>) (data => data.os.OrdSectsId), (Expression<Func<M1, M2>>) (rt => rt.OrdSection.OrdSectsId), (Expression<Func<M0, M1, M3>>) ((data, rt) => new
        {
          ol = data.\u0024VB\u0024It1.\u0024VB\u0024It1.ol,
          fo = data.\u0024VB\u0024It1.\u0024VB\u0024It1.fo,
          al = data.\u0024VB\u0024It1.al,
          os = data.os,
          rt = rt
        })), (Expression<Func<M0, bool>>) (data => Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), data.fo.OrderFO, closure153.\u0024VB\u0024Local_ldFO, false) == 0 & Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), data.ol.OrderLineNum, closure153.\u0024VB\u0024Local_ldLine, false) == 0 & Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), data.ol.OrderLineSL, closure153.\u0024VB\u0024Local_ldSL, false) == 0 & Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), data.ol.OrderLineSS, closure153.\u0024VB\u0024Local_ldSS, false) == 0)), (Expression<Func<M0, M1>>) (data => new
        {
          AssemLineAbbrv = data.al.AssemLineAbbrv,
          RoutingId = data.rt.RoutingId
        }));
        bool flag = false;
        if (source == null)
          flag = true;
        else if (source.Count() == 0)
          flag = true;
        if (flag)
        {
          string assemLineAbbrv = source.First().AssemLineAbbrv;
          List<scMESUpdateFull> scMesUpdateFullList = new List<scMESUpdateFull>();
          // ISSUE: reference to a compiler-generated field
          // ISSUE: reference to a compiler-generated field
          // ISSUE: reference to a compiler-generated field
          // ISSUE: reference to a compiler-generated field
          List<scMESUpdateFull> OrderList = this.LoadMESOrders(assemLineAbbrv, closure153.\u0024VB\u0024Local_ldFO, closure153.\u0024VB\u0024Local_ldLine, closure153.\u0024VB\u0024Local_ldSL, closure153.\u0024VB\u0024Local_ldSS);
          if (OrderList != null && OrderList.Count > 0)
          {
            this.ScheduleOrder(ref OrderList);
            this.MESLoad(this._Plant, this._AssemblyLine, OrderList, true, false);
          }
        }
        se0085CtEntities1.Database.Connection.Close();
      }
    }

    public bool dBDeleteDataBySectionId(int SectionId, bool delSection = false, bool delRouting = false, bool delVouchers = false)
    {
      // ISSUE: object of a compiler-generated type is created
      // ISSUE: variable of a compiler-generated type
      clsEngineMES._Closure\u0024__154 closure154 = new clsEngineMES._Closure\u0024__154();
      // ISSUE: reference to a compiler-generated field
      closure154.\u0024VB\u0024Local_SectionId = SectionId;
      int num = 0;
      bool flag1;
      if (delSection)
      {
        delRouting = true;
        delVouchers = true;
      }
      else if (delRouting)
        delVouchers = true;
      else if (!delVouchers)
      {
        flag1 = false;
        goto label_63;
      }
      if (delSection & !delRouting & !delVouchers)
      {
        // ISSUE: reference to a compiler-generated field
        this.lcLogWriter.logData("Requested Delete SectionId " + Conversions.ToString(closure154.\u0024VB\u0024Local_SectionId));
      }
      else if (delSection & delRouting & !delVouchers)
      {
        // ISSUE: reference to a compiler-generated field
        this.lcLogWriter.logData("Requested Delete SectionId plus routing " + Conversions.ToString(closure154.\u0024VB\u0024Local_SectionId));
      }
      else if (delSection & delRouting & delVouchers)
      {
        // ISSUE: reference to a compiler-generated field
        this.lcLogWriter.logData("Requested Delete SectionId plus routing and labor " + Conversions.ToString(closure154.\u0024VB\u0024Local_SectionId));
      }
      else if (!delSection & !delRouting & !delVouchers)
      {
        // ISSUE: reference to a compiler-generated field
        this.lcLogWriter.logData("Requested Delete SectionId " + Conversions.ToString(closure154.\u0024VB\u0024Local_SectionId) + " but type was not specified");
      }
      using (SE0085CTEntities1 se0085CtEntities1 = new SE0085CTEntities1())
      {
        se0085CtEntities1.Database.Connection.ConnectionString = this._CTConnection;
        ParameterExpression parameterExpression1;
        // ISSUE: reference to a compiler-generated field
        IQueryable<VB\u0024AnonymousType_64<OrdSection, SectionsRouting, IEnumerable<LaborVoucher>>> source1 = Queryable.Select(Queryable.Where((IQueryable<M0>) Queryable.GroupJoin((IQueryable<M0>) Queryable.Join((IQueryable<M0>) se0085CtEntities1.OrdSections, (IEnumerable<M1>) se0085CtEntities1.SectionsRoutings, (Expression<Func<M0, M2>>) (s => s.OrdSectsId), (Expression<Func<M1, M2>>) (r => r.OrdSection.OrdSectsId), (Expression<Func<M0, M1, M3>>) ((s, r) => new{ s = s, r = r })), (IEnumerable<M1>) se0085CtEntities1.LaborVouchers, (Expression<Func<M0, M2>>) (data => data.r.RoutingId), (Expression<Func<M1, M2>>) (v => v.SectionsRouting.RoutingId), (Expression<Func<M0, IEnumerable<M1>, M3>>) ((data, laborVouchers) => new
        {
          s = data.s,
          r = data.r,
          vt = laborVouchers
        })), (Expression<Func<M0, bool>>) Expression.Lambda<Func<VB\u0024AnonymousType_64<OrdSection, SectionsRouting, IEnumerable<LaborVoucher>>, bool>>((Expression) Expression.Equal(\u0024VB\u0024It.s.OrdSectsId, closure154.\u0024VB\u0024Local_SectionId, true, (MethodInfo) null), new ParameterExpression[1]
        {
          parameterExpression1
        })), (Expression<Func<M0, M1>>) (data => new
        {
          s = data.s,
          r = data.r,
          vt = data.vt
        }));
        bool flag2 = false;
        IEnumerator<VB\u0024AnonymousType_64<OrdSection, SectionsRouting, IEnumerable<LaborVoucher>>> enumerator1;
        if (source1.Count() == 0)
        {
          ParameterExpression parameterExpression2;
          // ISSUE: reference to a compiler-generated field
          IQueryable<OrdSection> source2 = (IQueryable<OrdSection>) Queryable.Select<OrdSection, OrdSection>(Queryable.Where<OrdSection>((IQueryable<M0>) se0085CtEntities1.OrdSections, (Expression<Func<M0, bool>>) Expression.Lambda<Func<OrdSection, bool>>((Expression) Expression.Equal(s.OrdSectsId, closure154.\u0024VB\u0024Local_SectionId, true, (MethodInfo) null), new ParameterExpression[1]
          {
            parameterExpression2
          })), (Expression<Func<M0, M1>>) (s => s));
          IEnumerator<OrdSection> enumerator2;
          if (delSection)
          {
            if (source2.Count<OrdSection>() != 0)
            {
              try
              {
                enumerator2 = source2.GetEnumerator();
                while (enumerator2.MoveNext())
                {
                  OrdSection current = enumerator2.Current;
                  try
                  {
                    se0085CtEntities1.OrdSections.Remove(current);
                    flag2 = true;
                  }
                  catch (Exception ex)
                  {
                    ProjectData.SetProjectError(ex);
                    flag1 = false;
                    ProjectData.ClearProjectError();
                    goto label_63;
                  }
                }
              }
              finally
              {
                if (enumerator2 != null)
                  enumerator2.Dispose();
              }
            }
          }
        }
        else
        {
          try
          {
            enumerator1 = source1.GetEnumerator();
            while (enumerator1.MoveNext())
            {
              var current1 = enumerator1.Current;
              if (delVouchers)
              {
                if (current1.vt.Count<LaborVoucher>() != 0)
                {
                  try
                  {
                    IEnumerator<LaborVoucher> enumerator2;
                    try
                    {
                      enumerator2 = current1.vt.GetEnumerator();
                      while (enumerator2.MoveNext())
                      {
                        LaborVoucher current2 = enumerator2.Current;
                        se0085CtEntities1.LaborVouchers.Remove(current2);
                        flag2 = true;
                      }
                    }
                    finally
                    {
                      if (enumerator2 != null)
                        enumerator2.Dispose();
                    }
                  }
                  catch (Exception ex)
                  {
                    ProjectData.SetProjectError(ex);
                    flag1 = false;
                    ProjectData.ClearProjectError();
                    goto label_63;
                  }
                }
              }
              if (delRouting)
              {
                if (current1.r != null)
                {
                  try
                  {
                    se0085CtEntities1.SectionsRoutings.Remove(current1.r);
                    flag2 = true;
                  }
                  catch (Exception ex)
                  {
                    ProjectData.SetProjectError(ex);
                    flag1 = false;
                    ProjectData.ClearProjectError();
                    goto label_63;
                  }
                }
              }
              if (delSection)
              {
                if (current1.s != null)
                {
                  try
                  {
                    se0085CtEntities1.OrdSections.Remove(current1.s);
                    flag2 = true;
                  }
                  catch (Exception ex)
                  {
                    ProjectData.SetProjectError(ex);
                    flag1 = false;
                    ProjectData.ClearProjectError();
                    goto label_63;
                  }
                }
              }
            }
          }
          finally
          {
            if (enumerator1 != null)
              enumerator1.Dispose();
          }
        }
        if (flag2)
        {
          try
          {
            num = se0085CtEntities1.SaveChanges();
          }
          catch (Exception ex)
          {
            ProjectData.SetProjectError(ex);
            Exception exception = ex;
            // ISSUE: reference to a compiler-generated field
            this.lcLogWriter.logData("Section Delete Failed! " + Conversions.ToString(closure154.\u0024VB\u0024Local_SectionId) + " Error; " + exception.Message);
            ProjectData.ClearProjectError();
          }
        }
        se0085CtEntities1.Database.Connection.Close();
      }
      flag1 = num > 0;
label_63:
      return flag1;
    }

    public bool dBDeleteDataByRoutingId(int RoutingId, bool delRouting = false, bool delVouchers = false)
    {
      // ISSUE: object of a compiler-generated type is created
      // ISSUE: variable of a compiler-generated type
      clsEngineMES._Closure\u0024__155 closure155 = new clsEngineMES._Closure\u0024__155();
      // ISSUE: reference to a compiler-generated field
      closure155.\u0024VB\u0024Local_RoutingId = RoutingId;
      int num = 0;
      bool flag1;
      if (delRouting)
        delVouchers = true;
      else if (!delVouchers)
      {
        flag1 = false;
        goto label_35;
      }
      using (SE0085CTEntities1 se0085CtEntities1 = new SE0085CTEntities1())
      {
        se0085CtEntities1.Database.Connection.ConnectionString = this._CTConnection;
        ParameterExpression parameterExpression;
        // ISSUE: reference to a compiler-generated field
        IQueryable<VB\u0024AnonymousType_65<SectionsRouting, IEnumerable<LaborVoucher>>> source = Queryable.Select(Queryable.Where((IQueryable<M0>) Queryable.GroupJoin((IQueryable<M0>) se0085CtEntities1.SectionsRoutings, (IEnumerable<M1>) se0085CtEntities1.LaborVouchers, (Expression<Func<M0, M2>>) (r => r.RoutingId), (Expression<Func<M1, M2>>) (v => v.SectionsRouting.RoutingId), (Expression<Func<M0, IEnumerable<M1>, M3>>) ((r, laborVouchers) => new
        {
          r = r,
          vt = laborVouchers
        })), (Expression<Func<M0, bool>>) Expression.Lambda<Func<VB\u0024AnonymousType_65<SectionsRouting, IEnumerable<LaborVoucher>>, bool>>((Expression) Expression.Equal(\u0024VB\u0024It.r.RoutingId, closure155.\u0024VB\u0024Local_RoutingId, true, (MethodInfo) null), new ParameterExpression[1]
        {
          parameterExpression
        })), (Expression<Func<M0, M1>>) (data => new
        {
          r = data.r,
          vt = data.vt
        }));
        bool flag2 = false;
        IEnumerator<VB\u0024AnonymousType_65<SectionsRouting, IEnumerable<LaborVoucher>>> enumerator1;
        if (source.Count() != 0)
        {
          try
          {
            enumerator1 = source.GetEnumerator();
            while (enumerator1.MoveNext())
            {
              var current1 = enumerator1.Current;
              if (delVouchers)
              {
                if (current1.vt.Count<LaborVoucher>() != 0)
                {
                  try
                  {
                    IEnumerator<LaborVoucher> enumerator2;
                    try
                    {
                      enumerator2 = current1.vt.GetEnumerator();
                      while (enumerator2.MoveNext())
                      {
                        LaborVoucher current2 = enumerator2.Current;
                        se0085CtEntities1.LaborVouchers.Remove(current2);
                        flag2 = true;
                      }
                    }
                    finally
                    {
                      if (enumerator2 != null)
                        enumerator2.Dispose();
                    }
                  }
                  catch (Exception ex)
                  {
                    ProjectData.SetProjectError(ex);
                    flag1 = false;
                    ProjectData.ClearProjectError();
                    goto label_35;
                  }
                }
              }
              if (delRouting)
              {
                if (current1.r != null)
                {
                  try
                  {
                    se0085CtEntities1.SectionsRoutings.Remove(current1.r);
                    flag2 = true;
                  }
                  catch (Exception ex)
                  {
                    ProjectData.SetProjectError(ex);
                    flag1 = false;
                    ProjectData.ClearProjectError();
                    goto label_35;
                  }
                }
              }
            }
          }
          finally
          {
            if (enumerator1 != null)
              enumerator1.Dispose();
          }
        }
        if (flag2)
          num = se0085CtEntities1.SaveChanges();
        se0085CtEntities1.Database.Connection.Close();
      }
      flag1 = num > 0;
label_35:
      return flag1;
    }

    public void ScheduleOrder(ref List<scMESUpdateFull> OrderList)
    {
      // ISSUE: object of a compiler-generated type is created
      // ISSUE: variable of a compiler-generated type
      clsEngineMES._Closure\u0024__156 closure156 = new clsEngineMES._Closure\u0024__156();
      DateTime[] TargetDate = new DateTime[26];
      int index1 = 0;
      do
      {
        TargetDate[index1] = Conversions.ToDate("01/01/2020");
        checked { ++index1; }
      }
      while (index1 <= 24);
      string OrdSER = " ";
      string ElecClpx = "1";
      string MechClpx = "1";
      int SectCnt = 1;
      // ISSUE: reference to a compiler-generated field
      closure156.\u0024VB\u0024Local_ldCurrentWC = "";
      // ISSUE: reference to a compiler-generated field
      closure156.\u0024VB\u0024Local_ldWCList = new List<string>();
      // ISSUE: reference to a compiler-generated field
      closure156.\u0024VB\u0024Local_ldWCList.Add("SHIPPING");
      // ISSUE: reference to a compiler-generated field
      closure156.\u0024VB\u0024Local_ldWCList.Add("SHIP");
      Conversions.ToDate("01/01/1901");
      // ISSUE: reference to a compiler-generated field
      closure156.\u0024VB\u0024Local_ldOrderFO = OrderList[0].hd_q2c_nbr;
      // ISSUE: reference to a compiler-generated field
      closure156.\u0024VB\u0024Local_ldOrderLineNum = OrderList[0].od_ln_dsply_seq_nbr;
      // ISSUE: reference to a compiler-generated field
      closure156.\u0024VB\u0024Local_ldOrderLineSL = OrderList[0].hd_sub_ln_itm_id;
      // ISSUE: reference to a compiler-generated field
      closure156.\u0024VB\u0024Local_ldOrderLineSS = OrderList[0].hd_orig_shpschd_id;
      using (SE0085CTEntities1 se0085CtEntities1 = new SE0085CTEntities1())
      {
        se0085CtEntities1.Database.Connection.ConnectionString = this._CTConnection;
        // ISSUE: method reference
        // ISSUE: reference to a compiler-generated field
        // ISSUE: method reference
        // ISSUE: reference to a compiler-generated field
        // ISSUE: method reference
        // ISSUE: reference to a compiler-generated field
        // ISSUE: method reference
        // ISSUE: reference to a compiler-generated field
        IQueryable<VB\u0024AnonymousType_67<DateTime?, string, string, string>> source1 = Queryable.Select(Queryable.Where((IQueryable<M0>) Queryable.Join((IQueryable<M0>) Queryable.Join((IQueryable<M0>) se0085CtEntities1.SEOrders, (IEnumerable<M1>) se0085CtEntities1.OrderLines, (Expression<Func<M0, M2>>) (od => od.OrderId), (Expression<Func<M1, M2>>) (ol => ol.SEOrder.OrderId), (Expression<Func<M0, M1, M3>>) ((od, ol) => new{ od = od, ol = ol })), (IEnumerable<M1>) se0085CtEntities1.OrderLinesExts, (Expression<Func<M0, M2>>) (data => data.ol.OrderLineId), (Expression<Func<M1, M2>>) (oe => oe.OrderLine.OrderLineId), (Expression<Func<M0, M1, M3>>) ((data, oe) => new
        {
          od = data.od,
          ol = data.ol,
          oe = oe
        })), (Expression<Func<M0, bool>>) (data => Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), data.od.OrderFO, closure156.\u0024VB\u0024Local_ldOrderFO, false) == 0 & Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), data.ol.OrderLineNum, closure156.\u0024VB\u0024Local_ldOrderLineNum, false) == 0 & Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), data.ol.OrderLineSL, closure156.\u0024VB\u0024Local_ldOrderLineSL, false) == 0 & Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), data.ol.OrderLineSS, closure156.\u0024VB\u0024Local_ldOrderLineSS, false) == 0)), (Expression<Func<M0, M1>>) (data => new
        {
          OrderLineCurTargetDt = data.oe.OrderLineCurTargetDt,
          OrderLineSER = data.ol.OrderLineSER,
          OrderLineElecClpx = data.oe.OrderLineElecClpx,
          OrderLineMechClpx = data.oe.OrderLineMechClpx
        }));
        if (source1 != null && source1.Count() > 0)
        {
          int index2 = 0;
          do
          {
            TargetDate[index2] = (DateTime) source1.FirstOrDefault().OrderLineCurTargetDt;
            checked { ++index2; }
          }
          while (index2 <= 24);
          OrdSER = source1.FirstOrDefault().OrderLineSER;
          ElecClpx = source1.FirstOrDefault().OrderLineElecClpx;
          MechClpx = source1.FirstOrDefault().OrderLineMechClpx;
        }
        ParameterExpression parameterExpression;
        IQueryable<RoutingSeq> source2 = (IQueryable<RoutingSeq>) Queryable.Select<RoutingSeq, RoutingSeq>(Queryable.Where<RoutingSeq>((IQueryable<M0>) se0085CtEntities1.RoutingSeqs, (Expression<Func<M0, bool>>) Expression.Lambda<Func<RoutingSeq, bool>>((Expression) Expression.Equal(rs.AssemblyLine.AssemLineId, this._AssemblyLine.LevelId, true, (MethodInfo) null), new ParameterExpression[1]
        {
          parameterExpression
        })), (Expression<Func<M0, M1>>) (rs => rs));
        if (source2 != null && source2.Count<RoutingSeq>() > 0)
        {
          // ISSUE: method pointer
          Dictionary<string, RoutingSeq> dictionary = (Dictionary<string, RoutingSeq>) Enumerable.ToDictionary<RoutingSeq, string>((IEnumerable<M0>) source2, (Func<M0, M1>) new Func<RoutingSeq, string>((object) null, __methodptr(_Lambda\u0024__87)));
          // ISSUE: reference to a compiler-generated field
          do
          {
            IQueryable<string> source3;
            do
            {
              // ISSUE: reference to a compiler-generated field
              // ISSUE: reference to a compiler-generated field
              closure156.\u0024VB\u0024Local_ldCurrentWC = closure156.\u0024VB\u0024Local_ldWCList[0];
              // ISSUE: reference to a compiler-generated field
              if (dictionary.ContainsKey(closure156.\u0024VB\u0024Local_ldCurrentWC))
              {
                List<scMESUpdateFull> scMesUpdateFullList = OrderList;
                // ISSUE: virtual method pointer
                IntPtr num = __vmethodptr(closure156, _Lambda\u0024__88);
                Func<scMESUpdateFull, bool> func = new Func<scMESUpdateFull, bool>((object) closure156, num);
                // ISSUE: method pointer
                // ISSUE: method pointer
                IEnumerable<scMESUpdateFull> source4 = (IEnumerable<scMESUpdateFull>) Enumerable.Select<scMESUpdateFull, scMESUpdateFull>((IEnumerable<M0>) Enumerable.OrderBy<scMESUpdateFull, int>(Enumerable.Where<scMESUpdateFull>((IEnumerable<M0>) scMesUpdateFullList, (Func<M0, bool>) func), (Func<M0, M1>) new Func<scMESUpdateFull, int>((object) null, __methodptr(_Lambda\u0024__89))), (Func<M0, M1>) new Func<scMESUpdateFull, scMESUpdateFull>((object) null, __methodptr(_Lambda\u0024__90)));
                if (source4 != null && source4.Count<scMESUpdateFull>() > 0)
                {
                  SectCnt = 0;
                  IEnumerator<scMESUpdateFull> enumerator;
                  try
                  {
                    enumerator = source4.GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                      scMESUpdateFull current = enumerator.Current;
                      checked { ++SectCnt; }
                      current.od_trgt_dt = TargetDate[current.hd_sect_id];
                      this.ScheduleWC(ref dictionary, ref current, OrdSER, ElecClpx, MechClpx, SectCnt);
                    }
                  }
                  finally
                  {
                    if (enumerator != null)
                      enumerator.Dispose();
                  }
                  // ISSUE: reference to a compiler-generated field
                  this.SyncShipSplt(ref OrderList, closure156.\u0024VB\u0024Local_ldCurrentWC);
                }
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated field
                if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(dictionary[closure156.\u0024VB\u0024Local_ldCurrentWC].RtSeqSeries, "PRIMARY", false) == 0 | Microsoft.VisualBasic.CompilerServices.Operators.CompareString(dictionary[closure156.\u0024VB\u0024Local_ldCurrentWC].RtSeqSeries, "PRIMRY", false) == 0)
                {
                  bool flag = true;
                  // ISSUE: reference to a compiler-generated field
                  bool? rtSeqSync2Wc = dictionary[closure156.\u0024VB\u0024Local_ldCurrentWC].RtSeqSync2WC;
                  IEnumerator<scMESUpdateFull> enumerator1;
                  if ((rtSeqSync2Wc.HasValue ? new bool?(rtSeqSync2Wc.GetValueOrDefault() == flag) : new bool?()).GetValueOrDefault())
                  {
                    DateTime t2 = Conversions.ToDate("12/31/2039");
                    IEnumerator<scMESUpdateFull> enumerator2;
                    try
                    {
                      enumerator2 = source4.GetEnumerator();
                      while (enumerator2.MoveNext())
                      {
                        scMESUpdateFull current = enumerator2.Current;
                        if (DateTime.Compare(current.due_st, t2) < 0)
                          t2 = current.due_st;
                      }
                    }
                    finally
                    {
                      if (enumerator2 != null)
                        enumerator2.Dispose();
                    }
                    IEnumerator<scMESUpdateFull> enumerator3;
                    try
                    {
                      enumerator3 = source4.GetEnumerator();
                      while (enumerator3.MoveNext())
                      {
                        scMESUpdateFull current = enumerator3.Current;
                        TargetDate[current.hd_sect_id] = t2;
                      }
                    }
                    finally
                    {
                      if (enumerator3 != null)
                        enumerator3.Dispose();
                    }
                  }
                  else
                  {
                    try
                    {
                      enumerator1 = source4.GetEnumerator();
                      while (enumerator1.MoveNext())
                      {
                        scMESUpdateFull current = enumerator1.Current;
                        TargetDate[current.hd_sect_id] = current.due_st;
                      }
                    }
                    finally
                    {
                      if (enumerator1 != null)
                        enumerator1.Dispose();
                    }
                  }
                }
              }
              // ISSUE: reference to a compiler-generated field
              // ISSUE: reference to a compiler-generated field
              closure156.\u0024VB\u0024Local_ldWCList.Remove(closure156.\u0024VB\u0024Local_ldCurrentWC);
              // ISSUE: method reference
              // ISSUE: method reference
              // ISSUE: method reference
              // ISSUE: reference to a compiler-generated field
              IQueryable<string> source5 = (IQueryable<string>) Queryable.Select<RoutingSeq, string>(Queryable.Where<RoutingSeq>((IQueryable<M0>) source2, (Expression<Func<M0, bool>>) (rt => !(Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), rt.RtSeqSeries, "PRIMARY", false) == 0 | Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), rt.RtSeqSeries, "PRIMRY", false) == 0) & Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), rt.RtSeqNextWorkCtr, closure156.\u0024VB\u0024Local_ldCurrentWC, false) == 0)), (Expression<Func<M0, M1>>) (rt => rt.RtSeqWorkCenter));
              List<string>.Enumerator enumerator4;
              if (source5 != null)
              {
                if (source5.Count<string>() > 0)
                {
                  try
                  {
                    enumerator4 = source5.ToList<string>().GetEnumerator();
                    while (enumerator4.MoveNext())
                    {
                      string current = enumerator4.Current;
                      this.ScheduleSubProc(ref OrderList, dictionary[current].RtSeqSeries, current, OrdSER, ElecClpx, MechClpx, SectCnt, TargetDate);
                    }
                  }
                  finally
                  {
                    enumerator4.Dispose();
                  }
                }
              }
              // ISSUE: method reference
              // ISSUE: method reference
              // ISSUE: method reference
              // ISSUE: reference to a compiler-generated field
              source3 = (IQueryable<string>) Queryable.Select<RoutingSeq, string>(Queryable.Where<RoutingSeq>((IQueryable<M0>) source2, (Expression<Func<M0, bool>>) (rt => (Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), rt.RtSeqSeries, "PRIMARY", false) == 0 | Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), rt.RtSeqSeries, "PRIMRY", false) == 0) & Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), rt.RtSeqNextWorkCtr, closure156.\u0024VB\u0024Local_ldCurrentWC, false) == 0)), (Expression<Func<M0, M1>>) (rt => rt.RtSeqWorkCenter));
            }
            while (source3 == null);
            List<string>.Enumerator enumerator5;
            if (source3.Count<string>() > 0)
            {
              try
              {
                enumerator5 = source3.ToList<string>().GetEnumerator();
                while (enumerator5.MoveNext())
                {
                  string current = enumerator5.Current;
                  // ISSUE: reference to a compiler-generated field
                  if (!closure156.\u0024VB\u0024Local_ldWCList.Contains(current))
                  {
                    // ISSUE: reference to a compiler-generated field
                    closure156.\u0024VB\u0024Local_ldWCList.Add(current);
                  }
                }
              }
              finally
              {
                enumerator5.Dispose();
              }
            }
            else
            {
              // ISSUE: reference to a compiler-generated field
              if (closure156.\u0024VB\u0024Local_ldWCList.Count == 0)
                break;
            }
          }
          while (closure156.\u0024VB\u0024Local_ldWCList.Count != 0);
        }
        se0085CtEntities1.Database.Connection.Close();
      }
    }

    public void ScheduleSubProc(ref List<scMESUpdateFull> OrderList, string SubSeq, string SubProcTieWC, string OrdSER, string ElecClpx, string MechClpx, int SectCnt, DateTime[] TargetDate)
    {
      // ISSUE: object of a compiler-generated type is created
      // ISSUE: variable of a compiler-generated type
      clsEngineMES._Closure\u0024__157 closure157 = new clsEngineMES._Closure\u0024__157();
      // ISSUE: reference to a compiler-generated field
      closure157.\u0024VB\u0024Local_SubSeq = SubSeq;
      // ISSUE: reference to a compiler-generated field
      closure157.\u0024VB\u0024Local_ldCurrentWC = "";
      // ISSUE: reference to a compiler-generated field
      closure157.\u0024VB\u0024Local_ldWCList = new List<string>();
      // ISSUE: reference to a compiler-generated field
      closure157.\u0024VB\u0024Local_ldWCList.Add(SubProcTieWC);
      Conversions.ToDate("01/01/1901");
      DateTime[] dateTimeArray = new DateTime[26];
      int index = 0;
      do
      {
        dateTimeArray[index] = TargetDate[index];
        checked { ++index; }
      }
      while (index <= 24);
      using (SE0085CTEntities1 se0085CtEntities1 = new SE0085CTEntities1())
      {
        se0085CtEntities1.Database.Connection.ConnectionString = this._CTConnection;
        ParameterExpression parameterExpression;
        IQueryable<RoutingSeq> source1 = (IQueryable<RoutingSeq>) Queryable.Select<RoutingSeq, RoutingSeq>(Queryable.Where<RoutingSeq>((IQueryable<M0>) se0085CtEntities1.RoutingSeqs, (Expression<Func<M0, bool>>) Expression.Lambda<Func<RoutingSeq, bool>>((Expression) Expression.Equal(rs.AssemblyLine.AssemLineId, this._AssemblyLine.LevelId, true, (MethodInfo) null), new ParameterExpression[1]
        {
          parameterExpression
        })), (Expression<Func<M0, M1>>) (rs => rs));
        if (source1 != null && source1.Count<RoutingSeq>() > 0)
        {
          // ISSUE: method pointer
          Dictionary<string, RoutingSeq> dictionary = (Dictionary<string, RoutingSeq>) Enumerable.ToDictionary<RoutingSeq, string>((IEnumerable<M0>) source1, (Func<M0, M1>) new Func<RoutingSeq, string>((object) null, __methodptr(_Lambda\u0024__91)));
          // ISSUE: reference to a compiler-generated field
          do
          {
            IQueryable<string> source2;
            do
            {
              // ISSUE: reference to a compiler-generated field
              // ISSUE: reference to a compiler-generated field
              closure157.\u0024VB\u0024Local_ldCurrentWC = closure157.\u0024VB\u0024Local_ldWCList[0];
              List<scMESUpdateFull> scMesUpdateFullList = OrderList;
              // ISSUE: virtual method pointer
              IntPtr num = __vmethodptr(closure157, _Lambda\u0024__92);
              Func<scMESUpdateFull, bool> func = new Func<scMESUpdateFull, bool>((object) closure157, num);
              // ISSUE: method pointer
              // ISSUE: method pointer
              IEnumerable<scMESUpdateFull> source3 = (IEnumerable<scMESUpdateFull>) Enumerable.Select<scMESUpdateFull, scMESUpdateFull>((IEnumerable<M0>) Enumerable.OrderBy<scMESUpdateFull, int>(Enumerable.Where<scMESUpdateFull>((IEnumerable<M0>) scMesUpdateFullList, (Func<M0, bool>) func), (Func<M0, M1>) new Func<scMESUpdateFull, int>((object) null, __methodptr(_Lambda\u0024__93))), (Func<M0, M1>) new Func<scMESUpdateFull, scMESUpdateFull>((object) null, __methodptr(_Lambda\u0024__94)));
              if (source3 != null)
              {
                if (source3.Count<scMESUpdateFull>() > 0)
                {
                  IEnumerator<scMESUpdateFull> enumerator;
                  try
                  {
                    enumerator = source3.GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                      scMESUpdateFull current = enumerator.Current;
                      current.od_trgt_dt = dateTimeArray[current.hd_sect_id];
                      current.RoutingProcessed = this.ScheduleWC(ref dictionary, ref current, OrdSER, ElecClpx, MechClpx, SectCnt);
                    }
                  }
                  finally
                  {
                    if (enumerator != null)
                      enumerator.Dispose();
                  }
                  // ISSUE: reference to a compiler-generated field
                  this.SyncShipSplt(ref OrderList, closure157.\u0024VB\u0024Local_ldCurrentWC);
                }
              }
              IEnumerator<scMESUpdateFull> enumerator1;
              // ISSUE: reference to a compiler-generated field
              // ISSUE: reference to a compiler-generated field
              if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(dictionary[closure157.\u0024VB\u0024Local_ldCurrentWC].RtSeqSeries, closure157.\u0024VB\u0024Local_SubSeq, false) == 0)
              {
                try
                {
                  enumerator1 = source3.GetEnumerator();
                  while (enumerator1.MoveNext())
                  {
                    scMESUpdateFull current = enumerator1.Current;
                    dateTimeArray[current.hd_sect_id] = current.due_st;
                  }
                }
                finally
                {
                  if (enumerator1 != null)
                    enumerator1.Dispose();
                }
              }
              // ISSUE: reference to a compiler-generated field
              // ISSUE: reference to a compiler-generated field
              closure157.\u0024VB\u0024Local_ldWCList.Remove(closure157.\u0024VB\u0024Local_ldCurrentWC);
              // ISSUE: method reference
              // ISSUE: reference to a compiler-generated field
              // ISSUE: method reference
              // ISSUE: reference to a compiler-generated field
              source2 = (IQueryable<string>) Queryable.Select<RoutingSeq, string>(Queryable.Where<RoutingSeq>((IQueryable<M0>) source1, (Expression<Func<M0, bool>>) (rt => Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), rt.RtSeqSeries, closure157.\u0024VB\u0024Local_SubSeq, false) == 0 & Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Microsoft.VisualBasic.CompilerServices.Operators.CompareString)), rt.RtSeqNextWorkCtr, closure157.\u0024VB\u0024Local_ldCurrentWC, false) == 0)), (Expression<Func<M0, M1>>) (rt => rt.RtSeqWorkCenter));
            }
            while (source2 == null);
            List<string>.Enumerator enumerator2;
            if (source2.Count<string>() > 0)
            {
              try
              {
                enumerator2 = source2.ToList<string>().GetEnumerator();
                while (enumerator2.MoveNext())
                {
                  string current = enumerator2.Current;
                  // ISSUE: reference to a compiler-generated field
                  if (!closure157.\u0024VB\u0024Local_ldWCList.Contains(current))
                  {
                    // ISSUE: reference to a compiler-generated field
                    closure157.\u0024VB\u0024Local_ldWCList.Add(current);
                  }
                }
              }
              finally
              {
                enumerator2.Dispose();
              }
            }
            else
            {
              // ISSUE: reference to a compiler-generated field
              if (closure157.\u0024VB\u0024Local_ldWCList.Count == 0)
                break;
            }
          }
          while (closure157.\u0024VB\u0024Local_ldWCList.Count != 0);
        }
        se0085CtEntities1.Database.Connection.Close();
      }
    }

    private void SyncShipSplt(ref List<scMESUpdateFull> OrderList, string WorkCenter)
    {
      // ISSUE: object of a compiler-generated type is created
      // ISSUE: variable of a compiler-generated type
      clsEngineMES._Closure\u0024__158 closure158 = new clsEngineMES._Closure\u0024__158();
      // ISSUE: reference to a compiler-generated field
      closure158.\u0024VB\u0024Local_WorkCenter = WorkCenter;
      List<scMESUpdateFull> scMesUpdateFullList = OrderList;
      // ISSUE: virtual method pointer
      IntPtr num1 = __vmethodptr(closure158, _Lambda\u0024__95);
      Func<scMESUpdateFull, bool> func1 = new Func<scMESUpdateFull, bool>((object) closure158, num1);
      // ISSUE: method pointer
      // ISSUE: method pointer
      IEnumerable<scMESUpdateFull> source1 = (IEnumerable<scMESUpdateFull>) Enumerable.Select<scMESUpdateFull, scMESUpdateFull>((IEnumerable<M0>) Enumerable.OrderBy<scMESUpdateFull, int>(Enumerable.Where<scMESUpdateFull>((IEnumerable<M0>) scMesUpdateFullList, (Func<M0, bool>) func1), (Func<M0, M1>) new Func<scMESUpdateFull, int>((object) null, __methodptr(_Lambda\u0024__96))), (Func<M0, M1>) new Func<scMESUpdateFull, scMESUpdateFull>((object) null, __methodptr(_Lambda\u0024__97)));
      if (source1 == null || source1.Count<scMESUpdateFull>() <= 0)
        return;
      // ISSUE: method pointer
      List<int> list = ((IEnumerable<int>) Enumerable.Select<scMESUpdateFull, int>((IEnumerable<M0>) source1, (Func<M0, M1>) new Func<scMESUpdateFull, int>((object) null, __methodptr(_Lambda\u0024__98)))).Distinct<int>().ToList<int>();
      DateTime[] dateTimeArray1 = new DateTime[checked (list.Count + 1)];
      DateTime[] dateTimeArray2 = new DateTime[checked (list.Count + 1)];
      int num2 = 0;
      int num3 = checked (list.Count - 1);
      int index1 = num2;
      while (index1 <= num3)
      {
        // ISSUE: object of a compiler-generated type is created
        // ISSUE: variable of a compiler-generated type
        clsEngineMES._Closure\u0024__158._Closure\u0024__159 other = new clsEngineMES._Closure\u0024__158._Closure\u0024__159(other);
        // ISSUE: reference to a compiler-generated field
        other.\u0024VB\u0024Local_ldShipSplt = list[index1];
        IEnumerable<scMESUpdateFull> scMesUpdateFulls = source1;
        // ISSUE: variable of a compiler-generated type
        clsEngineMES._Closure\u0024__158._Closure\u0024__159 closure159 = other;
        // ISSUE: virtual method pointer
        IntPtr num4 = __vmethodptr(closure159, _Lambda\u0024__99);
        Func<scMESUpdateFull, bool> func2 = new Func<scMESUpdateFull, bool>((object) closure159, num4);
        // ISSUE: method pointer
        // ISSUE: method pointer
        // ISSUE: method pointer
        // ISSUE: method pointer
        IEnumerable<VB\u0024AnonymousType_69<DateTime, DateTime>> source2 = Enumerable.Select((IEnumerable<M0>) Enumerable.GroupBy(Enumerable.Where<scMESUpdateFull>((IEnumerable<M0>) scMesUpdateFulls, (Func<M0, bool>) func2), (Func<M0, M1>) new Func<scMESUpdateFull, int>((object) null, __methodptr(_Lambda\u0024__100)), (Func<M0, M2>) new Func<scMESUpdateFull, scMESUpdateFull>((object) null, __methodptr(_Lambda\u0024__101)), (Func<M1, IEnumerable<M2>, M3>) new Func<int, IEnumerable<scMESUpdateFull>, VB\u0024AnonymousType_68<int, IEnumerable<scMESUpdateFull>>>((object) null, __methodptr(_Lambda\u0024__102))), (Func<M0, M1>) new Func<VB\u0024AnonymousType_68<int, IEnumerable<scMESUpdateFull>>, VB\u0024AnonymousType_69<DateTime, DateTime>>((object) null, __methodptr(_Lambda\u0024__103)));
        dateTimeArray1[index1] = source2.First().due_st;
        dateTimeArray2[index1] = source2.First().due_fn;
        checked { ++index1; }
      }
      IEnumerator<scMESUpdateFull> enumerator;
      try
      {
        enumerator = source1.GetEnumerator();
        while (enumerator.MoveNext())
        {
          scMESUpdateFull current = enumerator.Current;
          int num4 = 0;
          int num5 = checked (list.Count - 1);
          int index2 = num4;
          while (index2 <= num5)
          {
            if (current.hd_shp_splt == list[index2])
            {
              current.due_st = dateTimeArray1[index2];
              current.due_fn = dateTimeArray2[index2];
            }
            checked { ++index2; }
          }
        }
      }
      finally
      {
        if (enumerator != null)
          enumerator.Dispose();
      }
    }

    private bool ScheduleWC(ref Dictionary<string, RoutingSeq> WCDef, ref scMESUpdateFull RtStep, string OrdSER, string ElecClpx, string MechClpx, int SectCnt)
    {
      int num1 = 16;
      int num2 = 0;
      if (WCDef.ContainsKey(WCDef[RtStep.dt_eto_workctr].RtSeqNextWorkCtr))
        num2 = (int) WCDef[WCDef[RtStep.dt_eto_workctr].RtSeqNextWorkCtr].RtSeqQueueTm;
      int num3 = 0;
      int? nullable1 = WCDef[RtStep.dt_eto_workctr].RtSeqLeadTm;
      bool? nullable2;
      bool? nullable3;
      if (!nullable1.HasValue)
      {
        nullable3 = new bool?();
      }
      else
      {
        nullable2 = new bool?(nullable1.GetValueOrDefault() > num3);
        nullable3 = nullable2;
      }
      int? nullable4;
      int? nullable5;
      if (nullable3.GetValueOrDefault())
      {
        nullable4 = WCDef[RtStep.dt_eto_workctr].RtSeqLeadTm;
        int? nullable6;
        if (!nullable4.HasValue)
        {
          nullable6 = new int?();
        }
        else
        {
          nullable5 = new int?(checked (num2 + nullable4.GetValueOrDefault()));
          nullable6 = nullable5;
        }
        num2 = (int) nullable6;
      }
      DateTime dateTime1;
      if (num2 > 0)
      {
        scMESUpdateFull scMesUpdateFull = RtStep;
        dateTime1 = RtStep.od_trgt_dt;
        DateTime dateTime2 = dateTime1.AddMinutes((double) checked (-1 * num2));
        scMesUpdateFull.due_fn = dateTime2;
      }
      else
        RtStep.due_fn = RtStep.od_trgt_dt;
      int num4 = (int) WCDef[RtStep.dt_eto_workctr].RtSeqBaseTm;
      int num5 = 0;
      if (this._dtLaborContent.ContainsKey(RtStep.dt_eto_workctr))
      {
        num5 = this.LoadLabor(RtStep);
        checked { num4 += num5; }
      }
      int num6 = 0;
      nullable5 = WCDef[RtStep.dt_eto_workctr].RtSeqFeatureTm1;
      bool? nullable7 = nullable5.HasValue ? new bool?(nullable5.GetValueOrDefault() > num6) : new bool?();
      int num7 = 0;
      nullable4 = WCDef[RtStep.dt_eto_workctr].RtSeqFeatureTm2;
      bool? nullable8 = nullable4.HasValue ? new bool?(nullable4.GetValueOrDefault() > num7) : new bool?();
      bool? nullable9 = !nullable7.HasValue || !nullable7.GetValueOrDefault() ? (nullable8.HasValue ? (nullable8.GetValueOrDefault() ? new bool?(true) : nullable7) : new bool?()) : new bool?(true);
      int num8 = 0;
      nullable1 = WCDef[RtStep.dt_eto_workctr].RtSeqFeatureTm3;
      bool? nullable10 = nullable1.HasValue ? new bool?(nullable1.GetValueOrDefault() > num8) : new bool?();
      bool? nullable11 = !nullable9.HasValue || !nullable9.GetValueOrDefault() ? (nullable10.HasValue ? (nullable10.GetValueOrDefault() ? new bool?(true) : nullable9) : new bool?()) : new bool?(true);
      int num9 = 0;
      int? nullable12 = WCDef[RtStep.dt_eto_workctr].RtSeqFeatureTm4;
      bool? nullable13;
      bool? nullable14;
      if (!nullable12.HasValue)
      {
        nullable14 = new bool?();
      }
      else
      {
        nullable13 = new bool?(nullable12.GetValueOrDefault() > num9);
        nullable14 = nullable13;
      }
      bool? nullable15 = nullable14;
      bool? nullable16 = !nullable11.HasValue || !nullable11.GetValueOrDefault() ? (nullable15.HasValue ? (nullable15.GetValueOrDefault() ? new bool?(true) : nullable11) : new bool?()) : new bool?(true);
      int num10 = 0;
      int? nullable17 = WCDef[RtStep.dt_eto_workctr].RtSeqFeatureTm5;
      bool? nullable18;
      bool? nullable19;
      if (!nullable17.HasValue)
      {
        nullable19 = new bool?();
      }
      else
      {
        nullable18 = new bool?(nullable17.GetValueOrDefault() > num10);
        nullable19 = nullable18;
      }
      bool? nullable20 = nullable19;
      nullable2 = !nullable16.HasValue || !nullable16.GetValueOrDefault() ? (nullable20.HasValue ? (nullable20.GetValueOrDefault() ? new bool?(true) : nullable16) : new bool?()) : new bool?(true);
      if (nullable2.GetValueOrDefault())
      {
        string[] strArray = WCDef[RtStep.dt_eto_workctr].RtSeqFeatureKey.Split(':');
        int num11 = 0;
        nullable17 = WCDef[RtStep.dt_eto_workctr].RtSeqFeatureTm1;
        bool? nullable6;
        if (!nullable17.HasValue)
        {
          nullable6 = new bool?();
        }
        else
        {
          nullable13 = new bool?(nullable17.GetValueOrDefault() > num11);
          nullable6 = nullable13;
        }
        nullable18 = nullable6;
        double? nullable21;
        double? nullable22;
        double? nullable23;
        double? nullable24;
        if (nullable18.GetValueOrDefault() && ((IEnumerable<string>) strArray).Count<string>() > 0)
        {
          string str = strArray[0].Substring(checked (strArray[0].IndexOf(";") + 1));
          if (OrdSER.Contains(str.Trim()))
          {
            if (str.Trim().Contains("PLC"))
            {
              if (num5 > 1440)
              {
                nullable17 = WCDef[RtStep.dt_eto_workctr].RtSeqFeatureTm1;
                int? nullable25;
                if (!nullable17.HasValue)
                {
                  nullable25 = new int?();
                }
                else
                {
                  nullable12 = new int?(checked (num4 + nullable17.GetValueOrDefault()));
                  nullable25 = nullable12;
                }
                num4 = (int) nullable25;
              }
            }
            else
            {
              nullable17 = WCDef[RtStep.dt_eto_workctr].RtSeqFeatureTm1;
              int? nullable25;
              if (!nullable17.HasValue)
              {
                nullable25 = new int?();
              }
              else
              {
                nullable12 = new int?(checked (num4 + nullable17.GetValueOrDefault()));
                nullable25 = nullable12;
              }
              num4 = (int) nullable25;
            }
          }
          else if (str.Contains("MechCplx"))
          {
            double num12 = (double) num4;
            double num13 = Math.Pow(Conversions.ToDouble(MechClpx), 2.0);
            nullable17 = WCDef[RtStep.dt_eto_workctr].RtSeqFeatureTm1;
            double? nullable25;
            if (!nullable17.HasValue)
            {
              nullable25 = new double?();
            }
            else
            {
              nullable21 = new double?((double) nullable17.GetValueOrDefault());
              nullable25 = nullable21;
            }
            double? nullable26 = nullable25;
            double? nullable27;
            if (!nullable26.HasValue)
            {
              nullable27 = new double?();
            }
            else
            {
              nullable22 = new double?(nullable26.GetValueOrDefault() * num13);
              nullable27 = nullable22;
            }
            nullable23 = nullable27;
            double? nullable28;
            if (!nullable23.HasValue)
            {
              nullable28 = new double?();
            }
            else
            {
              nullable24 = new double?(num12 + nullable23.GetValueOrDefault());
              nullable28 = nullable24;
            }
            num4 = checked ((int) Math.Round((double) nullable28));
          }
          else if (str.Contains("ElecCplx"))
          {
            double num12 = (double) num4;
            double num13 = Math.Pow(Conversions.ToDouble(ElecClpx), 2.0);
            nullable17 = WCDef[RtStep.dt_eto_workctr].RtSeqFeatureTm1;
            double? nullable25;
            if (!nullable17.HasValue)
            {
              nullable25 = new double?();
            }
            else
            {
              nullable23 = new double?((double) nullable17.GetValueOrDefault());
              nullable25 = nullable23;
            }
            double? nullable26 = nullable25;
            double? nullable27;
            if (!nullable26.HasValue)
            {
              nullable27 = new double?();
            }
            else
            {
              nullable24 = new double?(nullable26.GetValueOrDefault() * num13);
              nullable27 = nullable24;
            }
            nullable21 = nullable27;
            double? nullable28;
            if (!nullable21.HasValue)
            {
              nullable28 = new double?();
            }
            else
            {
              nullable22 = new double?(num12 + nullable21.GetValueOrDefault());
              nullable28 = nullable22;
            }
            num4 = checked ((int) Math.Round((double) nullable28));
          }
          else if (str.Contains("SectCnt"))
          {
            nullable5 = WCDef[RtStep.dt_eto_workctr].RtSeqFeatureTm1;
            int? nullable25;
            if (!nullable5.HasValue)
            {
              nullable25 = new int?();
            }
            else
            {
              nullable4 = new int?(checked (nullable5.GetValueOrDefault() * SectCnt));
              nullable25 = nullable4;
            }
            nullable17 = nullable25;
            int? nullable26;
            if (!nullable17.HasValue)
            {
              nullable26 = new int?();
            }
            else
            {
              nullable12 = new int?(checked (num4 + nullable17.GetValueOrDefault()));
              nullable26 = nullable12;
            }
            num4 = (int) nullable26;
          }
        }
        int num14 = 0;
        nullable17 = WCDef[RtStep.dt_eto_workctr].RtSeqFeatureTm2;
        bool? nullable29;
        if (!nullable17.HasValue)
        {
          nullable29 = new bool?();
        }
        else
        {
          nullable13 = new bool?(nullable17.GetValueOrDefault() > num14);
          nullable29 = nullable13;
        }
        nullable18 = nullable29;
        if (nullable18.GetValueOrDefault() && ((IEnumerable<string>) strArray).Count<string>() > 0)
        {
          string str = strArray[1].Substring(checked (strArray[1].IndexOf(";") + 1));
          if (OrdSER.Contains(str.Trim()))
          {
            if (str.Trim().Contains("PLC"))
            {
              if (num5 > 1440)
              {
                nullable17 = WCDef[RtStep.dt_eto_workctr].RtSeqFeatureTm2;
                int? nullable25;
                if (!nullable17.HasValue)
                {
                  nullable25 = new int?();
                }
                else
                {
                  nullable12 = new int?(checked (num4 + nullable17.GetValueOrDefault()));
                  nullable25 = nullable12;
                }
                num4 = (int) nullable25;
              }
            }
            else
            {
              nullable17 = WCDef[RtStep.dt_eto_workctr].RtSeqFeatureTm2;
              int? nullable25;
              if (!nullable17.HasValue)
              {
                nullable25 = new int?();
              }
              else
              {
                nullable12 = new int?(checked (num4 + nullable17.GetValueOrDefault()));
                nullable25 = nullable12;
              }
              num4 = (int) nullable25;
            }
          }
          else if (str.Contains("MechCplx"))
          {
            double num12 = (double) num4;
            double num13 = Math.Pow(Conversions.ToDouble(MechClpx), 2.0);
            nullable17 = WCDef[RtStep.dt_eto_workctr].RtSeqFeatureTm2;
            double? nullable25;
            if (!nullable17.HasValue)
            {
              nullable25 = new double?();
            }
            else
            {
              nullable23 = new double?((double) nullable17.GetValueOrDefault());
              nullable25 = nullable23;
            }
            double? nullable26 = nullable25;
            double? nullable27;
            if (!nullable26.HasValue)
            {
              nullable27 = new double?();
            }
            else
            {
              nullable24 = new double?(nullable26.GetValueOrDefault() * num13);
              nullable27 = nullable24;
            }
            nullable21 = nullable27;
            double? nullable28;
            if (!nullable21.HasValue)
            {
              nullable28 = new double?();
            }
            else
            {
              nullable22 = new double?(num12 + nullable21.GetValueOrDefault());
              nullable28 = nullable22;
            }
            num4 = checked ((int) Math.Round((double) nullable28));
          }
          else if (str.Contains("ElecCplx"))
          {
            double num12 = (double) num4;
            double num13 = Math.Pow(Conversions.ToDouble(ElecClpx), 2.0);
            nullable17 = WCDef[RtStep.dt_eto_workctr].RtSeqFeatureTm2;
            double? nullable25;
            if (!nullable17.HasValue)
            {
              nullable25 = new double?();
            }
            else
            {
              nullable23 = new double?((double) nullable17.GetValueOrDefault());
              nullable25 = nullable23;
            }
            double? nullable26 = nullable25;
            double? nullable27;
            if (!nullable26.HasValue)
            {
              nullable27 = new double?();
            }
            else
            {
              nullable24 = new double?(nullable26.GetValueOrDefault() * num13);
              nullable27 = nullable24;
            }
            nullable21 = nullable27;
            double? nullable28;
            if (!nullable21.HasValue)
            {
              nullable28 = new double?();
            }
            else
            {
              nullable22 = new double?(num12 + nullable21.GetValueOrDefault());
              nullable28 = nullable22;
            }
            num4 = checked ((int) Math.Round((double) nullable28));
          }
          else if (str.Contains("SectCnt"))
          {
            nullable5 = WCDef[RtStep.dt_eto_workctr].RtSeqFeatureTm2;
            int? nullable25;
            if (!nullable5.HasValue)
            {
              nullable25 = new int?();
            }
            else
            {
              nullable4 = new int?(checked (nullable5.GetValueOrDefault() * SectCnt));
              nullable25 = nullable4;
            }
            nullable17 = nullable25;
            int? nullable26;
            if (!nullable17.HasValue)
            {
              nullable26 = new int?();
            }
            else
            {
              nullable12 = new int?(checked (num4 + nullable17.GetValueOrDefault()));
              nullable26 = nullable12;
            }
            num4 = (int) nullable26;
          }
        }
        int num15 = 0;
        nullable17 = WCDef[RtStep.dt_eto_workctr].RtSeqFeatureTm3;
        bool? nullable30;
        if (!nullable17.HasValue)
        {
          nullable30 = new bool?();
        }
        else
        {
          nullable13 = new bool?(nullable17.GetValueOrDefault() > num15);
          nullable30 = nullable13;
        }
        nullable18 = nullable30;
        if (nullable18.GetValueOrDefault() && ((IEnumerable<string>) strArray).Count<string>() > 0)
        {
          string str = strArray[2].Substring(checked (strArray[2].IndexOf(";") + 1));
          if (OrdSER.Contains(str.Trim()))
          {
            if (str.Trim().Contains("PLC"))
            {
              if (num5 > 1440)
              {
                nullable17 = WCDef[RtStep.dt_eto_workctr].RtSeqFeatureTm3;
                int? nullable25;
                if (!nullable17.HasValue)
                {
                  nullable25 = new int?();
                }
                else
                {
                  nullable12 = new int?(checked (num4 + nullable17.GetValueOrDefault()));
                  nullable25 = nullable12;
                }
                num4 = (int) nullable25;
              }
            }
            else
            {
              nullable17 = WCDef[RtStep.dt_eto_workctr].RtSeqFeatureTm3;
              int? nullable25;
              if (!nullable17.HasValue)
              {
                nullable25 = new int?();
              }
              else
              {
                nullable12 = new int?(checked (num4 + nullable17.GetValueOrDefault()));
                nullable25 = nullable12;
              }
              num4 = (int) nullable25;
            }
          }
          else if (str.Contains("MechCplx"))
          {
            double num12 = (double) num4;
            double num13 = Math.Pow(Conversions.ToDouble(MechClpx), 2.0);
            nullable17 = WCDef[RtStep.dt_eto_workctr].RtSeqFeatureTm3;
            double? nullable25;
            if (!nullable17.HasValue)
            {
              nullable25 = new double?();
            }
            else
            {
              nullable23 = new double?((double) nullable17.GetValueOrDefault());
              nullable25 = nullable23;
            }
            double? nullable26 = nullable25;
            double? nullable27;
            if (!nullable26.HasValue)
            {
              nullable27 = new double?();
            }
            else
            {
              nullable24 = new double?(nullable26.GetValueOrDefault() * num13);
              nullable27 = nullable24;
            }
            nullable21 = nullable27;
            double? nullable28;
            if (!nullable21.HasValue)
            {
              nullable28 = new double?();
            }
            else
            {
              nullable22 = new double?(num12 + nullable21.GetValueOrDefault());
              nullable28 = nullable22;
            }
            num4 = checked ((int) Math.Round((double) nullable28));
          }
          else if (str.Contains("ElecCplx"))
          {
            double num12 = (double) num4;
            double num13 = Math.Pow(Conversions.ToDouble(ElecClpx), 2.0);
            nullable17 = WCDef[RtStep.dt_eto_workctr].RtSeqFeatureTm3;
            double? nullable25;
            if (!nullable17.HasValue)
            {
              nullable25 = new double?();
            }
            else
            {
              nullable23 = new double?((double) nullable17.GetValueOrDefault());
              nullable25 = nullable23;
            }
            double? nullable26 = nullable25;
            double? nullable27;
            if (!nullable26.HasValue)
            {
              nullable27 = new double?();
            }
            else
            {
              nullable24 = new double?(nullable26.GetValueOrDefault() * num13);
              nullable27 = nullable24;
            }
            nullable21 = nullable27;
            double? nullable28;
            if (!nullable21.HasValue)
            {
              nullable28 = new double?();
            }
            else
            {
              nullable22 = new double?(num12 + nullable21.GetValueOrDefault());
              nullable28 = nullable22;
            }
            num4 = checked ((int) Math.Round((double) nullable28));
          }
          else if (str.Contains("SectCnt"))
          {
            nullable5 = WCDef[RtStep.dt_eto_workctr].RtSeqFeatureTm3;
            int? nullable25;
            if (!nullable5.HasValue)
            {
              nullable25 = new int?();
            }
            else
            {
              nullable4 = new int?(checked (nullable5.GetValueOrDefault() * SectCnt));
              nullable25 = nullable4;
            }
            nullable17 = nullable25;
            int? nullable26;
            if (!nullable17.HasValue)
            {
              nullable26 = new int?();
            }
            else
            {
              nullable12 = new int?(checked (num4 + nullable17.GetValueOrDefault()));
              nullable26 = nullable12;
            }
            num4 = (int) nullable26;
          }
        }
        int num16 = 0;
        nullable17 = WCDef[RtStep.dt_eto_workctr].RtSeqFeatureTm4;
        bool? nullable31;
        if (!nullable17.HasValue)
        {
          nullable31 = new bool?();
        }
        else
        {
          nullable13 = new bool?(nullable17.GetValueOrDefault() > num16);
          nullable31 = nullable13;
        }
        nullable18 = nullable31;
        if (nullable18.GetValueOrDefault() && ((IEnumerable<string>) strArray).Count<string>() > 0)
        {
          string str = strArray[3].Substring(checked (strArray[3].IndexOf(";") + 1));
          if (OrdSER.Contains(str.Trim()))
          {
            if (str.Trim().Contains("PLC"))
            {
              if (num5 > 1440)
              {
                nullable17 = WCDef[RtStep.dt_eto_workctr].RtSeqFeatureTm4;
                int? nullable25;
                if (!nullable17.HasValue)
                {
                  nullable25 = new int?();
                }
                else
                {
                  nullable12 = new int?(checked (num4 + nullable17.GetValueOrDefault()));
                  nullable25 = nullable12;
                }
                num4 = (int) nullable25;
              }
            }
            else
            {
              nullable17 = WCDef[RtStep.dt_eto_workctr].RtSeqFeatureTm4;
              int? nullable25;
              if (!nullable17.HasValue)
              {
                nullable25 = new int?();
              }
              else
              {
                nullable12 = new int?(checked (num4 + nullable17.GetValueOrDefault()));
                nullable25 = nullable12;
              }
              num4 = (int) nullable25;
            }
          }
          else if (str.Contains("MechCplx"))
          {
            double num12 = (double) num4;
            double num13 = Math.Pow(Conversions.ToDouble(MechClpx), 2.0);
            nullable17 = WCDef[RtStep.dt_eto_workctr].RtSeqFeatureTm4;
            double? nullable25;
            if (!nullable17.HasValue)
            {
              nullable25 = new double?();
            }
            else
            {
              nullable23 = new double?((double) nullable17.GetValueOrDefault());
              nullable25 = nullable23;
            }
            double? nullable26 = nullable25;
            double? nullable27;
            if (!nullable26.HasValue)
            {
              nullable27 = new double?();
            }
            else
            {
              nullable24 = new double?(nullable26.GetValueOrDefault() * num13);
              nullable27 = nullable24;
            }
            nullable21 = nullable27;
            double? nullable28;
            if (!nullable21.HasValue)
            {
              nullable28 = new double?();
            }
            else
            {
              nullable22 = new double?(num12 + nullable21.GetValueOrDefault());
              nullable28 = nullable22;
            }
            num4 = checked ((int) Math.Round((double) nullable28));
          }
          else if (str.Contains("ElecCplx"))
          {
            double num12 = (double) num4;
            double num13 = Math.Pow(Conversions.ToDouble(ElecClpx), 2.0);
            nullable17 = WCDef[RtStep.dt_eto_workctr].RtSeqFeatureTm4;
            double? nullable25;
            if (!nullable17.HasValue)
            {
              nullable25 = new double?();
            }
            else
            {
              nullable23 = new double?((double) nullable17.GetValueOrDefault());
              nullable25 = nullable23;
            }
            double? nullable26 = nullable25;
            double? nullable27;
            if (!nullable26.HasValue)
            {
              nullable27 = new double?();
            }
            else
            {
              nullable24 = new double?(nullable26.GetValueOrDefault() * num13);
              nullable27 = nullable24;
            }
            nullable21 = nullable27;
            double? nullable28;
            if (!nullable21.HasValue)
            {
              nullable28 = new double?();
            }
            else
            {
              nullable22 = new double?(num12 + nullable21.GetValueOrDefault());
              nullable28 = nullable22;
            }
            num4 = checked ((int) Math.Round((double) nullable28));
          }
          else if (str.Contains("SectCnt"))
          {
            nullable5 = WCDef[RtStep.dt_eto_workctr].RtSeqFeatureTm4;
            int? nullable25;
            if (!nullable5.HasValue)
            {
              nullable25 = new int?();
            }
            else
            {
              nullable4 = new int?(checked (nullable5.GetValueOrDefault() * SectCnt));
              nullable25 = nullable4;
            }
            nullable17 = nullable25;
            int? nullable26;
            if (!nullable17.HasValue)
            {
              nullable26 = new int?();
            }
            else
            {
              nullable12 = new int?(checked (num4 + nullable17.GetValueOrDefault()));
              nullable26 = nullable12;
            }
            num4 = (int) nullable26;
          }
        }
        int num17 = 0;
        nullable17 = WCDef[RtStep.dt_eto_workctr].RtSeqFeatureTm5;
        bool? nullable32;
        if (!nullable17.HasValue)
        {
          nullable32 = new bool?();
        }
        else
        {
          nullable13 = new bool?(nullable17.GetValueOrDefault() > num17);
          nullable32 = nullable13;
        }
        nullable18 = nullable32;
        if (nullable18.GetValueOrDefault() && ((IEnumerable<string>) strArray).Count<string>() > 0)
        {
          string str = strArray[4].Substring(checked (strArray[4].IndexOf(";") + 1));
          if (OrdSER.Contains(str.Trim()))
          {
            if (str.Trim().Contains("PLC"))
            {
              if (num5 > 1440)
              {
                nullable17 = WCDef[RtStep.dt_eto_workctr].RtSeqFeatureTm5;
                int? nullable25;
                if (!nullable17.HasValue)
                {
                  nullable25 = new int?();
                }
                else
                {
                  nullable12 = new int?(checked (num4 + nullable17.GetValueOrDefault()));
                  nullable25 = nullable12;
                }
                num4 = (int) nullable25;
              }
            }
            else
            {
              nullable17 = WCDef[RtStep.dt_eto_workctr].RtSeqFeatureTm5;
              int? nullable25;
              if (!nullable17.HasValue)
              {
                nullable25 = new int?();
              }
              else
              {
                nullable12 = new int?(checked (num4 + nullable17.GetValueOrDefault()));
                nullable25 = nullable12;
              }
              num4 = (int) nullable25;
            }
          }
          else if (str.Contains("MechCplx"))
          {
            double num12 = (double) num4;
            double num13 = Math.Pow(Conversions.ToDouble(MechClpx), 2.0);
            nullable17 = WCDef[RtStep.dt_eto_workctr].RtSeqFeatureTm5;
            double? nullable25;
            if (!nullable17.HasValue)
            {
              nullable25 = new double?();
            }
            else
            {
              nullable23 = new double?((double) nullable17.GetValueOrDefault());
              nullable25 = nullable23;
            }
            double? nullable26 = nullable25;
            double? nullable27;
            if (!nullable26.HasValue)
            {
              nullable27 = new double?();
            }
            else
            {
              nullable24 = new double?(nullable26.GetValueOrDefault() * num13);
              nullable27 = nullable24;
            }
            nullable21 = nullable27;
            double? nullable28;
            if (!nullable21.HasValue)
            {
              nullable28 = new double?();
            }
            else
            {
              nullable22 = new double?(num12 + nullable21.GetValueOrDefault());
              nullable28 = nullable22;
            }
            num4 = checked ((int) Math.Round((double) nullable28));
          }
          else if (str.Contains("ElecCplx"))
          {
            double num12 = (double) num4;
            double num13 = Math.Pow(Conversions.ToDouble(ElecClpx), 2.0);
            nullable17 = WCDef[RtStep.dt_eto_workctr].RtSeqFeatureTm5;
            double? nullable25;
            if (!nullable17.HasValue)
            {
              nullable25 = new double?();
            }
            else
            {
              nullable23 = new double?((double) nullable17.GetValueOrDefault());
              nullable25 = nullable23;
            }
            double? nullable26 = nullable25;
            double? nullable27;
            if (!nullable26.HasValue)
            {
              nullable27 = new double?();
            }
            else
            {
              nullable24 = new double?(nullable26.GetValueOrDefault() * num13);
              nullable27 = nullable24;
            }
            nullable21 = nullable27;
            double? nullable28;
            if (!nullable21.HasValue)
            {
              nullable28 = new double?();
            }
            else
            {
              nullable22 = new double?(num12 + nullable21.GetValueOrDefault());
              nullable28 = nullable22;
            }
            num4 = checked ((int) Math.Round((double) nullable28));
          }
          else if (str.Contains("SectCnt"))
          {
            nullable5 = WCDef[RtStep.dt_eto_workctr].RtSeqFeatureTm5;
            int? nullable25;
            if (!nullable5.HasValue)
            {
              nullable25 = new int?();
            }
            else
            {
              nullable4 = new int?(checked (nullable5.GetValueOrDefault() * SectCnt));
              nullable25 = nullable4;
            }
            nullable17 = nullable25;
            int? nullable26;
            if (!nullable17.HasValue)
            {
              nullable26 = new int?();
            }
            else
            {
              nullable12 = new int?(checked (num4 + nullable17.GetValueOrDefault()));
              nullable26 = nullable12;
            }
            num4 = (int) nullable26;
          }
        }
      }
      string Left = RtStep.hd_eto_ln.Trim();
      if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(Left, "SWBD", false) == 0)
        RtStep.AssemblyLineId = 1;
      else if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(Left, "LVDO", false) == 0)
        RtStep.AssemblyLineId = 2;
      RtStep.RoutingNextWorkCtr = WCDef[RtStep.dt_eto_workctr].RtSeqNextWorkCtr;
      int num18 = checked ((int) Math.Round(unchecked ((double) num4 / (double) num1 / 24.0)));
      RtStep.run_tm_tot = num18;
      scMESUpdateFull scMesUpdateFull1 = RtStep;
      dateTime1 = RtStep.due_fn;
      DateTime dateTime3 = dateTime1.AddMinutes((double) checked (-1 * num18));
      scMesUpdateFull1.due_st = dateTime3;
      scDateValidate scDateValidate1 = new scDateValidate();
      scDateValidate scDateValidate2 = this.ProcessWeekEndsHolidays(RtStep.due_fn, RtStep.due_st);
      RtStep.due_fn = scDateValidate2.EndDate;
      RtStep.due_st = scDateValidate2.StartDate;
      return true;
    }

    public scDateValidate ProcessWeekEndsHolidays(DateTime EndDate, DateTime StartDate)
    {
      scDateValidate scDateValidate = new scDateValidate();
      DateTime dateTime1 = EndDate;
      DateTime t2 = StartDate;
      int num1 = 0;
      DateTime date = dateTime1.AddDays((double) num1).Date;
      if (date.DayOfWeek == DayOfWeek.Saturday)
        checked { num1 += -1; }
      else if (date.DayOfWeek == DayOfWeek.Sunday)
        checked { num1 += -2; }
      DateTime dateTime2 = dateTime1.AddDays((double) num1);
      for (date = dateTime2.Date; this._dtHoliday.ContainsKey(date); date = dateTime2.Date)
      {
        scHolidays scHolidays = new scHolidays();
        scHolidays = this._dtHoliday[date];
        checked { num1 += -1; }
        dateTime2 = dateTime1.AddDays((double) num1);
        date = dateTime2.Date;
        if (date.DayOfWeek == DayOfWeek.Saturday)
          checked { num1 += -1; }
        else if (date.DayOfWeek == DayOfWeek.Sunday)
          checked { num1 += -2; }
        dateTime2 = dateTime1.AddDays((double) num1);
      }
      if (date.DayOfWeek == DayOfWeek.Saturday)
        checked { num1 += -1; }
      else if (date.DayOfWeek == DayOfWeek.Sunday)
        checked { num1 += -2; }
      DateTime dateTime3 = dateTime1.AddDays((double) num1);
      t2 = t2.AddDays((double) num1);
      int num2 = 0;
      dateTime2 = dateTime3.AddDays((double) num2);
      date = dateTime2.Date;
      while (DateTime.Compare(date, t2) >= 0)
      {
        dateTime2 = dateTime3.AddDays((double) num2);
        date = dateTime2.Date;
        if (date.DayOfWeek == DayOfWeek.Saturday)
        {
          t2 = t2.AddDays(-1.0);
          checked { num2 += -1; }
        }
        else if (date.DayOfWeek == DayOfWeek.Sunday)
        {
          t2 = t2.AddDays(-2.0);
          checked { num2 += -2; }
        }
        dateTime2 = dateTime3.AddDays((double) num2);
        for (date = dateTime2.Date; this._dtHoliday.ContainsKey(date); date = dateTime2.Date)
        {
          scHolidays scHolidays = new scHolidays();
          scHolidays = this._dtHoliday[date];
          t2 = t2.AddDays(-1.0);
          checked { num2 += -1; }
          dateTime2 = dateTime3.AddDays((double) num2);
          date = dateTime2.Date;
          if (date.DayOfWeek == DayOfWeek.Saturday)
          {
            t2 = t2.AddDays(-1.0);
            checked { num2 += -1; }
          }
          else if (date.DayOfWeek == DayOfWeek.Sunday)
          {
            t2 = t2.AddDays(-2.0);
            checked { num2 += -2; }
          }
          dateTime2 = dateTime3.AddDays((double) num2);
        }
        if (date.DayOfWeek == DayOfWeek.Saturday)
        {
          t2 = t2.AddDays(-1.0);
          checked { num2 += -1; }
        }
        else if (date.DayOfWeek == DayOfWeek.Sunday)
        {
          t2 = t2.AddDays(-2.0);
          checked { num2 += -2; }
        }
        else
          checked { num2 += -1; }
      }
      scDateValidate.EndDate = dateTime3;
      scDateValidate.StartDate = t2;
      return scDateValidate;
    }

    public void UpdateShipSpltFabDueDt(ref List<scMESUpdateFull> OrderList)
    {
      // ISSUE: method pointer
      List<int> list = ((IEnumerable<int>) Enumerable.Select<scMESUpdateFull, int>((IEnumerable<M0>) OrderList, (Func<M0, M1>) new Func<scMESUpdateFull, int>((object) null, __methodptr(_Lambda\u0024__106)))).Distinct<int>().ToList<int>();
      DateTime[] dateTimeArray1 = new DateTime[checked (list.Count + 1)];
      DateTime[] dateTimeArray2 = new DateTime[checked (list.Count + 1)];
      int num1 = 0;
      int num2 = checked (list.Count - 1);
      int index = num1;
      while (index <= num2)
      {
        // ISSUE: object of a compiler-generated type is created
        // ISSUE: variable of a compiler-generated type
        clsEngineMES._Closure\u0024__160 other = new clsEngineMES._Closure\u0024__160(other);
        // ISSUE: reference to a compiler-generated field
        other.\u0024VB\u0024Local_ldShipSplt = list[index];
        List<scMESUpdateFull> scMesUpdateFullList = OrderList;
        // ISSUE: variable of a compiler-generated type
        clsEngineMES._Closure\u0024__160 closure160 = other;
        // ISSUE: virtual method pointer
        IntPtr num3 = __vmethodptr(closure160, _Lambda\u0024__107);
        Func<scMESUpdateFull, bool> func = new Func<scMESUpdateFull, bool>((object) closure160, num3);
        // ISSUE: method pointer
        // ISSUE: method pointer
        // ISSUE: method pointer
        // ISSUE: method pointer
        IEnumerable<VB\u0024AnonymousType_69<DateTime, DateTime>> source = Enumerable.Select((IEnumerable<M0>) Enumerable.GroupBy(Enumerable.Where<scMESUpdateFull>((IEnumerable<M0>) scMesUpdateFullList, (Func<M0, bool>) func), (Func<M0, M1>) new Func<scMESUpdateFull, int>((object) null, __methodptr(_Lambda\u0024__108)), (Func<M0, M2>) new Func<scMESUpdateFull, scMESUpdateFull>((object) null, __methodptr(_Lambda\u0024__109)), (Func<M1, IEnumerable<M2>, M3>) new Func<int, IEnumerable<scMESUpdateFull>, VB\u0024AnonymousType_68<int, IEnumerable<scMESUpdateFull>>>((object) null, __methodptr(_Lambda\u0024__110))), (Func<M0, M1>) new Func<VB\u0024AnonymousType_68<int, IEnumerable<scMESUpdateFull>>, VB\u0024AnonymousType_69<DateTime, DateTime>>((object) null, __methodptr(_Lambda\u0024__111)));
        dateTimeArray1[index] = source.First().due_st;
        dateTimeArray2[index] = source.First().due_fn;
        checked { ++index; }
      }
    }

    public struct scMESOrder
    {
      internal string FactoryOrder;
      internal string LineItem;
      internal string SLNumber;
      internal string SSNumber;
      internal int Section;
      internal string ProductionOrder;
      internal string WorkCenter;
      internal int RunTimeMin;
      internal DateTime ScheduleStart;
      internal DateTime ScheduleFinish;
      internal DateTime ActualStart;
      internal DateTime ActualFinish;
      internal DateTime ShipDate;
      internal DateTime Target;
      internal string NextWorkCenter;
      internal DateTime Release2MFG;
      internal string CurrentWorkCenter;
      internal string CrypticRouting;
    }
  }
}
