Пример #1
0
        public static bool Create(RecurringAccountRequest req)
        {
            var result = false;

            try
            {
                using (var con = new RecurringAccountTransfersEntities())
                {
                    var obj = new RecurringSetup();
                    obj.Amount      = req.Amount;
                    obj.DateCreated = DateTime.Now;
                    obj.DestinationAccountNumber = req.DestinationAccountNumber;
                    obj.DestinationBankCode      = req.DestinationBankCode;
                    obj.Enable              = true;
                    obj.Purpose             = req.Purpose;
                    obj.RecurringAlias      = req.RecurringAlias;
                    obj.SourceAccountNumber = req.SourceAccountNumber;
                    obj.SourceBankCode      = req.SourceBankCode;
                    obj.RecurringFrequency  = req.Frequency.ToString();
                    con.RecurringSetups.Add(obj);
                    con.SaveChanges();
                    result = true;
                }
            }
            catch (Exception e) { Logger.Error(e); }
            return(result);
        }
Пример #2
0
        public static RecurringSetup GetById(Int64 recurringId)
        {
            var result = new RecurringSetup();

            try
            {
                using (var dc = new RecurringAccountTransfersEntities())
                {
                    result = dc.RecurringSetups.FirstOrDefault(f => f.Id == recurringId && f.Enable);
                }
            }
            catch (Exception e) { Logger.Error(e); }
            return(result);
        }