Exemplo n.º 1
0
        public static List <PendingRequestModel> GetOpenRequest(string empCode)
        {
            List <PendingRequestModel> List = new List <PendingRequestModel>();

            using (var context = new SalesReturndbEntities())
            {
                var data = context.SP_GetOpenRequest(empCode).ToList();
                if (data.Count != 0)
                {
                    List = data.Select(x => new PendingRequestModel()
                    {
                        BatchNo            = x.BatchNo,
                        DealerAddress      = x.DealerAddress,
                        DealerCode         = x.DealerCode,
                        DealerName         = x.DealerName,
                        DepotName          = x.DealerName,
                        DepotAddress       = x.DepotAddress,
                        DepotCode          = x.DepotCode,
                        RequestHeaderId    = x.RequestHeaderId,
                        CurrentStatus      = x.CurrentStatus,
                        CurrentStatus_Id   = x.CurrentStatus_Id,
                        SKUCode            = x.SKUCode,
                        SKUName            = x.SKUName,
                        CreatedBy_EMP_CODE = x.CreatedBy,
                        CreatedBy          = context.SP_LFGDetails(x.CreatedBy).FirstOrDefault().Emp_First_name,
                        CreatedDate        = x.CreatedDate,

                        TotalSRV = context.tblRequestDtls.Where(o => o.RequestHeaderId == x.RequestHeaderId && o.IsActive == true).Sum(p => p.SRVValue),
                    }).ToList();
                }
                return(List);
            }
        }