Exemplo n.º 1
0
        public void CreateWorkOrder(string requestorEmailAddress, DateTime dateTimeReceived, string subject, string workOrderDescription)
        {
            var appUserId = GetAppUserIdByEmail(requestorEmailAddress);
            var workOrder = new WorkOrder()
            {
                CreateDateTime   = dateTimeReceived,
                ModifiedDateTime = dateTimeReceived,
                StatusDateTime   = dateTimeReceived,
                RequestorId      = appUserId,
                LocationId       = appUserId == null ? null : GetLocationIdByAppUserId(appUserId),
                UnitId           = appUserId == null ? null : GetUnitIdByAppUserId(appUserId),
                StatusId         = 1,
                Subject          = subject
            };

            _context.WorkOrders.InsertOnSubmit(workOrder);
            _context.SubmitChanges();

            var workOrderComment = new WorkOrderComment()
            {
                CommentorId    = appUserId,
                CreateDateTime = dateTimeReceived,
                WorkOrderId    = workOrder.Id,
                Comment        = dateTimeReceived + "\n\r" + requestorEmailAddress + "\n\r" + workOrderDescription
            };

            _context.WorkOrderComments.InsertOnSubmit(workOrderComment);
            _context.SubmitChanges();

            SendEmail(workOrder, requestorEmailAddress, workOrderDescription);
        }
Exemplo n.º 2
0
 private void detach_WorkOrderComments(WorkOrderComment entity)
 {
     this.SendPropertyChanging();
     entity.AppUser = null;
 }
Exemplo n.º 3
0
 private void attach_WorkOrderComments(WorkOrderComment entity)
 {
     this.SendPropertyChanging();
     entity.WorkOrder = this;
 }
Exemplo n.º 4
0
 partial void DeleteWorkOrderComment(WorkOrderComment instance);
Exemplo n.º 5
0
 partial void UpdateWorkOrderComment(WorkOrderComment instance);
Exemplo n.º 6
0
 partial void InsertWorkOrderComment(WorkOrderComment instance);