public List<DepositType> GetActiveDepositTypes()
 {
     using (var context = new FinanceEntities())
     {
         return context.DepositType.Where(dt => dt.IsActive).ToList();
     }
 }
 public CreditType GetCreditTypeById(int creditTypeId)
 {
     using (var context = new FinanceEntities())
     {
         return context.CreditType.FirstOrDefault(ct => ct.Id == creditTypeId);
     }
 }
 public List<CreditType> GetCreditTypes()
 {
     using (var context = new FinanceEntities())
     {
         return context.CreditType.ToList();
     }
 }
 public UserProfile GetUserByPassportNumber(String passportNumber)
 {
     using (var context = new FinanceEntities())
     {
         return context.UserProfile.FirstOrDefault(user => user.PassportIdentificationNumber == passportNumber);
     }
 }
 public List<CreditType> GetActiveCreditTypes()
 {
     using (var context = new FinanceEntities())
     {
         return context.CreditType.Where(ct => ct.IsActive).ToList();
     }
 }
        public void AddOrUpdateUser(UserProfile user)
        {
            try
            {
                using (var context = new FinanceEntities())
                {
                    if (user.UserId == 0)
                    {
                        context.UserProfile.Add(user);

                    }
                    else
                    {
                        var dbuser = context.UserProfile.Include(u => u.webpages_Roles).Single(u => u.UserId == user.UserId);
                        context.Entry(dbuser).CurrentValues.SetValues(user);
                        dbuser.webpages_Roles = new List<webpages_Roles>();
                        foreach (var role in user.webpages_Roles)
                        {
                            dbuser.webpages_Roles.Add(context.webpages_Roles.Single(r => r.RoleId == role.RoleId));
                        }
                    }

                    context.SaveChanges();
                }
            }
            catch (DbEntityValidationException e)
            {
                var message = e.Message;
                throw;
            }
            
        }
 public UserProfile GetUserByLogin(String login)
 {
     using (var context = new FinanceEntities())
     {
         return context.UserProfile.FirstOrDefault(item => item.Login == login);
     }
 }
 public List<UserProfile> GetUsers()
 {
     using (var context = new FinanceEntities())
     {
         return context.UserProfile.ToList();
     }
 }
 public void Percents()
 {
     using (var context = new FinanceEntities())
     {
         context.Database.ExecuteSqlCommand("exec DepositOvercharge");
     }
 }
Beispiel #10
0
 private void SetDatumSource()
 {
     FinanceEntities datumDb = new FinanceEntities();
     ObjectSet<Datum> datum = datumDb.Data;
     datumBindingSource.DataSource = datum;
     datumBindingSource.ResetBindings(false);
 }
 public DepositType GetDepositTypeById(int depositTypeId)
 {
     using (var context = new FinanceEntities())
     {
         return context.DepositType.FirstOrDefault(item => item.Id == depositTypeId);
     }
 }
 public List<DepositPayment> GetPaymentsPerDeposit(int depositId)
 {
     using (var context = new FinanceEntities())
     {
         return context.DepositPayment.Include(item => item.Deposit).Where(item => item.DepositId == depositId).ToList();
     }
 }
 public void CreateRequest(Request request)
 {
     using (var context = new FinanceEntities())
     {
         context.Request.Add(request);
         context.SaveChanges();
     }
 }
 public void CreateDeposit(Deposit deposit)
 {
     using (var context = new FinanceEntities())
     {
         context.Deposit.Add(deposit);
         context.SaveChanges();
     }
 }
 public List<CreditPayment> GetPaymentsPerCredit(int creditId)
 {
     using (var context = new FinanceEntities())
     {
         return
             context.CreditPayment.Include(item => item.Credit).Where(item => item.CreditId == creditId).ToList();
     }
 }
 public void CreateComment(Comment comment)
 {
     using (var context = new FinanceEntities())
     {
         context.Comment.Add(comment);
         context.SaveChanges();
     }
 }
 public List<DepositType> GetDepositRows()
 {
     using (var context = new FinanceEntities())
     {
         return context.DepositType
             .ToList();
     }
 }
 public void CreatePayment(CreditPayment creditPayment)
 {
     using (var context = new FinanceEntities())
     {
         context.CreditPayment.Add(creditPayment);
         context.SaveChanges();
     }
 }
        public void DeleteCreditType(int creditTypeId)
        {
            using (var context = new FinanceEntities())
            {
                context.CreditType.Remove(context.CreditType.First(ct => ct.Id == creditTypeId));
            }

        }
 public void RemovePayment(int id)
 {
     using (var context = new FinanceEntities())
     {
         var payment = context.CreditPayment.Find(id);
         context.CreditPayment.Remove(payment);
         context.SaveChanges();
     }
 }
 public UserProfile GetUserById(int userId)
 {
     using (var context = new FinanceEntities())
     {
         return context.UserProfile
             .Include(user => user.webpages_Roles)
             .FirstOrDefault(user => user.UserId == userId);
     }
 }
 public void UpdateCredit(Credit credit)
 {
     using (var context = new FinanceEntities())
     {
         context.Credit.Attach(credit);
         context.Entry(credit).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
 public void UpdateRequest(Request request)
 {
     using (var context = new FinanceEntities())
     {
         context.Request.Attach(request);
         context.Entry(request).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
 public List<Request> GetUnassignedAndPersonalRequests(int employeeId, int state)
 {
     using (var context = new FinanceEntities())
     {
         var query = context.Request.Include(item => item.CreditType).Include(item => item.DepositType);
         query = SetEmployeeCriteria(query, employeeId, state);
         return query.ToList();
     }
 }
 public void UpdateDeposit(Deposit deposit)
 {
     using (var context = new FinanceEntities())
     {
         context.Deposit.Attach(deposit);
         context.Entry(deposit).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
 public List<UserProfile> GetUsers(int page, string sortColumnName)
 {
     using (var context = new FinanceEntities())
     {
         return context.UserProfile
             .Include(u => u.webpages_Roles)
             .OrderBy(sortColumnName)
             .Skip((page - 1) * 20).Take(20).ToList();
     }
 }
 public Credit GetCreditById(int creditId)
 {
     using (var context = new FinanceEntities())
     {
         return context.Credit.Include(item => item.CreditType)
             .Include(item => item.CreditPayment)
             .Include(item => item.UserProfile)
             .FirstOrDefault(item => item.Id == creditId);
     }
 }
        public FinanceBrowser(FinanceEntities DB)
        {
            _browser = new WebBrowser();
            _browser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(browser_DocumentCompleted);
            _browser.Navigated += new WebBrowserNavigatedEventHandler(browser_Navigated);
            _db = DB;
            _downloadUrl = GetDownloadUrl();

            _timer = new Timer {Interval = 5000};
            _timer.Tick += new System.EventHandler(timer_Tick);
        }
 public Deposit FindByRequestId(int requestId)
 {
     using (var context = new FinanceEntities())
     {
         return
             context.Deposit.Include(item => item.DepositType)
                 .Include(item => item.UserProfile)
                 .Include(item => item.DepositPayment)
                 .FirstOrDefault(item => item.RequestId == requestId);
     }
 }
 public List<Credit> GetCredits()
 {
     using (var context = new FinanceEntities())
     {
         return
             context.Credit.Include(item => item.CreditType)
                 .Include(item => item.UserProfile)
                 .Include(item => item.CreditPayment)
                 .ToList();
     }
 }
        public IEnumerable <Company> Get()
        // public string  Get()
        {
            using (FinanceEntities entities = new FinanceEntities())
            {
                var templist = from a in entities.Companys
                               // where a.IPOYear != null
                               select a;

                //var json = JsonConvert.SerializeObject(templist.ToArray());
                //            return json;
                return(templist.ToList());
            }
        }
        public IEnumerable <Company> GetIndustry(string id)
        {
            using (FinanceEntities entities = new FinanceEntities())
            {
                var templist = from a in entities.Companys
                               //a.IPOYear != null &&
                               where a.Industry.StartsWith(id)

                               select a;

                // templist.Where(x => x.IPOYear == null).Select(a => a.IPOYear. = 0).ToList();

                return(templist.ToList());
            }
        }
Beispiel #33
0
        public void Post([FromBody] Cardadd cu)
        {
            FinanceEntities db     = new FinanceEntities();
            CardDetail      c      = new CardDetail();
            int             custid = (from u in db.Users
                                      where u.Username == cu.Username
                                      select u.CustomerID).FirstOrDefault();
            var entry = (from cd in db.CardDetails
                         where cd.CustomerID == custid
                         select cd);

            foreach (var item in entry)
            {
                //item.RemainingCredit = item.TotalCredit - cu.RemainingCredit;
                item.EMIPendingStatus = true;
            }
            db.SaveChanges();
        }
Beispiel #34
0
        public void Post([FromBody] CardNew cu)
        {
            FinanceEntities db  = new FinanceEntities();
            CardDetail      c   = new CardDetail();
            Random          rd  = new Random();
            int             rno = rd.Next(000000, 999999);

            c.CustomerID       = (from a in db.Users where a.Username == cu.Username select a.CustomerID).FirstOrDefault();
            c.CardID           = "EMI" + rno;
            c.Validity         = cu.Validity;
            c.CardType         = cu.CardType;
            c.ActivationStatus = cu.ActivationStatus;
            c.TotalCredit      = cu.TotalCredit;
            c.RemainingCredit  = cu.RemainingCredit;
            c.EMIPendingStatus = cu.EmiPendingStatus;
            db.CardDetails.Add(c);
            db.SaveChanges();
        }
        public void Post([FromBody] Purchase pur)
        {
            FinanceEntities db = new FinanceEntities();

            PurchaseDetail p = new PurchaseDetail();

            p.PurchaseID   = 1;
            p.ProductID    = pur.id;
            p.CardID       = "EMI093443";
            p.PurchaseDate = DateTime.Now;
            p.CustomerID   = 3;
            p.EmiScheme    = pur.scheme;
            p.EmiPerMonth  = pur.amount / pur.scheme;
            p.EmiPaid      = 0;
            p.EmiLeft      = pur.amount;

            db.PurchaseDetails.Add(p);
            db.SaveChanges();
        }
 public HttpResponseMessage CheckIfsc(string id)
 {
     try
     {
         using (FinanceEntities db = new FinanceEntities())
         {
             var data = db.Banks.Find(id);
             if (data != null)
             {
                 return(Request.CreateResponse(HttpStatusCode.OK, data));
             }
             else
             {
                 return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "IFSC Code Not Found"));
             }
         }
     } catch
     {
         return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "IFSC Code Could Not Be Checked"));
     }
 }
        public void Post([FromBody] Pay pay)
        {
            FinanceEntities db = new FinanceEntities();

            var query = (from x in db.PurchaseDetails
                         where x.PurchaseID == pay.pur_id
                         select x).FirstOrDefault();


            var query1 = (from a in db.CardDetails
                          where a.CardID.Equals(query.CardID)
                          select a).FirstOrDefault();

            if (query.EmiLeft > 0)
            {
                query.EmiPaid          += query.EmiPerMonth;
                query.EmiLeft          -= query.EmiPerMonth;
                query.PaidForMonth      = "YES";
                query1.RemainingCredit += Convert.ToInt32(query.EmiPerMonth);
            }


            db.SaveChanges();
        }
Beispiel #38
0
 //实例化
 public AccountModel()
 {
     fin = new FinanceEntities();
 }