public ActionResult SignUp(BanksCustomer banks_Customer)
        {
            if (ModelState.IsValid)
            {
                using (var db = new BankEntities1())
                {
                    banks_Customer.UserRole       = "Customer";
                    banks_Customer.CurrentBalance = 0;
                    banks_Customer.Fund           = 0;
                    db.BanksCustomers.Add(banks_Customer);

                    db.SaveChanges();
                    return(RedirectToAction("Login", "Login"));
                }
            }
            return(View());
        }
Exemple #2
0
        //查询当前账号的所有记录信息
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            BankEntities1 context = new BankEntities1();
            var           query   = from t in context.MoneyInfo
                                    where t.accountNo == txtID.Text
                                    select t;

            if (query.Count() > 0)
            {
                datagrid1.ItemsSource = query.ToList();
            }
            else
            {
                MessageBox.Show("此账号不存在");
                this.txtID.Clear();
            }
            context.Dispose();
        }
 public ActionResult Index(string selectedAccount)
 {
     if (string.IsNullOrEmpty(selectedAccount))
     {
         return(RedirectToAction("Index"));
     }
     else
     {
         Session["accountNumber"] = selectedAccount;
         int           selectedAccount2 = int.Parse(selectedAccount);
         BankEntities1 dbContext        = new BankEntities1();
         Account       account          = dbContext.Accounts.Single(x => x.accountNo == selectedAccount2);
         var           amount           = account.amount;
         CustomerMedal cmedal           = dbContext.CustomerMedals.Single(x => amount > x.min && amount < x.max);
         Session["medal"] = cmedal.type;
         return(RedirectToAction("Menu"));
     }
 }
Exemple #4
0
        private void button3_Click(object sender, RoutedEventArgs e)
        {
            if (i == 0)
            {
                context = new BankEntities1();
                var q = from t in context.EmployeeInfo
                        where t.EmployeeNo == textBox2.Text
                        select t;
                var q1 = from t in context.LoginInfo
                         where t.Bno == textBox2.Text
                         select t;
                foreach (var w in q)
                {
                    context.EmployeeInfo.Remove(w);
                }
                foreach (var w in q1)
                {
                    context.LoginInfo.Remove(w);
                }
                context.SaveChanges();
                textBox2.Text = "";
                var s = from t in context.EmployeeInfo

                        select t;
                this.dataGrid.ItemsSource = s.ToList();
            }
            else
            {
                context = new BankEntities1();
                var q = from t in context.Salary
                        where t.Id == textBox2.Text
                        select t;
                foreach (var w in q)
                {
                    context.Salary.Remove(w);
                }
                context.SaveChanges();
                textBox2.Text = "";
                var s = from t in context.Salary

                        select t;
                this.dataGrid.ItemsSource = s.ToList();
            }
        }
Exemple #5
0
        private void comboBoxAccountType_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            string s = comboBoxAccountType.SelectedItem.ToString();

            using (BankEntities1 c = new BankEntities1())
            {
                var q = from t in c.AccountInfo
                        where t.accountType == s
                        select t;
                if (q.Count() > 0)
                {
                    this.txtAccountNo.Text = string.Format("{0}", int.Parse(q.Max(x => x.accountNo)) + 1);
                }
                else
                {
                    txtAccountNo.Text = string.Format("{0}00001", comboBoxAccountType.SelectedIndex + 1);
                }
            }
        }
Exemple #6
0
        public ActionResult EditManager(int id)
        {
            ViewBag.mgrId    = id;
            Session["mgrId"] = id;
            BankEntities1 newObj = new BankEntities1();

            try
            {
                SuperManagerClass superManagerClass = new SuperManagerClass();
                List <string>     branchesList      = superManagerClass.getNonAssignedBranches();
            }
            catch (Exception e)
            {
                ViewBag.Error = "Exception " + e;
            }
            Manager obj = newObj.Managers.Single(x => x.managerId == id);

            return(View(obj));
        }
Exemple #7
0
 private double GetLoadRateOfYear(int year)
 {
     using (BankEntities1 context = new BankEntities1())
     {
         var rates = context.LoadRate.ToList();
         //下面的写死了不太好,要彻底解决需要改进数据库结构,但由于存款利息表也是这样设计就没改
         if (year <= 1)
         {
             return(rates.First(x => x.rationType == "1年以内").rationValue.Value);
         }
         else if (year > 5)
         {
             return(rates.First(x => x.rationType == "5年以上").rationValue.Value);
         }
         else
         {
             return(rates.First(x => x.rationType == "1年到5年").rationValue.Value);
         }
     }
 }
Exemple #8
0
 private void button_Click(object sender, RoutedEventArgs e)
 {
     context = new BankEntities1();
     if (comboBox.SelectedItem == null)
     {
         MessageBox.Show("选择查找类别");
     }
     else
     {
         i = 0;
         string s1 = comboBox.SelectedItem.ToString();
         string s2 = textBox.Text;
         if (s1 == "编号")
         {
             if (s2 == "")
             {
                 MessageBox.Show("请输入查找的编号");
             }
             else
             {
                 var q = from t in context.EmployeeInfo
                         where t.EmployeeNo == s2
                         select t;
                 dataGrid.ItemsSource = q.ToList();
             }
         }
         if (s1 == "姓名")
         {
             if (s2 == "")
             {
                 MessageBox.Show("请输入查找的姓名");
             }
             else
             {
                 var q = from t in context.EmployeeInfo
                         where t.EmployeeName == s2
                         select t;
                 dataGrid.ItemsSource = q.ToList();
             }
         }
         if (s1 == "性别")
         {
             if (s2 == "")
             {
                 MessageBox.Show("请输入查找的性别");
             }
             else
             {
                 var q = from t in context.EmployeeInfo
                         where t.sex == s2
                         select t;
                 dataGrid.ItemsSource = q.ToList();
             }
         }
         if (s1 == "ID")
         {
             if (s2 == "")
             {
                 MessageBox.Show("请输入查找的ID");
             }
             else
             {
                 var q = from t in context.EmployeeInfo
                         where t.idCard == s2
                         select t;
                 dataGrid.ItemsSource = q.ToList();
             }
         }
         if (s1 == "全部")
         {
             var q = from t in context.EmployeeInfo
                     select t;
             dataGrid.ItemsSource = q.ToList();
         }
         if (s1 == "电话")
         {
             if (s2 == "")
             {
                 MessageBox.Show("请输入查找的电话");
             }
             else
             {
                 var q = from t in context.EmployeeInfo
                         where t.telphone == s2
                         select t;
                 dataGrid.ItemsSource = q.ToList();
             }
         }
     }
 }
Exemple #9
0
        private void button2_Click(object sender, RoutedEventArgs e)
        {
            context = new BankEntities1();
            if (i == 0)
            {
                EmployeeInfo p = new EmployeeInfo()
                {
                    EmployeeName = null,
                    EmployeeNo   = textBox2.Text,
                    idCard       = null,
                    telphone     = null,
                    workDate     = null,
                    sex          = null,
                    photo        = null
                };
                LoginInfo l = new LoginInfo()
                {
                    Bno = textBox2.Text, Password = "******"
                };
                try
                {
                    context.EmployeeInfo.Add(p);
                    context.LoginInfo.Add(l);
                    context.SaveChanges();
                    textBox2.Text = "";
                }
                catch (Exception e2)
                {
                    MessageBox.Show("添加失败" + e2.Message);
                    textBox2.Text = "";
                }
                var q = from t in context.EmployeeInfo

                        select t;
                this.dataGrid.ItemsSource = q.ToList();
            }
            else
            {
                Salary sa = new Salary()
                {
                    Id   = textBox2.Text,
                    姓名   = null,
                    基本工资 = null,
                    车补贴  = null,
                    房补贴  = null,
                    奖金   = null,
                    罚款   = null,
                    总和   = null,
                };
                try
                {
                    context.Salary.Add(sa);
                    context.SaveChanges();
                    textBox2.Text = "";
                }
                catch (Exception e2)
                {
                    MessageBox.Show("添加失败" + e2.Message);
                    textBox2.Text = "";
                }
                var q = from t in context.Salary

                        select t;
                this.dataGrid.ItemsSource = q.ToList();
            }
        }