/// <summary>
        /// The sorting.
        /// </summary>
        /// <param name="sort">
        /// Сolumn that sort
        /// </param>
        /// <param name="direction">
        /// Ascending or Descending direction
        /// </param>
        /// <returns>
        /// The <see cref="IQueryable"/>.
        /// </returns>
        private static IQueryable <Passport> Sorting(int sort, bool direction)
        {
            var db = new PassContext();
            IObjectContextAdapter dbcontextadapter = (IObjectContextAdapter)db;

            dbcontextadapter.ObjectContext.CommandTimeout = 1000;
            IQueryable <Passport> query = db.Passports;

            switch (sort)
            {
            case (int)Cells.Name:
                query = direction ? db.Passports.OrderBy(a => a.Name) : db.Passports.OrderByDescending(a => a.Name);
                break;

            case (int)Cells.Surname:
                query = direction
                                ? db.Passports.OrderBy(a => a.Surname)
                                : db.Passports.OrderByDescending(a => a.Surname);
                break;

            case (int)Cells.Patronymic:
                query = direction
                                ? db.Passports.OrderBy(a => a.Patronymic)
                                : db.Passports.OrderByDescending(a => a.Patronymic);
                break;

            case (int)Cells.PassportNumber:
                query = direction
                                ? db.Passports.OrderBy(a => a.PassportNumber)
                                : db.Passports.OrderByDescending(a => a.PassportNumber);
                break;

            case (int)Cells.Sex:
                query = direction ? db.Passports.OrderBy(a => a.Sex) : db.Passports.OrderByDescending(a => a.Sex);
                break;

            case (int)Cells.Birthday:
                query = direction
                                ? db.Passports.OrderBy(a => a.Birthday)
                                : db.Passports.OrderByDescending(a => a.Birthday);
                break;

            case (int)Cells.City:
                query = direction ? db.Passports.OrderBy(a => a.City) : db.Passports.OrderByDescending(a => a.City);
                break;

            case (int)Cells.Address:
                query = direction
                                ? db.Passports.OrderBy(a => a.Address)
                                : db.Passports.OrderByDescending(a => a.Address);
                break;

            case (int)Cells.IssuedBy:
                query = direction
                                ? db.Passports.OrderBy(a => a.IssuedBy)
                                : db.Passports.OrderByDescending(a => a.IssuedBy);
                break;

            case (int)Cells.DateOfIssue:
                query = direction
                                ? db.Passports.OrderBy(a => a.DateOfIssue)
                                : db.Passports.OrderByDescending(a => a.DateOfIssue);
                break;

            case (int)Cells.Code:
                query = direction ? db.Passports.OrderBy(a => a.Code) : db.Passports.OrderByDescending(a => a.Code);
                break;
            }

            return(query);
        }
        /// <summary>
        /// The sorting.
        /// </summary>
        /// <param name="sort">
        /// Сolumn that sort
        /// </param>
        /// <param name="direction">
        /// Ascending or Descending direction
        /// </param>
        /// <returns>
        /// The <see cref="IQueryable"/>.
        /// </returns>
        private static IQueryable<Passport> Sorting(int sort, bool direction)
        {
            var db = new PassContext();
            IObjectContextAdapter dbcontextadapter = (IObjectContextAdapter)db;
            dbcontextadapter.ObjectContext.CommandTimeout = 1000;
            IQueryable<Passport> query = db.Passports;
            switch (sort)
            {
                case (int)Cells.Name:
                    query = direction ? db.Passports.OrderBy(a => a.Name) : db.Passports.OrderByDescending(a => a.Name);
                    break;
                case (int)Cells.Surname:
                    query = direction
                                ? db.Passports.OrderBy(a => a.Surname)
                                : db.Passports.OrderByDescending(a => a.Surname);
                    break;
                case (int)Cells.Patronymic:
                    query = direction
                                ? db.Passports.OrderBy(a => a.Patronymic)
                                : db.Passports.OrderByDescending(a => a.Patronymic);
                    break;
                case (int)Cells.PassportNumber:
                    query = direction
                                ? db.Passports.OrderBy(a => a.PassportNumber)
                                : db.Passports.OrderByDescending(a => a.PassportNumber);
                    break;
                case (int)Cells.Sex:
                    query = direction ? db.Passports.OrderBy(a => a.Sex) : db.Passports.OrderByDescending(a => a.Sex);
                    break;
                case (int)Cells.Birthday:
                    query = direction
                                ? db.Passports.OrderBy(a => a.Birthday)
                                : db.Passports.OrderByDescending(a => a.Birthday);
                    break;
                case (int)Cells.City:
                    query = direction ? db.Passports.OrderBy(a => a.City) : db.Passports.OrderByDescending(a => a.City);
                    break;
                case (int)Cells.Address:
                    query = direction
                                ? db.Passports.OrderBy(a => a.Address)
                                : db.Passports.OrderByDescending(a => a.Address);
                    break;
                case (int)Cells.IssuedBy:
                    query = direction
                                ? db.Passports.OrderBy(a => a.IssuedBy)
                                : db.Passports.OrderByDescending(a => a.IssuedBy);
                    break;
                case (int)Cells.DateOfIssue:
                    query = direction
                                ? db.Passports.OrderBy(a => a.DateOfIssue)
                                : db.Passports.OrderByDescending(a => a.DateOfIssue);
                    break;
                case (int)Cells.Code:
                    query = direction ? db.Passports.OrderBy(a => a.Code) : db.Passports.OrderByDescending(a => a.Code);
                    break;
            }

            return query;
        }