Beispiel #1
0
        public BulkPurchasePayment Save(BulkPurchasePayment model, string action)
        {
            ActionMode mode = (ActionMode)Enum.Parse(typeof(ActionMode), action, true);

            switch (mode)
            {
            case ActionMode.Add:
                BulkPurchasePaymentViewModel.Current.AddItem(model);
                return(model);

            case ActionMode.Edit:
                var payment = BulkPurchasePaymentViewModel.Current;
                payment.Remove(payment.Where(i => i.Id == model.Id).FirstOrDefault());
                payment.AddItem(model);
                BulkPurchasePaymentViewModel.Current = payment;
                return(model);

            case ActionMode.Delete:
                var removepayment = BulkPurchasePaymentViewModel.Current;
                removepayment.Remove(removepayment.Where(i => i.Id == model.Id).FirstOrDefault());
                BulkPurchasePaymentViewModel.Current = removepayment;
                return(model);

            //case ActionMode.Cancel:
            //    break;
            default:
                break;
            }

            return(null);
        }
Beispiel #2
0
 public static void ClearSession()
 {
     if (BulkPurchasePaymentViewModel.Current != null)
     {
         BulkPurchasePaymentViewModel.Current.Clear();
         BulkPurchasePaymentViewModel.Current = null;
     }
 }
Beispiel #3
0
        public BulkPurchasePaymentList Delete(int id)
        {
            var payment = BulkPurchasePaymentViewModel.Current;
            var row     = FindById(id);

            payment.Remove(row);
            BulkPurchasePaymentViewModel.Current = payment;
            return(BulkPurchasePaymentViewModel.Current);
        }
Beispiel #4
0
        public BulkPurchasePaymentList DeleteAll()
        {
            var payment = BulkPurchasePaymentViewModel.Current;

            foreach (var row in payment)
            {
                payment.Remove(row);
            }
            BulkPurchasePaymentViewModel.Current = payment;
            return(BulkPurchasePaymentViewModel.Current);
        }