// Decompiled with JetBrains decompiler
// Type: SE0085.CTdB.clsPlant
// 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 clsPlant
  {
    private string _CTConnection;
    private scPlants _Plant;
    private List<scPlants> _PlantsList;

    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 List<scPlants> PlantsList
    {
      get
      {
        return this._PlantsList;
      }
    }

    public clsPlant()
    {
      this._PlantsList = new List<scPlants>();
      this._Plant = new scPlants();
      this._PlantsList = new List<scPlants>();
      clsDBC clsDbc = new clsDBC();
      clsDbc.GetServer((object) "SE0085CTEntities1");
      this._CTConnection = Conversions.ToString(clsDbc.ConnectionString);
    }

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

    public List<scPlants> rtnPlants(bool ActiveOnly)
    {
      // ISSUE: object of a compiler-generated type is created
      // ISSUE: variable of a compiler-generated type
      clsPlant._Closure\u0024__53 closure53 = new clsPlant._Closure\u0024__53();
      List<scPlants> scPlantsList = new List<scPlants>();
      // ISSUE: reference to a compiler-generated field
      closure53.\u0024VB\u0024Local_ldActive1 = true;
      // ISSUE: reference to a compiler-generated field
      closure53.\u0024VB\u0024Local_ldActive2 = ActiveOnly;
      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: 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
        // ISSUE: method reference
        IQueryable<scPlants> source = (IQueryable<scPlants>) Queryable.Select<SEPlant, scPlants>(Queryable.Where<SEPlant>((IQueryable<M0>) se0085CtEntities1.SEPlants, (Expression<Func<M0, bool>>) Expression.Lambda<Func<SEPlant, bool>>((Expression) Expression.Coalesce((Expression) Expression.Or((Expression) Expression.Equal(p.SEPlantActive, (bool?) closure53.\u0024VB\u0024Local_ldActive1, true, (MethodInfo) null), (Expression) Expression.Equal((Expression) Expression.Property((Expression) parameterExpression1, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SEPlant.get_SEPlantActive))), (Expression) Expression.Convert((Expression) Expression.Field((Expression) Expression.Constant((object) closure53, typeof (clsPlant._Closure\u0024__53)), FieldInfo.GetFieldFromHandle(__fieldref (clsPlant._Closure\u0024__53.\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<SEPlant, scPlants>>((Expression) Expression.MemberInit(Expression.New((ConstructorInfo) MethodBase.GetMethodFromHandle(__methodref (scPlants.\u002Ector)), (Expression[]) null), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scPlants.set_PlantId)), (Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SEPlant.get_SEPlantId)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scPlants.set_PlantDesin)), (Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SEPlant.get_SEPlantDesin)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scPlants.set_PlantName)), (Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SEPlant.get_SEPlantName)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scPlants.set_PlantCity)), (Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SEPlant.get_SEPlantCity)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scPlants.set_PlantState)), (Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SEPlant.get_SEPlantState)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scPlants.set_PlantValue)), (Expression) Expression.ConvertChecked((Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SEPlant.get_SEPlantValue))), typeof (byte))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scPlants.set_PlantActiveBool)), (Expression) Expression.Convert((Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SEPlant.get_SEPlantActive))), typeof (bool)))), new ParameterExpression[1]
        {
          parameterExpression2
        }));
        if (source != null && source.Count<scPlants>() > 0)
          scPlantsList = source.ToList<scPlants>();
        this._PlantsList = scPlantsList;
        se0085CtEntities1.Database.Connection.Close();
      }
      return scPlantsList;
    }

    public scPlants rtnPlantById(int PlantId)
    {
      // ISSUE: object of a compiler-generated type is created
      // ISSUE: variable of a compiler-generated type
      clsPlant._Closure\u0024__54 closure54 = new clsPlant._Closure\u0024__54();
      // ISSUE: reference to a compiler-generated field
      closure54.\u0024VB\u0024Local_PlantId = PlantId;
      scPlants scPlants = new scPlants();
      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
        IQueryable<scPlants> source = (IQueryable<scPlants>) Queryable.Select<SEPlant, scPlants>(Queryable.Where<SEPlant>((IQueryable<M0>) se0085CtEntities1.SEPlants, (Expression<Func<M0, bool>>) Expression.Lambda<Func<SEPlant, bool>>((Expression) Expression.Equal(p.SEPlantId, closure54.\u0024VB\u0024Local_PlantId, true, (MethodInfo) null), new ParameterExpression[1]
        {
          parameterExpression1
        })), (Expression<Func<M0, M1>>) Expression.Lambda<Func<SEPlant, scPlants>>((Expression) Expression.MemberInit(Expression.New((ConstructorInfo) MethodBase.GetMethodFromHandle(__methodref (scPlants.\u002Ector)), (Expression[]) null), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scPlants.set_PlantId)), (Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SEPlant.get_SEPlantId)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scPlants.set_PlantDesin)), (Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SEPlant.get_SEPlantDesin)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scPlants.set_PlantName)), (Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SEPlant.get_SEPlantName)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scPlants.set_PlantCity)), (Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SEPlant.get_SEPlantCity)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scPlants.set_PlantState)), (Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SEPlant.get_SEPlantState)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scPlants.set_PlantValue)), (Expression) Expression.ConvertChecked((Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SEPlant.get_SEPlantValue))), typeof (byte))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scPlants.set_PlantActiveBool)), (Expression) Expression.Convert((Expression) Expression.Property((Expression) parameterExpression2, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SEPlant.get_SEPlantActive))), typeof (bool)))), new ParameterExpression[1]
        {
          parameterExpression2
        }));
        if (source != null && source.Count<scPlants>() == 1)
          scPlants = source.First<scPlants>();
        this._Plant = scPlants;
        se0085CtEntities1.Database.Connection.Close();
      }
      return scPlants;
    }

    public scPlants rtnPlantByDesin(string PlantDesin)
    {
      // ISSUE: object of a compiler-generated type is created
      // ISSUE: variable of a compiler-generated type
      clsPlant._Closure\u0024__55 closure55 = new clsPlant._Closure\u0024__55();
      // ISSUE: reference to a compiler-generated field
      closure55.\u0024VB\u0024Local_PlantDesin = PlantDesin;
      scPlants scPlants = new scPlants();
      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
        IQueryable<scPlants> source = (IQueryable<scPlants>) Queryable.Select<SEPlant, scPlants>(Queryable.Where<SEPlant>((IQueryable<M0>) se0085CtEntities1.SEPlants, (Expression<Func<M0, bool>>) (p => Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Operators.CompareString)), p.SEPlantDesin, closure55.\u0024VB\u0024Local_PlantDesin, false) == 0)), (Expression<Func<M0, M1>>) Expression.Lambda<Func<SEPlant, scPlants>>((Expression) Expression.MemberInit(Expression.New((ConstructorInfo) MethodBase.GetMethodFromHandle(__methodref (scPlants.\u002Ector)), (Expression[]) null), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scPlants.set_PlantId)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SEPlant.get_SEPlantId)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scPlants.set_PlantDesin)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SEPlant.get_SEPlantDesin)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scPlants.set_PlantName)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SEPlant.get_SEPlantName)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scPlants.set_PlantCity)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SEPlant.get_SEPlantCity)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scPlants.set_PlantState)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SEPlant.get_SEPlantState)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scPlants.set_PlantValue)), (Expression) Expression.ConvertChecked((Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SEPlant.get_SEPlantValue))), typeof (byte))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scPlants.set_PlantActiveBool)), (Expression) Expression.Convert((Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (SEPlant.get_SEPlantActive))), typeof (bool)))), new ParameterExpression[1]{ parameterExpression }));
        if (source.Count<scPlants>() != 1)
          return (scPlants) null;
        scPlants = source.First<scPlants>();
        this._Plant = scPlants;
        se0085CtEntities1.Database.Connection.Close();
      }
      return scPlants;
    }
  }
}
