Commit 80a1c938 authored by 黄奎's avatar 黄奎

页面修改

parent 966f9d2f
...@@ -53,6 +53,16 @@ namespace Edu.Module.User ...@@ -53,6 +53,16 @@ namespace Edu.Module.User
/// </summary> /// </summary>
private readonly RB_AccountRepository accountRepository = new RB_AccountRepository(); private readonly RB_AccountRepository accountRepository = new RB_AccountRepository();
/// <summary>
/// 讲师仓储层对象
/// </summary>
private readonly RB_TeacherRepository teacherRepository = new RB_TeacherRepository();
/// <summary>
/// 助教仓储层对象
/// </summary>
private readonly RB_AssistRepository assistRepository = new RB_AssistRepository();
/// <summary> /// <summary>
/// 获取管理者列表 /// 获取管理者列表
/// </summary> /// </summary>
...@@ -408,16 +418,45 @@ namespace Edu.Module.User ...@@ -408,16 +418,45 @@ namespace Edu.Module.User
/// 修改员工类型 /// 修改员工类型
/// </summary> /// </summary>
/// <param name="targetAccountType">目标用户类型</param> /// <param name="targetAccountType">目标用户类型</param>
/// <param name="Id">编号</param> /// <param name="AccountId">编号</param>
/// <param name="AccountType">类型</param>
/// <param name="Remark">调整原因</param> /// <param name="Remark">调整原因</param>
/// <returns></returns> /// <returns></returns>
[TransactionCallHandler] [TransactionCallHandler]
public virtual bool SetEmployeeTypeModule(AccountTypeEnum targetAccountType, int Id,string Remark) public virtual bool SetEmployeeTypeModule(AccountTypeEnum targetAccountType, int AccountId, AccountTypeEnum AccountType, string Remark)
{ {
bool flag = false; bool flag = false;
var model = accountRepository.GetEmployeeInfo(Id); var model = accountRepository.GetEmployeeListRepository(new Employee_ViewModel()
{
AccountId = AccountId,
AccountTypeStr = ((int)AccountType).ToString()
})?.FirstOrDefault();
if (model != null && model.Id > 0) if (model != null && model.Id > 0)
{ {
#region 删除原来的数据
if (model.AccountType == AccountTypeEnum.Admin)
{
flag = managerRepository.Delete(model.AccountId) > 0;
}
else if (model.AccountType == AccountTypeEnum.Teacher)
{
flag = teacherRepository.Delete(model.AccountId) > 0;
}
else if (model.AccountType == AccountTypeEnum.Assist)
{
flag = assistRepository.Delete(model.AccountId) > 0;
}
#endregion
if (flag)
{
#region 添加新数据
var newId = 0;
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Account_ViewModel.AccountType),(int)targetAccountType }
};
if (targetAccountType == AccountTypeEnum.Admin) if (targetAccountType == AccountTypeEnum.Admin)
{ {
RB_Manager_ViewModel manager = new RB_Manager_ViewModel() RB_Manager_ViewModel manager = new RB_Manager_ViewModel()
...@@ -432,7 +471,7 @@ namespace Edu.Module.User ...@@ -432,7 +471,7 @@ namespace Edu.Module.User
CreateTime = DateTime.Now, CreateTime = DateTime.Now,
UpdateBy = model.UpdateBy, UpdateBy = model.UpdateBy,
UpdateTime = DateTime.Now, UpdateTime = DateTime.Now,
Status = model.Status, Status = DateStateEnum.Normal,
Dept_Id = model.Dept_Id, Dept_Id = model.Dept_Id,
Post_Id = model.Post_Id, Post_Id = model.Post_Id,
IDCard = model.IDCard, IDCard = model.IDCard,
...@@ -445,51 +484,58 @@ namespace Edu.Module.User ...@@ -445,51 +484,58 @@ namespace Edu.Module.User
Education = model.Education, Education = model.Education,
Email = model.Email Email = model.Email
}; };
newId = managerRepository.Insert(manager);
flag = newId > 0;
manager.MId = newId;
fileds.Add(nameof(RB_Account_ViewModel.AccountId), newId);
} }
else if (targetAccountType == AccountTypeEnum.Teacher) else if (targetAccountType == AccountTypeEnum.Teacher)
{ {
RB_Teacher_ViewModel teacher = new RB_Teacher_ViewModel() RB_Teacher_ViewModel teacher = new RB_Teacher_ViewModel()
{ {
TId=0, TId = 0,
School_Id=model.School_Id, School_Id = model.School_Id,
TeacherName=model.EmployeeName, TeacherName = model.EmployeeName,
TeacherTel=model.EmployeeTel, TeacherTel = model.EmployeeTel,
TeacherHead=model.UserIcon, TeacherHead = model.UserIcon,
TeacherIcon=model.UserIcon, TeacherIcon = model.UserIcon,
TeacherSay="", TeacherSay = "",
TeacherIntro="", TeacherIntro = "",
Status=model.Status, Status = model.Status,
AuditStatus= AccountStatusEnum.Pass, AuditStatus = AccountStatusEnum.Pass,
AuditRemark="", AuditRemark = "",
IsShow=1, IsShow = 1,
IsRecommend=0, IsRecommend = 0,
SortNum=1, SortNum = 1,
CreateBy=model.CreateBy, CreateBy = model.CreateBy,
CreateTime=DateTime.Now, CreateTime = DateTime.Now,
UpdateBy=model.UpdateBy, UpdateBy = model.UpdateBy,
UpdateTime=DateTime.Now, UpdateTime = DateTime.Now,
Group_Id=model.Group_Id, Group_Id = model.Group_Id,
TeachTag="", TeachTag = "",
Dept_Id=model.Dept_Id, Dept_Id = model.Dept_Id,
Post_Id=model.Post_Id, Post_Id = model.Post_Id,
IDCard=model.IDCard, IDCard = model.IDCard,
Sex=model.Sex, Sex = model.Sex,
EntryTime=model.EntryTime, EntryTime = model.EntryTime,
Address=model.Address, Address = model.Address,
BirthDate=model.BirthDate, BirthDate = model.BirthDate,
LeaveStatus=model.LeaveStatus, LeaveStatus = model.LeaveStatus,
LeaveTime=model.LeaveTime, LeaveTime = model.LeaveTime,
Education=model.Education, Education = model.Education,
BaseStuNum=13, BaseStuNum = 13,
Email=model.Email, Email = model.Email,
BaseHourFee=0, BaseHourFee = 0,
Nationality="", Nationality = "",
ForeignersUrl="", ForeignersUrl = "",
Specialty="1,2,3,4", Specialty = "1,2,3,4",
BaseHoursEnabled=1, BaseHoursEnabled = 1,
EnableTime=model.EnableTime, EnableTime = model.EnableTime,
}; };
newId = teacherRepository.Insert(teacher);
flag = newId > 0;
teacher.TId = newId;
fileds.Add(nameof(RB_Account_ViewModel.AccountId), newId);
} }
else if (targetAccountType == AccountTypeEnum.Assist) else if (targetAccountType == AccountTypeEnum.Assist)
{ {
...@@ -522,7 +568,30 @@ namespace Edu.Module.User ...@@ -522,7 +568,30 @@ namespace Edu.Module.User
Education = model.Education, Education = model.Education,
Email = model.Email Email = model.Email
}; };
newId = assistRepository.Insert(assist);
flag = newId > 0;
assist.AId = newId;
fileds.Add(nameof(RB_Account_ViewModel.AccountId), newId);
}
if (fileds != null && fileds.Count > 0 && flag)
{
//更新关联编号
flag = accountRepository.Update(fileds, new WhereHelper(nameof(RB_Account_ViewModel.Id), model.Id));
}
string logContent = Remark;
if (model.AccountType != targetAccountType)
{
logContent += string.Format(",将在由【{0}】修改为【{1}】。", model.AccountType.ToName(), targetAccountType.ToName());
}
if (!string.IsNullOrEmpty(logContent))
{
//新增日志
userChangeLogModule.SetUserChangeLogModule(model.CreateBy, model.Group_Id, model.School_Id, logContent, newId, targetAccountType);
}
#endregion
} }
} }
return flag; return flag;
......
...@@ -1555,10 +1555,12 @@ namespace Edu.WebApi.Controllers.User ...@@ -1555,10 +1555,12 @@ namespace Edu.WebApi.Controllers.User
/// <returns></returns> /// <returns></returns>
public ApiResult SetEmployeeType() public ApiResult SetEmployeeType()
{ {
var Id = base.ParmJObj.GetInt("Id"); var AccountId = base.ParmJObj.GetInt("AccountId");
var AccountType = (AccountTypeEnum)base.ParmJObj.GetInt("AccountType");
var Remark = base.ParmJObj.GetStringValue("Remark"); var Remark = base.ParmJObj.GetStringValue("Remark");
var targetAccountType = (AccountTypeEnum)base.ParmJObj.GetInt("TargetAccountType"); var targetAccountType = (AccountTypeEnum)base.ParmJObj.GetInt("TargetAccountType");
var flag = managerModule.SetEmployeeTypeModule(targetAccountType, Id,Remark); var flag = managerModule.SetEmployeeTypeModule(targetAccountType, AccountId, AccountType,Remark);
return flag ? ApiResult.Success() : ApiResult.Failed(); return flag ? ApiResult.Success() : ApiResult.Failed();
} }
#endregion #endregion
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment