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 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(); }
/// <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="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("修改失败"); } } }
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(); }
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(); }
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(); }
void TotalQuery_Unloaded(object sender, RoutedEventArgs e) { context.Dispose(); }
void ratePage_Unloaded(object sender, RoutedEventArgs e) { context.Dispose(); }
private void StaffManagement_Unloaded(object sender, RoutedEventArgs e) { context.Dispose(); }