public List<CreditAgency> GetAgencies()
 {
     using (LoanPriceEntities context = new LoanPriceEntities())
     {
         return context.CreditAgencies.OrderBy(s => s.CreditAgency1).ToList();
     }
 }
        //public bool IsValidName(string name)
        //{
        //    using (LoanPriceEntities context = new LoanPriceEntities())
        //    {
        //        int count = context.CreditRatings.Where(s => s. == name).Count();
        //        if (count == 0)
        //            return true;
        //        else
        //            return false;
        //    }
        //}
        public string SaveAgency(CreditAgency agency)
        {
            using (LoanPriceEntities context = new LoanPriceEntities())
            {
                if (agency.ID <= 0)
                {

                    //if (context.CreditRatings.Where(s => s.CreditAgency == rating.CreditAgency).Count() == 0)
                    //{
                    context.AddToCreditAgencies(agency);
                    context.SaveChanges();
                    return "Credit Agency is added successfully";
                    //}
                    //else
                    //    return "Entry of the same Currency is already exists.";
                }
                else
                {
                    //if (context.Currencies.Where(s => s.Currancy == currency.Currancy && s.ID != currency.ID).Count() == 0)
                    //{
                    context.CreditAgencies.Attach(agency);
                    context.ObjectStateManager.ChangeObjectState(agency, System.Data.EntityState.Modified);
                    context.SaveChanges();
                    return "Credit Agency is Updated successfully";
                    //}
                    //else
                    //    return "Entry of the same Currency is already exists.";
                }
            }
        }
Esempio n. 3
0
 public List<tblCountry> GetCountry()
 {
     using (LoanPriceEntities context = new LoanPriceEntities())
     {
         return context.tblCountry.OrderBy(s => s.Name).ToList();
     }
 }
 public EmailGroup GetById(int id)
 {
     using (LoanPriceEntities context = new LoanPriceEntities())
     {
         return context.EmailGroups.FirstOrDefault(c => c.ID == id);
     }
 }
 public List<CreditRating> GetRatingsByAgencyID(int id)
 {
     using (LoanPriceEntities context = new LoanPriceEntities())
     {
         return context.CreditRatings.Where(c => c.CreditAgencyID == id).ToList();
     }
 }
Esempio n. 6
0
 public tblCountry GetCountry(int id)
 {
     using (LoanPriceEntities context = new LoanPriceEntities())
     {
         return context.tblCountry.FirstOrDefault(c => c.ID == id);
     }
 }
 public List<CounterParty> GetCounterParty()
 {
     using (LoanPriceEntities context = new LoanPriceEntities())
     {
         return context.CounterParties.OrderBy(s => s.Name).ToList();
     }
 }
 public CreditRating GetRatings(int id)
 {
     using (LoanPriceEntities context = new LoanPriceEntities())
     {
         return context.CreditRatings.FirstOrDefault(c => c.ID == id);
     }
 }
 public CounterParty GetCounterParty(int id)
 {
     using (LoanPriceEntities context = new LoanPriceEntities())
     {
         return context.CounterParties.FirstOrDefault(c => c.ID == id);
     }
 }
 public List<tblHoliday> GetPublicHolidays(int id)
 {
     using (LoanPriceEntities context =new LoanPriceEntities())
     {
         return context.tblHoliday.Where(c => c.tblCountry.ID == id).ToList();
     }
 }
Esempio n. 11
0
 public List<Borrower> GetBorrowers()
 {
     using (LoanPriceEntities context = new LoanPriceEntities())
     {
         return context.Borrowers.OrderBy(s => s.Name).ToList();
     }
 }
 public List<QuotesAndTrades> GetQuotesAndTrades()
 {
     using (LoanPriceEntities context = new LoanPriceEntities())
     {
         return context.QuotesAndTrades.OrderByDescending(s => s.ID).ToList();
     }
 }
Esempio n. 13
0
 public List<EmailGroup> GetAll()
 {
     using (LoanPriceEntities context = new LoanPriceEntities())
     {
         return context.EmailGroups.ToList();
     }
 }
Esempio n. 14
0
 public CreditAgency GetByID(int id)
 {
     using (LoanPriceEntities context = new LoanPriceEntities())
     {
         return context.CreditAgencies.SingleOrDefault(c => c.ID == id);
     }
 }
Esempio n. 15
0
 public List<Login> GetAccounts()
 {
     using (LoanPriceEntities context = new LoanPriceEntities())
     {
         return context.Logins.Where(c => !c.IsLocked).ToList();
     }
 }
 public void InsertDuplicateRecord(DuplicateRecord select)
 {
     using (LoanPriceEntities context = new LoanPriceEntities())
     {
         context.AddToDuplicateRecords(select);
     }
 }
Esempio n. 17
0
 public List<tblActivityLog> GetAllLogs()
 {
     using (LoanPriceEntities context = new LoanPriceEntities())
     {
         return context.tblActivityLogs.ToList();
     }
 }
Esempio n. 18
0
 /// <summary>
 /// Authenticate the user and log the failed attempts and locked the account if failed attemtps reach to 3
 /// </summary>
 /// <param name="name"></param>
 /// <param name="password"></param>
 /// <returns></returns>
 public Login Authenticate(string name, string password)
 {
     using (LoanPriceEntities context = new LoanPriceEntities())
     {
         Login login = context.Logins.FirstOrDefault(c => c.Name == name && c.Password == password);
         if (login == null)
         {
             // Log failed attempt
             Login log = context.Logins.FirstOrDefault(c => c.Name == name);
             if (log != null)
             {
                 log.FailedAttempts = log.FailedAttempts + 1;
                 // if there are 3 failed attempts then Lock the account
                 if (log.FailedAttempts == 3)
                 {
                     log.IsLocked = true;
                 }
             }
         }
         else
         {
             // reset failed attempt if login successfully
             login.FailedAttempts = 0;
         }
         context.SaveChanges();
         return login;
     }
 }
Esempio n. 19
0
 public tblEmailQue GetEmailQue(int id)
 {
     using (LoanPriceEntities context = new LoanPriceEntities())
     {
         return context.tblEmailQues.FirstOrDefault(c => c.ID == id);
     }
 }
Esempio n. 20
0
 public Borrower GetBorrowers(int id)
 {
     using (LoanPriceEntities context = new LoanPriceEntities())
     {
         return context.Borrowers.FirstOrDefault(c => c.ID == id);
     }
 }
Esempio n. 21
0
 public List<tblActivityLog> GetTodayLogs()
 {
     using (LoanPriceEntities context = new LoanPriceEntities())
     {
         DateTime date = DateTime.Now.Date;
         return context.tblActivityLogs.Where(c => EntityFunctions.TruncateTime(c.ActivityDate) == date).ToList();
     }
 }
 public QuotesAndTrades GetQuotesAndTrades(string loanName)
 {
     using (LoanPriceEntities context = new LoanPriceEntities())
     {
         QuotesAndTrades model = context.QuotesAndTrades.OrderByDescending(s => s.ID).First(c => c.LoanName == loanName);
         return model;
     }
 }
Esempio n. 23
0
 public tblActivityLog AddActivityLog(tblActivityLog model)
 {
     using (LoanPriceEntities context = new LoanPriceEntities())
     {
         context.tblActivityLogs.AddObject(model);
         context.SaveChanges();
         return model;
     }
 }
Esempio n. 24
0
 public string SaveHistory(LoanHistory history)
 {
     using (LoanPriceEntities context = new LoanPriceEntities())
     {
         context.AddToLoanHistories(history);
         context.SaveChanges();
         return "History is added successfully";
     }
 }
Esempio n. 25
0
 public List<EmailGroup> GetEmailReceiver(string group)
 {
     using (LoanPriceEntities context = new LoanPriceEntities())
     {
         // Get email receiver group
         return context.EmailGroups.Where(c => c.GroupName == group).ToList();
         return null;
     }
 }
Esempio n. 26
0
 public int GetBorrowerFromName(string name)
 {
     using (LoanPriceEntities context = new LoanPriceEntities())
     {
         Borrower borrower = context.Borrowers.FirstOrDefault(c => c.Name == name);
         if (borrower != null)
             return borrower.ID;
         else
             return 0;
     }
 }
Esempio n. 27
0
 public int GetCountryFromName(string name)
 {
     using (LoanPriceEntities context = new LoanPriceEntities())
     {
         tblCountry group = context.tblCountry.FirstOrDefault(c => c.Name == name);
         if (group != null)
             return group.ID;
         else
             return 0;
     }
 }
Esempio n. 28
0
 public bool IsValidName(string countryName)
 {
     using (LoanPriceEntities context = new LoanPriceEntities())
     {
         int count = context.tblCountry.Where(s => s.Name == countryName).Count();
         if (count == 0)
             return true;
         else
             return false;
     }
 }
 public bool CheckForExist(string loanName, string counterParty)
 {
     using (LoanPriceEntities context = new LoanPriceEntities())
     {
         List<QuotesAndTrades> quoteList = context.QuotesAndTrades.Where(s => s.LoanName == loanName && s.CounterParty == counterParty).ToList();
         if (quoteList != null && quoteList.Count > 0)
             return true;
         else
             return false;
     }
 }
Esempio n. 30
0
 public Setting GetSettingyear(string name)
 {
     using (LoanPriceEntities context = new LoanPriceEntities())
     {
         Setting setting = context.Settings.SingleOrDefault(s => s.Name == name);
         if (setting != null)
             return setting;
         else
             return null;
     }
 }