protected override void TakeFormAction() { if (CurrentActivity().CurrAction.FormDataProcessing.IsSaveRequestData) { if (WorkflowInstance.Requisition != null) { Requisition Requisition = WorkflowInstance.Requisition; bool isUpdate = false; if (RequestHeader.Id > 0) { var currentRequisition = _requisitionRepository.GetByRequestHeader(RequestHeader.Id); if (currentRequisition != null) { string referenceNo = GetReferenceNo(); if (!string.IsNullOrEmpty(referenceNo)) { currentRequisition.ReferenceNo = referenceNo; WorkflowInstance.Message = string.Format("Reference number is {0}.", referenceNo); } currentRequisition.Position = Requisition.Position; currentRequisition.ReportingTo = Requisition.ReportingTo; currentRequisition.SalaryRange = Requisition.SalaryRange; currentRequisition.RequestTypeId = Requisition.RequestTypeId; currentRequisition.ShiftTypeId = Requisition.ShiftTypeId; currentRequisition.LocationTypeId = Requisition.LocationTypeId; currentRequisition.Private = Requisition.Private; currentRequisition.RequisitionNumber = Requisition.RequisitionNumber; currentRequisition.Justification = Requisition.Justification; _requisitionRepository.Update(currentRequisition); Requisition.RequestHeaderId = RequestHeader.Id; isUpdate = true; } } if (!isUpdate) { WorkflowInstance.Requisition.RequestHeader = RequestHeader; _requisitionRepository.Add(Requisition); } } else { throw new Exception("Requisition ERF have no instance"); } } }
public void Save(Requisition requisition) { Requisition r = requisitionContext.Get(requisition.Id); if (r == null) { requisitionContext.Add(requisition); } else { r.Remark = requisition.Remark; r.Status = requisition.Status; } requisitionContext.Commit(); }
public bool Add(Requisition model) { return(requisitionRepository.Add(model)); }