Exemplo n.º 1
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();
        }
Exemplo n.º 3
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();
        }