Exemplo n.º 1
0
        public int LoanTrans(Loan_Transcation_Entites lt)
        {
            db = new MphasisBankEntities();
            var r = db.LoanAccounts.Where(t => t.LnAccountid == lt.LnAccountid);

            if (r.Count() > 0)
            {
                foreach (var item in r)
                {
                    lt.Outstanding = item.lnAmount - lt.Amount;
                }
                LoanTranscation l = new LoanTranscation()
                {
                    LnAccountid = lt.LnAccountid,
                    Emidate     = DateTime.Today,
                    Amount      = lt.Amount,
                    Outstanding = lt.Outstanding
                };
                db.LoanTranscations.Add(l);
                db.SaveChanges();
                return(1);
            }
            else
            {
                return(0);
            }
        }
Exemplo n.º 2
0
        public List <TranscationEnties> ViewTrans(string Aid)
        {
            db = new MphasisBankEntities();

            List <TranscationEnties> li = new List <TranscationEnties>();

            var res = db.Transcations.Where(x => x.Accountid.StartsWith(Aid) || Aid == null);

            foreach (var item in res)
            {
                li.Add(new TranscationEnties()
                {
                    Accountid       = item.Accountid,
                    TranscationId   = item.TranscationId,
                    TranscationDate = item.TranscationDate,
                    Balance         = item.Balance,
                    TranscationType = item.TranscationType
                });
            }
            return(li);
        }
Exemplo n.º 3
0
        public int LoanAc(Loan_Account_Entites la)
        {
            int d   = 0;
            int age = 0;

            db = new MphasisBankEntities();
            var res = db.Customers.Where(t => t.CustId == la.CustId);

            if (res.Count() > 0)
            {
                var cd = db.LoanAccounts.OrderByDescending(t => t.LnAccountid).First();
                if (cd == null)
                {
                    la.LnAccountid = "LN10001";
                }
                else
                {
                    la.LnAccountid = "LN" + (Convert.ToInt32(cd.LnAccountid.Substring(2, 5)) + 1).ToString();
                }
                foreach (var item in res)
                {
                    DateTime dt    = Convert.ToDateTime(item.Dob);
                    DateTime today = DateTime.Today;
                    age += today.Year - dt.Year;
                }
                if (age > 60)
                {
                    if (la.lnAmount < 100000)
                    {
                        la.ROI = 0.095;
                        d      = 1;
                    }
                    else
                    {
                        d = 0;
                    }
                }
                else
                {
                    if (la.lnAmount > 10000 && la.lnAmount <= 500000)
                    {
                        la.ROI = 0.1;
                        d      = 1;
                    }
                    else if (la.lnAmount > 500000 && la.lnAmount <= 1000000)
                    {
                        la.ROI = 0.095;
                        d      = 1;
                    }
                    else if (la.lnAmount > 1000000)
                    {
                        la.ROI = 0.09;
                        d      = 1;
                    }
                    else
                    {
                        d = 0;
                    }
                }
                if (d == 1)
                {
                    la.EMI       = la.lnAmount * la.ROI * (1 + la.ROI) * la.Tenure / ((1 + la.ROI) * la.Tenure - 1);
                    la.StartDate = DateTime.Now;
                    LoanAccount l = new LoanAccount()
                    {
                        LnAccountid = la.LnAccountid,
                        CustId      = la.CustId,
                        lnAmount    = la.lnAmount,
                        StartDate   = la.StartDate,
                        Tenure      = la.Tenure,
                        ROI         = la.ROI,
                        EMI         = la.EMI
                    };
                    db.LoanAccounts.Add(l);
                    db.SaveChanges();
                }
            }
            else
            {
                d = 0;
            }
            return(d);
        }
Exemplo n.º 4
0
 public EmployeeDAL()
 {
     dbEntites = new MphasisBankEntities();
 }
Exemplo n.º 5
0
 public LoginDAL()
 {
     db = new MphasisBankEntities();
 }
Exemplo n.º 6
0
        public int AddTranscation(TranscationEnties te)
        {
            db = new MphasisBankEntities();
            var res = db.SavingsAccounts.Where(t => t.Accountid == te.Accountid);

            if (res.Count() > 0)
            {
                if (te.TranscationType == "Withdraw")
                {
                    foreach (var item in res)
                    {
                        if (item.Balance < 0 || item.Balance < te.Balance)
                        {
                            d = 0;
                        }
                        else
                        {
                            Transcation t = new Transcation()
                            {
                                Accountid       = te.Accountid,
                                TranscationType = te.TranscationType,
                                TranscationDate = DateTime.Now,
                                Balance         = te.Balance
                            };
                            db.Transcations.Add(t);
                            item.Balance -= te.Balance;
                            d             = 1;
                        }
                    }
                    if (d == 1)
                    {
                        SavingsAccount sa = new SavingsAccount()
                        {
                            Balance = te.Balance
                        };
                        db.SaveChanges();
                    }
                    return(1);
                }
                else if (te.TranscationType == "Deposite")
                {
                    foreach (var item in res)
                    {
                        if (item.Balance < 0 || item.Balance < te.Balance)
                        {
                            d = 0;
                        }
                        else
                        {
                            Transcation t = new Transcation()
                            {
                                Accountid       = te.Accountid,
                                TranscationType = te.TranscationType,
                                TranscationDate = DateTime.Now,
                                Balance         = te.Balance
                            };
                            db.Transcations.Add(t);
                            item.Balance += te.Balance;
                            d             = 1;
                        }
                    }
                    if (d == 1)
                    {
                        SavingsAccount sa = new SavingsAccount()
                        {
                            Balance = te.Balance
                        };
                        db.SaveChanges();
                    }
                    return(1);
                }
                else
                {
                    return(0);
                }
            }
            else
            {
                return(0);
            }
        }
Exemplo n.º 7
0
 public CustomerDAL()
 {
     dbEntites = new MphasisBankEntities();
 }