protected void CreateInterviewer(ITracingService tracer, IOrganizationService service, int dxc_businessarea, int dxc_interviewertype, Guid candidateID) { try { BL_Systemuser bL_Systemuser = new BL_Systemuser(); EntityCollection ec_Systemuser = bL_Systemuser.GetSystemusersViaBusinessArea(tracer, service, dxc_businessarea, dxc_interviewertype); foreach (Entity e in ec_Systemuser.Entities) { tracer.Trace("Entity e in ec_Systemuser.Entities started!!! "); Guid systemUserId = e.GetAttributeValue <Guid>(systemuserid); string firstName = e.GetAttributeValue <string>(firstname).ToString(); string interviewerFullname = e.GetAttributeValue <string>(fullname).ToString(); tracer.Trace("systemuser.SystemUserId = " + systemUserId.ToString()); /// Add the interviewer to the candidate interviewer.CreateInterviewer(tracer, service, interviewerFullname, dxc_interviewertype, systemUserId, candidateID); tracer.Trace(help.SuccessfulTraceMsg("added " + interviewerFullname + "as an interviewer. ")); } } catch (Exception e) { tracer.Trace(e.Message); tracer.Trace(help.UnsuccessfulTraceMsg("CreateInterviewer")); throw new InvalidPluginExecutionException(e.Message); } finally { tracer.Trace(help.SuccessfulTraceMsg("CreateInterviewer")); } }
protected void CreateAssessmentViaAllAssmntMgr(ITracingService tracer, IOrganizationService service, Guid assessmentID, Guid systemuserid) { BL_Systemuser bl_systemuser = new BL_Systemuser(); BL_AssessmentManager assessment_Manager = new BL_AssessmentManager(); // Get the user's Business Area of a user. EntityCollection systemusers = bl_systemuser.GetAssesmentUser(tracer, service, systemuserid); EntityCollection assessmentManager = new EntityCollection(); // Check if the user is existing. if (systemusers.Entities.Count > 0) { // Get Business Area. EntityReference businessArea = new EntityReference(); tracer.Trace("here 1"); foreach (Entity en in systemusers.Entities) { tracer.Trace("here 2"); // Check if Empty if (en.GetAttributeValue <EntityReference>(dxc_businessareas) != null) { tracer.Trace("here 3"); businessArea = (EntityReference)en.Attributes[dxc_businessareas]; tracer.Trace("businessArea.Id = " + businessArea.Id); } // If there's no Business Area for the user, then create an assessment without a business area criteria. else { assessmentManager = assessment_Manager.GetAllAssessmentManagers(tracer, service); CheckToCreateAssessment(tracer, service, assessmentManager, assessmentID); } } if (businessArea != null) { assessmentManager = assessment_Manager.GetAssessmentManagersViaBusArea(tracer, service, businessArea.Id); CheckToCreateAssessment(tracer, service, assessmentManager, assessmentID); } } // If there's no user, then create an assessment without a business area criteria. else { assessmentManager = assessment_Manager.GetAllAssessmentManagers(tracer, service); CheckToCreateAssessment(tracer, service, assessmentManager, assessmentID); } }