public List <AssignedUser> getAcceptedAssignments(int id)
        {
            List <AssignedUser> assignedUsersList = new List <AssignedUser>();
            string queryString = "SELECT * FROM AssignedUser WHERE UserID = @id AND Accepted = 1";

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                SqlCommand command = new SqlCommand(queryString, connection);
                command.Connection.Open();
                command.Parameters.AddWithValue("@id", id);
                SqlDataReader reader = command.ExecuteReader();
                try
                {
                    while (reader.Read())
                    {
                        AssignedUser assignedUsers = new AssignedUser();
                        assignedUsers.ID       = reader.GetInt32(0);
                        assignedUsers.TaskID   = reader.GetInt32(1);
                        assignedUsers.UserID   = reader.GetInt32(2);
                        assignedUsers.Accepted = reader.GetBoolean(3);
                        assignedUsersList.Add(assignedUsers);
                    }
                }
                finally
                {
                    reader.Close();
                }
            }
            return(assignedUsersList);
        }
        public AssignedUser GetMatch(int task, int user)
        {
            AssignedUser assignedUser = new AssignedUser();
            string       queryString  = "SELECT * FROM AssignedUser WHERE TaskID = @TASK AND UserID = @USER";

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                SqlCommand command = new SqlCommand(queryString, connection);
                connection.Open();

                command.Parameters.AddWithValue("@TASK", task);
                command.Parameters.AddWithValue("@USER", user);

                SqlDataReader reader = command.ExecuteReader();
                try
                {
                    while (reader.Read())
                    {
                        assignedUser.ID       = reader.GetInt32(0);
                        assignedUser.TaskID   = reader.GetInt32(1);
                        assignedUser.UserID   = reader.GetInt32(2);
                        assignedUser.Accepted = reader.GetBoolean(3);
                    }
                }
                finally
                {
                    reader.Close();
                }

                return(assignedUser);
            }
        }
        public AssignedUser GetAssignedUsersFromId(int id)
        {
            AssignedUser AssignedUsers = new AssignedUser();

            string queryString = "SELECT * FROM AssignedUser WHERE ID = @ID";

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                SqlCommand command = new SqlCommand(queryString, connection);
                command.Connection.Open();

                command.Parameters.AddWithValue("@ID", id);

                SqlDataReader reader = command.ExecuteReader();
                try
                {
                    while (reader.Read())
                    {
                        AssignedUsers.ID       = reader.GetInt32(0);
                        AssignedUsers.TaskID   = reader.GetInt32(1);
                        AssignedUsers.UserID   = reader.GetInt32(2);
                        AssignedUsers.Accepted = reader.GetBoolean(3);
                    }
                }
                finally
                {
                    reader.Close();
                }
            }

            return(AssignedUsers);
        }
예제 #4
0
        public async Task <TaskUnitDTO> SaveTaskUnitAsync(TaskUnitDTO taskUnitDto)
        {
            TaskUnit taskUnit = _mapper.Map <TaskUnitDTO, TaskUnit>(taskUnitDto);

            TaskUnitDTO taskUnitD = _mapper.Map <TaskUnit, TaskUnitDTO>(await _taskUnitRepository.SaveTaskUnitAsync(taskUnit));

            var assignedUsers = taskUnitDto.AssignedUsers;

            if (assignedUsers != null)
            {
                for (int i = 0; i < assignedUsers.Count(); i++)
                {
                    int          assignedUserId = Int32.Parse(assignedUsers.ElementAt(i));
                    AssignedUser assignedUser   = await _assignedUserService.GetAssignedUserByIdAsync(assignedUserId);

                    AssignedUserTaskUnit assignedUserTaskUnit = new AssignedUserTaskUnit
                    {
                        AssignedUser = assignedUser,
                        TaskUnit     = taskUnit
                    };
                    await _assignedUserTaskUnitService.AddAssignedUserTaskUnit(assignedUserTaskUnit);
                }
            }
            return(taskUnitDto);
        }
예제 #5
0
        public async Task EditTaskUnitAsync(TaskUnitDTO editTaskUnit)
        {
            TaskUnit taskUnit = _mapper.Map <TaskUnitDTO, TaskUnit>(editTaskUnit);
            await _assignedUserTaskUnitService.DeleteAllAssignedUsersForTaskUnit(taskUnit.TaskUnitId);

            TaskUnit taskUnitInDb = await _taskUnitRepository.GetTaskUnitByIdAsync(taskUnit.TaskUnitId);

            var assignedUsers = editTaskUnit.AssignedUsers;

            if (assignedUsers != null)
            {
                for (int i = 0; i < assignedUsers.Count(); i++)
                {
                    int          assignedUserId = Int32.Parse(assignedUsers.ElementAt(i));
                    AssignedUser assignedUser   = await _assignedUserService.GetAssignedUserByIdAsync(assignedUserId);

                    AssignedUserTaskUnit assignedUserTaskUnit = new AssignedUserTaskUnit
                    {
                        AssignedUserId = assignedUser.AssignedUserId,
                        TaskUnitId     = taskUnitInDb.TaskUnitId
                    };
                    await _assignedUserTaskUnitService.AddAssignedUserTaskUnit(assignedUserTaskUnit);
                }
            }

            await _taskUnitRepository.EditTaskUnitAsync(taskUnit);
        }
예제 #6
0
        public async Task <IActionResult> GetAssignedUserById(int id)
        {
            AssignedUser assignedUserInDb = await _assignedUserService.GetAssignedUserByIdAsync(id);

            if (assignedUserInDb == null)
            {
                return(NotFound());
            }
            return(Ok(await _assignedUserService.GetAssignedUserByIdAsync(id)));
        }
예제 #7
0
        public async Task <IActionResult> EditAssignedUser(AssignedUser assignedUser)
        {
            AssignedUser assignedUserInDb = await _assignedUserService.GetAssignedUserByIdAsync(assignedUser.AssignedUserId);

            if (assignedUserInDb == null)
            {
                return(NotFound());
            }
            await _assignedUserService.EditAssignedUserAsync(assignedUserInDb, assignedUser);

            return(Ok());
        }
예제 #8
0
        public async Task <IActionResult> DeleteAssignedUser(int id)
        {
            AssignedUser assignedUserInDb = await _assignedUserService.GetAssignedUserByIdAsync(id);

            if (assignedUserInDb == null)
            {
                return(NotFound());
            }
            await _assignedUserService.DeleteAssignedUserAsync(assignedUserInDb);

            return(Ok());
        }
예제 #9
0
 private static void CreateQuizEntityAssignList(QuizDTO quizDTO, Quiz quiz, Data.Entities.AssignType type, IEnumerable <ApplicationUserDTO> listOfusersDTO)
 {
     foreach (var user in listOfusersDTO)
     {
         var ass = new AssignedUser()
         {
             ApplicationUserId = user.Id,
             AssignType        = type,
             QuizId            = quizDTO.Id
         };
         quiz.AssignedUsers.Add(ass);
     }
 }
예제 #10
0
        public static void SendSingleTaskEmailForUser(AssignedUser user, UserTaskEmail tasks, int siteId, int userId, int templateId, int actionTypeId)
        {
            var lstTasks = new List <UserTaskEmail>();

            try
            {
                lstTasks.Add(tasks);
                SendMultipleTaskEmailForUser(user, lstTasks, siteId, userId, templateId, actionTypeId);
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #11
0
        public bool createAssignedUsers(AssignedUser item)
        {
            string queryString = "INSERT INTO AssignedUser (TaskID, UserID, Accepted) VALUES (@TaskID, @UserID, @Accepted)";

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                SqlCommand command = new SqlCommand(queryString, connection);

                command.Parameters.AddWithValue("@TaskID", item.TaskID);
                command.Parameters.AddWithValue("@UserID", item.UserID);
                command.Parameters.AddWithValue("@Accepted", item.Accepted);
                connection.Open();

                command.ExecuteNonQuery();
                connection.Close();
                return(true);
            }
        }
예제 #12
0
        protected override async Task Save()
        {
            try
            {
                var labels    = AssignedLabels.With(x => x.Select(y => y.Name).ToArray());
                var milestone = AssignedMilestone.With(x => (int?)x.Number);
                var user      = AssignedUser.With(x => x.Login);
                var request   = _applicationService.Client.Users[RepositoryOwner].Repositories[RepositoryName].Issues
                                .Create(Subject, Content, user, milestone, labels);
                var data = await _applicationService.Client.ExecuteAsync(request);

                _createdIssueSubject.OnNext(data.Data);
            }
            catch (Exception e)
            {
                throw new Exception("Unable to save new issue! Please try again.", e);
            }
        }
예제 #13
0
        public bool UpdateAssignedUsers(AssignedUser item, int id)
        {
            string queryString = "UPDATE AssignedUser SET TaskID = @TaskID, UserID = @UserID, Accepted = @Accepted WHERE ID = @ID";

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                SqlCommand command = new SqlCommand(queryString, connection);
                command.Parameters.AddWithValue("@ID", id);
                command.Parameters.AddWithValue("@TaskID", item.TaskID);
                command.Parameters.AddWithValue("@UserID", item.UserID);
                command.Parameters.AddWithValue("@Accepted", item.Accepted);

                connection.Open();

                command.ExecuteNonQuery();
                connection.Close();
                return(true);
            }
        }
예제 #14
0
        public static void SendMultipleTaskEmailForUser(AssignedUser user, List <UserTaskEmail> lstTasks, int siteId, int userId, int templateId, int actionTypeId)
        {
            try
            {
                //Sending email to Assignee
                var emailRecipient = new CCMService.EmailRecipient {
                    EmailAddress = user.EmailAddress, FullName = user.FullName
                };

                SendMultipleTaskEmailThroughCCM(emailRecipient, lstTasks, siteId, userId, templateId, actionTypeId);
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                lstTasks = null;
            }
        }
예제 #15
0
        public void InitializeBase(IWebDriver objDriver)
        {
            //LoginPage = new MdnHomePage(driver);
            //LoginPage1 = new MdnLoginPage1(driver);
            //HomePage = new MdnHomePage(driver);
            //CommonPage = new MdnCommonPage(driver);

            #region initialize old
            driver                = objDriver;
            CheckOutobj           = new CheckOut(driver);
            takeScreenhsot        = new ScreenShot(driver);
            approvalrequest       = new Approvalrequestobject(driver);
            instructors           = new Instructor(driver);
            approvalrequest       = new Approvalrequestobject(driver);
            DomainConsoleobj      = new DomainConsole(driver);
            ManageGradebookobj    = new ManageGradebook();
            Instructorsobj        = new Instructorspof();
            MyResponsibilitiesobj = new My_Responsibilities(driver);
            manageuserobj         = new ManageUsers(driver);
            objTrainingHome       = new TrainingHomes(driver);
            objCurriculum         = new CreateCurriculum(driver);
            classroomcourse       = new ClassroomCourse(driver);
            ContentSearchobj      = new ContentSearch(driver);
            objCreate             = new Create(driver);
            detailspage           = new Details(driver);


            TrainingHomeobj         = new TrainingHomes(driver);
            AdminstrationConsoleobj = new AdminstrationConsole(driver);
            Testsobj             = new Tests(driver);
            Detailsobj           = new Details(driver);
            EditSummaryobj       = new EditSummary(driver);
            Scorm1_2obj          = new Scorm1_2(driver);
            EditQuestionobj      = new EditQuestion(driver);
            EditQuestionGroupobj = new EditQuestionGroup(driver);

            AddUsrObj = new AddUsers(driver);

            generalcourseobj           = new GeneralCourse(driver);
            myteachingscheduleobj      = new MyTeachingSchedule();
            professionaldevelopmentobj = new ProfessionalDevelopments(driver);
            documentobj                = new Document(driver);
            CreateNewAccountobj        = new CreateNewAccount(driver);
            ManageUsersobj             = new ManageUsers(driver);
            Createobj                  = new Create(driver);
            summaryobj                 = new Summary(driver);
            reauiredtrainingconsoleobj = new RequiredTrainingConsoles(driver);
            requiredtrainingobj        = new RequiredTraining(driver);
            Trainingobj                = new Training(driver);
            Loginobj      = new Login(driver);
            Contentobj    = new Content(driver);
            Creditsobj    = new Credits(driver);
            AddContentobj = new AddContent(driver);
            Summaryobj    = new Summary(driver);
            ScheduleAndManageSectionobj = new ScheduleAndManageSection(driver);
            SearchResultsobj            = new SearchResults(driver);
            CourseSectionobj            = new CreateNewCourseSectionAndEventPage(driver);
            Transcriptsobj              = new Transcripts(driver);
            Productsobj                 = new Products(driver);
            BrowseTrainingCatalogobj    = new BrowseTrainingCatalog(driver);
            ShoppingCartsobj            = new ShoppingCarts(driver);
            ProfessionalDevelopmentsobj = new ProfessionalDevelopments(driver);
            Createnewproficencyscaleobj = new Createnewproficencyscale(driver);
            Createnewcompetencyobj      = new Createnewcompetency(driver);
            CreateNewSucessProfileobj   = new CreateNewSucessProfile(driver);
            SucessProfileobj            = new SucessProfile(driver);
            Searchobj             = new Search(driver);
            TrainingActivitiesobj = new TrainingActivities(driver);
            ProfessionalDevelopments_learnerobj = new ProfessionalDevelopments_learner(driver);
            Organizationobj             = new Organization(driver);
            DevelopmentPlansobj         = new DevelopmentPlans(driver);
            AddDevelopmentActivitiesobj = new AddDevelopmentActivities(driver);
            MyAccountobj            = new MyAccount(driver);
            UsersUtilobj            = new UsersUtil(driver);
            MyCalendersobj          = new MyCalenders(driver);
            MyReportsobj            = new MyReports(driver);
            Config_Reportsobj       = new Config_Reports(driver);
            ConfigurationConsoleobj = new ConfigurationConsole(driver);
            ApprovalPathobj         = new ApprovalPath(driver);
            MyMessageobj            = new MyMessages(driver);
            MessageUtilobj          = new MessageUtil(driver);
            MyRequestsobj           = new MyRequests(driver);
            Blogsobj = new Blogs(driver);
            CollabarationSpacesobj = new CollabarationSpaces(driver);
            Faqsobj                     = new Faqs(driver);
            HomePageFeedobj             = new HomePageFeed(driver);
            ProductTypesobj             = new ProductTypes(driver);
            Surveysobj                  = new Surveys(driver);
            SurveyScalesobj             = new SurveyScales(driver);
            AuditingConsolesobj         = new AuditingConsoles(driver);
            Categoryobj                 = new Category(driver);
            Trainingsobj                = new Trainings(driver);
            VirtualMeetingsobj          = new VirtualMeetings(driver);
            CreditTypeobj               = new CreditType(driver);
            AssignedUserobj             = new AssignedUser(driver);
            AddUsersobj                 = new AddUsers(driver);
            CustomFieldobj              = new CustomField(driver);
            CreateNewCustomFieldobj     = new CreateNewCustomField(driver);
            EditFieldobj                = new EditField(driver);
            EducationLevelobj           = new EducationLevel(driver);
            EditOrganizationobj         = new EditOrganization(driver);
            SelectManagerobj            = new SelectManager(driver);
            Roleobj                     = new Role(driver);
            SelectTrainingPOCobj        = new SelectTrainingPOC(driver);
            Complexobj                  = new Complex(driver);
            AccountCodesobj             = new AccountCodes(driver);
            AccountCodeTypesobj         = new AccountCodeTypes(driver);
            DiscountCodesobj            = new DiscountCodes(driver);
            ManageTaxRatesobj           = new ManageTaxRates(driver);
            TaxItemCategoriesobj        = new TaxItemCategories(driver);
            Certificatesobj             = new Certificates(driver);
            CourseProvidersobj          = new CourseProviders(driver);
            ExternalLearningsobj        = new ExternalLearnings(driver);
            ExternalLearningConsolesobj = new ExternalLearningConsoles(driver);
            ExternalLearningtypesobj    = new ExternalLearningtypes(driver);
            RequiredTrainingConsolesobj = new RequiredTrainingConsoles(driver);
            SelectProfileobj            = new SelectProfile(driver);
            TrainingProfilesobj         = new TrainingProfiles(driver);
            EditTrainingProfileobj      = new EditTrainingProfile(driver);
            MergeUsersobj               = new MergeUsers(driver);
            UserGroupobj                = new UserGroup(driver);
            SelectCertificateobj        = new SelectCertificate(driver);
            ManageProficencyScaleobj    = new ManageProficencyScale(driver);
            ArchivedProficencyScaleobj  = new ArchivedProficencyScale(driver);
            MappedContentobj            = new MappedContent(driver);
            MappedCompetencyobj         = new MappedCompetency(driver);
            ManageSuccessProfileobj     = new ManageSuccessProfile(driver);
            FAQ_lobj                    = new FAQ_l(driver);
            Announcements_lobj          = new Announcements_l(driver);
            JobTitlesobj                = new JobTitles(driver);
            ManageJobTitleobj           = new ManageJobTitle(driver);
            ManagePricingScheduleobj    = new ManagePricingSchedule(driver);
            ExternalLearningSearchobj   = new ExternalLearningSearch(driver);
            urlobj              = new url(driver);
            skinobj             = new skin(driver);
            MyOwnLearningobj    = new MyOwnLearningUtils(driver);
            CurrentTrainingsobj = new CurrentTrainings(driver);
            scormobj            = new Scorm12(driver);
            aicccourse          = new AICC(driver);
            ojtcourse           = new OJT(driver);
            TrainingCatalogobj  = new TrainingCatalogUtil(driver);
            accesskeys          = new AccessKeys(driver);
            #endregion
        }
예제 #16
0
        public static void SendTaskEmailAfterSave(List <UserTaskEmail> lstTasks, List <UserTaskEmail> lstTaskPreviousData, int siteId, int userId, List <AssignedUser> ccUsers, string observationTitle = "", bool ResendEmail = false)
        {
            var lstCCUserTaskEmail = new List <CCUserTaskEmail>();

            foreach (var task in lstTasks)
            {
                var           lstEmailRecipients = new List <CCMService.EmailRecipient>();
                UserTaskEmail previousTaskData   = null;

                try
                {
                    int templateId   = 0;
                    int actionTypeId = 0;

                    if (lstTaskPreviousData != null)
                    {
                        previousTaskData = lstTaskPreviousData.FirstOrDefault(a => a.TaskID == task.TaskID);
                    }


                    switch ((Enums.TaskStatus)task.TaskStatus)
                    {
                    case Enums.TaskStatus.Open:

                        if ((TaskType)task.TaskTypeID == TaskType.TracerObservation)
                        {
                            task.ItemAssociated += !string.IsNullOrEmpty(observationTitle) ? " - " + observationTitle : observationTitle;
                        }

                        if (previousTaskData == null)                                 //New Task
                        {
                            templateId   = (int)Enums.TaskEmailTemplateID.NewTask;
                            actionTypeId = (int)Enums.ActionTypeEnum.TaskNew;

                            lstEmailRecipients.Clear();

                            //Sending email to Assignee
                            lstEmailRecipients.Add(new CCMService.EmailRecipient {
                                EmailAddress = task.AssignedToEmail, FullName = task.AssignedToFullName
                            });

                            SendTaskEmailThroughCCM(task, lstEmailRecipients, siteId, userId, templateId, actionTypeId);

                            if (ResendEmail == false)
                            {
                                //Send email to CC Users
                                if (ccUsers != null)
                                {
                                    foreach (var user in ccUsers.Where(a => task.CCUserIDs.Split(';').Contains(a.UserId.ToString())).ToList())
                                    {
                                        var ccUserObj = lstCCUserTaskEmail.FirstOrDefault(a => a.CCUserID == user.UserId);

                                        if (ccUserObj == null)
                                        {
                                            ccUserObj           = new CCUserTaskEmail();
                                            ccUserObj.Assignees = new List <AssignedToUserTaskEmail>();
                                            lstCCUserTaskEmail.Add(ccUserObj);

                                            ccUserObj.CCUserID = user.UserId;
                                            ccUserObj.CCUser   = new CCMService.EmailRecipient {
                                                EmailAddress = user.EmailAddress, FullName = user.FullName
                                            };
                                            ccUserObj.TaskIDs = "";
                                        }

                                        ccUserObj.TaskIDs += "," + task.TaskID.ToString();
                                        ccUserObj.Assignees.Add(new AssignedToUserTaskEmail()
                                        {
                                            AssignedToFirstName = task.AssignedToFirstName,
                                            AssignedToLastName  = task.AssignedToLastName,
                                            AssignedToEmail     = task.AssignedToEmail
                                        });
                                    }
                                }
                            }
                        }
                        else
                        {
                            var newCCUserIds = new string[0];

                            if (task.AssignedToUserID != previousTaskData.AssignedToUserID)                                    // Task Reassigned to another user, since the Edit task will now allow only 1 user in Assignee Field 5/15/2018 Bug: 54390
                            {
                                //Send Email to New Assignee
                                templateId   = (int)Enums.TaskEmailTemplateID.TaskReassignedToNewAssignee;
                                actionTypeId = (int)Enums.ActionTypeEnum.TaskReassign;

                                var assignUser = new AssignedUser
                                {
                                    EmailAddress = task.AssignedToEmail,
                                    FirstName    = task.AssignedToFirstName,
                                    LastName     = task.AssignedToLastName,
                                    UserId       = task.AssignedToUserID
                                };

                                SendSingleTaskEmailForUser(assignUser, task, siteId, userId, templateId, actionTypeId);

                                //Send Email to Previous Assignees
                                templateId   = (int)Enums.TaskEmailTemplateID.TaskReassignedToPrevAssignee;
                                actionTypeId = (int)Enums.ActionTypeEnum.TaskReassign;

                                var prevUser = new AssignedUser
                                {
                                    EmailAddress = previousTaskData.AssignedToEmail,
                                    FirstName    = previousTaskData.AssignedToFirstName,
                                    LastName     = previousTaskData.AssignedToLastName,
                                    UserId       = previousTaskData.AssignedToUserID
                                };

                                SendSingleTaskEmailForUser(prevUser, task, siteId, userId, templateId, actionTypeId);

                                //Send Email to CC users
                                templateId   = (int)Enums.TaskEmailTemplateID.TaskReassignedToCCUser;
                                actionTypeId = (int)Enums.ActionTypeEnum.TaskReassign;

                                var ccuser = ccUsers.Where(a => task.CCUserIDs.Split(';').Contains(a.UserId.ToString())).ToList();

                                foreach (var item in ccuser)
                                {
                                    SendSingleTaskEmailForUser(item, task, siteId, userId, templateId, actionTypeId);
                                }
                            }
                            else if (IsTaskValueChanged(previousTaskData, task, ref newCCUserIds) == true)                                     //Updated Task and if any values changed
                            {
                                templateId   = (int)Enums.TaskEmailTemplateID.EditTask;
                                actionTypeId = (int)Enums.ActionTypeEnum.TaskEdit;

                                lstEmailRecipients.Clear();

                                //Sending email to Assignee
                                lstEmailRecipients.Add(new CCMService.EmailRecipient {
                                    EmailAddress = task.AssignedToEmail, FullName = task.AssignedToFullName
                                });

                                SendTaskEmailThroughCCM(task, lstEmailRecipients, siteId, userId, templateId, actionTypeId);

                                //Send email to CC Users
                                if (ccUsers != null)
                                {
                                    foreach (var user in ccUsers.Where(a => newCCUserIds.Contains(a.UserId.ToString())).ToList())
                                    {
                                        var ccUserObj = lstCCUserTaskEmail.FirstOrDefault(a => a.CCUserID == user.UserId);

                                        if (ccUserObj == null)
                                        {
                                            ccUserObj           = new CCUserTaskEmail();
                                            ccUserObj.Assignees = new List <AssignedToUserTaskEmail>();
                                            lstCCUserTaskEmail.Add(ccUserObj);

                                            ccUserObj.CCUserID = user.UserId;
                                            ccUserObj.CCUser   = new CCMService.EmailRecipient {
                                                EmailAddress = user.EmailAddress, FullName = user.FullName
                                            };
                                            ccUserObj.TaskIDs = "";
                                        }

                                        ccUserObj.TaskIDs += "," + task.TaskID.ToString();
                                        ccUserObj.Assignees.Add(new AssignedToUserTaskEmail()
                                        {
                                            AssignedToFirstName = task.AssignedToFirstName,
                                            AssignedToLastName  = task.AssignedToLastName,
                                            AssignedToEmail     = task.AssignedToEmail
                                        });
                                    }
                                }
                            }
                        }

                        break;

                    case Enums.TaskStatus.Complete:
                        templateId   = (int)Enums.TaskEmailTemplateID.CompletedTask;
                        actionTypeId = (int)Enums.ActionTypeEnum.TaskCompleted;

                        lstEmailRecipients.Clear();

                        //Sending email to Assignee
                        lstEmailRecipients.Add(new CCMService.EmailRecipient {
                            EmailAddress = task.AssignedToEmail, FullName = task.AssignedToFullName
                        });

                        //Sending email to Assigner if not same.
                        if (task.AssignedToUserID != task.AssignedByUserID)
                        {
                            lstEmailRecipients.Add(new CCMService.EmailRecipient {
                                EmailAddress = task.AssignedByEmail, FullName = task.AssignedByFullName
                            });
                        }

                        //If LastUpdatedBy (Before marking Completed) is different from Assigner or Assignee, send email
                        if (previousTaskData.UpdatedByUserID != task.AssignedByUserID && previousTaskData.UpdatedByUserID != task.AssignedToUserID)
                        {
                            lstEmailRecipients.Add(new CCMService.EmailRecipient {
                                EmailAddress = previousTaskData.UpdatedByEmail, FullName = previousTaskData.UpdatedByFullName
                            });
                        }

                        SendTaskEmailThroughCCM(task, lstEmailRecipients, siteId, userId, templateId, actionTypeId);

                        break;

                    case Enums.TaskStatus.Deleted:
                        continue;                                 //skip the task since it is removed/deleted.
                    }
                }
                catch (Exception ex)
                {
                    throw;
                }
                finally
                {
                    lstEmailRecipients = null;
                }
            }


            //Send email to CC Users
            try
            {
                if (lstCCUserTaskEmail.Count > 0)
                {
                    var templateId   = (int)Enums.TaskEmailTemplateID.NewTaskToCC;
                    var actionTypeId = (int)Enums.ActionTypeEnum.TaskNew;
                    var task         = lstTasks.First();

                    foreach (var ccuser in lstCCUserTaskEmail)
                    {
                        SendTaskEmailForCCUsersThroughCCM(task, ccuser.TaskIDs.Substring(1), ccuser.CCUser, ccuser.Assignees, siteId, userId, templateId, actionTypeId);
                    }
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
                lstCCUserTaskEmail = null;
            }
        }
예제 #17
0
        public static void SendTaskReassignedEmail(string taskIds, int siteId, int programId, int userId, List <UserTaskEmail> lstPreviousTasks)
        {
            List <UserTaskEmail> lstTasks;
            int           templateId, actionTypeId;
            UserTaskEmail task;
            AssignedUser  user;

            try
            {
                var siteEmailSetting = GetSiteEmailNotificationSettings(siteId);

                if (siteEmailSetting.SendEmailOnTaskCreation == true)
                {
                    //Send Email to New Assignee
                    lstTasks     = TaskServices.GetTaskDetailsForSendingEmail(taskIds, siteId, programId, userId);
                    templateId   = (int)Enums.TaskEmailTemplateID.TaskReassignedToNewAssignee;
                    actionTypeId = (int)Enums.ActionTypeEnum.TaskReassign;

                    task = lstTasks.First();
                    user = new AssignedUser
                    {
                        EmailAddress = task.AssignedToEmail,
                        FirstName    = task.AssignedToFirstName,
                        LastName     = task.AssignedToLastName,
                        UserId       = task.AssignedToUserID
                    };

                    EmailHelpers.SendMultipleTaskEmailForUser(user, lstTasks, siteId, userId, templateId, actionTypeId);

                    //Send Email to Previous Assignees
                    var assignees = lstPreviousTasks.Select(a => a.AssignedToUserID).Distinct().ToList();
                    templateId   = (int)Enums.TaskEmailTemplateID.TaskReassignedToPrevAssignee;
                    actionTypeId = (int)Enums.ActionTypeEnum.TaskReassign;

                    foreach (var assignee in assignees)
                    {
                        List <UserTaskEmail> assigneeTasks = lstPreviousTasks.Where(a => a.AssignedToUserID == assignee).ToList();

                        task = assigneeTasks.First();
                        user = new AssignedUser
                        {
                            EmailAddress = task.AssignedToEmail,
                            FirstName    = task.AssignedToFirstName,
                            LastName     = task.AssignedToLastName,
                            UserId       = task.AssignedToUserID
                        };

                        EmailHelpers.SendMultipleTaskEmailForUser(user, assigneeTasks, siteId, userId, templateId, actionTypeId);
                    }

                    //Send Email to CC users
                    templateId   = (int)Enums.TaskEmailTemplateID.TaskReassignedToCCUser;
                    actionTypeId = (int)Enums.ActionTypeEnum.TaskReassign;

                    var ccUserIds = String.Join(";", lstTasks.Select(a => a.CCUserIDs).Distinct());
                    var ccUsers   = GetUsers(ccUserIds, siteId);

                    foreach (var ccUser in ccUsers)
                    {
                        List <UserTaskEmail> ccTasks = lstTasks.Where(a => a.CCUserIDs.Split(';').Contains(ccUser.UserId.ToString())).ToList();
                        EmailHelpers.SendMultipleTaskEmailForUser(ccUser, ccTasks, siteId, userId, templateId, actionTypeId);
                    }
                }
            }
            catch (Exception ex)
            {
                string sqlParam   = "";
                string methodName = "SendReassignedTaskEmailToAssignee";
                new ExceptionLogServices().ExceptionLogInsert(ex.Message.ToString(), "", methodName, userId, siteId, sqlParam, string.Empty);
            }
            finally
            {
                lstTasks         = null;
                lstPreviousTasks = null;
                task             = null;
                user             = null;
            }
        }
 public async Task DeleteAssignedUserAsync(AssignedUser assignedUser)
 {
     _context.AssignedUsers.Remove(assignedUser);
     await _context.SaveChangesAsync();
 }
예제 #19
0
        protected BaseIssueViewModel(
            IApplicationService applicationService,
            IMarkdownService markdownService)
        {
            _applicationService = applicationService;

            var issuePresenceObservable = this.WhenAnyValue(x => x.Issue, x => x.CanModify)
                                          .Select(x => x.Item1 != null && x.Item2);

            Events = InternalEvents.CreateDerivedCollection(x => x);

            _participants = Events.Changed
                            .Select(_ => Events.Select(y => y.Actor).Distinct().Count())
                            .Select(x => x == 0 ? 1 : x)
                            .ToProperty(this, x => x.Participants);

            GoToAssigneesCommand = ReactiveCommand.Create(issuePresenceObservable)
                                   .WithSubscription(_ => Assignees.LoadCommand.ExecuteIfCan());

            GoToLabelsCommand = ReactiveCommand.Create(issuePresenceObservable)
                                .WithSubscription(_ => Labels.LoadCommand.ExecuteIfCan());

            GoToMilestonesCommand = ReactiveCommand.Create(issuePresenceObservable)
                                    .WithSubscription(_ => Milestones.LoadCommand.ExecuteIfCan());

            _assignedUser = this.WhenAnyValue(x => x.Issue.Assignee)
                            .ToProperty(this, x => x.AssignedUser);

            _assignedMilestone = this.WhenAnyValue(x => x.Issue.Milestone)
                                 .ToProperty(this, x => x.AssignedMilestone);

            _assignedLabels = this.WhenAnyValue(x => x.Issue.Labels)
                              .ToProperty(this, x => x.AssignedLabels);

            _isClosed = this.WhenAnyValue(x => x.Issue.State)
                        .Select(x => x == Octokit.ItemState.Closed)
                        .ToProperty(this, x => x.IsClosed);

            Assignees = new IssueAssigneeViewModel(
                () => applicationService.GitHubClient.Issue.Assignee.GetForRepository(RepositoryOwner, RepositoryName),
                () => Task.FromResult(Issue.Assignee),
                x => UpdateIssue(new Octokit.IssueUpdate
            {
                Assignee  = x.With(y => y.Login),
                Milestone = AssignedMilestone.With(y => (int?)y.Number)
            }));

            Milestones = new IssueMilestonesViewModel(
                () => applicationService.GitHubClient.Issue.Milestone.GetForRepository(RepositoryOwner, RepositoryName),
                () => Task.FromResult(Issue.Milestone),
                x => UpdateIssue(new Octokit.IssueUpdate
            {
                Assignee  = AssignedUser.With(y => y.Login),
                Milestone = x.With(y => (int?)y.Number)
            }));

            Labels = new IssueLabelsViewModel(
                () => applicationService.GitHubClient.Issue.Labels.GetForRepository(RepositoryOwner, RepositoryName),
                () => Task.FromResult((IReadOnlyList <Octokit.Label>) new ReadOnlyCollection <Octokit.Label>(Issue.Labels.ToList())),
                x =>
            {
                var update = new Octokit.IssueUpdate
                {
                    Assignee  = AssignedUser.With(y => y.Login),
                    Milestone = AssignedMilestone.With(y => (int?)y.Number),
                };

                foreach (var label in x.Select(y => y.Name))
                {
                    update.AddLabel(label);
                }
                return(UpdateIssue(update));
            });

            _markdownDescription = this.WhenAnyValue(x => x.Issue)
                                   .Select(x => ((x == null || string.IsNullOrEmpty(x.Body)) ? null : markdownService.Convert(x.Body)))
                                   .ToProperty(this, x => x.MarkdownDescription);

            LoadCommand = ReactiveCommand.CreateAsyncTask(t => Load(applicationService));

            GoToOwnerCommand = ReactiveCommand.Create(this.WhenAnyValue(x => x.Issue).Select(x => x != null));
            GoToOwnerCommand.Select(_ => Issue.User).Subscribe(x =>
            {
                var vm      = this.CreateViewModel <UserViewModel>();
                vm.Username = x.Login;
                NavigateTo(vm);
            });

            ToggleStateCommand = ReactiveCommand.CreateAsyncTask(issuePresenceObservable, async t =>
            {
                try
                {
                    Issue = await applicationService.GitHubClient.Issue.Update(RepositoryOwner, RepositoryName, Id, new Octokit.IssueUpdate {
                        State = (Issue.State == Octokit.ItemState.Open) ? Octokit.ItemState.Closed : Octokit.ItemState.Open
                    });
                }
                catch (Exception e)
                {
                    var close = (Issue.State == Octokit.ItemState.Open) ? "close" : "open";
                    throw new Exception("Unable to " + close + " the item. " + e.Message, e);
                }
            });

            AddCommentCommand = ReactiveCommand.Create()
                                .WithSubscription(_ =>
            {
                var vm             = this.CreateViewModel <IssueCommentViewModel>();
                vm.RepositoryOwner = RepositoryOwner;
                vm.RepositoryName  = RepositoryName;
                vm.Id = Id;
                vm.SaveCommand.Subscribe(x => InternalEvents.Add(new IssueCommentItemViewModel(x)));
                NavigateTo(vm);
            });


            GoToUrlCommand = ReactiveCommand.Create();
            GoToUrlCommand.OfType <string>().Subscribe(x =>
            {
                var vm = this.CreateViewModel <WebBrowserViewModel>();
                vm.Url = x;
                NavigateTo(vm);
            });
            GoToUrlCommand.OfType <Uri>().Subscribe(x =>
            {
                var vm = this.CreateViewModel <WebBrowserViewModel>();
                vm.Url = x.AbsoluteUri;
                NavigateTo(vm);
            });
        }
 public async Task SaveAssignedUserAsync(AssignedUser assignedUser)
 {
     _context.AssignedUsers.Add(assignedUser);
     await _context.SaveChangesAsync();
 }
 public async Task EditAssignedUserAsync(AssignedUser assignedUser)
 {
     _context.AssignedUsers.Update(assignedUser);
     await _context.SaveChangesAsync();
 }
예제 #22
0
        public bool Post([FromBody] AssignedUser value)
        {
            ManageAssignedUsers manageAssignedUser = new ManageAssignedUsers();

            return(manageAssignedUser.createAssignedUsers(value));
        }
예제 #23
0
        public async Task <IActionResult> CreateAssignedUser(AssignedUser assignedUser)
        {
            await _assignedUserService.SaveAssignedUserAsync(assignedUser);

            return(CreatedAtAction(nameof(GetAssignedUserById), new { id = assignedUser.AssignedUserId }, assignedUser));
        }
예제 #24
0
        public void Put(int id, [FromBody] AssignedUser value)
        {
            ManageAssignedUsers manageAssignedUser = new ManageAssignedUsers();

            manageAssignedUser.UpdateAssignedUsers(value, id);
        }
예제 #25
0
 public Task SaveAssignedUserAsync(AssignedUser assignedUser)
 {
     return(_assignedUserRepository.SaveAssignedUserAsync(assignedUser));
 }
예제 #26
0
 public Task EditAssignedUserAsync(AssignedUser assignedUserInDb, AssignedUser assignedUser)
 {
     assignedUserInDb.FirstName = assignedUser.FirstName;
     assignedUserInDb.LastName  = assignedUser.LastName;
     return(_assignedUserRepository.EditAssignedUserAsync(assignedUserInDb));
 }
예제 #27
0
 public Task DeleteAssignedUserAsync(AssignedUser assignedUser)
 {
     return(_assignedUserRepository.DeleteAssignedUserAsync(assignedUser));
 }
 internal PersonalComputeInstanceSettings(AssignedUser assignedUser)
 {
     AssignedUser = assignedUser;
 }