protected void btnBank_Click(object sender, EventArgs e) { int id = GetQueryIntValue("id"); Infobasis.Data.DataEntity.EmployeeBank eeBank = DB.EmployeeBanks.Where(u => u.UserID == id).FirstOrDefault(); bool createNew = false; if (eeBank != null) { eeBank.LastUpdateDatetime = DateTime.Now; eeBank.LastUpdateByID = UserInfo.Current.ID; eeBank.LastUpdateByName = UserInfo.Current.ChineseName; } else { eeBank = new EmployeeBank(); eeBank.CreateDatetime = DateTime.Now; eeBank.CreateByID = UserInfo.Current.ID; eeBank.CreateByName = UserInfo.Current.ChineseName; eeBank.Default = true; createNew = true; } eeBank.UserID = id; eeBank.BankName = tbxBankName.Text.Trim(); eeBank.AccountHolder = tbxBankUserName.Text.Trim(); eeBank.BankAccount = tbxBankAccount.Text.Trim(); eeBank.Remark = tbxBankRemark.Text; EmployeeAdjust eeAdjust = new EmployeeAdjust() { UserID = id, AdjustItemName = "银行账号", AdjustDate = DateTime.Now, AllChangeData = eeBank.ToString(), isAdjusted = true, CreateByID = UserInfo.Current.ID, CreateByName = UserInfo.Current.ChineseName, CreateDatetime = DateTime.Now }; DB.EmployeeAdjusts.Add(eeAdjust); if (createNew) { DB.EmployeeBanks.Add(eeBank); } SaveChanges(); ShowNotify("保存成功!"); }
private void LoadBankInfo() { int id = GetQueryIntValue("id"); Infobasis.Data.DataEntity.EmployeeBank eeBank = DB.EmployeeBanks.Where(u => u.UserID == id).FirstOrDefault(); if (eeBank != null) { tbxBankAccount.Text = eeBank.BankAccount; tbxBankName.Text = eeBank.BankName; tbxBankUserName.Text = eeBank.AccountHolder; } }