Esempio n. 1
0
 public Transport()
 {
     Driver       = new Driver();
     Delivery     = new Delivery();
     Loading      = new Loading();
     Truck        = new Truck();
     Container    = new Container();
     Railcar      = new Railcar();
     Ard          = new Ard();
     Arrival      = new Arrival();
     BillOfLading = new BillOfLading();
     Carrier      = new Carrier();
     Weighbridge  = new Weighbridge();
     Seal         = new Seal();
 }
        public List <ReleaseNote> SearchReleasesByRailcar(string number, DateTime startDate, DateTime endDate,
                                                          string railcar, string certificate, string reciver)
        {
            try
            {
                ReleaseNote note = null;
                Railcar     car  = null;

                var s = session.QueryOver <ReleaseNote>(() => note)
                        .JoinAlias(() => note.Railcars, () => car, JoinType.LeftOuterJoin)
                        .TransformUsing(Transformers.DistinctRootEntity);

                if (!string.IsNullOrWhiteSpace(railcar))
                {
                    s.WhereRestrictionOn(() => car.Number).IsInsensitiveLike(railcar, MatchMode.Start);
                }

                if (!string.IsNullOrWhiteSpace(number))
                {
                    s.WhereRestrictionOn(x => x.Number).IsInsensitiveLike(number, MatchMode.Start);
                }

                if (!string.IsNullOrWhiteSpace(certificate))
                {
                    s.WhereRestrictionOn(() => car.Certificate).IsInsensitiveLike(certificate, MatchMode.Start);
                }

                if (!string.IsNullOrWhiteSpace(reciver))
                {
                    s.WhereRestrictionOn(() => car.Destination).IsInsensitiveLike(reciver, MatchMode.Start);
                }

                if (startDate != DateTime.MinValue && endDate != DateTime.MinValue)
                {
                    s.WhereRestrictionOn(x => x.Date).IsBetween(startDate).And(endDate.AddHours(23).AddMinutes(59).AddSeconds(59));
                }
                var list = new List <ReleaseNote>(s.List <ReleaseNote>().OrderBy(x => x.Number));

                return(list);
            }
            catch (GenericADOException ex)
            {
                throw new RepositoryException("SearchReleasesByRailcar", ex);
            }
        }
Esempio n. 3
0
        public IList <Pipe> GetReleasedNotePipe(Guid Id)
        {
            try
            {
                IList <Pipe> pipeList = new List <Pipe>();
                ReleaseNote  note     = null;
                Railcar      car      = null;
                Pipe         pipe     = null;

                PipeTestResult result    = null;
                Inspector      inspector = null;
                Certificate    cert      = null;

                var s = session.QueryOver <ReleaseNote>(() => note)
                        .Where(n => ((n.Id == Id)))
                        .JoinAlias(() => note.Railcars, () => car, JoinType.LeftOuterJoin)
                        .JoinAlias(() => car.Pipes, () => pipe, JoinType.LeftOuterJoin)
                        //.JoinAlias(() => pipe.PipeTestResult, () => result, JoinType.LeftOuterJoin)
                        //.JoinAlias(() => result.Inspectors, () => inspector, JoinType.LeftOuterJoin)
                        //.JoinAlias(() => inspector.Certificates, () => cert, JoinType.LeftOuterJoin)
                        .TransformUsing(Transformers.DistinctRootEntity);

                var listReleaseNote = new List <ReleaseNote>(s.List <ReleaseNote>());
                foreach (ReleaseNote n in listReleaseNote)
                {
                    foreach (Prizm.Domain.Entity.Mill.Railcar r in n.Railcars)
                    {
                        foreach (Pipe p in r.Pipes)
                        {
                            pipeList.Add(p);
                        }
                    }
                }

                return(pipeList);
            }
            catch (GenericADOException ex)
            {
                throw new RepositoryException("Get pipes from Release note", ex);
            }
        }