- SELECT TOP (1000) [WeekId]
- ,[WeekNum]
- ,[Year]
- ,[CreatedDate]
- ,[CreatedBy]
- ,[ModifiedDate]
- ,[ModifiedBy]
- ,[InActive]
- FROM [ProductionManagement].[Schedule].[Week]
- where WeekNum = 53
- order by Year
Hi team
I need some help and i have a problem the problem, the issue i have my excel data its duplicating a year, week column. e.g if data is available for 2021 its counting on week 2 as 2021 2, 2, 3. How do i fix this issue and must check if there is no data available for a specific year and week.
- public IList GetExtractionViewModels()
- {
- var db = new ProductionManagementEntities();
- var scheduleList = (from p in db.ProductionDays
- from m in db.Models
- from mx in db.Models
- from mt in db.Models
- from mv in db.Models
- from wk in db.Models
- join w in db.Weeks on p.WeekId equals w.WeekId
- orderby w.Year descending, m.Name descending, p.ProductionDate descending, w.WeekNum descending, mt.Name descending, mx.Name descending, mv.Name descending
- where (mx.InActive == true)
- where (mt.InActive == false)
- where(m.InActive == false)
- where(mv.InActive == false)
- where(w.WeekNum < 53)
- where (mt.Name == "VW270")
- where(mx.Name == "VW250")
- where(m.Name == "VW270PA")
- where(mv.Name == "VW250/2PA")
- select new ExtractionViewModel
- {
- Year = w.Year,
- Day = p.ProductionDate,
- Week = w.WeekNum,
- VW270 = mt.Name,
- VW270PA = m.Name,
- VW250 = mx.Name,
- VW2502PA = mv.Name
- }).ToList();
- return scheduleList;
- }
-
-
-
- public class ExtractionViewModel
- {
- public string Year { get; set; }
- public int Week { get; set; }
- [DataType(DataType.Date)]
- public DateTime Day { get; set; }
- public string VW250 { get; set; }
- public string VW270 { get; set; }
- public string VW2502PA { get; set; }
- public int VW270PA { get; set; }
- }