// Decompiled with JetBrains decompiler
// Type: SE0085.CTdB.clsItemMaster
// 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.Diagnostics;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Threading;

namespace SE0085.CTdB
{
  public class clsItemMaster
  {
    private static List<WeakReference> __ENCList = new List<WeakReference>();
    private string _CTConnection;

    public event clsItemMaster.ProcessUpdateEventHandler ProcessUpdate;

    public event clsItemMaster.AssyPartUpdateEventHandler AssyPartUpdate;

    [DebuggerNonUserCode]
    static clsItemMaster()
    {
    }

    public clsItemMaster()
    {
      clsItemMaster.__ENCAddToList((object) this);
      this.GetdBConnString();
    }

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

    [DebuggerNonUserCode]
    private static void __ENCAddToList(object value)
    {
      List<WeakReference> encList = clsItemMaster.__ENCList;
      bool flag = false;
      try
      {
        Monitor.Enter((object) encList, ref flag);
        if (clsItemMaster.__ENCList.Count == clsItemMaster.__ENCList.Capacity)
        {
          int index1 = 0;
          int num1 = 0;
          int num2 = checked (clsItemMaster.__ENCList.Count - 1);
          int index2 = num1;
          while (index2 <= num2)
          {
            if (clsItemMaster.__ENCList[index2].IsAlive)
            {
              if (index2 != index1)
                clsItemMaster.__ENCList[index1] = clsItemMaster.__ENCList[index2];
              checked { ++index1; }
            }
            checked { ++index2; }
          }
          clsItemMaster.__ENCList.RemoveRange(index1, checked (clsItemMaster.__ENCList.Count - index1));
          clsItemMaster.__ENCList.Capacity = clsItemMaster.__ENCList.Count;
        }
        clsItemMaster.__ENCList.Add(new WeakReference(RuntimeHelpers.GetObjectValue(value)));
      }
      finally
      {
        if (flag)
          Monitor.Exit((object) encList);
      }
    }

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

    public int ImportItemsData(ArrayList ItemsData)
    {
      // ISSUE: object of a compiler-generated type is created
      // ISSUE: variable of a compiler-generated type
      clsItemMaster._Closure\u0024__59 closure59 = new clsItemMaster._Closure\u0024__59();
      AssyPart assyPart1 = (AssyPart) null;
      // ISSUE: reference to a compiler-generated field
      closure59.\u0024VB\u0024Local_ldAssyPartNumber = "";
      clsItemMaster.AssyPartUpdateEventHandler assyPartUpdateEvent1 = this.AssyPartUpdateEvent;
      if (assyPartUpdateEvent1 != null)
        assyPartUpdateEvent1("Building Hashtable...");
      Hashtable hashtable1 = new Hashtable();
      Hashtable hashtable2 = this.LoadPartsHashFromdB();
      List<scItemMaster> scItemMasterList = new List<scItemMaster>();
      clsItemMaster.AssyPartUpdateEventHandler assyPartUpdateEvent2 = this.AssyPartUpdateEvent;
      if (assyPartUpdateEvent2 != null)
        assyPartUpdateEvent2("Creating a list of Assy/Parts to update...");
      try
      {
        foreach (scItemMaster scItemMaster1 in ItemsData)
        {
          Thread.CurrentThread.Join(0);
          if (hashtable2.ContainsKey((object) scItemMaster1.AssyPartNumber))
          {
            int num1;
            checked { ++num1; }
            int num2;
            checked { ++num2; }
            if (num2 > 1000)
            {
              clsItemMaster.ProcessUpdateEventHandler processUpdateEvent = this.ProcessUpdateEvent;
              if (processUpdateEvent != null)
                processUpdateEvent(checked ((int) Math.Round(unchecked ((double) num1 / (double) ItemsData.Count * 100.0))));
              num2 = 0;
            }
            scItemMaster scItemMaster2 = new scItemMaster();
            scItemMaster scItemMaster3 = (scItemMaster) hashtable2[(object) scItemMaster1.AssyPartNumber];
            bool flag = false;
            if (Decimal.Compare(scItemMaster1.UnitCost, scItemMaster3.UnitCost) != 0 & Decimal.Compare(scItemMaster1.UnitCost, Decimal.Zero) > 0)
              flag = true;
            if (Decimal.Compare(scItemMaster1.MaterialCost, scItemMaster3.MaterialCost) != 0 & Decimal.Compare(scItemMaster1.MaterialCost, Decimal.Zero) > 0)
              flag = true;
            if (Decimal.Compare(scItemMaster1.LaborCost, scItemMaster3.LaborCost) != 0 & Decimal.Compare(scItemMaster1.LaborCost, Decimal.Zero) > 0)
              flag = true;
            if (Decimal.Compare(scItemMaster1.OverHeadCost, scItemMaster3.OverHeadCost) != 0 & Decimal.Compare(scItemMaster1.OverHeadCost, Decimal.Zero) > 0)
              flag = true;
            if (Decimal.Compare(scItemMaster1.O08FBUR, scItemMaster3.O08FBUR) != 0 & Decimal.Compare(scItemMaster1.O08FBUR, Decimal.Zero) > 0)
              flag = true;
            if (Decimal.Compare(scItemMaster1.O09PBUR, scItemMaster3.O09PBUR) != 0 & Decimal.Compare(scItemMaster1.O09PBUR, Decimal.Zero) > 0)
              flag = true;
            if (Decimal.Compare(scItemMaster1.O10AMU, scItemMaster3.O10AMU) != 0 & Decimal.Compare(scItemMaster1.O10AMU, Decimal.Zero) > 0)
              flag = true;
            if (Decimal.Compare(scItemMaster1.O11VBUR, scItemMaster3.O11VBUR) != 0 & Decimal.Compare(scItemMaster1.O11VBUR, Decimal.Zero) > 0)
              flag = true;
            if ((scItemMaster1.Routing != scItemMaster3.Routing | scItemMaster3.Routing == 0) & scItemMaster1.Routing > 0)
              flag = true;
            if (!(Operators.CompareString(scItemMaster1.AssyPartNumber, scItemMaster3.AssyPartNumber, false) == 0 & Operators.CompareString(scItemMaster1.Description1, scItemMaster3.Description1, false) == 0 & Operators.CompareString(scItemMaster1.Description2, scItemMaster3.Description2, false) == 0 & Operators.CompareString(scItemMaster1.OFOKanban, scItemMaster3.OFOKanban, false) == 0 & (int) scItemMaster1.BuyMake == (int) scItemMaster3.BuyMake & (int) scItemMaster1.AssyPartActive == (int) scItemMaster3.AssyPartActive & Operators.CompareString(scItemMaster1.CostCode, scItemMaster3.CostCode, false) == 0 & Operators.CompareString(scItemMaster1.UOM, scItemMaster3.UOM, false) == 0 & Operators.CompareString(scItemMaster1.Vendor, scItemMaster3.Vendor, false) == 0 & scItemMaster1.ItemType == scItemMaster3.ItemType) | flag)
            {
              scItemMasterList.Add(scItemMaster1);
              clsItemMaster.AssyPartUpdateEventHandler assyPartUpdateEvent3 = this.AssyPartUpdateEvent;
              if (assyPartUpdateEvent3 != null)
                assyPartUpdateEvent3("Item Needs Updating; " + scItemMaster1.AssyPartNumber);
            }
            else
              scItemMaster2 = (scItemMaster) null;
          }
          else
          {
            scItemMasterList.Add(scItemMaster1);
            clsItemMaster.AssyPartUpdateEventHandler assyPartUpdateEvent3 = this.AssyPartUpdateEvent;
            if (assyPartUpdateEvent3 != null)
              assyPartUpdateEvent3("Item Needs Adding; " + scItemMaster1.AssyPartNumber);
          }
        }
      }
      finally
      {
        IEnumerator enumerator;
        if (enumerator is IDisposable)
          (enumerator as IDisposable).Dispose();
      }
      clsItemMaster.AssyPartUpdateEventHandler assyPartUpdateEvent4 = this.AssyPartUpdateEvent;
      if (assyPartUpdateEvent4 != null)
        assyPartUpdateEvent4("Updating Database...");
      int num3 = 0;
      int num4 = 0;
      int num5;
      if (scItemMasterList != null && scItemMasterList.Count > 0)
      {
        using (SE0085CTEntities1 se0085CtEntities1 = new SE0085CTEntities1())
        {
          se0085CtEntities1.Database.Connection.ConnectionString = this._CTConnection;
          List<scItemMaster>.Enumerator enumerator1;
          try
          {
            enumerator1 = scItemMasterList.GetEnumerator();
            while (enumerator1.MoveNext())
            {
              scItemMaster current1 = enumerator1.Current;
              Thread.CurrentThread.Join(0);
              checked { ++num4; }
              checked { ++num3; }
              if (num3 > 1000)
              {
                clsItemMaster.ProcessUpdateEventHandler processUpdateEvent = this.ProcessUpdateEvent;
                if (processUpdateEvent != null)
                  processUpdateEvent(checked ((int) Math.Round(unchecked ((double) num4 / (double) ItemsData.Count * 100.0))));
                num3 = 0;
              }
              // ISSUE: reference to a compiler-generated field
              closure59.\u0024VB\u0024Local_ldAssyPartNumber = current1.AssyPartNumber;
              // ISSUE: method reference
              // ISSUE: reference to a compiler-generated field
              IQueryable<AssyPart> source = (IQueryable<AssyPart>) Queryable.Select<AssyPart, AssyPart>(Queryable.Where<AssyPart>((IQueryable<M0>) se0085CtEntities1.AssyParts, (Expression<Func<M0, bool>>) (p => Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Operators.CompareString)), p.AssyPartNum, closure59.\u0024VB\u0024Local_ldAssyPartNumber, false) == 0)), (Expression<Func<M0, M1>>) (p => p));
              if (source.Count<AssyPart>() == 0)
              {
                se0085CtEntities1.AssyParts.Add(new AssyPart()
                {
                  AssyPartNum = current1.AssyPartNumber,
                  AssyDesc1 = current1.Description1,
                  AssyDesc2 = current1.Description2,
                  OFOKanban = current1.OFOKanban,
                  BuyMake = current1.BuyMake,
                  AssyPartActive = current1.AssyPartActive,
                  DateAdded = (DateTime?) DateTime.Now,
                  CostCode = current1.CostCode,
                  UOM = current1.UOM,
                  UnitCost = (Decimal?) current1.UnitCost,
                  MaterialCost = (Decimal?) current1.MaterialCost,
                  LaborCost = (Decimal?) current1.LaborCost,
                  OveheadCost = (Decimal?) current1.OverHeadCost,
                  O08FBUR = (Decimal?) current1.O08FBUR,
                  O09PBUR = (Decimal?) current1.O09PBUR,
                  O10AMU = (Decimal?) current1.O10AMU,
                  O11VBUR = (Decimal?) current1.O11VBUR,
                  Vendor = current1.Vendor,
                  Routing = current1.Routing,
                  ItemType = current1.ItemType
                });
                int num1 = se0085CtEntities1.SaveChanges();
                checked { num5 += num1; }
                clsItemMaster.AssyPartUpdateEventHandler assyPartUpdateEvent3 = this.AssyPartUpdateEvent;
                if (assyPartUpdateEvent3 != null)
                  assyPartUpdateEvent3("Item Added; " + current1.AssyPartNumber);
              }
              else if (source.Count<AssyPart>() == 1)
              {
                IEnumerator<AssyPart> enumerator2;
                try
                {
                  enumerator2 = source.GetEnumerator();
                  while (enumerator2.MoveNext())
                  {
                    AssyPart current2 = enumerator2.Current;
                    Decimal unitCost1 = current1.UnitCost;
                    Decimal? unitCost2 = current2.UnitCost;
                    bool? nullable1 = unitCost2.HasValue ? new bool?(Decimal.Compare(unitCost2.GetValueOrDefault(), unitCost1) == 0) : new bool?();
                    bool? nullable2 = Operators.CompareString(current2.AssyPartNum, current1.AssyPartNumber, false) == 0 & Operators.CompareString(current2.AssyDesc1, current1.Description1, false) == 0 & Operators.CompareString(current2.AssyDesc2, current1.Description2, false) == 0 & Operators.CompareString(current2.OFOKanban, current1.OFOKanban, false) == 0 & (int) current2.BuyMake == (int) current1.BuyMake & (int) current2.AssyPartActive == (int) current1.AssyPartActive & Operators.CompareString(current2.CostCode, current1.CostCode, false) == 0 & Operators.CompareString(current2.UOM, current1.UOM, false) == 0 ? nullable1 : new bool?(false);
                    Decimal materialCost1 = current1.MaterialCost;
                    Decimal? materialCost2 = current2.MaterialCost;
                    bool? nullable3 = materialCost2.HasValue ? new bool?(Decimal.Compare(materialCost2.GetValueOrDefault(), materialCost1) == 0) : new bool?();
                    bool? nullable4 = !nullable2.HasValue || nullable2.GetValueOrDefault() ? (nullable3.HasValue ? (nullable3.GetValueOrDefault() ? nullable2 : new bool?(false)) : new bool?()) : new bool?(false);
                    Decimal laborCost1 = current1.LaborCost;
                    Decimal? laborCost2 = current2.LaborCost;
                    bool? nullable5 = laborCost2.HasValue ? new bool?(Decimal.Compare(laborCost2.GetValueOrDefault(), laborCost1) == 0) : new bool?();
                    bool? nullable6 = !nullable4.HasValue || nullable4.GetValueOrDefault() ? (nullable5.HasValue ? (nullable5.GetValueOrDefault() ? nullable4 : new bool?(false)) : new bool?()) : new bool?(false);
                    Decimal overHeadCost = current1.OverHeadCost;
                    Decimal? oveheadCost = current2.OveheadCost;
                    bool? nullable7 = oveheadCost.HasValue ? new bool?(Decimal.Compare(oveheadCost.GetValueOrDefault(), overHeadCost) == 0) : new bool?();
                    bool? nullable8 = !nullable6.HasValue || nullable6.GetValueOrDefault() ? (nullable7.HasValue ? (nullable7.GetValueOrDefault() ? nullable6 : new bool?(false)) : new bool?()) : new bool?(false);
                    Decimal o08Fbur1 = current1.O08FBUR;
                    Decimal? o08Fbur2 = current2.O08FBUR;
                    bool? nullable9 = o08Fbur2.HasValue ? new bool?(Decimal.Compare(o08Fbur2.GetValueOrDefault(), o08Fbur1) == 0) : new bool?();
                    bool? nullable10 = !nullable8.HasValue || nullable8.GetValueOrDefault() ? (nullable9.HasValue ? (nullable9.GetValueOrDefault() ? nullable8 : new bool?(false)) : new bool?()) : new bool?(false);
                    Decimal o09Pbur1 = current1.O09PBUR;
                    Decimal? o09Pbur2 = current2.O09PBUR;
                    bool? nullable11 = o09Pbur2.HasValue ? new bool?(Decimal.Compare(o09Pbur2.GetValueOrDefault(), o09Pbur1) == 0) : new bool?();
                    bool? nullable12 = !nullable10.HasValue || nullable10.GetValueOrDefault() ? (nullable11.HasValue ? (nullable11.GetValueOrDefault() ? nullable10 : new bool?(false)) : new bool?()) : new bool?(false);
                    Decimal o10Amu1 = current1.O10AMU;
                    Decimal? o10Amu2 = current2.O10AMU;
                    bool? nullable13 = o10Amu2.HasValue ? new bool?(Decimal.Compare(o10Amu2.GetValueOrDefault(), o10Amu1) == 0) : new bool?();
                    bool? nullable14 = !nullable12.HasValue || nullable12.GetValueOrDefault() ? (nullable13.HasValue ? (nullable13.GetValueOrDefault() ? nullable12 : new bool?(false)) : new bool?()) : new bool?(false);
                    Decimal o11Vbur1 = current1.O11VBUR;
                    Decimal? o11Vbur2 = current2.O11VBUR;
                    bool? nullable15 = o11Vbur2.HasValue ? new bool?(Decimal.Compare(o11Vbur2.GetValueOrDefault(), o11Vbur1) == 0) : new bool?();
                    bool? nullable16 = !nullable14.HasValue || nullable14.GetValueOrDefault() ? (nullable15.HasValue ? (nullable15.GetValueOrDefault() ? nullable14 : new bool?(false)) : new bool?()) : new bool?(false);
                    bool? nullable17 = Operators.CompareString(current2.Vendor, current1.Vendor, false) == 0 ? nullable16 : new bool?(false);
                    bool? nullable18 = current2.Routing == current1.Routing | current1.Routing == 0 ? nullable17 : new bool?(false);
                    bool? nullable19 = current2.ItemType == current1.ItemType ? nullable18 : new bool?(false);
                    if ((nullable19.HasValue ? new bool?(!nullable19.GetValueOrDefault()) : new bool?()).GetValueOrDefault())
                    {
                      AssyPart assyPart2 = current2;
                      assyPart2.AssyPartNum = current1.AssyPartNumber;
                      assyPart2.AssyDesc1 = current1.Description1;
                      assyPart2.AssyDesc2 = current1.Description2;
                      assyPart2.OFOKanban = current1.OFOKanban;
                      assyPart2.BuyMake = current1.BuyMake;
                      assyPart2.AssyPartActive = current1.AssyPartActive;
                      assyPart2.CostCode = current1.CostCode;
                      assyPart2.UOM = current1.UOM;
                      if (Decimal.Compare(current1.UnitCost, Decimal.Zero) > 0)
                        assyPart2.UnitCost = (Decimal?) current1.UnitCost;
                      if (Decimal.Compare(current1.MaterialCost, Decimal.Zero) > 0)
                        assyPart2.MaterialCost = (Decimal?) current1.MaterialCost;
                      if (Decimal.Compare(current1.LaborCost, Decimal.Zero) > 0)
                        assyPart2.LaborCost = (Decimal?) current1.LaborCost;
                      if (Decimal.Compare(current1.OverHeadCost, Decimal.Zero) > 0)
                        assyPart2.OveheadCost = (Decimal?) current1.OverHeadCost;
                      if (Decimal.Compare(current1.O08FBUR, Decimal.Zero) > 0)
                        assyPart2.O08FBUR = (Decimal?) current1.O08FBUR;
                      if (Decimal.Compare(current1.O09PBUR, Decimal.Zero) > 0)
                        assyPart2.O09PBUR = (Decimal?) current1.O09PBUR;
                      if (Decimal.Compare(current1.O10AMU, Decimal.Zero) > 0)
                        assyPart2.O10AMU = (Decimal?) current1.O10AMU;
                      if (Decimal.Compare(current1.O11VBUR, Decimal.Zero) > 0)
                        assyPart2.O11VBUR = (Decimal?) current1.O11VBUR;
                      assyPart2.Vendor = current1.Vendor;
                      assyPart2.ItemType = current1.ItemType;
                      if (current1.Routing > 0)
                        assyPart2.Routing = current1.Routing;
                      clsItemMaster.AssyPartUpdateEventHandler assyPartUpdateEvent3 = this.AssyPartUpdateEvent;
                      if (assyPartUpdateEvent3 != null)
                        assyPartUpdateEvent3("Item Updated; " + current1.AssyPartNumber);
                    }
                  }
                }
                finally
                {
                  if (enumerator2 != null)
                    enumerator2.Dispose();
                }
                int num1 = se0085CtEntities1.SaveChanges();
                checked { num5 += num1; }
              }
            }
          }
          finally
          {
            enumerator1.Dispose();
          }
          se0085CtEntities1.Database.Connection.Close();
        }
      }
      hashtable1 = (Hashtable) null;
      assyPart1 = (AssyPart) null;
      return num5;
    }

    public Hashtable LoadPartsHashFromdB()
    {
      Hashtable hashtable = new Hashtable();
      List<scItemMaster> scItemMasterList1 = new List<scItemMaster>();
      List<scItemMaster> scItemMasterList2 = this.rtnAllAssyParts();
      try
      {
        List<scItemMaster>.Enumerator enumerator;
        try
        {
          enumerator = scItemMasterList2.GetEnumerator();
          while (enumerator.MoveNext())
          {
            scItemMaster current = enumerator.Current;
            Thread.CurrentThread.Join(0);
            if (!hashtable.ContainsKey((object) current.AssyPartNumber))
            {
              hashtable.Add((object) current.AssyPartNumber, (object) current);
              int num;
              checked { ++num; }
            }
          }
        }
        finally
        {
          enumerator.Dispose();
        }
      }
      catch (Exception ex)
      {
        ProjectData.SetProjectError(ex);
        ProjectData.ClearProjectError();
      }
      return hashtable;
    }

    public scItemMaster rtnByAssyPartNum(string AssyPart)
    {
      // ISSUE: object of a compiler-generated type is created
      // ISSUE: variable of a compiler-generated type
      clsItemMaster._Closure\u0024__60 closure60 = new clsItemMaster._Closure\u0024__60();
      // ISSUE: reference to a compiler-generated field
      closure60.\u0024VB\u0024Local_AssyPart = AssyPart;
      scItemMaster scItemMaster = new scItemMaster();
      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: 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
        // 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
        // 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
        // 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<scItemMaster> source = (IQueryable<scItemMaster>) Queryable.Select<AssyPart, scItemMaster>(Queryable.Where<AssyPart>((IQueryable<M0>) se0085CtEntities1.AssyParts, (Expression<Func<M0, bool>>) (p => Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Operators.CompareString)), p.AssyPartNum, closure60.\u0024VB\u0024Local_AssyPart, false) == 0)), (Expression<Func<M0, M1>>) Expression.Lambda<Func<AssyPart, scItemMaster>>((Expression) Expression.MemberInit(Expression.New((ConstructorInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.\u002Ector)), (Expression[]) null), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_AssyPartId)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_AssyPartId)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_AssyPartNumber)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_AssyPartNum)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_Description1)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_AssyDesc1)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_Description2)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_AssyDesc2)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_BuyMake)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_BuyMake)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_OFOKanban)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_OFOKanban)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_AssyPartActive)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_AssyPartActive)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_CostCode)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_CostCode)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_UOM)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_UOM)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_UnitCost)), (Expression) Expression.Convert((Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_UnitCost))), typeof (Decimal))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_MaterialCost)), (Expression) Expression.Convert((Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_MaterialCost))), typeof (Decimal))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_LaborCost)), (Expression) Expression.Convert((Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_LaborCost))), typeof (Decimal))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_OverHeadCost)), (Expression) Expression.Convert((Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_OveheadCost))), typeof (Decimal))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_O08FBUR)), (Expression) Expression.Convert((Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_O08FBUR))), typeof (Decimal))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_O09PBUR)), (Expression) Expression.Convert((Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_O09PBUR))), typeof (Decimal))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_O10AMU)), (Expression) Expression.Convert((Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_O10AMU))), typeof (Decimal))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_O11VBUR)), (Expression) Expression.Convert((Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_O11VBUR))), typeof (Decimal))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_Vendor)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_Vendor)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_Routing)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_Routing)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_ItemType)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_ItemType)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_DateAdded)), (Expression) Expression.Convert((Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_DateAdded))), typeof (DateTime)))), new ParameterExpression[1]
        {
          parameterExpression
        }));
        if (source.Count<scItemMaster>() == 1)
          scItemMaster = source.First<scItemMaster>();
        se0085CtEntities1.Database.Connection.Close();
      }
      return scItemMaster;
    }

    public scItemMaster rtnByAssyPartId(int AssyPartId)
    {
      // ISSUE: object of a compiler-generated type is created
      // ISSUE: variable of a compiler-generated type
      clsItemMaster._Closure\u0024__61 closure61 = new clsItemMaster._Closure\u0024__61();
      // ISSUE: reference to a compiler-generated field
      closure61.\u0024VB\u0024Local_AssyPartId = AssyPartId;
      scItemMaster scItemMaster = new scItemMaster();
      using (SE0085CTEntities1 se0085CtEntities1 = new SE0085CTEntities1())
      {
        se0085CtEntities1.Database.Connection.ConnectionString = this._CTConnection;
        ParameterExpression parameterExpression1;
        ParameterExpression parameterExpression2;
        // ISSUE: reference to a compiler-generated field
        // 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
        // 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
        // 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
        // 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<scItemMaster> source = (IQueryable<scItemMaster>) Queryable.Select<AssyPart, scItemMaster>(Queryable.Where<AssyPart>((IQueryable<M0>) se0085CtEntities1.AssyParts, (Expression<Func<M0, bool>>) Expression.Lambda<Func<AssyPart, bool>>((Expression) Expression.Equal(p.AssyPartId, closure61.\u0024VB\u0024Local_AssyPartId, true, (MethodInfo) null), new ParameterExpression[1]
        {
          parameterExpression1
        })), (Expression<Func<M0, M1>>) Expression.Lambda<Func<AssyPart, scItemMaster>>((Expression) Expression.MemberInit(Expression.New((ConstructorInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.\u002Ector)), (Expression[]) null), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_AssyPartId)), (Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_AssyPartId)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_AssyPartNumber)), (Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_AssyPartNum)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_Description1)), (Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_AssyDesc1)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_Description2)), (Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_AssyDesc2)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_BuyMake)), (Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_BuyMake)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_OFOKanban)), (Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_OFOKanban)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_AssyPartActive)), (Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_AssyPartActive)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_CostCode)), (Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_CostCode)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_UOM)), (Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_UOM)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_UnitCost)), (Expression) Expression.Convert((Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_UnitCost))), typeof (Decimal))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_MaterialCost)), (Expression) Expression.Convert((Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_MaterialCost))), typeof (Decimal))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_LaborCost)), (Expression) Expression.Convert((Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_LaborCost))), typeof (Decimal))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_OverHeadCost)), (Expression) Expression.Convert((Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_OveheadCost))), typeof (Decimal))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_O08FBUR)), (Expression) Expression.Convert((Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_O08FBUR))), typeof (Decimal))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_O09PBUR)), (Expression) Expression.Convert((Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_O09PBUR))), typeof (Decimal))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_O10AMU)), (Expression) Expression.Convert((Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_O10AMU))), typeof (Decimal))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_O11VBUR)), (Expression) Expression.Convert((Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_O11VBUR))), typeof (Decimal))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_Vendor)), (Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_Vendor)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_Routing)), (Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_Routing)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_ItemType)), (Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_ItemType)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_DateAdded)), (Expression) Expression.Convert((Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_DateAdded))), typeof (DateTime)))), new ParameterExpression[1]
        {
          parameterExpression2
        }));
        if (source.Count<scItemMaster>() == 1)
          scItemMaster = source.First<scItemMaster>();
        se0085CtEntities1.Database.Connection.Close();
      }
      return scItemMaster;
    }

    public List<scItemMaster> rtnAllAssyParts()
    {
      List<scItemMaster> scItemMasterList = new List<scItemMaster>();
      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
        // 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
        // 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
        // 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<scItemMaster> source = (IQueryable<scItemMaster>) Queryable.Select<AssyPart, scItemMaster>((IQueryable<M0>) se0085CtEntities1.AssyParts, (Expression<Func<M0, M1>>) Expression.Lambda<Func<AssyPart, scItemMaster>>((Expression) Expression.MemberInit(Expression.New((ConstructorInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.\u002Ector)), (Expression[]) null), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_AssyPartId)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_AssyPartId)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_AssyPartNumber)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_AssyPartNum)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_Description1)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_AssyDesc1)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_Description2)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_AssyDesc2)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_BuyMake)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_BuyMake)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_OFOKanban)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_OFOKanban)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_AssyPartActive)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_AssyPartActive)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_CostCode)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_CostCode)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_UOM)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_UOM)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_UnitCost)), (Expression) Expression.Convert((Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_UnitCost))), typeof (Decimal))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_MaterialCost)), (Expression) Expression.Convert((Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_MaterialCost))), typeof (Decimal))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_LaborCost)), (Expression) Expression.Convert((Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_LaborCost))), typeof (Decimal))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_OverHeadCost)), (Expression) Expression.Convert((Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_OveheadCost))), typeof (Decimal))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_O08FBUR)), (Expression) Expression.Convert((Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_O08FBUR))), typeof (Decimal))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_O09PBUR)), (Expression) Expression.Convert((Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_O09PBUR))), typeof (Decimal))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_O10AMU)), (Expression) Expression.Convert((Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_O10AMU))), typeof (Decimal))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_O11VBUR)), (Expression) Expression.Convert((Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_O11VBUR))), typeof (Decimal))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_Vendor)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_Vendor)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_Routing)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_Routing)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_ItemType)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_ItemType)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_DateAdded)), (Expression) Expression.Convert((Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_DateAdded))), typeof (DateTime)))), new ParameterExpression[1]
        {
          parameterExpression
        }));
        if (source.Count<scItemMaster>() > 0)
          scItemMasterList = source.ToList<scItemMaster>();
        se0085CtEntities1.Database.Connection.Close();
      }
      return scItemMasterList;
    }

    public List<scItemMaster> rtnLikeAssyParts(string AssyPart, int SkipRecords = 0, int TakeRecords = 2147483647)
    {
      List<scItemMaster> scItemMasterList = new List<scItemMaster>();
      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
        // ISSUE: method reference
        // ISSUE: method reference
        // ISSUE: method reference
        // ISSUE: method reference
        IQueryable<scItemMaster> source = ((IQueryable<scItemMaster>) Queryable.Select<AssyPart, scItemMaster>((IQueryable<M0>) Queryable.OrderBy<AssyPart, string>(Queryable.Where<AssyPart>((IQueryable<M0>) se0085CtEntities1.AssyParts, (Expression<Func<M0, bool>>) (p => p.AssyPartNum.Contains(AssyPart))), (Expression<Func<M0, M1>>) (p => p.AssyPartNum)), (Expression<Func<M0, M1>>) Expression.Lambda<Func<AssyPart, scItemMaster>>((Expression) Expression.MemberInit(Expression.New((ConstructorInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.\u002Ector)), (Expression[]) null), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_AssyPartId)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_AssyPartId)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_AssyPartNumber)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_AssyPartNum)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_Description1)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_AssyDesc1)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_Description2)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_AssyDesc2)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_BuyMake)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_BuyMake)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_OFOKanban)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_OFOKanban)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scItemMaster.set_AssyPartActive)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (AssyPart.get_AssyPartActive))))), new ParameterExpression[1]
        {
          parameterExpression
        }))).Skip<scItemMaster>(SkipRecords).Take<scItemMaster>(TakeRecords);
        if (source.Count<scItemMaster>() > 0)
          scItemMasterList = source.ToList<scItemMaster>();
        se0085CtEntities1.Database.Connection.Close();
      }
      return scItemMasterList;
    }

    public delegate void ProcessUpdateEventHandler(int Progress);

    public delegate void AssyPartUpdateEventHandler(string ItemUpdated);
  }
}
