コード例 #1
0
        public void Execute(AddActivityInfectionLineItemCommand command)
        {
            _log.InfoFormat("Execute AddActivityInfectionLineItemCommandHandler - 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))
                {
                    _log.InfoFormat("Cannot add line item. Document does not exist  Execute {1} - Command Id {0} ", command.CommandId, command.GetType());
                    return;
                }

                if (_context.tblActivityInfectionLineItem.Any(s => s.Id == command.LineItemId))
                {
                    _log.InfoFormat("Cannot add line item {0}. Line item already exists", command.CommandId);
                    return;
                }
                tblActivityInfectionLineItem doc = new tblActivityInfectionLineItem();
                doc.Id = command.LineItemId;
                doc.ActivityId = command.DocumentId;
                doc.InfectionId = command.InfectionId;
                doc.InfectionRate = command.Rate;

                doc.Description = command.Description;
                doc.IM_DateCreated = DateTime.Now;
                doc.IM_DateLastUpdated = DateTime.Now;
                doc.IM_Status = 1;
                _context.tblActivityInfectionLineItem.AddObject(doc);
                _context.SaveChanges();

            }
            catch (Exception ex)
            {
                _log.ErrorFormat("Error Execute {1} - Command Id {0} ", command.CommandId, command.GetType().ToString());
                _log.Error("AddActivityInfectionLineItemCommandHandler exception ", ex);
                throw;
            }

        }
コード例 #2
0
 /// <summary>
 /// Create a new tblActivityInfectionLineItem object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="infectionId">Initial value of the InfectionId property.</param>
 /// <param name="infectionRate">Initial value of the InfectionRate property.</param>
 /// <param name="activityId">Initial value of the ActivityId 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>
 public static tblActivityInfectionLineItem CreatetblActivityInfectionLineItem(global::System.Guid id, global::System.Guid infectionId, global::System.Decimal infectionRate, global::System.Guid activityId, global::System.DateTime iM_DateCreated, global::System.DateTime iM_DateLastUpdated, global::System.Int32 iM_Status)
 {
     tblActivityInfectionLineItem tblActivityInfectionLineItem = new tblActivityInfectionLineItem();
     tblActivityInfectionLineItem.Id = id;
     tblActivityInfectionLineItem.InfectionId = infectionId;
     tblActivityInfectionLineItem.InfectionRate = infectionRate;
     tblActivityInfectionLineItem.ActivityId = activityId;
     tblActivityInfectionLineItem.IM_DateCreated = iM_DateCreated;
     tblActivityInfectionLineItem.IM_DateLastUpdated = iM_DateLastUpdated;
     tblActivityInfectionLineItem.IM_Status = iM_Status;
     return tblActivityInfectionLineItem;
 }
コード例 #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the tblActivityInfectionLineItem EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTotblActivityInfectionLineItem(tblActivityInfectionLineItem tblActivityInfectionLineItem)
 {
     base.AddObject("tblActivityInfectionLineItem", tblActivityInfectionLineItem);
 }