public static List <PendingRequestModel> getClosedRequest(string EmployeeCode) { using (var context = new SalesReturndbEntities()) { List <PendingRequestModel> dataList = null; var RequestList = context.SP_GetClosedRequest(EmployeeCode).ToList(); if (RequestList != null) { dataList = RequestList.Select(x => new PendingRequestModel() { BatchNo = x.BatchNo, DealerAddress = x.DealerAddress, DealerCode = x.DealerCode, DealerName = x.DealerName, DepotName = x.DepotName, 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).Value, RequestTypeOption = x.SKUCode,// for access data behalf on skucode }).ToList(); return(dataList); } return(dataList); } }
public static List <PendingRequestModel> GetClosedRequest(string empCode) { List <PendingRequestModel> List = new List <PendingRequestModel>(); using (var context = new SalesReturndbEntities()) { var data = context.SP_GetClosedRequest(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).Value }).ToList(); } return(List); } }
public static int GetClosedRequestCount(string empCode) { using (var context = new SalesReturndbEntities()) { int Count = context.SP_GetClosedRequest(empCode).Count(); return(Count); } }