public JsonResult SendACLRejectionNotification(string compID, string requester, string quoteQN, string quoteID, string rejectReason)
        {
            string           result = null;
            ComponentFindDTO param  = new ComponentFindDTO();

            param.id = Convert.ToInt32(compID);
            var    comp_data             = UnitOfWork.TblComp.Get(Convert.ToInt32(compID));
            var    formattedRejectReason = rejectReason.Replace("\n", Environment.NewLine);
            var    emailDTO        = new { compID = compID, comp_data = comp_data, quoteQN = quoteQN, quoteID = quoteID, rejectReason = formattedRejectReason };
            string aclApproverList = GetUsersInRole("9");

            try
            {
                try
                {
                    var email   = new EmailController();
                    var message = new EmailModels();
                    message.To      = requester;
                    message.CC      = aclApproverList;
                    message.Subject = string.Format("ACL request rejected for Vendor Part Number {0}", comp_data.comp_vend_pn);
                    Task.Run(() => email.Send(message, null, emailDTO, "componentACLRejectionNotification.html"));
                }
                catch (Exception ex)
                {
                    _logger.Error(string.Format("Email Send Error: {0}", ex.ToString()));
                }
            }
            catch (Exception ex)
            {
                _logger.Error(ex);
                result = null;
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        public JsonResult Find(ComponentFindDTO param)
        {
            bool?aclOnly = null;

            //if (param.acl == 1)
            //{ aclOnly = true; }
            //if (param.acl == 0)
            //{ aclOnly = null; }

            if (param.acl.HasValue && !param.acl.Value)
            {
                aclOnly = null;
            }
            else
            {
                aclOnly = param.acl;
            }
            if (param.latex.HasValue && !param.latex.Value)
            {
                param.latex = null;
            }

            if (User.Identity.IsAuthenticated && User.IsInRole("SalesRep"))
            {
                aclOnly = true;
            }

            List <int> exceptionCompIDs = new List <int> {
            };

            if (aclOnly == true)
            {
                if (param.acct_id.HasValue)
                {
                    var exceptionData = UnitOfWork.TblACLAccountExceptions.GetCompExecptionsByAccount((int)param.acct_id);
                    foreach (var row in exceptionData)
                    {
                        exceptionCompIDs.Add(row.comp_id);
                    }
                }
            }

            var data = UnitOfWork.TblComp.Find(param.PageSize, param.PageNumber,
                                               param.SortBy, param.SortDir, param.descOrg, param.vendor, param.vendorPart,
                                               param.equiv, param.includeDeleted, param.desc, param.mfg, param.sterility, param.WildcardSearch,
                                               null, param.id, aclOnly, param.latex, exceptionCompIDs);
            var dto = Mapper.Map <PageListDTO <ICollection <ComponentVendorDTO> > >(data);

            return(Json(dto, JsonRequestBehavior.AllowGet));
        }