public IEnumerable <ProductProcessViewModel> GetMaxProductProcessListForDesign(int Id)
        {
            var Temp = (from p in db.Product
                        join t in db.ProductProcess on p.ProductId equals t.ProductId into ProductProcessTable from ProductProcessTab in ProductProcessTable.DefaultIfEmpty()
                        where p.ProductGroupId == Id
                        group new { p, ProductProcessTab } by ProductProcessTab.ProductId into g
                        orderby g.Select(m => m.ProductProcessTab).Count() descending
                        select new{
                List = (from p in g.Select(m => m.ProductProcessTab)
                        orderby p.Sr
                        select new ProductProcessViewModel {
                    ProcessName = p.Process.ProcessName,
                    ProcessId = p.ProcessId,
                    ProductProcessId = p.ProductProcessId,
                    Sr = p.Sr,
                    ProductRateGroupId = p.ProductRateGroupId,
                    ProudctRateGroupName = p.ProductRateGroup.ProductRateGroupName,
                    Instructions = p.Instructions,
                }).ToList(),
            }).FirstOrDefault();

            return(Temp.List);
        }
Exemple #2
0
        public List <QAGroupLineLineViewModel> GetJobReceiveQAAttribute(int JobReceiveLineid)
        {
            List <QAGroupLineLineViewModel> JobReceiveQAAttribute = (from L in db.JobReceiveLine
                                                                     join H in db.JobReceiveHeader on L.JobReceiveHeaderId equals H.JobReceiveHeaderId into JobReceiveHeaderTable
                                                                     from JobReceiveHeaderTab in JobReceiveHeaderTable.DefaultIfEmpty()
                                                                     join Jol in db.JobOrderLine on L.JobOrderLineId equals Jol.JobOrderLineId into JobOrderLineTable
                                                                     from JobOrderLineTab in JobOrderLineTable.DefaultIfEmpty()
                                                                     join Pp in db.ProductProcess on new { X1 = JobOrderLineTab.ProductId, X2 = JobReceiveHeaderTab.ProcessId } equals new { X1 = Pp.ProductId, X2 = (Pp.ProcessId ?? 0) } into ProductProcessTable
                                                                     from ProductProcessTab in ProductProcessTable.DefaultIfEmpty()
                                                                     join QAGl in db.QAGroupLine on ProductProcessTab.QAGroupId equals QAGl.QAGroupId into QAGroupLineTable
                                                                     from QAGroupLineTab in QAGroupLineTable.DefaultIfEmpty()
                                                                     where L.JobReceiveLineId == JobReceiveLineid && ((int?)QAGroupLineTab.QAGroupLineId ?? 0) != 0
                                                                     select new QAGroupLineLineViewModel
            {
                QAGroupLineId = QAGroupLineTab.QAGroupLineId,
                DefaultValue = QAGroupLineTab.DefaultValue,
                Value = QAGroupLineTab.DefaultValue,
                Name = QAGroupLineTab.Name,
                DataType = QAGroupLineTab.DataType,
                ListItem = QAGroupLineTab.ListItem
            }).ToList();


            return(JobReceiveQAAttribute);
        }