protected override object ReadRow(IRowReader reader) { AssetWorkflow assetWorkflow = AssetWorkflow.New(); // Table Fields assetWorkflow.AssetWorkflowId = reader.GetInt32("AssetWorkflowId"); assetWorkflow.AssetId = reader.GetInt32("AssetId"); assetWorkflow.SubmittedByUserId = reader.GetInt32("SubmittedByUserId"); assetWorkflow.CreateDate = reader.GetDateTime("CreateDate"); assetWorkflow.IsComplete = reader.GetBoolean("IsComplete"); assetWorkflow.IsDirty = false; assetWorkflow.ChangedProperties.Clear(); return(assetWorkflow); }
public virtual AssetWorkflow Update(AssetWorkflow assetWorkflow) { if (!assetWorkflow.IsDirty || assetWorkflow.IsNull) { // Nothing to do - no point hammering the database unnecessarily return(assetWorkflow); } IDbCommand command = CreateCommand(); if (assetWorkflow.IsNew) { // Adding command.CommandText = "INSERT INTO [AssetWorkflow] ([AssetId], [SubmittedByUserId], [CreateDate], [IsComplete]) VALUES (@assetId, @submittedByUserId, @createDate, @isComplete) ; SELECT @@identity AS NewId;"; } else { // Updating command.CommandText = "UPDATE [AssetWorkflow] SET [AssetId] = @assetId, [SubmittedByUserId] = @submittedByUserId, [CreateDate] = @createDate, [IsComplete] = @isComplete WHERE AssetWorkflowId = @assetWorkflowId"; } command.Parameters.Add(CreateParameter("@assetId", assetWorkflow.AssetId)); command.Parameters.Add(CreateParameter("@submittedByUserId", assetWorkflow.SubmittedByUserId)); command.Parameters.Add(CreateParameter("@createDate", assetWorkflow.CreateDate)); command.Parameters.Add(CreateParameter("@isComplete", assetWorkflow.IsComplete)); if (assetWorkflow.IsNew) { assetWorkflow.AssetWorkflowId = Convert.ToInt32(ExecScalar(command)); } else { command.Parameters.Add(CreateParameter("@assetWorkflowId", assetWorkflow.AssetWorkflowId)); ExecuteCommand(command); } assetWorkflow.IsDirty = false; assetWorkflow.ChangedProperties.Clear(); return(assetWorkflow); }
public static AssetWorkflow FindOne(AssetWorkflowFinder finder) { AssetWorkflow AssetWorkflow = AssetWorkflowMapper.Instance.FindOne(finder); return(AssetWorkflow ?? Empty); }
public static AssetWorkflow Update(AssetWorkflow assetWorkflow) { return(AssetWorkflowMapper.Instance.Update(assetWorkflow)); }
public static AssetWorkflow Get(Nullable <Int32> AssetWorkflowId) { AssetWorkflow AssetWorkflow = AssetWorkflowMapper.Instance.Get(AssetWorkflowId); return(AssetWorkflow ?? Empty); }