protected void btnFixPay_Click(object sender, EventArgs e) { int id = GetQueryIntValue("id"); Infobasis.Data.DataEntity.EmployeeFixPay fixPay = DB.EmployeeFixPays.Where(u => u.UserID == id).FirstOrDefault(); bool createNew = false; if (fixPay != null) { fixPay.LastUpdateDatetime = DateTime.Now; fixPay.LastUpdateByID = UserInfo.Current.ID; fixPay.LastUpdateByName = UserInfo.Current.ChineseName; } else { fixPay = new EmployeeFixPay(); fixPay.CreateDatetime = DateTime.Now; fixPay.CreateByID = UserInfo.Current.ID; fixPay.CreateByName = UserInfo.Current.ChineseName; createNew = true; } fixPay.UserID = id; fixPay.ProbationFixPayValue = Change.ToDecimal(tbxProbationFixPayValue.Text); fixPay.FixPayValue = Change.ToDecimal(tbxFixPayValue.Text); fixPay.JobAllowanceValue = Change.ToDecimal(tbxJobAllowanceValue.Text); fixPay.TrafficAllowanceValue = Change.ToDecimal(tbxTrafficAllowanceValue.Text); fixPay.DiningAllowanceValue = Change.ToDecimal(tbxDiningAllowanceValue.Text); EmployeeAdjust eeAdjust = new EmployeeAdjust() { UserID = id, AdjustItemName = "固定薪酬", AdjustDate = DateTime.Now, AllChangeData = fixPay.ToString(), isAdjusted = true, CreateByID = UserInfo.Current.ID, CreateByName = UserInfo.Current.ChineseName, CreateDatetime = DateTime.Now }; DB.EmployeeAdjusts.Add(eeAdjust); if (createNew) { DB.EmployeeFixPays.Add(fixPay); } SaveChanges(); ShowNotify("保存成功!"); }
private void LoadFixPay() { int id = GetQueryIntValue("id"); Infobasis.Data.DataEntity.EmployeeFixPay fixPay = DB.EmployeeFixPays.Where(u => u.UserID == id).FirstOrDefault(); if (fixPay != null) { tbxProbationFixPayValue.Text = fixPay.ProbationFixPayValue.ToString(); tbxFixPayValue.Text = fixPay.FixPayValue.ToString(); tbxJobAllowanceValue.Text = fixPay.JobAllowanceValue.ToString(); tbxTrafficAllowanceValue.Text = fixPay.TrafficAllowanceValue.ToString(); tbxDiningAllowanceValue.Text = fixPay.DiningAllowanceValue.ToString(); } }