public async Task <JsonResult> Add(AddActionPlanViewModel obj)
        {
            var userprofile = Session["UserProfile"] as UserProfileVM;

            obj.OwnerID = userprofile.User.ID;
            var data = await new ActionPlanDAO().Add(obj);//(item, obj.Subject, obj.Auditor, obj.CategoryID);

            NotificationHub.SendNotifications();
            if (data.ListEmails.Count > 0 && await new SettingDAO().IsSendMail("ADDTASK"))
            {
                string content = "The account " + data.ListEmails.First()[0] + " mentioned you in KPI System Apps. Content: " + data.ListEmails.First()[4] + ". " + data.ListEmails.First()[3] + " Link: " + obj.Link;
                Commons.SendMail(data.ListEmails.Select(x => x[1]).ToList(), "[KPI System] Add task", content, "Action Plan (Add Task)");
            }
            return(Json(new { status = data.Status, isSendmail = true, message = data.Message }, JsonRequestBehavior.AllowGet));
        }
        //Add ActionPlan
        public async Task <JsonResult> Add(AddActionPlanViewModel obj)
        {
            var userprofile = Session["UserProfile"] as UserProfileVM;

            obj.OwnerID = userprofile.User.ID;
            var data = await new ActionPlanDAO().Add(obj);//(item, obj.Subject, obj.Auditor, obj.CategoryID);

            NotificationHub.SendNotifications();
            if (data.ListEmails.Count > 0 && await new SettingDAO().IsSendMail("ADDTASK"))
            {
                string contentForPIC = @"<p><b>*PLEASE DO NOT REPLY* this email was automatically sent from the KPI system.</b></p> 
                                <p>The account <b>" + data.ListEmails.First()[0].ToTitleCase() + "</b> assigned a task to you in KPI Sytem App. </p>" +
                                       "<p>Task name : <b>" + data.ListEmails.First()[3] + "</b></p>" +
                                       "<p>Description : " + data.ListEmails.First()[4] + "</p>" +
                                       "<p>Link: <a href='" + data.QueryString + "'>Click Here</a></p>";

                string contentAuditor = @"<p><b>*PLEASE DO NOT REPLY* this email was automatically sent from the KPI system.</b></p> 
                                <p>The account <b>" + data.ListEmailsForAuditor.First()[0].ToTitleCase() + "</b> created a new task ,assigned you are an auditor in KPI Sytem App. </p>" +
                                        "<p>Task name : <b>" + data.ListEmailsForAuditor.First()[3] + "</b></p>" +
                                        "<p>Description : " + data.ListEmailsForAuditor.First()[4] + "</p>" +
                                        "<p>Link: <a href='" + data.QueryString + "'>Click Here</a></p>";
                Thread thread = new Thread(() =>
                {
                    Commons.SendMail(data.ListEmailsForAuditor.Select(x => x[1]).ToList(), "[KPI System-03] Action Plan (Add Task - Assign Auditor)", contentAuditor, "Action Plan (Add Task - Assign Auditor)");
                });
                Thread thread2 = new Thread(() =>
                {
                    Commons.SendMail(data.ListEmails.Select(x => x[1]).ToList(), "[KPI System-03] Action Plan (Add Task)", contentForPIC, "Action Plan (Add Task)");
                });
                thread.Start();
                thread2.Start();

                return(Json(new { status = data.Status, isSendmail = true, message = data.Message }, JsonRequestBehavior.AllowGet));
            }
            return(Json(new { status = data.Status, isSendmail = true, message = data.Message }, JsonRequestBehavior.AllowGet));
        }