Example #1
0
        public BulkPurchaseViewModel Add()
        {
            BulkPurchaseViewModel model = null;

            model = SetModel();
            BulkPurchaseForexViewModel.ClearSession();
            BulkPurchasePaymentViewModel.ClearSession();
            return(model);
        }
Example #2
0
        public void Save(BulkPurchaseViewModel model)
        {
            model.BulkPurchase.IsDeleted   = false;
            model.BulkPurchase.CreatedDate = DateTime.Now;
            _bulkpurchaseRepository.Insert(model.BulkPurchase);
            _bulkpurchaseRepository.Save();


            var forex = BulkPurchaseForexViewModel.Current;

            if (forex != null && forex.Count > 0)
            {
                foreach (var row in forex)
                {
                    row.BulkPurchaseId = model.BulkPurchase.Id;
                    row.IsDeleted      = false;
                    row.CreatedDate    = DateTime.Now;
                    row.Id             = 0;
                    _bulkpurchaseforexRepository.Insert(row);
                    _bulkpurchaseforexRepository.Save();
                }
                BulkPurchaseForexViewModel.ClearSession();
            }


            var payment = BulkPurchasePaymentViewModel.Current;

            if (payment != null && payment.Count > 0)
            {
                foreach (var row in payment)
                {
                    row.BulkPurchaseId = model.BulkPurchase.Id;
                    row.IsDeleted      = false;
                    row.CreatedDate    = DateTime.Now;
                    row.Id             = 0;
                    _bulkpurchasepaymentRepository.Insert(row);
                    _bulkpurchasepaymentRepository.Save();
                }
                BulkPurchasePaymentViewModel.ClearSession();
            }
        }