public JsonResult GetEmployerContacts([ModelBinder(typeof(DataTablesBinder))] IDataTablesRequest requestModel, string EmployerId)
        {
            string userkey   = ConfigurationManager.AppSettings["userkey"];
            string uid       = ConfigurationManager.AppSettings["uid"];
            string LoginUser = (string)Session["LoginSAPID"];

            try
            {
                Employer.Employer employer = new Employer.Employer();
                DataTable         dt       = employer.FetchExternalUsers(true, EmployerId, userkey, uid);

                dt.TableName = "ExternalUsers";
                dt.Columns.ToString();

                List <ExternalUsers> userList = new List <ExternalUsers>();
                int startRec = requestModel.Start;
                int pageSize = requestModel.Length;

                List <ExternalUsers> usersCount = (from DataRow dr in dt.Rows
                                                   select new ExternalUsers()
                {
                    ID = dr["ID"].ToString()
                }).ToList();

                userList = (from DataRow dr in dt.Rows
                            select new ExternalUsers()
                {
                    ID = dr["ID"].ToString(),
                    EMAIL = dr["EMAIL"].ToString(),
                    PHONE = dr["PHONE"].ToString(),
                    FULLNAME = dr["FULLNAME"].ToString(),
                    LOCKED = dr["LOCKED"].ToString(),
                    STATUS = dr["STATUS"].ToString(),
                    PCODE = dr["PCODE"].ToString(),
                    ROLE_ID = dr["ROLE_ID"].ToString(),

                    /*STATUS = dr["EMPLOYER_ID"].ToString(),
                     * STATUS = dr["APPROVAL_STATUS"].ToString(),
                     * STATUS = dr["CREATED_BY"].ToString(),
                     * STATUS = dr["DATE_CREATED"].ToString(),
                     * STATUS = dr["APPROVED_BY"].ToString(),
                     * STATUS = dr["STATUS"].ToString(),
                     * DATE_LAST_MODIFIED = dr["DATE_APPROVED"].ToString()*/
                }).Skip(startRec).Take(pageSize).ToList();

                var totalCount    = usersCount.Count();
                var filteredCount = userList.Count();

                if (requestModel.Search.Value != string.Empty)
                {
                    var value = requestModel.Search.Value.ToLower().Trim();

                    usersCount = (from DataRow dr in dt.Rows
                                  where dr["ID"].ToString().ToLower().Contains(value) || dr["EMAIL"].ToString().ToLower().Contains(value) ||
                                  dr["FULLNAME"].ToString().ToLower().Contains(value) || dr["PHONE"].ToString().ToLower().Contains(value)
                                  select new ExternalUsers()
                    {
                        ID = dr["ID"].ToString()
                    }).ToList();

                    userList = (from DataRow dr in dt.Rows
                                where dr["ID"].ToString().ToLower().Contains(value) || dr["EMAIL"].ToString().ToLower().Contains(value) ||
                                dr["FULLNAME"].ToString().ToLower().Contains(value) || dr["PHONE"].ToString().ToLower().Contains(value)
                                select new ExternalUsers()
                    {
                        ID = dr["ID"].ToString(),
                        EMAIL = dr["EMAIL"].ToString(),
                        PHONE = dr["PHONE"].ToString(),
                        FULLNAME = dr["FULLNAME"].ToString(),
                        LOCKED = dr["LOCKED"].ToString(),
                        STATUS = dr["STATUS"].ToString(),
                        PCODE = dr["PCODE"].ToString(),
                        ROLE_ID = dr["ROLE_ID"].ToString(),

                        /*STATUS = dr["EMPLOYER_ID"].ToString(),
                         * STATUS = dr["APPROVAL_STATUS"].ToString(),
                         * STATUS = dr["CREATED_BY"].ToString(),
                         * STATUS = dr["DATE_CREATED"].ToString(),
                         * STATUS = dr["APPROVED_BY"].ToString(),
                         * STATUS = dr["STATUS"].ToString(),*/
                        DATE_LAST_MODIFIED = dr["DATE_APPROVED"].ToString()
                    }).Skip(startRec).Take(pageSize).ToList();

                    totalCount    = usersCount.Count();
                    filteredCount = userList.Count();
                }

                var sortedColumns = requestModel.Columns.GetSortedColumns();
                var orderByString = String.Empty;

                foreach (var column in sortedColumns)
                {
                    orderByString += orderByString != String.Empty ? "," : "";
                    orderByString += (column.Data) + (column.SortDirection == Column.OrderDirection.Ascendant ? " asc" : " desc");
                }

                var data = userList.Select(emList => new
                {
                    ID                 = emList.ID,
                    PHONE              = emList.PHONE,
                    FULLNAME           = emList.FULLNAME,
                    EMAIL              = emList.EMAIL,
                    LOCKED             = emList.LOCKED,
                    STATUS             = emList.STATUS,
                    ROLE_ID            = emList.ROLE_ID,
                    DATE_LAST_MODIFIED = emList.DATE_LAST_MODIFIED
                }).OrderBy(orderByString == string.Empty ? "ID asc" : orderByString).ToList();

                return(Json(new DataTablesResponse(requestModel.Draw, data, totalCount, totalCount), JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                LogError logerror = new LogError();
                logerror.ErrorLog("", LoginUser, "", "Admin/GetInternalUsers", "Admin", "GetExternalUsers", "FetchExternalUsers Error", ex.Message.ToString(), 0);
                throw new Exception(ex.Message.ToString());
            }
        }