Exemple #1
0
        /// <summary>
        /// 存款
        /// </summary>
        /// <param name="accountInfo"></param>
        public static void UpdateSave(UserAccountInfo accountInfo)
        {
            using (var context = new BMS_DBEntities())
            {
                try
                {
                    OperateRecordInfo operateinfo = new OperateRecordInfo();

                    var q = from t in context.UserAccountInfoes
                            where accountInfo.UAccountNumber == t.UAccountNumber
                            select t;
                    foreach (var i in q)
                    {
                        i.Balance += accountInfo.Balance;
                        operateinfo.AccountRemaining = (double)i.Balance;
                    }

                    operateinfo.OTime          = System.DateTime.Now;
                    operateinfo.OType          = "存款";
                    operateinfo.OAccountNumber = accountInfo.UAccountNumber;
                    operateinfo.OAccountChange = (double)accountInfo.Balance;
                    context.OperateRecordInfoes.Add(operateinfo);
                    context.SaveChanges();
                    context.Dispose();
                }
                catch
                {
                    MessageBox.Show("修改失败");
                }
            }
        }
        /// <summary>
        /// 获取存款用户信息,并初始化余额
        /// </summary>
        /// <param name="accountNumber"></param>
        /// <returns></returns>
        public static Custom GetCustom(string accountNumber)
        {
            Custom         custom = null;
            BMS_DBEntities c      = new BMS_DBEntities();

            try
            {
                var q = (from t in c.UserAccountInfoes
                         where t.UAccountNumber == accountNumber
                         select t).Single();
                custom = CreateCustom(q.LoanType);
                custom.AccountInfo.UAccountNumber   = accountNumber;
                custom.AccountInfo.UName            = q.UName;
                custom.AccountInfo.UAccountPassword = q.UAccountPassword;
                custom.AccountInfo.UIdCardNumber    = q.UIdCardNumber;
            }
            catch
            {
                return(null);
            }
            var q1 = (from t in c.OperateRecordInfoes
                      where t.OAccountNumber == accountNumber
                      select t).Sum(x => x.OAccountChange);

            custom.AccountBalance = (double)q1;                             //??????????????????????????????????
            return(custom);
        }
 private void b1_Click(object sender, RoutedEventArgs e)
 {
     using (var context = new BMS_DBEntities())
     {
         EmployeeInfo em = new EmployeeInfo()
         {
             EId           = this.Id.Text,
             EName         = this.stName.Text,
             EPassword     = this.pass.Password,
             ESex          = this.Sex.Text,
             EIdCardNumber = this.IdCard.Text,
             ESalary       = decimal.Parse(this.Wage.Text),
             EPhone        = this.Conn.Text,
         };
         try
         {
             context.EmployeeInfoes.Add(em);
             context.SaveChanges();
             context.Dispose();
             MessageBox.Show("添加成功");
         }
         catch (Exception ex)
         {
             MessageBox.Show("添加失败!" + ex.Message);
         }
     }
     this.Close();
 }
 public void show()
 {
     //查找数据库有关信息
     using (var context = new BMS_DBEntities())
     {
         var q = from t1 in context.BusinessLoanInfoes
                 from t2 in context.UserAccountInfoes
                 where t1.BlAccountNumber == t2.UAccountNumber
                 select new
         {
             账号   = t1.BlAccountNumber,
             姓名   = t2.UName,
             公司   = t1.BlCompany,
             总资产  = t1.BlCompanyAsset,
             余额   = t2.Balance,
             贷款类型 = "企业贷款"
         };
         data.ItemsSource = q.ToList();
         //var q1 = from t2 in context.UserAccountInfoes
         //         from t1 in context.BusinessLoanInfoes
         //        where t1.BlAccountNumber == t2.UAccountNumber
         //        select t2;
         //data.ItemsSource = q1.ToList();
     }
 }
        //by wygdove start
        public int check()
        {
            accountinfo.UName            = this.CName.Text;
            accountinfo.UIdCardNumber    = this.IDCard.Text;
            accountinfo.UAccountNumber   = this.CreditCard.Text;
            accountinfo.UAccountPassword = this.Password.Password;

            using (var context = new BMS_DBEntities())
            {
                try
                {
                    var q = from t in context.UserAccountInfoes
                            where t.UIdCardNumber == accountinfo.UIdCardNumber && t.UAccountPassword == accountinfo.UAccountPassword && t.UAccountNumber == accountinfo.UAccountNumber
                            select t;
                    foreach (var i in q)
                    {
                        MessageBox.Show("该账户状态为:" + i.Statement);
                    }
                    return(q.ToList().Count());
                }
                catch
                {
                    MessageBox.Show("查询用户失败");
                }
            }
            return(-1);
        }
Exemple #6
0
        /// <summary>
        /// 开户
        /// </summary>
        /// <param name="accountInfo"></param>
        public static void CreateUser(UserAccountInfo accountInfo)
        {
            using (var context = new BMS_DBEntities())
            {
                try
                {
                    accountInfo.Statement = "normal";
                    context.UserAccountInfoes.Add(accountInfo);

                    OperateRecordInfo operateinfo = new OperateRecordInfo();
                    operateinfo.OTime            = System.DateTime.Now;
                    operateinfo.OType            = "开户";
                    operateinfo.OAccountNumber   = accountInfo.UAccountNumber;
                    operateinfo.OAccountChange   = (double)accountInfo.Balance;
                    operateinfo.AccountRemaining = (double)accountInfo.Balance;
                    context.OperateRecordInfoes.Add(operateinfo);
                    context.SaveChanges();

                    context.Dispose();
                }
                catch
                {
                    MessageBox.Show("修改失败");
                }
            }
        }
Exemple #7
0
        public void staff()
        {
            BMS_DBEntities context = new BMS_DBEntities();
            var            query   = from t in context.EmployeeInfoes
                                     select t;

            this.datagrid1.ItemsSource = query.ToList();
        }
        public OperateRecord()
        {
            InitializeComponent();
            BMS_DBEntities context = new BMS_DBEntities();
            var            query   = from t in context.OperateRecordInfoes
                                     select t;

            this.datagrid1.ItemsSource = query.ToList();       //数据库
        }
        /// <summary>
        /// 获取指定类别的利率
        /// </summary>
        /// <param name="rateType">利率类别</param>
        /// <returns>对应类别的利率值</returns>
        public static double GetRate(RateType rateType)
        {
            string         type = rateType.ToString();
            BMS_DBEntities c    = new BMS_DBEntities();
            var            q    = (from t in c.RateInfoes
                                   where t.DepositType == type
                                   select t.Rate).Single();

            return(q.Value);
        }
Exemple #10
0
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            //by wygdove start
            UserAccountInfo accountinfo = new UserAccountInfo();

            using (var context = new BMS_DBEntities())
            {
                accountinfo.UAccountNumber = this.AccountId.Text;
                accountinfo.UName          = this.LName.Text;
                accountinfo.UPhone         = this.LPhone.Text;
                accountinfo.Balance        = decimal.Parse(this.LoanAmount.Text);

                var q = from t in context.UserAccountInfoes
                        where t.UAccountNumber == accountinfo.UAccountNumber
                        select t;
                if (q.Count() == 0)
                {
                    CustomOperation.CreateLoan(accountinfo, "企业贷款");
                    context.SaveChanges();
                    context.Dispose();
                }
            }
            //by wygdove end

            //将贷款信息添置数据库
            using (var context = new BMS_DBEntities())
            {
                BusinessLoanInfo firm = new BusinessLoanInfo()
                {
                    BlCompany         = this.Company.Text,
                    BlCompanyLoaction = this.Location.Text,
                    BlAccountNumber   = accountinfo.UAccountNumber,
                    BlCompanyAsset    = this.TotalAssets.Text
                };

                try
                {
                    context.BusinessLoanInfoes.Add(firm);
                    context.SaveChanges();
                    context.Dispose();
                    MessageBox.Show("贷款成功");
                }
                catch (Exception ex)
                {
                    MessageBox.Show("贷款失败! " + ex.Message);
                }
                context.Dispose();
                this.Close();
            }
        }
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            //by wygdove start
            UserAccountInfo accountinfo = new UserAccountInfo();

            using (var context = new BMS_DBEntities())
            {
                accountinfo.UAccountNumber = this.AccountId.Text;
                accountinfo.UName          = this.PName.Text;
                accountinfo.UPhone         = this.PPhone.Text;
                accountinfo.Balance        = decimal.Parse(this.LoanAmount.Text);

                var q = from t in context.UserAccountInfoes
                        where t.UAccountNumber == accountinfo.UAccountNumber
                        select t;
                if (q.Count() == 0)
                {
                    CustomOperation.CreateLoan(accountinfo, "个人贷款");
                    context.SaveChanges();
                    context.Dispose();
                }
            }
            //by wygdove end

            //将贷款信息添置数据库
            using (var context = new BMS_DBEntities())
            {
                PersonalLoanInfo person = new PersonalLoanInfo()
                {
                    PlWork = this.Unit.Text,
                    //PlSalary = this.Wage.Text,
                    PlAccountNumber = this.AccountId.Text,
                    PlSalary        = decimal.Parse(this.Wage.Text)
                };
                try
                {
                    context.PersonalLoanInfoes.Add(person);
                    context.SaveChanges();
                    MessageBox.Show("贷款成功");
                }
                catch (Exception ex)
                {
                    MessageBox.Show("贷款失败!" + ex.Message);
                }
            }
            this.Close();
        }
Exemple #12
0
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            //by wygdove start
            UserAccountInfo accountinfo = new UserAccountInfo();

            using (var context = new BMS_DBEntities())
            {
                accountinfo.UAccountNumber = this.AccountId.Text;
                accountinfo.UName          = this.SName.Text;
                accountinfo.UPhone         = this.Phone.Text;
                accountinfo.Balance        = decimal.Parse(this.LoanAmount.Text);

                var q = from t in context.UserAccountInfoes
                        where t.UAccountNumber == accountinfo.UAccountNumber
                        select t;
                if (q.Count() == 0)
                {
                    CustomOperation.CreateLoan(accountinfo, "教学贷款");
                    context.SaveChanges();
                    context.Dispose();
                }
            }
            //by wygdove end

            //将贷款信息添置数据库
            using (var context = new BMS_DBEntities())
            {
                StudentLoanInfo student = new StudentLoanInfo()
                {
                    SlSchool        = this.School.Text,
                    SlInstitute     = this.Academy.Text,
                    SlProfession    = this.Major.Text,
                    SlAccountNumber = this.AccountId.Text
                };
                try
                {
                    context.StudentLoanInfoes.Add(student);
                    context.SaveChanges();
                    MessageBox.Show("贷款成功");
                }
                catch (Exception ex)
                {
                    MessageBox.Show("贷款失败!" + ex.Message);
                }
            }
            this.Close();
        }
 /// <summary>
 /// 获取操作员姓名
 /// </summary>
 /// <param name="id">操作员编号</param>
 /// <returns></returns>
 public static string GetOperateName(string id)
 {
     using (BMS_DBEntities c = new BMS_DBEntities())
     {
         var q = from t in c.EmployeeInfoes
                 where t.EId == id
                 select t;
         if (q != null && q.Count() >= 1)
         {
             return(q.First().EName);
         }
         else
         {
             return("");
         }
     }
 }
Exemple #14
0
        private void b3_Click(object sender, RoutedEventArgs e)
        {
            using (var context = new BMS_DBEntities())
            {
                var q = from t in context.EmployeeInfoes
                        where t.EId == this.SId.Text && t.EIdCardNumber == this.SIdCard.Text && t.EName == this.SName.Text && t.EPassword == this.password.Password
                        select t;
                foreach (var v in q)
                {
                    context.EmployeeInfoes.Remove(v);
                }

                context.SaveChanges();
                context.Dispose();
                MessageBox.Show("删除成功");
            }
            this.Close();
        }
Exemple #15
0
        private void comboBoxAccountType_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            string s = comboBoxAccountType.SelectedItem.ToString();

            using (BMS_DBEntities c = new BMS_DBEntities())                           //数据库
            {
                var q = from t in c.UserAccountInfoes
                        where t.LoanType == s
                        select t;
                if (q.Count() > 0)
                {
                    this.txtAccountNo.Text = string.Format("{0}", int.Parse(q.Max(x => x.UAccountNumber)) + 1);
                }
                else
                {
                    txtAccountNo.Text = string.Format("{0}00001", comboBoxAccountType.SelectedIndex + 1);
                }
            }
        }
 public void show()
 {
     //查找数据库有关信息
     using (var context = new BMS_DBEntities())
     {
         var q = from t1 in context.StudentLoanInfoes
                 from t2 in context.UserAccountInfoes
                 where t1.SlAccountNumber == t2.UAccountNumber
                 select new
         {
             账户   = t1.SlAccountNumber,
             姓名   = t2.UName,
             学校   = t1.SlSchool,
             手机号码 = t2.UPhone,
             余额   = t2.Balance,
             贷款类型 = "学生短期借款"
         };
         data.ItemsSource = q.ToList();
     }
 }
Exemple #17
0
 public void show()
 {
     InitializeComponent();
     //查找数据库有关信息
     using (var context = new BMS_DBEntities())
     {
         var q = from t1 in context.StudentLoanInfoes
                 from t2 in context.UserAccountInfoes
                 where t1.SlAccountNumber == t2.UAccountNumber
                 select new
         {
             账户   = t1.SlAccountNumber,
             姓名   = t2.UName,
             学校   = t1.SlSchool,
             专业   = t1.SlProfession,
             院系   = t1.SlInstitute,
             余额   = t2.Balance,
             贷款类型 = "教学贷款"
         };
         data.ItemsSource = q.ToList();
     }
 }
Exemple #18
0
 public void show()
 {
     //查找数据库有关信息
     using (var context = new BMS_DBEntities())
     {
         var q = from t1 in context.PersonalLoanInfoes
                 from t2 in context.UserAccountInfoes
                 where t1.PlAccountNumber == t2.UAccountNumber
                 select new
         {
             账户   = t1.PlAccountNumber,
             姓名   = t2.UName,
             所在单位 = t1.PlWork,
             基本工资 = t1.PlSalary,
             余额   = t2.Balance,
             贷款类型 = "个人贷款"
         };
         ////test
         //var q = from t in context.PersonalLoanInfoes
         //        select t;
         ////test
         data.ItemsSource = q.ToList();
     }
 }