Beispiel #1
0
        public IEnumerable <PerkViewModel> GetPerkListForDocumentTypeForEdit(int JobOrderHeaderId)
        {
            var JobOrder = new JobOrderHeaderService(_unitOfWork).Find(JobOrderHeaderId);

            return(from p in db.JobOrderPerk
                   join t in db.Perk on p.PerkId equals t.PerkId
                   join t2 in db.PerkDocumentType.Where(m => m.RateDocId == null) on new { t.PerkId, JobOrder.DocTypeId } equals new { t2.PerkId, t2.DocTypeId } into PerkDocType
                   from t2 in PerkDocType.DefaultIfEmpty()
                   where p.JobOrderHeaderId == JobOrderHeaderId
                   select new PerkViewModel
            {
                JobOrderHeaderId = p.JobOrderHeaderId,
                JobOrderPerkId = p.JobOrderPerkId,
                Base = p.Base,
                BaseDescription = t.BaseDescription,
                CostConversionMultiplier = t.CostConversionMultiplier,
                IsActive = t.IsActive,
                PerkId = p.PerkId,
                PerkName = t.PerkName,
                Worth = p.Worth,
                WorthDescription = t.WorthDescription,
                IsEditableRate = (t2 == null? true : t2.IsEditableRate),
            }
                   );
        }
        public List <ComboBoxList> GetPendingBarCodesList(int id)
        {
            List <ComboBoxList> Barcodes = new List <ComboBoxList>();

            var JobOrderline   = new JobOrderLineService(_unitOfWork).Find(id);
            var JobOrderHeader = new JobOrderHeaderService(_unitOfWork).Find(JobOrderline.JobOrderHeaderId);

            using (ApplicationDbContext context = new ApplicationDbContext())
            {
                //context.Database.ExecuteSqlCommand("SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED");
                context.Configuration.AutoDetectChangesEnabled = false;
                context.Configuration.LazyLoadingEnabled       = false;

                //context.Database.CommandTimeout = 30000;

                //var Temp = (from p in context.ProductUid
                //            where p.ProductUidHeaderId == JobOrderline.ProductUidHeaderId
                //            join t in context.JobReceiveLine on p.ProductUIDId equals t.ProductUidId into table
                //            from tab in table.DefaultIfEmpty()
                //            join RT in context.JobReturnLine  on tab.JobReceiveLineId  equals RT.JobReceiveLineId into tableRT
                //            from tabRT in tableRT.DefaultIfEmpty()
                //            where ( tab == null && p.Status != ProductUidStatusConstants.Cancel && ((p.GenDocId == p.LastTransactionDocId && p.GenDocNo == p.LastTransactionDocNo && p.GenPersonId == p.LastTransactionPersonId) || p.CurrenctGodownId != null) )
                //            || (tab != null && tabRT != null )
                //            orderby p.ProductUidName
                //            select new { Id = p.ProductUIDId, Name = p.ProductUidName }).ToList();


                //p.Status != ProductUidStatusConstants.Return &&


                SqlParameter SQLProductUidHeaderId = new SqlParameter("@ProductUidHeaderId", JobOrderline.ProductUidHeaderId);
                SqlParameter SQLSiteId             = new SqlParameter("@SiteId", JobOrderHeader.SiteId);
                SqlParameter SQLDivisionId         = new SqlParameter("@DivisionId", JobOrderHeader.DivisionId);
                SqlParameter SQLProcessId          = new SqlParameter("@ProcessId", JobOrderHeader.ProcessId);


                var Temp = db.Database.SqlQuery <ProductUidList>("" + ConfigurationManager.AppSettings["DataBaseSchema"] + ".sp_GetProductUidListForWeavingOrderCancel @ProductUidHeaderId, @SiteId,	@DivisionId, @ProcessId", SQLProductUidHeaderId, SQLSiteId, SQLDivisionId, SQLProcessId).ToList();


                //var Temp = (from p in context.ProductUid
                //            join t in context.JobReceiveLine on p.ProductUIDId equals t.ProductUidId into table
                //            from tab in table.DefaultIfEmpty()
                //            join t3 in context.JobReceiveHeader.Where(m => m.SiteId == JobOrderHeader.SiteId && m.DivisionId == JobOrderHeader.DivisionId) on tab.JobReceiveHeaderId equals t3.JobReceiveHeaderId into table5
                //            from JRH in table5.DefaultIfEmpty()
                //            join t2 in context.JobOrderLine on p.ProductUidHeaderId equals t2.ProductUidHeaderId
                //            join JOH in context.JobOrderHeader.Where(m => m.SiteId == JobOrderHeader.SiteId && m.DivisionId == JobOrderHeader.DivisionId) on t2.JobOrderHeaderId equals JOH.JobOrderHeaderId
                //            join RecLineStatus in context.JobReceiveLineStatus on tab.JobReceiveLineId equals RecLineStatus.JobReceiveLineId into RecLineStatTab
                //            from RecLineStat in RecLineStatTab.DefaultIfEmpty()
                //            where p.ProductUidHeaderId == JobOrderline.ProductUidHeaderId && (JRH == null || ((tab.Qty - (RecLineStat.ReturnQty ?? 0)) == 0)) &&
                //            p.Status != ProductUidStatusConstants.Cancel && ((p.GenPersonId == p.LastTransactionPersonId) || p.CurrenctGodownId != null)
                //            && JOH.ProcessId == JobOrderHeader.ProcessId
                //            orderby p.ProductUIDId
                //            select new { Id = p.ProductUIDId, Name = p.ProductUidName }).ToList();

                foreach (var item in Temp)
                {
                    Barcodes.Add(new ComboBoxList
                    {
                        Id        = item.ProductUidId,
                        PropFirst = item.ProductUidName,
                    });
                }
            }



            return(Barcodes);
        }