public Enrolment AddEnrolment(Enrolment newEnrolment, EnrolmentType enrolmentType, string OrgDepCode, string userName, string mainId) { Enrolment rtEnrolment = null; try { newEnrolment.enrolment_number = _sysBillNoService.GetBillNo(enrolmentType.bill_number_id.Value, OrgDepCode); newEnrolment.enrolment_date = _sPGetSysDateTimeService.GetSysDateTime(); newEnrolment.EnrolmentType = enrolmentType; if (newEnrolment.status == (int)EnrolmentStatue.确认) { //如果确认状态,则可直接赋值confirmdate newEnrolment.confirm_date = newEnrolment.enrolment_date; } _unitOfWork.AddAction(newEnrolment, DataActions.Add); if (mainId != "") { //有标签发行 _rfidTagIssueService.AddRFIDTagIssueWithEnrolment(newEnrolment, mainId, userName); } if (newEnrolment.status != (int)EnrolmentStatue.新建) { //新建状态不创建计划 _planTaskService.AddPlanTaskWithEnrolment(newEnrolment, enrolmentType.PlanTaskType, OrgDepCode); } _unitOfWork.Save(); rtEnrolment = newEnrolment; } catch (DataMisalignedException ex) { throw ex; } catch (RepositoryException ex) { throw ex; } return(rtEnrolment); }
public void UpdEnrolmentType(EnrolmentType newEnrolmentType) { try { _unitOfWork.Actions.Clear(); if (newEnrolmentType.isdefault == true) { EnrolmentType oldDefaultEnrolmentType = _enrolmentTypeDal.Single(t => t.isdefault == true).Entity; if (oldDefaultEnrolmentType != null) { oldDefaultEnrolmentType.isdefault = false; _unitOfWork.AddAction(oldDefaultEnrolmentType, DataActions.Update); } } _unitOfWork.AddAction(newEnrolmentType, DataActions.Update); _unitOfWork.Save(); } catch (RepositoryException ex) { throw ex; } }