using Edu.Model.Entity.Course;
using Edu.Model.Entity.EduTask;
using Edu.Model.Entity.Sell;
using Edu.Model.ViewModel.EduTask;
using Edu.Model.ViewModel.Sell;
using Edu.Repository.Course;
using Edu.Repository.EduTask;
using Edu.Repository.Sell;
using System.Collections.Generic;
using System.Linq;
using VT.FW.AOP.CustomerAttribute;
using VT.FW.DB;
namespace Edu.Module.EduTask
{
///
/// 调课计划处理类
///
public class LeaveStudentModule
{
///
/// 教务单据仓储层对象
///
private readonly RB_Education_ReceiptRepository education_ReceiptRepository = new RB_Education_ReceiptRepository();
///
/// 请假计划仓储层对象
///
private readonly RB_Student_LeaveRepository RB_Student_LeaveRepository = new RB_Student_LeaveRepository();
///
/// 订单学员仓储层对象
///
private readonly RB_Order_GuestRepository order_GuestRepository = new RB_Order_GuestRepository();
///
/// 获取请假列表
///
///
///
public List GetStudentLeaveListRepository(RB_Student_Leave_ViewModel query)
{
return RB_Student_LeaveRepository.GetStudentLeaveListRepository(query);
}
///
/// 新增修改请假申请
///
///
[TransactionCallHandler]
public virtual bool SetStudentLeaveModule(RB_Student_Leave_ViewModel extModel, string receiptFile)
{
bool flag = false;
if (extModel.Id > 0)
{
Dictionary fileds = new Dictionary()
{
{nameof(RB_Student_Leave_ViewModel.OrderGuestId),extModel.OrderGuestId },
{nameof(RB_Student_Leave_ViewModel.ClassId),extModel.ClassId },
{nameof(RB_Student_Leave_ViewModel.CourseId),extModel.CourseId },
{nameof(RB_Student_Leave_ViewModel.LeaveInfo),extModel.LeaveInfo },
{nameof(RB_Student_Leave_ViewModel.UpdateBy),extModel.UpdateBy },
{nameof(RB_Student_Leave_ViewModel.UpdateTime),extModel.UpdateTime },
};
flag = RB_Student_LeaveRepository.Update(fileds, new WhereHelper(nameof(RB_Student_Leave_ViewModel.Id), extModel.Id));
}
else
{
var newId = RB_Student_LeaveRepository.Insert(extModel);
extModel.Id = newId;
flag = newId > 0;
if (flag)
{
var educationReceipt = new RB_Education_Receipt()
{
Id = 0,
Title = "学生请假申请",
ReceiptType = Common.Enum.Finance.ReceiptTypeEnum.LeaveClass,
RelationId = newId,
ClassId = extModel.ClassId,
Group_Id = extModel.Group_Id,
School_Id = extModel.School_Id,
CreateBy = extModel.CreateBy,
CreateTime = extModel.CreateTime,
UpdateBy = extModel.UpdateBy,
UpdateTime = extModel.UpdateTime,
VerifyStatus = Common.Enum.EduTask.EduTaskRrocessStatus.NotAudit,
ReceiptFile = receiptFile
};
flag = education_ReceiptRepository.SetEducationReceiptRepository(educationReceipt, out string message);
}
}
return flag;
}
public bool UpdateChangeClassPlan(int id)
{
return RB_Student_LeaveRepository.UpdateStundetLeave(id,1);
}
}
}