public void Execute(CreateActivityNoteCommand command)
        {
            _log.InfoFormat("Execute CreateActivityCommandHandler - Command Id {0} ", command.CommandId);
            _log.InfoFormat("Execute {1} - Command Id {0} ", command.CommandId, command.GetType().ToString());
            try
            {
                if (_context.tblActivityDocument.Any(s=>s.Id==command.DocumentId))
                    return;
                tblActivityDocument doc = new tblActivityDocument();
                doc.Id = command.DocumentId;
                doc.ActivityDate = command.ActivityDate;
                doc.ActivityReference = command.DocumentReference;
                doc.ActivityTypeId = command.ActivityTypeId;
                doc.CentreId = command.CentreId;
                doc.RouteId = command.RouteId;
                doc.ClerkId = command.DocumentIssuerCostCentreId;
                doc.CommoditySupplierId = command.CommoditySupplierId;
                doc.Description = command.Description;
                doc.IM_DateCreated = DateTime.Now;
                doc.IM_DateLastUpdated = DateTime.Now;
                doc.IM_Status =0;
                doc.SeasonId = command.SeasonId;
                doc.hubId = command.HubId;
                doc.ActivityReference = command.DocumentReference;
                doc.CommodityProducerId = command.CommodityProducerId;
                
                
                _context.tblActivityDocument.AddObject(doc);
                _context.SaveChanges();

            }
            catch (Exception ex)
            {
                _log.ErrorFormat("Error Execute {1} - Command Id {0} ", command.CommandId, command.GetType().ToString());
                _log.Error("CreateCommodityPurchaseCommandHandler exception ", ex);
                throw;
            }
            
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Create a new tblActivityDocument object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="activityTypeId">Initial value of the ActivityTypeId property.</param>
 /// <param name="activityDate">Initial value of the ActivityDate property.</param>
 /// <param name="seasonId">Initial value of the SeasonId property.</param>
 /// <param name="clerkId">Initial value of the ClerkId property.</param>
 /// <param name="hubId">Initial value of the hubId property.</param>
 /// <param name="routeId">Initial value of the RouteId property.</param>
 /// <param name="centreId">Initial value of the CentreId property.</param>
 /// <param name="commoditySupplierId">Initial value of the CommoditySupplierId property.</param>
 /// <param name="iM_DateCreated">Initial value of the IM_DateCreated property.</param>
 /// <param name="iM_DateLastUpdated">Initial value of the IM_DateLastUpdated property.</param>
 /// <param name="iM_Status">Initial value of the IM_Status property.</param>
 /// <param name="commodityProducerId">Initial value of the CommodityProducerId property.</param>
 public static tblActivityDocument CreatetblActivityDocument(global::System.Guid id, global::System.Guid activityTypeId, global::System.DateTime activityDate, global::System.Guid seasonId, global::System.Guid clerkId, global::System.Guid hubId, global::System.Guid routeId, global::System.Guid centreId, global::System.Guid commoditySupplierId, global::System.DateTime iM_DateCreated, global::System.DateTime iM_DateLastUpdated, global::System.Int32 iM_Status, global::System.Guid commodityProducerId)
 {
     tblActivityDocument tblActivityDocument = new tblActivityDocument();
     tblActivityDocument.Id = id;
     tblActivityDocument.ActivityTypeId = activityTypeId;
     tblActivityDocument.ActivityDate = activityDate;
     tblActivityDocument.SeasonId = seasonId;
     tblActivityDocument.ClerkId = clerkId;
     tblActivityDocument.hubId = hubId;
     tblActivityDocument.RouteId = routeId;
     tblActivityDocument.CentreId = centreId;
     tblActivityDocument.CommoditySupplierId = commoditySupplierId;
     tblActivityDocument.IM_DateCreated = iM_DateCreated;
     tblActivityDocument.IM_DateLastUpdated = iM_DateLastUpdated;
     tblActivityDocument.IM_Status = iM_Status;
     tblActivityDocument.CommodityProducerId = commodityProducerId;
     return tblActivityDocument;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the tblActivityDocument EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTotblActivityDocument(tblActivityDocument tblActivityDocument)
 {
     base.AddObject("tblActivityDocument", tblActivityDocument);
 }