Beispiel #1
0
 public ActionResult AssignPhysicianToCustomer(PhysicianCustomerAssignmentEditModel model)
 {
     if (ModelState.IsValid)
     {
         try
         {
             var physicianCustomerAssignment =
                 Mapper.Map <PhysicianCustomerAssignmentEditModel, PhysicianCustomerAssignment>(model);
             physicianCustomerAssignment.DataRecorderMetaData = new DataRecorderMetaData
             {
                 DataRecorderCreator = Mapper.Map <OrganizationRoleUserModel, OrganizationRoleUser>(
                     _sessionContext.UserSession.CurrentOrganizationRole),
                 DateCreated = DateTime.Now
             };
             _physicianCustomerAssignmentRepository.Save(physicianCustomerAssignment);
             model.FeedbackMessage    = FeedbackMessageModel.CreateSuccessMessage("Physicians assigned successfully");
             model.AssignedPhysicians = _physicianAssignmentService.GetPhysiciansAssignedToCustomer(model.EventCustomerId);
         }
         catch (Exception exception)
         {
             model.FeedbackMessage = FeedbackMessageModel.CreateFailureMessage("System Error:" + exception.Message);
             return(View(model));
         }
     }
     return(View(model));
 }
Beispiel #2
0
        public ActionResult AssignPhysicianToCustomer(long eventCustomerId)
        {
            var model = new PhysicianCustomerAssignmentEditModel {
                EventCustomerId = eventCustomerId
            };

            model.AssignedPhysicians = _physicianAssignmentService.GetPhysiciansAssignedToCustomer(eventCustomerId);
            if (model.AssignedPhysicians != null)
            {
                foreach (var assignedPhysician in model.AssignedPhysicians)
                {
                    if (assignedPhysician.IsOverReadPhysician)
                    {
                        model.OverReadPhysicianId = assignedPhysician.PhysicianId;
                    }
                    else
                    {
                        model.PhysicianId = assignedPhysician.PhysicianId;
                    }
                }
            }
            return(View(model));
        }