Пример #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 List <RecurringSetup> GetAllByProfileId(Int64 profileId)
        {
            var result = new List <RecurringSetup>();

            try
            {
                using (var dc = new RecurringAccountTransfersEntities())
                {
                    result = dc.RecurringSetups.Where(f => f.ProfileId == profileId && f.Enable).ToList <RecurringSetup>();
                }
            }
            catch (Exception e) { Logger.Error(e); }
            return(result);
        }
Пример #3
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);
        }
Пример #4
0
        public static List <RecurringSetup> Search(string alias, Int64 profileId)
        {
            var result = new List <RecurringSetup>();

            try
            {
                using (var dc = new RecurringAccountTransfersEntities())
                {
                    result = dc.RecurringSetups.Where(f => f.ProfileId == profileId && f.Enable && f.RecurringAlias.ToLower().Contains(alias.Trim().ToLower())).ToList <RecurringSetup>();
                }
            }
            catch (Exception e) { Logger.Error(e); }
            return(result);
        }
Пример #5
0
        public static List <RecurringSetup> GetSemiFilteredRecurringDuePerDay(DateTime dueDate)
        {
            var result = new List <RecurringSetup>();

            try
            {
                using (var dc = new RecurringAccountTransfersEntities())
                {
                    result = dc.RecurringSetups.Where(f => f.Enable && !f.IsCompleted && (DbFunctions.TruncateTime(f.EndDate) <= DbFunctions.TruncateTime(f.EndDate))).ToList <RecurringSetup>();
                }
            }
            catch (Exception e) { Logger.Error(e); }
            return(result);
        }
Пример #6
0
        public static bool CreateRecurringSetupAttemptLog(RecurringSetupAttemptLog req)
        {
            var result = false;

            try
            {
                using (var con = new RecurringAccountTransfersEntities())
                {
                    var obj = new RecurringSetupAttemptLog();
                    obj.DateAttempted        = req.DateAttempted;
                    obj.DebitServiceResponse = req.DebitServiceResponse;
                    obj.IsSuccessful         = req.IsSuccessful;
                    obj.RecurringSetupId     = req.RecurringSetupId;
                    con.RecurringSetupAttemptLogs.Add(obj);
                    con.SaveChanges();
                    result = true;
                }
            }
            catch (Exception e) { Logger.Error(e); }
            return(result);
        }