Ejemplo n.º 1
0
        public string checkMedal(long acc)
        {
            BankEntities2 dbContext2 = new BankEntities2();
            int           amt;
            CustomerClass obj = new CustomerClass();

            Account account = dbContext.Accounts.Where(val => val.accountNo == acc).Single <Account>();

            amt = (int)(account.amount);
            CustomerMedal medal = dbContext2.CustomerMedals.Where(val => val.min <amt && val.max> amt).Single <CustomerMedal>();

            account.type = medal.type;
            dbContext.SaveChanges();

            return(account.type);
        }
Ejemplo n.º 2
0
        public string editManager(int mId, string name, string address, string phno, string mail, string branch)
        {
            //SqlConnection con = new SqlConnection(ConnectionString);
            //con.Open();
            //string sql = "editManager";

            //SqlCommand command = new SqlCommand(sql, con);

            //SqlParameter param6 = new SqlParameter("@managerId", mId);
            //command.Parameters.Add(param6);

            //SqlParameter param1 = new SqlParameter("@managerName", name);
            //command.Parameters.Add(param1);

            //SqlParameter param3 = new SqlParameter("@address", address);
            //command.Parameters.Add(param3);

            //SqlParameter param4 = new SqlParameter("@phoneNo", phno);
            //command.Parameters.Add(param4);

            //SqlParameter param5 = new SqlParameter("@emailId", mail);
            //command.Parameters.Add(param5);

            //SqlParameter param2 = new SqlParameter("@branchId", branch);
            //command.Parameters.Add(param2);



            //command.CommandType = CommandType.StoredProcedure;
            //command.ExecuteNonQuery();
            //return "success";
            Manager editManager = dbContext.Managers.Where(val => val.managerId == mId).Single <Manager>();

            editManager.managerName = name;
            editManager.address     = address;
            editManager.phoneNo     = phno;
            editManager.userId      = mail;
            editManager.branchId    = branch;
            Branch addAssigned = dbContext.Branches.Where(val => val.branchId == branch).Single <Branch>();

            addAssigned.assigned = 1;
            dbContext.SaveChanges();


            return("success");
        }
Ejemplo n.º 3
0
        public string withdraw(long acc, int amt)
        {
            string comment = "withdraw done";
            string type    = "withdraw";

            try
            {
                Account transactionWithdraw = dbContext.Accounts.Where(var => var.accountNo == acc).Single <Account>();
                if (transactionWithdraw.amount >= amt)
                {
                    transactionWithdraw.amount -= amt;
                    dbContext.SaveChanges();
                }
                else
                {
                    return("amountNotSufficient");
                }
            }
            catch (Exception exe)
            {
                return("accountNotFound");
            }
            TransactionClass obj1 = new TransactionClass();

            obj1.insTrans(acc, acc, amt, type, comment);
            return("Success");
        }
Ejemplo n.º 4
0
        public void insTrans(long acc1, long acc2, int amt, string type, string comment)
        {
            BankEntities2 dbContext         = new BankEntities2();
            string        date              = DateTime.Now.ToString();
            Transaction   transactionInsert = new Transaction
            {
                fromAccountNo   = acc1,
                toAccountNo     = acc2,
                transactionDate = date,
                amount          = amt,
                transactionType = type,
                comments        = comment
            };

            dbContext.Transactions.Add(transactionInsert);
            dbContext.SaveChanges();
        }