// Decompiled with JetBrains decompiler
// Type: SE0085.CTdB.clsAssemblyLine
// 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.CTdB.My;
using SE0085.dBc;
using SE0085.StCl;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;

namespace SE0085.CTdB
{
  public class clsAssemblyLine
  {
    private string _CTConnection;
    private scPlants _Plant;
    private scAssemblyLine _AssemblyLine;
    private List<scAssemblyLine> _AssemblyLinesList;

    public string Revision
    {
      [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] get
      {
        return "Version; " + Conversions.ToString(MyProject.Application.Info.Version.Major) + "." + Conversions.ToString(MyProject.Application.Info.Version.Minor) + "." + Conversions.ToString((int) MyProject.Application.Info.Version.MajorRevision) + "." + Conversions.ToString((int) MyProject.Application.Info.Version.MinorRevision);
      }
    }

    public scPlants Plant
    {
      get
      {
        return this._Plant;
      }
      set
      {
        this._Plant = value;
      }
    }

    public scAssemblyLine AssemblyLine
    {
      get
      {
        return this._AssemblyLine;
      }
      set
      {
        this._AssemblyLine = value;
      }
    }

    public List<scAssemblyLine> AssemblyLinesList
    {
      get
      {
        return this._AssemblyLinesList;
      }
    }

    public clsAssemblyLine(scPlants Plant)
    {
      this._Plant = new scPlants();
      this._AssemblyLinesList = new List<scAssemblyLine>();
      this._Plant = Plant;
      this._AssemblyLine = new scAssemblyLine();
      this.GetdBConnString();
    }

    public clsAssemblyLine(scLevels Plant)
    {
      this._Plant = new scPlants();
      this._AssemblyLinesList = new List<scAssemblyLine>();
      this._Plant.PlantLevel = Plant;
      this._AssemblyLine = new scAssemblyLine();
      this.GetdBConnString();
    }

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

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

    public scAssemblyLine rtnAssemblyLineById(int AssemblyLineId)
    {
      // ISSUE: object of a compiler-generated type is created
      // ISSUE: variable of a compiler-generated type
      clsAssemblyLine._Closure\u0024__56 closure56 = new clsAssemblyLine._Closure\u0024__56();
      // ISSUE: reference to a compiler-generated field
      closure56.\u0024VB\u0024Local_AssemblyLineId = AssemblyLineId;
      scAssemblyLine scAssemblyLine = new scAssemblyLine();
      using (SE0085CTEntities1 se0085CtEntities1 = new SE0085CTEntities1())
      {
        se0085CtEntities1.Database.Connection.ConnectionString = this._CTConnection;
        ParameterExpression parameterExpression1;
        ParameterExpression parameterExpression2;
        // ISSUE: method reference
        // ISSUE: field 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<scAssemblyLine> source = (IQueryable<scAssemblyLine>) Queryable.Select<SE0085.dBc.AssemblyLine, scAssemblyLine>(Queryable.Where<SE0085.dBc.AssemblyLine>((IQueryable<M0>) se0085CtEntities1.AssemblyLines, (Expression<Func<M0, bool>>) Expression.Lambda<Func<SE0085.dBc.AssemblyLine, bool>>((Expression) Expression.And((Expression) Expression.Equal(al.SEPlant.SEPlantId, this._Plant.PlantId, true, (MethodInfo) null), (Expression) Expression.Equal((Expression) Expression.Property((Expression) parameterExpression1, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SE0085.dBc.AssemblyLine.get_AssemLineId))), (Expression) Expression.Field((Expression) Expression.Constant((object) closure56, typeof (clsAssemblyLine._Closure\u0024__56)), FieldInfo.GetFieldFromHandle(__fieldref (clsAssemblyLine._Closure\u0024__56.\u0024VB\u0024Local_AssemblyLineId))), true, (MethodInfo) null)), new ParameterExpression[1]
        {
          parameterExpression1
        })), (Expression<Func<M0, M1>>) Expression.Lambda<Func<SE0085.dBc.AssemblyLine, scAssemblyLine>>((Expression) Expression.MemberInit(Expression.New((ConstructorInfo) MethodBase.GetMethodFromHandle(__methodref (scAssemblyLine.\u002Ector)), (Expression[]) null), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scLevels.set_LevelId)), (Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SE0085.dBc.AssemblyLine.get_AssemLineId)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scLevels.set_LevelAbbrv)), (Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SE0085.dBc.AssemblyLine.get_AssemLineAbbrv)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scLevels.set_LevelName)), (Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SE0085.dBc.AssemblyLine.get_AssemLineName)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scLevels.set_LevelValue)), (Expression) Expression.ConvertChecked((Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SE0085.dBc.AssemblyLine.get_AssemLineValue))), typeof (byte))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scLevels.set_LevelActiveBool)), (Expression) Expression.Convert((Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SE0085.dBc.AssemblyLine.get_AssemLineActive))), typeof (bool))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scLevels.set_LevelParentId)), (Expression) Expression.Property((Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SE0085.dBc.AssemblyLine.get_SEPlant))), (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SEPlant.get_SEPlantId))))), new ParameterExpression[1]
        {
          parameterExpression2
        }));
        if (source != null && source.Count<scAssemblyLine>() == 1)
          scAssemblyLine = source.First<scAssemblyLine>();
        this._AssemblyLine = scAssemblyLine;
        se0085CtEntities1.Database.Connection.Close();
      }
      return scAssemblyLine;
    }

    public List<scAssemblyLine> rtnAssemblyLines(bool ActiveOnly)
    {
      // ISSUE: object of a compiler-generated type is created
      // ISSUE: variable of a compiler-generated type
      clsAssemblyLine._Closure\u0024__57 closure57 = new clsAssemblyLine._Closure\u0024__57();
      List<scAssemblyLine> scAssemblyLineList = new List<scAssemblyLine>();
      // ISSUE: reference to a compiler-generated field
      closure57.\u0024VB\u0024Local_ldActive1 = true;
      // ISSUE: reference to a compiler-generated field
      closure57.\u0024VB\u0024Local_ldActive2 = ActiveOnly;
      using (SE0085CTEntities1 se0085CtEntities1 = new SE0085CTEntities1())
      {
        se0085CtEntities1.Database.Connection.ConnectionString = this._CTConnection;
        ParameterExpression parameterExpression1;
        ParameterExpression parameterExpression2;
        // ISSUE: method reference
        // ISSUE: field reference
        // ISSUE: method reference
        // ISSUE: field 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<scAssemblyLine> source = (IQueryable<scAssemblyLine>) Queryable.Select<SE0085.dBc.AssemblyLine, scAssemblyLine>(Queryable.Where<SE0085.dBc.AssemblyLine>((IQueryable<M0>) se0085CtEntities1.AssemblyLines, (Expression<Func<M0, bool>>) Expression.Lambda<Func<SE0085.dBc.AssemblyLine, bool>>((Expression) Expression.Coalesce((Expression) Expression.And((Expression) Expression.Convert((Expression) Expression.Equal(al.SEPlant.SEPlantId, this._Plant.PlantId, true, (MethodInfo) null), typeof (bool?)), (Expression) Expression.Or((Expression) Expression.Equal((Expression) Expression.Property((Expression) parameterExpression1, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SE0085.dBc.AssemblyLine.get_AssemLineActive))), (Expression) Expression.Convert((Expression) Expression.Field((Expression) Expression.Constant((object) closure57, typeof (clsAssemblyLine._Closure\u0024__57)), FieldInfo.GetFieldFromHandle(__fieldref (clsAssemblyLine._Closure\u0024__57.\u0024VB\u0024Local_ldActive1))), typeof (bool?)), true, (MethodInfo) null), (Expression) Expression.Equal((Expression) Expression.Property((Expression) parameterExpression1, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SE0085.dBc.AssemblyLine.get_AssemLineActive))), (Expression) Expression.Convert((Expression) Expression.Field((Expression) Expression.Constant((object) closure57, typeof (clsAssemblyLine._Closure\u0024__57)), FieldInfo.GetFieldFromHandle(__fieldref (clsAssemblyLine._Closure\u0024__57.\u0024VB\u0024Local_ldActive2))), typeof (bool?)), true, (MethodInfo) null))), (Expression) Expression.Constant((object) false, typeof (bool))), new ParameterExpression[1]
        {
          parameterExpression1
        })), (Expression<Func<M0, M1>>) Expression.Lambda<Func<SE0085.dBc.AssemblyLine, scAssemblyLine>>((Expression) Expression.MemberInit(Expression.New((ConstructorInfo) MethodBase.GetMethodFromHandle(__methodref (scAssemblyLine.\u002Ector)), (Expression[]) null), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scLevels.set_LevelId)), (Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SE0085.dBc.AssemblyLine.get_AssemLineId)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scLevels.set_LevelAbbrv)), (Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SE0085.dBc.AssemblyLine.get_AssemLineAbbrv)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scLevels.set_LevelName)), (Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SE0085.dBc.AssemblyLine.get_AssemLineName)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scLevels.set_LevelValue)), (Expression) Expression.ConvertChecked((Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SE0085.dBc.AssemblyLine.get_AssemLineValue))), typeof (byte))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scLevels.set_LevelActiveBool)), (Expression) Expression.Convert((Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SE0085.dBc.AssemblyLine.get_AssemLineActive))), typeof (bool))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scLevels.set_LevelParentId)), (Expression) Expression.Property((Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SE0085.dBc.AssemblyLine.get_SEPlant))), (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SEPlant.get_SEPlantId))))), new ParameterExpression[1]
        {
          parameterExpression2
        }));
        if (source != null && source.Count<scAssemblyLine>() > 0)
          scAssemblyLineList = source.ToList<scAssemblyLine>();
        this._AssemblyLinesList = scAssemblyLineList;
        se0085CtEntities1.Database.Connection.Close();
      }
      return scAssemblyLineList;
    }

    public scAssemblyLine rtnAssemblyLineByAbbrv(int PlantId, string AssemblyLineAddrv)
    {
      // ISSUE: object of a compiler-generated type is created
      // ISSUE: variable of a compiler-generated type
      clsAssemblyLine._Closure\u0024__58 closure58 = new clsAssemblyLine._Closure\u0024__58();
      // ISSUE: reference to a compiler-generated field
      closure58.\u0024VB\u0024Local_AssemblyLineAddrv = AssemblyLineAddrv;
      scAssemblyLine scAssemblyLine = new scAssemblyLine();
      using (SE0085CTEntities1 se0085CtEntities1 = new SE0085CTEntities1())
      {
        se0085CtEntities1.Database.Connection.ConnectionString = this._CTConnection;
        ParameterExpression parameterExpression1;
        ParameterExpression parameterExpression2;
        // ISSUE: method reference
        // ISSUE: method reference
        // ISSUE: field 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<scAssemblyLine> source = (IQueryable<scAssemblyLine>) Queryable.Select<SE0085.dBc.AssemblyLine, scAssemblyLine>(Queryable.Where<SE0085.dBc.AssemblyLine>((IQueryable<M0>) se0085CtEntities1.AssemblyLines, (Expression<Func<M0, bool>>) Expression.Lambda<Func<SE0085.dBc.AssemblyLine, bool>>((Expression) Expression.And((Expression) Expression.Equal(al.SEPlant.SEPlantId, this._Plant.PlantId, true, (MethodInfo) null), (Expression) Expression.Equal((Expression) Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Operators.CompareString)), (Expression) Expression.Property((Expression) parameterExpression1, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SE0085.dBc.AssemblyLine.get_AssemLineAbbrv))), (Expression) Expression.Field((Expression) Expression.Constant((object) closure58, typeof (clsAssemblyLine._Closure\u0024__58)), FieldInfo.GetFieldFromHandle(__fieldref (clsAssemblyLine._Closure\u0024__58.\u0024VB\u0024Local_AssemblyLineAddrv))), (Expression) Expression.Constant((object) false, typeof (bool))), (Expression) Expression.Constant((object) 0, typeof (int)))), new ParameterExpression[1]
        {
          parameterExpression1
        })), (Expression<Func<M0, M1>>) Expression.Lambda<Func<SE0085.dBc.AssemblyLine, scAssemblyLine>>((Expression) Expression.MemberInit(Expression.New((ConstructorInfo) MethodBase.GetMethodFromHandle(__methodref (scAssemblyLine.\u002Ector)), (Expression[]) null), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scLevels.set_LevelId)), (Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SE0085.dBc.AssemblyLine.get_AssemLineId)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scLevels.set_LevelAbbrv)), (Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SE0085.dBc.AssemblyLine.get_AssemLineAbbrv)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scLevels.set_LevelName)), (Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SE0085.dBc.AssemblyLine.get_AssemLineName)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scLevels.set_LevelValue)), (Expression) Expression.ConvertChecked((Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SE0085.dBc.AssemblyLine.get_AssemLineValue))), typeof (byte))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scLevels.set_LevelActiveBool)), (Expression) Expression.Convert((Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SE0085.dBc.AssemblyLine.get_AssemLineActive))), typeof (bool))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scLevels.set_LevelParentId)), (Expression) Expression.Property((Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SE0085.dBc.AssemblyLine.get_SEPlant))), (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SEPlant.get_SEPlantId))))), new ParameterExpression[1]
        {
          parameterExpression2
        }));
        if (source.Count<scAssemblyLine>() != 1)
          return (scAssemblyLine) null;
        scAssemblyLine = source.First<scAssemblyLine>();
        this._AssemblyLine = scAssemblyLine;
        se0085CtEntities1.Database.Connection.Close();
      }
      return scAssemblyLine;
    }
  }
}
