public List <SalesViewModel> GetSalesByCustomerId(string id) { var customerId = Convert.ToInt64(id); var SalesList = new List <SalesViewModel>(); try { SalesList = (from stock in _dbContext.StockIn from sales in _dbContext.Sales from vendor in _dbContext.Vendor from cust in _dbContext.Customer where sales.CustId.Equals(customerId) && stock.StockId.Equals(sales.StockIn) && stock.VendorId.Equals(vendor.VendorId) && sales.CustId.Equals(cust.CustId) select new SalesViewModel { VendorId = HelperUtility.ConvertLongToInt(vendor.VendorId), StockInId = HelperUtility.ConvertLongToInt(stock.StockId), CustomerId = HelperUtility.ConvertLongToInt(cust.CustId), CustomerName = HelperUtility.GetCustName(cust), LoadName = stock.LoadName, Id = HelperUtility.ConvertLongToInt(sales.SalesId), Quantity = sales.Quantity, Total = sales.Total, Price = sales.Price, CreatedDate = sales.CreatedDate.ToString(), VendorName = HelperUtility.GetVendorName(vendor), }).ToList(); } catch (Exception) { } return(SalesList); }
private EfDbContext.VendorPayments ConstructVendorPaymentVModelToContext(VendorPaymentViewModel vendorPaymentVM) { return(new EfDbContext.VendorPayments { StockInId = HelperUtility.ConvertLongToInt(vendorPaymentVM.StockInId), VendorId = HelperUtility.ConvertLongToInt(vendorPaymentVM.VendorId), AmountPaid = vendorPaymentVM.AmountPaid, }); }
private EfDbContext.Sales ConstructSalesAsPerContext(SalesViewModel item) { return(new EfDbContext.Sales { CustId = HelperUtility.ConvertLongToInt(item.CustomerId), StockInId = HelperUtility.ConvertLongToInt(item.StockInId), Price = item.Price, Quantity = item.Quantity, Total = item.Total, }); }
private CustomerViewModel ConstructCustomerViewModelFromContext(EfDbContext.Customer item) { return(new CustomerViewModel { firstName = item.FirstName, lastName = item.LastName, middleName = item.MiddleName, id = HelperUtility.ConvertLongToInt(item.CustId), mobile = item.Mobile }); }
private VendorViewModel ConstructVendorViewModelFromContext(EfDbContext.Vendor item) { return(new VendorViewModel { firstName = item.FirstName, lastName = item.LastName, middleName = item.MiddleName, id = HelperUtility.ConvertLongToInt(item.VendorId), mobile = item.MobileNo, nickName = item.NickName, }); }
private SalesViewModel ConstructSalesViewModelFromPerContext(EfDbContext.Sales item) { return(new SalesViewModel { CustomerId = HelperUtility.ConvertLongToInt(item.CustId.Value), StockInId = HelperUtility.ConvertLongToInt(item.StockInId.Value), Price = item.Price, Quantity = item.Quantity, Total = item.Total, CustomerName = HelperUtility.GetCustName(item.Cust), VendorName = HelperUtility.GetVendorName(item.StockIn.Vendor), VendorId = HelperUtility.ConvertLongToInt(item.StockIn.VendorId) }); }
public List <SalesViewModel> LoadVendorNames(AutoCompleteModel data) { var SalesList = new List <SalesViewModel>(); try { SalesList = (from v in _dbContext.Vendor where v.NickName.Contains(data.q) select new SalesViewModel { VendorId = HelperUtility.ConvertLongToInt(v.VendorId), VendorName = HelperUtility.GetVendorName(v) }).ToList(); } catch (Exception ex) { throw ex; } return(SalesList); }
public List <SalesViewModel> LoadCustNames(AutoCompleteModel data) { var SalesList = new List <SalesViewModel>(); try { SalesList = (from c in _dbContext.Customer where c.NickName.Contains(data.q) select new SalesViewModel { CustomerId = HelperUtility.ConvertLongToInt(c.CustId), CustomerName = HelperUtility.GetCustName(c) }).ToList(); } catch (Exception ex) { throw ex; } return(SalesList); }