Example #1
0
        public List <PurchaseDTO> GetAllPurchases()
        {
            List <PurchaseDTO> list = new List <PurchaseDTO>();

            foreach (Purchase p in dataContext.Purchases)
            {
                list.Add(PurchaseDTOConverter.ConvertPurchase(p));
            }
            return(list);
        }
Example #2
0
        public bool Save(PurchaseDTO dto)
        {
            //int result = dataContext.ExecuteCommand(string.Format(DataResource.SQL_SavePurchase, dto.MerchantID, dto.TotalInUSD, dto.TotalInPeso, dto.ExchangeRate, null , dto.Remarks));
            Purchase p = PurchaseDTOConverter.ConvertPurchaseDTO(dto);

            dataContext.Purchases.InsertOnSubmit(p);
            int result = dataContext.GetChangeSet().Inserts.Count;

            dataContext.SubmitChanges();
            return(result > 0);
        }
Example #3
0
        public PurchaseDTO GetOnePurchase(int id)
        {
            PurchaseDTO result = null;
            Purchase    data   = dataContext.Purchases.Where(x => x.PurchaseID == id).FirstOrDefault();

            if (data != null)
            {
                result = PurchaseDTOConverter.ConvertPurchase(data);
            }
            return(result);
        }