public ActionResult CoordinatorProfile(Guid?id)
        {
            ViewBag.gender = new List <SelectListItem>
            {
                new SelectListItem {
                    Selected = true, Text = General.Male, Value = "Male"
                },
                new SelectListItem {
                    Selected = false, Text = General.Female, Value = "Female"
                }
            };
            var cu         = Session["user"] as ContextUser;
            var repository = new CoordinatorRepository();
            coordinator_profile oCordinator = null;

            if (id != null)
            {
                oCordinator = repository.GetByRowId(id.Value);
            }
            else
            {
                oCordinator = repository.GetByUserId(cu.OUser.Id);
            }

            return(View(oCordinator));
        }
        // GET: EvaluationResult
        public ActionResult Index(string sortOrder, string filter, string archived, int page = 1, Guid?archive = null)
        {
            ViewBag.searchQuery  = string.IsNullOrEmpty(filter) ? "" : filter;
            ViewBag.showArchived = (archived ?? "") == "on";

            page = page > 0 ? page : 1;
            int pageSize = 0;

            pageSize = pageSize > 0 ? pageSize : 10;

            ViewBag.CurrentSort = sortOrder;

            var cu = Session["user"] as ContextUser;
            IEnumerable <school> Profile;
            var repository = new CoordinatorRepository();

            if (archive != null)
            {
                var oCoordinator = repository.GetByRowId(archive.Value);
                oCoordinator.IsActive = !oCoordinator.IsActive;
                repository.Put(oCoordinator.Id, oCoordinator);
            }

            Profile = repository.GetAllSchools();

            //Sorting order
            Profile       = Profile.OrderByDescending(x => x.CreatedAt);
            ViewBag.Count = Profile.Count();

            return(View(Profile.ToPagedList(page, pageSize)));
        }
        public ActionResult Register(Guid id)
        {
            ViewBag.gender = new List <SelectListItem>
            {
                new SelectListItem {
                    Selected = true, Text = General.Male, Value = "Male"
                },
                new SelectListItem {
                    Selected = false, Text = General.Female, Value = "Female"
                }
            };
            SetRegisterDD();
            var coordinatorRepo = new CoordinatorRepository();
            var coordinator     = coordinatorRepo.GetByRowId(id);

            return(View(coordinator));
        }
        // GET: Coordinator

        public ActionResult Index(string sortOrder, string filter, string archived, int page = 1, Guid?archive = null)
        {
            //PdfGenerator.PdfGenerator pdf = new PdfGenerator.PdfGenerator();
            //pdf.GenerateOnflyPdf();

            //ExcelReader.Read(@"C:\Users\malikwaqar\Desktop\bredford code analysic.xlsx");

            ViewBag.searchQuery  = string.IsNullOrEmpty(filter) ? "" : filter;
            ViewBag.showArchived = (archived ?? "") == "on";

            page = page > 0 ? page : 1;
            int pageSize = 0;

            pageSize = pageSize > 0 ? pageSize : 10;

            ViewBag.CurrentSort = sortOrder;

            var cu = Session["user"] as ContextUser;
            IEnumerable <coordinator_profile> Profile;
            var repository = new CoordinatorRepository();

            if (archive != null)
            {
                var oCoordinator = repository.GetByRowId(archive.Value);
                oCoordinator.IsActive      = !oCoordinator.IsActive;
                oCoordinator.user.IsLocked = !oCoordinator.IsActive;
                repository.Put(oCoordinator.Id, oCoordinator);
            }
            if (cu != null && cu.EnumRole == EnumUserRole.Coordinator)
            {
                Profile = repository.GetSubCoordinator(cu.OUser.coordinator_profile.First().Id);
            }
            else
            {
                Profile = string.IsNullOrEmpty(filter) ? repository.Get() : repository.Get().Where(x => x.school.SchoolName.Contains(filter));
            }
            //Sorting order
            Profile       = Profile.OrderByDescending(x => x.CreatedAt);
            ViewBag.Count = Profile.Count();

            return(View(Profile.ToPagedList(page, pageSize)));
        }
        public ActionResult Edit(Guid?id)
        {
            var cities = new CityRepository().Get().Distinct().Select(x =>
                                                                      new SelectListItem {
                Text = x.City + " (" + x.City_ar + ")", Value = x.City + "", Selected = x.City == "Jeddah"
            }).ToList();

            ViewBag.citiesdd = cities;
            var distict = new CityRepository().Get().GroupBy(x => x.Region).Select(x => x.First()).Select(x =>
                                                                                                          new SelectListItem {
                Text = x.Region + " (" + x.Region_ar + ")", Value = x.Region + ""
            }).ToList();

            ViewBag.distictdd = distict;

            coordinator_profile coordinator = null;
            var su = Session["user"] as ContextUser;

            if (id == null)
            {
                coordinator = new coordinator_profile();
                if (su.EnumRole == EnumUserRole.Coordinator)
                {
                    coordinator.school = su.OUser.coordinator_profile.First().school;
                }
                else
                {
                    coordinator.school = new school();
                }
                coordinator.IsActive = true;
                coordinator.Password = Membership.GeneratePassword(8, 4);
            }
            else
            {
                var coordinatorRepo = new CoordinatorRepository();
                coordinator          = coordinatorRepo.GetByRowId(id.Value);
                coordinator.Password = EncryptionKeys.Decrypt(coordinator.user.Password);
            }

            return(View(coordinator));
        }