private ContractWorkflow CreateWorkflow(WtPtWorkoffice oldWorkoffice, int newContractId) { try { var wf = new ContractWorkflow { ControlDate = GetNullableDate(oldWorkoffice.ControlDate), CurrentStageId = GetObjectId <DicRouteStage>(oldWorkoffice.ToStageId), CurrentUserId = GetUserId(oldWorkoffice.ToUserId), DateCreate = new DateTimeOffset(oldWorkoffice.DateCreate.GetValueOrDefault(DateTime.Now)), DateUpdate = new DateTimeOffset(oldWorkoffice.Stamp.GetValueOrDefault(DateTime.Now)), Description = oldWorkoffice.Description, ExternalId = oldWorkoffice.Id, FromStageId = GetObjectId <DicRouteStage>(oldWorkoffice.FromStageId), FromUserId = GetUserId(oldWorkoffice.FromUserId), IsComplete = GenerateHelper.StringToNullableBool(oldWorkoffice.IsComplete), IsMain = false, IsSystem = GenerateHelper.StringToNullableBool(oldWorkoffice.IsSystem), OwnerId = newContractId, RouteId = GetObjectId <DicRoute>(oldWorkoffice.TypeId), Timestamp = BitConverter.GetBytes(DateTime.Now.Ticks), }; return(wf); } catch (Exception) { return(null); } }
private bool GetCurentFlag(WtPtWorkoffice oldWorkoffice) { return(!GenerateHelper.StringToNullableBool(oldWorkoffice.IsComplete) ?? false); }