/// <summary> /// 插入人员信息,根据人员信息修改业务主管信息 /// </summary> public void InserUser() { string stroderpws = ""; string sqlcon = GetConStr(); using (SqlConnection conn = new SqlConnection(sqlcon)) { conn.Open(); SqlTransaction trans = conn.BeginTransaction(); try { if (users.UserPwd != null && users.UserPwd != "") { stroderpws = users.UserPwd; } userDal.DeleteUser(users.UserCode, trans); depDal.DeleteYwzgByUser(users.UserCode, trans); string deptcode = ""; if (users.UserGroup == "02") { //部门经理 deptcode = this.GetRootDept().DeptCode; } else if (users.UserGroup == "03") { //业务主管 deptcode = users.UserDept; } if (!string.IsNullOrEmpty(deptcode)) { depDal.InsertYwzgByUser(deptcode, users.UserCode, trans); } users.UserPwd = stroderpws; userDal.InserUser(users, trans); trans.Commit(); } catch { trans.Rollback(); throw; } } }