public FileViewModel(Entities.GridRun gridRun) { FileName = gridRun.XmlFile.FileName; BigZip = gridRun.XmlFile.BigZip; Received = gridRun.XmlFile.Received; Allocated = gridRun.XmlFile.Allocated; AllocatorGrid = gridRun.XmlFile.AlloctorGrid; ProcessesGrid = gridRun.Grid; }
public GridRunDetailViewModel(Entities.GridRun gridRun, bool houseHolding = false) : base(houseHolding) { FileName = gridRun.XmlFile.FileName; Grid = gridRun.Grid; BigZip = gridRun.XmlFile.BigZip; DocType = gridRun.XmlFile.DocType.Code; ManCo = gridRun.XmlFile.ManCo.Code; StartDate = gridRun.StartDate.GetValueOrDefault(); }
public GridRunSearchViewModel(Entities.GridRun gridRun, bool houseHolding = false) : base(houseHolding) { GridRunId = gridRun.Id.ToString(); Grid = gridRun.Grid; Code = gridRun.Application.Code; Desc = gridRun.Application.Description; StartDate = gridRun.StartDate.GetValueOrDefault(); Duration = gridRun.EndDate != null ? gridRun.EndDate.Value - gridRun.StartDate.GetValueOrDefault() : new TimeSpan(); FileName = gridRun.XmlFile.FileName; }
public GridRunStatusViewModel(Entities.GridRun gridRun) { Grid = gridRun.Grid; if (gridRun.XmlFile != null) { Arrived = gridRun.XmlFile.Received.ToString("ddd d MMM yyyy HH:mm"); Proccessed = gridRun.EndDate.GetValueOrDefault().ToString("ddd d MMM yyyy HH:mm"); } if (gridRun.Documents != null && gridRun.Documents.Count > 0) { if (gridRun.Documents.All(d => d.Approval == null) && gridRun.Documents.All(d => d.Rejection == null)) { ApprovalStatus = (int)ApprovalStatuses.Unapproved; } else if (gridRun.Documents.All(d => d.Approval != null)) { ApprovalStatus = (int)ApprovalStatuses.FullyApproved; var document = (from g in gridRun.Documents where g.Approval != null orderby g.Approval.ApprovedDate descending select g).First(); ApprovedBy = document.Approval.ApprovedBy; ApprovalDate = document.Approval.ApprovedDate.GetValueOrDefault().ToString("ddd d MMM yyyy HH:mm"); } else if (gridRun.Documents.Any(d => d.Approval != null)) { ApprovalStatus = (int)ApprovalStatuses.PartiallyApproved; var document = (from g in gridRun.Documents where g.Approval != null orderby g.Approval.ApprovedDate descending select g).First(); ApprovedBy = document.Approval.ApprovedBy; ApprovalDate = document.Approval.ApprovedDate.GetValueOrDefault().ToString("ddd d MMM yyyy HH:mm"); } else if (gridRun.Documents.All(d => d.Rejection != null)) { ApprovalStatus = (int)ApprovalStatuses.FullyRejected; var document = (from g in gridRun.Documents where g.Rejection != null orderby g.Rejection.RejectionDate descending select g).First(); RejectedBy = document.Rejection.RejectedBy; RejectedDate = document.Rejection.RejectionDate.GetValueOrDefault().ToString("ddd d MMM yyyy HH:mm"); } if (gridRun.Documents.All(d => d.HouseHold != null)) { HouseHoldStatus = (int)HouseHoldingStatuses.FullyHouseHeld; HouseHoldingDate = gridRun.Documents.Last().HouseHold.HouseHoldDate.GetValueOrDefault().ToString("ddd d MMM yyyy HH:mm"); } else if (gridRun.Documents.Any(d => d.HouseHold != null)) { HouseHoldStatus = (int)HouseHoldingStatuses.PartiallyHouseHeld; HouseHoldingDate = (from d in gridRun.Documents where d.HouseHold != null orderby d.HouseHold.HouseHoldDate descending select d).First().HouseHold.HouseHoldDate.GetValueOrDefault().ToString("ddd d MMM yyyy HH:mm"); } } }