// Decompiled with JetBrains decompiler
// Type: SE0085.Q2CdB.clsT2Q2CdB
// Assembly: SE0085Q2CdB, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: A5680110-30A2-457F-A920-E4C024719231
// Assembly location: C:\Users\Abishek\Downloads\SchneiderCode_Breaker_09292016\Breaker Schedule-20160930T014118Z\Breaker Schedule\Solution for gathering Breaker Data\DMS\bin\Debug\SE0085Q2CdB.dll

using Microsoft.VisualBasic.CompilerServices;
using SE0085.Q2CdB.My;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;

namespace SE0085.Q2CdB
{
  public class clsT2Q2CdB
  {
    private dBConnect ldConnCT;
    private MDSS_dbmor_dEntities ldDataProCT;
    private dBConnect ldConnCD;
    private MDSS_dbmdsEntities ldDataProCD;

    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 string Author
    {
      get
      {
        return "Terry Taylor";
      }
    }

    public clsT2Q2CdB()
    {
      this.ldConnCT = new dBConnect(emDataEntity.SEQ2C01, emDataSource.BRCCSQLCLUSTER, emInitCatalog.SE0085Q2C01, "NewCastle");
      this.ldDataProCT = new MDSS_dbmor_dEntities(this.ldConnCT.Connection);
      this.ldConnCD = new dBConnect(emDataEntity.SEQ2C02, emDataSource.BRCCSQLCLUSTER, emInitCatalog.SE0085Q2C02, "NewCastle");
      this.ldDataProCD = new MDSS_dbmdsEntities(this.ldConnCD.Connection);
    }

    ~clsT2Q2CdB()
    {
      this.ldDataProCT = (MDSS_dbmor_dEntities) null;
      this.ldConnCT = (dBConnect) null;
      // ISSUE: explicit finalizer call
      base.Finalize();
    }

    public List<scmdsbodq2c> getByPOmdsbodq2c(string PONum)
    {
      // ISSUE: object of a compiler-generated type is created
      // ISSUE: variable of a compiler-generated type
      clsT2Q2CdB._Closure\u0024__1 closure1 = new clsT2Q2CdB._Closure\u0024__1();
      // ISSUE: reference to a compiler-generated field
      closure1.\u0024VB\u0024Local_PONum = PONum;
      List<scmdsbodq2c> scmdsbodq2cList = new List<scmdsbodq2c>();
      // ISSUE: method reference
      // ISSUE: reference to a compiler-generated field
      IQueryable<mdsbodq2c> source = (IQueryable<mdsbodq2c>) Queryable.Select<mdsbodq2c, mdsbodq2c>((IQueryable<M0>) Queryable.ThenBy<mdsbodq2c, string>(Queryable.OrderBy<mdsbodq2c, DateTime>(Queryable.Where<mdsbodq2c>((IQueryable<M0>) this.ldDataProCT.mdsbodq2c, (Expression<Func<M0, bool>>) (q => Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Operators.CompareString)), q.purch_po_nbr, closure1.\u0024VB\u0024Local_PONum, false) == 0)), (Expression<Func<M0, M1>>) (q => q.curr_prom_dt)), (Expression<Func<M0, M1>>) (q => q.shp_sched_id)), (Expression<Func<M0, M1>>) (q => q));
      IEnumerator<mdsbodq2c> enumerator;
      if (source != null)
      {
        if (source.Count<mdsbodq2c>() > 0)
        {
          try
          {
            enumerator = source.GetEnumerator();
            while (enumerator.MoveNext())
            {
              mdsbodq2c current = enumerator.Current;
              scmdsbodq2c scmdsbodq2c = new scmdsbodq2c();
              scmdsbodq2c.q2c_nbr = current.q2c_nbr;
              scmdsbodq2c.ln_itm = current.ln_itm;
              scmdsbodq2c.sub_ln_itm_id = current.sub_ln_itm_id;
              scmdsbodq2c.shp_sched_id = current.shp_sched_id;
              scmdsbodq2c.orig_prom_dt = current.orig_prom_dt;
              scmdsbodq2c.curr_prom_dt = current.curr_prom_dt;
              scmdsbodq2c.not_b4_dt = current.not_b4_dt;
              try
              {
                DateTime? shpdDt = current.shpd_dt;
                scmdsbodq2c.shpd_dt = !shpdDt.HasValue ? Conversions.ToDate("1901-01-01") : (DateTime) current.shpd_dt;
              }
              catch (Exception ex)
              {
                ProjectData.SetProjectError(ex);
                scmdsbodq2c.shpd_dt = Conversions.ToDate("1901-01-01");
                ProjectData.ClearProjectError();
              }
              scmdsbodq2c.shpg_loc = current.shpg_loc;
              scmdsbodq2c.hold_ord_ind = current.hold_ord_ind;
              scmdsbodq2c.srce_loc = current.srce_loc;
              scmdsbodq2c.tot_unfld_ord_qty = current.tot_unfld_ord_qty;
              try
              {
                scmdsbodq2c.carr = current.carr == null ? " " : current.carr;
              }
              catch (Exception ex)
              {
                ProjectData.SetProjectError(ex);
                scmdsbodq2c.carr = " ";
                ProjectData.ClearProjectError();
              }
              scmdsbodq2c.catlg_nbr = current.catlg_nbr;
              scmdsbodq2cList.Add(scmdsbodq2c);
            }
          }
          finally
          {
            if (enumerator != null)
              enumerator.Dispose();
          }
        }
      }
      return scmdsbodq2cList;
    }

    public List<scmdsbodq2c> getByShipDtmdsbodq2c(DateTime ShipDate)
    {
      List<scmdsbodq2c> scmdsbodq2cList = new List<scmdsbodq2c>();
      // ISSUE: method reference
      IQueryable<mdsbodq2c> source = (IQueryable<mdsbodq2c>) Queryable.Select<mdsbodq2c, mdsbodq2c>((IQueryable<M0>) Queryable.ThenBy<mdsbodq2c, string>(Queryable.OrderBy<mdsbodq2c, DateTime>(Queryable.Where<mdsbodq2c>((IQueryable<M0>) this.ldDataProCT.mdsbodq2c, (Expression<Func<M0, bool>>) (q => q.shpd_dt >= (DateTime?) ShipDate & (bool?) (Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Operators.CompareString)), q.mfg_loc, "085", false) == 0) ?? false)), (Expression<Func<M0, M1>>) (q => q.curr_prom_dt)), (Expression<Func<M0, M1>>) (q => q.shp_sched_id)), (Expression<Func<M0, M1>>) (q => q));
      IEnumerator<mdsbodq2c> enumerator;
      if (source != null)
      {
        if (source.Count<mdsbodq2c>() > 0)
        {
          try
          {
            enumerator = source.GetEnumerator();
            while (enumerator.MoveNext())
            {
              mdsbodq2c current = enumerator.Current;
              scmdsbodq2c scmdsbodq2c = new scmdsbodq2c();
              scmdsbodq2c.q2c_nbr = current.q2c_nbr;
              scmdsbodq2c.ln_itm = current.ln_itm;
              scmdsbodq2c.sub_ln_itm_id = current.sub_ln_itm_id;
              scmdsbodq2c.shp_sched_id = current.shp_sched_id;
              scmdsbodq2c.orig_prom_dt = current.orig_prom_dt;
              scmdsbodq2c.curr_prom_dt = current.curr_prom_dt;
              scmdsbodq2c.not_b4_dt = current.not_b4_dt;
              try
              {
                DateTime? shpdDt = current.shpd_dt;
                scmdsbodq2c.shpd_dt = !shpdDt.HasValue ? Conversions.ToDate("1901-01-01") : (DateTime) current.shpd_dt;
              }
              catch (Exception ex)
              {
                ProjectData.SetProjectError(ex);
                scmdsbodq2c.shpd_dt = Conversions.ToDate("1901-01-01");
                ProjectData.ClearProjectError();
              }
              scmdsbodq2c.shpg_loc = current.shpg_loc;
              scmdsbodq2c.hold_ord_ind = current.hold_ord_ind;
              scmdsbodq2c.srce_loc = current.srce_loc;
              scmdsbodq2c.tot_unfld_ord_qty = current.tot_unfld_ord_qty;
              try
              {
                scmdsbodq2c.carr = current.carr == null ? " " : current.carr;
              }
              catch (Exception ex)
              {
                ProjectData.SetProjectError(ex);
                scmdsbodq2c.carr = " ";
                ProjectData.ClearProjectError();
              }
              scmdsbodq2c.catlg_nbr = current.catlg_nbr;
              scmdsbodq2cList.Add(scmdsbodq2c);
            }
          }
          finally
          {
            if (enumerator != null)
              enumerator.Dispose();
          }
        }
      }
      return scmdsbodq2cList;
    }

    public List<scmdsbodq2c> savegetByPOmdsbodq2c(string PONum)
    {
      // ISSUE: object of a compiler-generated type is created
      // ISSUE: variable of a compiler-generated type
      clsT2Q2CdB._Closure\u0024__3 closure3 = new clsT2Q2CdB._Closure\u0024__3();
      // ISSUE: reference to a compiler-generated field
      closure3.\u0024VB\u0024Local_PONum = PONum;
      List<scmdsbodq2c> scmdsbodq2cList = new List<scmdsbodq2c>();
      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
      IQueryable<scmdsbodq2c> source = (IQueryable<scmdsbodq2c>) Queryable.Select<mdsbodq2c, scmdsbodq2c>((IQueryable<M0>) Queryable.ThenBy<mdsbodq2c, string>(Queryable.OrderBy<mdsbodq2c, DateTime>(Queryable.Where<mdsbodq2c>((IQueryable<M0>) this.ldDataProCT.mdsbodq2c, (Expression<Func<M0, bool>>) (q => Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Operators.CompareString)), q.purch_po_nbr, closure3.\u0024VB\u0024Local_PONum, false) == 0)), (Expression<Func<M0, M1>>) (q => q.curr_prom_dt)), (Expression<Func<M0, M1>>) (q => q.shp_sched_id)), (Expression<Func<M0, M1>>) Expression.Lambda<Func<mdsbodq2c, scmdsbodq2c>>((Expression) Expression.MemberInit(Expression.New((ConstructorInfo) MethodBase.GetMethodFromHandle(__methodref (scmdsbodq2c.\u002Ector)), (Expression[]) null), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scmdsbodq2c.set_q2c_nbr)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (mdsbodq2c.get_q2c_nbr)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scmdsbodq2c.set_ln_itm)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (mdsbodq2c.get_ln_itm)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scmdsbodq2c.set_sub_ln_itm_id)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (mdsbodq2c.get_sub_ln_itm_id)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scmdsbodq2c.set_shp_sched_id)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (mdsbodq2c.get_shp_sched_id)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scmdsbodq2c.set_orig_prom_dt)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (mdsbodq2c.get_orig_prom_dt)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scmdsbodq2c.set_curr_prom_dt)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (mdsbodq2c.get_curr_prom_dt)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scmdsbodq2c.set_not_b4_dt)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (mdsbodq2c.get_not_b4_dt)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scmdsbodq2c.set_shpd_dt)), (Expression) Expression.Convert((Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (mdsbodq2c.get_shpd_dt))), typeof (DateTime))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scmdsbodq2c.set_shpg_loc)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (mdsbodq2c.get_shpg_loc)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scmdsbodq2c.set_hold_ord_ind)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (mdsbodq2c.get_hold_ord_ind)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scmdsbodq2c.set_srce_loc)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (mdsbodq2c.get_srce_loc)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scmdsbodq2c.set_tot_unfld_ord_qty)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (mdsbodq2c.get_tot_unfld_ord_qty)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scmdsbodq2c.set_carr)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (mdsbodq2c.get_carr)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scmdsbodq2c.set_catlg_nbr)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (mdsbodq2c.get_catlg_nbr))))), new ParameterExpression[1]{ parameterExpression }));
      if (source != null && source.Count<scmdsbodq2c>() > 0)
        scmdsbodq2cList = source.ToList<scmdsbodq2c>();
      return scmdsbodq2cList;
    }

    public scmdsbodtd getByQ2Cmdsbodtd(string q2c_num, string ln_itm, string sub_ln_itm_id, string shp_sched_id)
    {
      // ISSUE: object of a compiler-generated type is created
      // ISSUE: variable of a compiler-generated type
      clsT2Q2CdB._Closure\u0024__4 closure4 = new clsT2Q2CdB._Closure\u0024__4();
      // ISSUE: reference to a compiler-generated field
      closure4.\u0024VB\u0024Local_q2c_num = q2c_num;
      // ISSUE: reference to a compiler-generated field
      closure4.\u0024VB\u0024Local_ln_itm = ln_itm;
      // ISSUE: reference to a compiler-generated field
      closure4.\u0024VB\u0024Local_sub_ln_itm_id = sub_ln_itm_id;
      // ISSUE: reference to a compiler-generated field
      closure4.\u0024VB\u0024Local_shp_sched_id = shp_sched_id;
      scmdsbodtd scmdsbodtd = new scmdsbodtd();
      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: 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<scmdsbodtd> source = ((IQueryable<scmdsbodtd>) Queryable.Select<mdsbodtd, scmdsbodtd>((IQueryable<M0>) Queryable.OrderByDescending<mdsbodtd, DateTime>(Queryable.Where<mdsbodtd>((IQueryable<M0>) this.ldDataProCT.mdsbodtds, (Expression<Func<M0, bool>>) (q => Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Operators.CompareString)), q.q2c_nbr, closure4.\u0024VB\u0024Local_q2c_num, false) == 0 & Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Operators.CompareString)), q.ln_itm, closure4.\u0024VB\u0024Local_ln_itm, false) == 0 & Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Operators.CompareString)), q.sub_ln_itm_id, closure4.\u0024VB\u0024Local_sub_ln_itm_id, false) == 0 & Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Operators.CompareString)), q.shp_sched_id, closure4.\u0024VB\u0024Local_shp_sched_id, false) == 0)), (Expression<Func<M0, M1>>) (q => q.load_dt)), (Expression<Func<M0, M1>>) Expression.Lambda<Func<mdsbodtd, scmdsbodtd>>((Expression) Expression.MemberInit(Expression.New((ConstructorInfo) MethodBase.GetMethodFromHandle(__methodref (scmdsbodtd.\u002Ector)), (Expression[]) null), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scmdsbodtd.set_q2c_nbr)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (mdsbodtd.get_q2c_nbr)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scmdsbodtd.set_ln_itm)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (mdsbodtd.get_ln_itm)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scmdsbodtd.set_sub_ln_itm_id)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (mdsbodtd.get_sub_ln_itm_id)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scmdsbodtd.set_shp_sched_id)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (mdsbodtd.get_shp_sched_id)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scmdsbodtd.set_tot_bo_qty)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (mdsbodtd.get_tot_bo_qty)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scmdsbodtd.set_tot_shpg_qty)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (mdsbodtd.get_tot_shpg_qty)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scmdsbodtd.set_tot_unfld_ord_qty)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (mdsbodtd.get_tot_unfld_ord_qty)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scmdsbodtd.set_prgrs_pnt)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (mdsbodtd.get_prgrs_pnt)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scmdsbodtd.set_load_dt)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (mdsbodtd.get_load_dt))))), new ParameterExpression[1]{ parameterExpression }))).Take<scmdsbodtd>(1);
      if (source != null && source.Count<scmdsbodtd>() > 0)
        scmdsbodtd = source.First<scmdsbodtd>();
      return scmdsbodtd;
    }

    public List<scmdsbodq2c> getByQ2Cmdsbodq2c(string q2c_num, string ln_itm, string sub_ln_itm_id, string shp_sched_id)
    {
      // ISSUE: object of a compiler-generated type is created
      // ISSUE: variable of a compiler-generated type
      clsT2Q2CdB._Closure\u0024__5 closure5 = new clsT2Q2CdB._Closure\u0024__5();
      // ISSUE: reference to a compiler-generated field
      closure5.\u0024VB\u0024Local_shp_sched_id = shp_sched_id;
      // ISSUE: reference to a compiler-generated field
      closure5.\u0024VB\u0024Local_q2c_num = q2c_num;
      // ISSUE: reference to a compiler-generated field
      closure5.\u0024VB\u0024Local_ln_itm = ln_itm;
      // ISSUE: reference to a compiler-generated field
      closure5.\u0024VB\u0024Local_sub_ln_itm_id = sub_ln_itm_id;
      List<scmdsbodq2c> scmdsbodq2cList = new List<scmdsbodq2c>();
      // 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<mdsbodq2c> source = (IQueryable<mdsbodq2c>) Queryable.Select<mdsbodq2c, mdsbodq2c>((IQueryable<M0>) Queryable.ThenBy<mdsbodq2c, string>(Queryable.OrderBy<mdsbodq2c, DateTime>(Queryable.Where<mdsbodq2c>((IQueryable<M0>) this.ldDataProCT.mdsbodq2c, (Expression<Func<M0, bool>>) (q => Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Operators.CompareString)), q.q2c_nbr, closure5.\u0024VB\u0024Local_q2c_num, false) == 0 & Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Operators.CompareString)), q.ln_itm, closure5.\u0024VB\u0024Local_ln_itm, false) == 0 & Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Operators.CompareString)), q.sub_ln_itm_id, closure5.\u0024VB\u0024Local_sub_ln_itm_id, false) == 0 & Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Operators.CompareString)), q.shp_sched_id, closure5.\u0024VB\u0024Local_shp_sched_id, false) == 0)), (Expression<Func<M0, M1>>) (q => q.curr_prom_dt)), (Expression<Func<M0, M1>>) (q => q.shp_sched_id)), (Expression<Func<M0, M1>>) (q => q));
      IEnumerator<mdsbodq2c> enumerator;
      if (source != null)
      {
        if (source.Count<mdsbodq2c>() > 0)
        {
          try
          {
            enumerator = source.GetEnumerator();
            while (enumerator.MoveNext())
            {
              mdsbodq2c current = enumerator.Current;
              scmdsbodq2c scmdsbodq2c = new scmdsbodq2c();
              scmdsbodq2c.q2c_nbr = current.q2c_nbr;
              scmdsbodq2c.ln_itm = current.ln_itm;
              scmdsbodq2c.sub_ln_itm_id = current.sub_ln_itm_id;
              scmdsbodq2c.shp_sched_id = current.shp_sched_id;
              scmdsbodq2c.ln_cd = current.ln_cd;
              scmdsbodq2c.orig_prom_dt = current.orig_prom_dt;
              scmdsbodq2c.curr_prom_dt = current.curr_prom_dt;
              scmdsbodq2c.not_b4_dt = current.not_b4_dt;
              try
              {
                DateTime? shpdDt = current.shpd_dt;
                scmdsbodq2c.shpd_dt = !shpdDt.HasValue ? Conversions.ToDate("1901-01-01") : (DateTime) current.shpd_dt;
              }
              catch (Exception ex)
              {
                ProjectData.SetProjectError(ex);
                scmdsbodq2c.shpd_dt = Conversions.ToDate("1901-01-01");
                ProjectData.ClearProjectError();
              }
              scmdsbodq2c.shpg_loc = current.shpg_loc;
              scmdsbodq2c.hold_ord_ind = current.hold_ord_ind;
              scmdsbodq2c.srce_loc = current.srce_loc;
              scmdsbodq2c.tot_unfld_ord_qty = current.tot_unfld_ord_qty;
              try
              {
                scmdsbodq2c.carr = current.carr == null ? " " : current.carr;
              }
              catch (Exception ex)
              {
                ProjectData.SetProjectError(ex);
                scmdsbodq2c.carr = " ";
                ProjectData.ClearProjectError();
              }
              scmdsbodq2c.catlg_nbr = current.catlg_nbr;
              scmdsbodq2cList.Add(scmdsbodq2c);
            }
          }
          finally
          {
            if (enumerator != null)
              enumerator.Dispose();
          }
        }
      }
      return scmdsbodq2cList;
    }

    public List<scmdsbodq2c> getByCurrDtmdsbodq2c(DateTime CurrentPromDate)
    {
      List<scmdsbodq2c> scmdsbodq2cList = new List<scmdsbodq2c>();
      IQueryable<mdsbodq2c> source = (IQueryable<mdsbodq2c>) Queryable.Select<mdsbodq2c, mdsbodq2c>((IQueryable<M0>) Queryable.ThenBy<mdsbodq2c, string>(Queryable.ThenBy<mdsbodq2c, string>(Queryable.ThenBy<mdsbodq2c, string>(Queryable.ThenBy<mdsbodq2c, string>(Queryable.OrderBy<mdsbodq2c, DateTime>(Queryable.Where<mdsbodq2c>((IQueryable<M0>) this.ldDataProCT.mdsbodq2c, (Expression<Func<M0, bool>>) (q => q.curr_prom_dt == CurrentPromDate)), (Expression<Func<M0, M1>>) (q => q.curr_prom_dt)), (Expression<Func<M0, M1>>) (q => q.q2c_nbr)), (Expression<Func<M0, M1>>) (q => q.ln_itm)), (Expression<Func<M0, M1>>) (q => q.sub_ln_itm_id)), (Expression<Func<M0, M1>>) (q => q.shp_sched_id)), (Expression<Func<M0, M1>>) (q => q));
      IEnumerator<mdsbodq2c> enumerator;
      if (source != null)
      {
        if (source.Count<mdsbodq2c>() > 0)
        {
          try
          {
            enumerator = source.GetEnumerator();
            while (enumerator.MoveNext())
            {
              mdsbodq2c current = enumerator.Current;
              scmdsbodq2c scmdsbodq2c = new scmdsbodq2c();
              scmdsbodq2c.q2c_nbr = current.q2c_nbr;
              scmdsbodq2c.ln_itm = current.ln_itm;
              scmdsbodq2c.sub_ln_itm_id = current.sub_ln_itm_id;
              scmdsbodq2c.shp_sched_id = current.shp_sched_id;
              scmdsbodq2c.ln_cd = current.ln_cd;
              scmdsbodq2c.orig_prom_dt = current.orig_prom_dt;
              scmdsbodq2c.curr_prom_dt = current.curr_prom_dt;
              scmdsbodq2c.not_b4_dt = current.not_b4_dt;
              try
              {
                DateTime? shpdDt = current.shpd_dt;
                scmdsbodq2c.shpd_dt = !shpdDt.HasValue ? Conversions.ToDate("1901-01-01") : (DateTime) current.shpd_dt;
              }
              catch (Exception ex)
              {
                ProjectData.SetProjectError(ex);
                scmdsbodq2c.shpd_dt = Conversions.ToDate("1901-01-01");
                ProjectData.ClearProjectError();
              }
              scmdsbodq2c.shpg_loc = current.shpg_loc;
              scmdsbodq2c.hold_ord_ind = current.hold_ord_ind;
              scmdsbodq2c.srce_loc = current.srce_loc;
              scmdsbodq2c.tot_unfld_ord_qty = current.tot_unfld_ord_qty;
              try
              {
                scmdsbodq2c.carr = current.carr == null ? " " : current.carr;
              }
              catch (Exception ex)
              {
                ProjectData.SetProjectError(ex);
                scmdsbodq2c.carr = " ";
                ProjectData.ClearProjectError();
              }
              scmdsbodq2c.catlg_nbr = current.catlg_nbr;
              scmdsbodq2cList.Add(scmdsbodq2c);
            }
          }
          finally
          {
            if (enumerator != null)
              enumerator.Dispose();
          }
        }
      }
      return scmdsbodq2cList;
    }

    public List<scmdsbodq2c> getOpenByLineCdmdsbodq2c(string LineCd)
    {
      // ISSUE: object of a compiler-generated type is created
      // ISSUE: variable of a compiler-generated type
      clsT2Q2CdB._Closure\u0024__7 closure7 = new clsT2Q2CdB._Closure\u0024__7();
      // ISSUE: reference to a compiler-generated field
      closure7.\u0024VB\u0024Local_LineCd = LineCd;
      List<scmdsbodq2c> scmdsbodq2cList = new List<scmdsbodq2c>();
      // ISSUE: method reference
      // ISSUE: method reference
      // ISSUE: reference to a compiler-generated field
      IQueryable<mdsbodq2c> source = (IQueryable<mdsbodq2c>) Queryable.Select<mdsbodq2c, mdsbodq2c>((IQueryable<M0>) Queryable.ThenBy<mdsbodq2c, string>(Queryable.OrderBy<mdsbodq2c, DateTime>(Queryable.Where<mdsbodq2c>((IQueryable<M0>) this.ldDataProCT.mdsbodq2c, (Expression<Func<M0, bool>>) (q => q.shpd_dt <= (DateTime?) (DateTime) "1910-01-01" & (bool?) (q.curr_prom_dt >= (DateTime) "2013-01-01") & (bool?) (q.curr_prom_dt <= (DateTime) "2020-01-01") & (bool?) (Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Operators.CompareString)), q.mfg_loc, "085", false) == 0) & (bool?) (Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Operators.CompareString)), q.ln_cd, closure7.\u0024VB\u0024Local_LineCd, false) == 0) ?? false)), (Expression<Func<M0, M1>>) (q => q.curr_prom_dt)), (Expression<Func<M0, M1>>) (q => q.shp_sched_id)), (Expression<Func<M0, M1>>) (q => q));
      IEnumerator<mdsbodq2c> enumerator;
      if (source != null)
      {
        if (source.Count<mdsbodq2c>() > 0)
        {
          try
          {
            enumerator = source.GetEnumerator();
            while (enumerator.MoveNext())
            {
              mdsbodq2c current = enumerator.Current;
              scmdsbodq2c scmdsbodq2c = new scmdsbodq2c();
              scmdsbodq2c.q2c_nbr = current.q2c_nbr;
              scmdsbodq2c.ln_itm = current.ln_itm;
              scmdsbodq2c.sub_ln_itm_id = current.sub_ln_itm_id;
              scmdsbodq2c.shp_sched_id = current.shp_sched_id;
              scmdsbodq2c.orig_prom_dt = current.orig_prom_dt;
              scmdsbodq2c.curr_prom_dt = current.curr_prom_dt;
              scmdsbodq2c.not_b4_dt = current.not_b4_dt;
              try
              {
                DateTime? shpdDt = current.shpd_dt;
                scmdsbodq2c.shpd_dt = !shpdDt.HasValue ? Conversions.ToDate("1901-01-01") : (DateTime) current.shpd_dt;
              }
              catch (Exception ex)
              {
                ProjectData.SetProjectError(ex);
                scmdsbodq2c.shpd_dt = Conversions.ToDate("1901-01-01");
                ProjectData.ClearProjectError();
              }
              scmdsbodq2c.shpg_loc = current.shpg_loc;
              scmdsbodq2c.hold_ord_ind = current.hold_ord_ind;
              scmdsbodq2c.srce_loc = current.srce_loc;
              scmdsbodq2c.tot_unfld_ord_qty = current.tot_unfld_ord_qty;
              try
              {
                scmdsbodq2c.carr = current.carr == null ? " " : current.carr;
              }
              catch (Exception ex)
              {
                ProjectData.SetProjectError(ex);
                scmdsbodq2c.carr = " ";
                ProjectData.ClearProjectError();
              }
              scmdsbodq2c.catlg_nbr = current.catlg_nbr;
              scmdsbodq2cList.Add(scmdsbodq2c);
            }
          }
          finally
          {
            if (enumerator != null)
              enumerator.Dispose();
          }
        }
      }
      return scmdsbodq2cList;
    }

    public scmdsbodtd getByQ2CmdsbodtdCOV(string q2c_num, string ln_itm, string sub_ln_itm_id, string shp_sched_id)
    {
      // ISSUE: object of a compiler-generated type is created
      // ISSUE: variable of a compiler-generated type
      clsT2Q2CdB._Closure\u0024__8 closure8 = new clsT2Q2CdB._Closure\u0024__8();
      // ISSUE: reference to a compiler-generated field
      closure8.\u0024VB\u0024Local_q2c_num = q2c_num;
      // ISSUE: reference to a compiler-generated field
      closure8.\u0024VB\u0024Local_ln_itm = ln_itm;
      // ISSUE: reference to a compiler-generated field
      closure8.\u0024VB\u0024Local_sub_ln_itm_id = sub_ln_itm_id;
      // ISSUE: reference to a compiler-generated field
      closure8.\u0024VB\u0024Local_shp_sched_id = shp_sched_id;
      scmdsbodtd scmdsbodtd = new scmdsbodtd();
      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: 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<scmdsbodtd> source = ((IQueryable<scmdsbodtd>) Queryable.Select<mdsbodtd, scmdsbodtd>((IQueryable<M0>) Queryable.OrderByDescending<mdsbodtd, string>(Queryable.Where<mdsbodtd>((IQueryable<M0>) this.ldDataProCT.mdsbodtds, (Expression<Func<M0, bool>>) (q => Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Operators.CompareString)), q.q2c_nbr, closure8.\u0024VB\u0024Local_q2c_num, false) == 0 & Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Operators.CompareString)), q.ln_itm, closure8.\u0024VB\u0024Local_ln_itm, false) == 0 & Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Operators.CompareString)), q.sub_ln_itm_id, closure8.\u0024VB\u0024Local_sub_ln_itm_id, false) == 0 & Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Operators.CompareString)), q.shp_sched_id, closure8.\u0024VB\u0024Local_shp_sched_id, false) == 0)), (Expression<Func<M0, M1>>) (q => q.prgrs_pnt)), (Expression<Func<M0, M1>>) Expression.Lambda<Func<mdsbodtd, scmdsbodtd>>((Expression) Expression.MemberInit(Expression.New((ConstructorInfo) MethodBase.GetMethodFromHandle(__methodref (scmdsbodtd.\u002Ector)), (Expression[]) null), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scmdsbodtd.set_q2c_nbr)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (mdsbodtd.get_q2c_nbr)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scmdsbodtd.set_ln_itm)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (mdsbodtd.get_ln_itm)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scmdsbodtd.set_sub_ln_itm_id)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (mdsbodtd.get_sub_ln_itm_id)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scmdsbodtd.set_shp_sched_id)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (mdsbodtd.get_shp_sched_id)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scmdsbodtd.set_tot_bo_qty)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (mdsbodtd.get_tot_bo_qty)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scmdsbodtd.set_tot_shpg_qty)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (mdsbodtd.get_tot_shpg_qty)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scmdsbodtd.set_tot_unfld_ord_qty)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (mdsbodtd.get_tot_unfld_ord_qty)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scmdsbodtd.set_prgrs_pnt)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (mdsbodtd.get_prgrs_pnt)))), (MemberBinding) Expression.Bind((MethodInfo) MethodBase.GetMethodFromHandle(__methodref (scmdsbodtd.set_load_dt)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (mdsbodtd.get_load_dt))))), new ParameterExpression[1]{ parameterExpression }))).Take<scmdsbodtd>(1);
      if (source != null && source.Count<scmdsbodtd>() > 0)
        scmdsbodtd = source.First<scmdsbodtd>();
      return scmdsbodtd;
    }

    public string getByPPmdsq2ccd(string prgrs_pnt)
    {
      // ISSUE: object of a compiler-generated type is created
      // ISSUE: variable of a compiler-generated type
      clsT2Q2CdB._Closure\u0024__9 closure9 = new clsT2Q2CdB._Closure\u0024__9();
      // ISSUE: reference to a compiler-generated field
      closure9.\u0024VB\u0024Local_prgrs_pnt = prgrs_pnt;
      string str = "";
      ParameterExpression parameterExpression;
      // ISSUE: reference to a compiler-generated field
      // ISSUE: method reference
      // ISSUE: method reference
      IQueryable<string> source = (IQueryable<string>) Queryable.Select<mdsq2ccd, string>(Queryable.Where<mdsq2ccd>((IQueryable<M0>) this.ldDataProCD.mdsq2ccd, (Expression<Func<M0, bool>>) Expression.Lambda<Func<mdsq2ccd, bool>>((Expression) Expression.And((Expression) Expression.Equal((double) q.col_nm_cd_nbr, (double) closure9.\u0024VB\u0024Local_prgrs_pnt, true, (MethodInfo) null), (Expression) Expression.Equal((Expression) Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Operators.CompareString)), (Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (mdsq2ccd.get_col_nm))), (Expression) Expression.Constant((object) "PRGRS_PNT", typeof (string)), (Expression) Expression.Constant((object) false, typeof (bool))), (Expression) Expression.Constant((object) 0, typeof (int)))), new ParameterExpression[1]{ parameterExpression })), (Expression<Func<M0, M1>>) (q => q.cd_desc));
      if (source != null && source.Count<string>() > 0)
        str = source.First<string>();
      return str;
    }

    public Hashtable getHashmdsq2ccd()
    {
      Hashtable hashtable = new Hashtable();
      // ISSUE: method reference
      IQueryable<mdsq2ccd> source = (IQueryable<mdsq2ccd>) Queryable.Select<mdsq2ccd, mdsq2ccd>((IQueryable<M0>) Queryable.OrderBy<mdsq2ccd, short>(Queryable.Where<mdsq2ccd>((IQueryable<M0>) this.ldDataProCD.mdsq2ccd, (Expression<Func<M0, bool>>) (q => Expression.Call((Expression) null, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Operators.CompareString)), q.col_nm, "PRGRS_PNT", false) == 0)), (Expression<Func<M0, M1>>) (q => q.col_nm_cd_nbr)), (Expression<Func<M0, M1>>) (q => q));
      IEnumerator<mdsq2ccd> enumerator;
      if (source != null)
      {
        if (source.Count<mdsq2ccd>() > 0)
        {
          try
          {
            enumerator = source.GetEnumerator();
            while (enumerator.MoveNext())
            {
              mdsq2ccd current = enumerator.Current;
              hashtable.Add((object) current.col_nm_cd_nbr, (object) current.cd_desc);
            }
          }
          finally
          {
            if (enumerator != null)
              enumerator.Dispose();
          }
        }
      }
      return hashtable;
    }
  }
}
