public BaseResponse SaveAllocateTask(long ID, IList <DC_TaskEmpModel> empList) { BaseResponse response = new BaseResponse(); DC_TASKREMIND tr = unitOfWork.GetRepository <DC_TASKREMIND>().dbSet.Where(x => x.ID == ID && x.ORGID == SecurityHelper.CurrentPrincipal.OrgId).FirstOrDefault(); List <DC_TASKREMIND> newTaskList = new List <DC_TASKREMIND>(); foreach (DC_TaskEmpModel t in empList) { Mapper.CreateMap <DC_TASKREMIND, DC_TaskRemind>(); DC_TASKREMIND task = new DC_TASKREMIND(); DC_TaskRemind taskMap = Mapper.Map <DC_TaskRemind>(tr); taskMap.ID = 0; taskMap.AssignedBy = SecurityHelper.CurrentPrincipal.EmpNo; taskMap.AssignedName = SecurityHelper.CurrentPrincipal.EmpName; taskMap.Assignee = t.EmpNo; taskMap.AssignName = t.EmpName; taskMap.NewRecFlag = true; Mapper.CreateMap <DC_TaskRemind, DC_TASKREMIND>(); task = Mapper.Map <DC_TASKREMIND>(taskMap); newTaskList.Add(task); } unitOfWork.GetRepository <DC_TASKREMIND>().InsertRange(newTaskList); unitOfWork.GetRepository <DC_TASKREMIND>().Delete(tr); unitOfWork.Commit(); return(response); }
public BaseResponse ChangeRecStatus(int id, bool?recStatus, DateTime?finishDate) { BaseResponse response = new BaseResponse(); DC_TASKREMIND tr = unitOfWork.GetRepository <DC_TASKREMIND>().dbSet.Where(x => x.ID == id && x.ORGID == SecurityHelper.CurrentPrincipal.OrgId).FirstOrDefault(); tr.RECSTATUS = recStatus; tr.FINISHDATE = finishDate; unitOfWork.GetRepository <DC_TASKREMIND>().Update(tr); unitOfWork.Commit(); return(response); }
public BaseResponse SaveAssignWorkNote(DC_ReAllocateTaskModel list) { BaseResponse response = new BaseResponse(); List <DC_TASKREMIND> newTaskList = new List <DC_TASKREMIND>(); DateTime now = DateTime.Now; foreach (DC_TaskEmpModel t in list.empList) { DC_TASKREMIND task = new DC_TASKREMIND(); task.ASSIGNEDBY = SecurityHelper.CurrentPrincipal.EmpNo; task.ASSIGNEDNAME = SecurityHelper.CurrentPrincipal.EmpName; task.ORGID = SecurityHelper.CurrentPrincipal.OrgId; task.ASSIGNEE = t.EmpNo; task.ASSIGNNAME = t.EmpName; task.NEWRECFLAG = true; task.CONTENT = list.Content; task.PERFORMDATE = list.PerformDate; task.ASSIGNDATE = now; newTaskList.Add(task); } unitOfWork.GetRepository <DC_TASKREMIND>().InsertRange(newTaskList); unitOfWork.Commit(); return(response); }