示例#1
0
        // GET: All Property
        public ActionResult GetAllProperty(string Search_Data, int?Page_No, string Filter_Value)
        {
            var allProperty = _getPropertyDetailsWithUser.GetAllProperty();

            if (Search_Data != null)
            {
                Page_No = 1;
            }
            else
            {
                Search_Data = Filter_Value;
            }

            ViewBag.FilterValue = Search_Data;

            if (!string.IsNullOrEmpty(Search_Data))
            {
                allProperty = allProperty.Where(x => x.University.ToLower().Contains(Search_Data.ToLower()));
            }

            int Size_Of_Page = 2;
            int No_Of_Page   = (Page_No ?? 1);

            return(View(allProperty.ToPagedList(No_Of_Page, Size_Of_Page)));
        }
        public ActionResult Index(string Sorting_Order, string Search_Data, string Filter_Value, int?Page_No)
        {
            ViewBag.CurrentSortOrder = Sorting_Order;
            ViewBag.SortingName      = String.IsNullOrEmpty(Sorting_Order) ? "Name_Description" : "";

            if (Search_Data != null)
            {
                Page_No = 1;
            }
            else
            {
                Search_Data = Filter_Value;
            }

            ViewBag.FilterValue = Search_Data;

            var products = from stu in db.Products select stu;

            if (!String.IsNullOrEmpty(Search_Data))
            {
                products = products.Where(stu => stu.Name.ToUpper().Contains(Search_Data.ToUpper()));
            }
            switch (Sorting_Order)
            {
            case "Name":
                products = products.OrderByDescending(stu => stu.Name);
                break;
            }

            int Size_Of_Page = 4;
            int No_Of_Page   = (Page_No ?? 1);

            return(View(products.ToPagedList(No_Of_Page, Size_Of_Page)));
        }
        public ActionResult GetAllUsers(string Search_Data, int?Page_No, string Filter_Value)
        {
            var user   = _getUser.GetAll();
            var userId = User.Identity.GetSecurityUserId();

            ViewBag.UserId = userId;

            if (Search_Data != null)
            {
                Page_No = 1;
            }
            else
            {
                Search_Data = Filter_Value;
            }

            ViewBag.FilterValue = Search_Data;

            if (!string.IsNullOrEmpty(Search_Data))
            {
                user = user.Where(x => x.University.ToLower().Contains(Search_Data.ToLower()));
            }

            int Size_Of_Page = 2;
            int No_Of_Page   = (Page_No ?? 1);

            return(View(user.ToList().ToPagedList(No_Of_Page, Size_Of_Page)));
        }
示例#4
0
        // GET: Modifier
        public ActionResult GetAllModifiers(string Sorting_Order, string Search_Data, string Filter_Value, int?Page_No)
        {
            ViewBag.ProductName = Sorting_Order;

            if (Search_Data != null)
            {
                Page_No = 1;
            }
            else
            {
                Search_Data = Filter_Value;
            }

            ViewBag.FilterValue = Search_Data;
            var modifier = from s in modifierRepository.GetAllModifiers()
                           select s;

            if (!String.IsNullOrEmpty(Search_Data))
            {
                modifier = modifier.Where(s => s.date_creation.ToString().Contains(Search_Data.ToUpper()) ||
                                          s.Quantity.ToString().Contains(Search_Data.ToUpper()));
            }

            //IEnumerable<ModifierModel> listOfModifiers = modifierRepository.GetAllModifiers();

            int Size_Of_Page = 10;
            int No_Of_Page   = (Page_No ?? 1);

            return(View(modifier.ToPagedList(No_Of_Page, Size_Of_Page)));
        }
示例#5
0
        //public ActionResult Index()
        //{
        //    return View(Context.Emplyoees.ToList());
        //}

        public ActionResult Index(string Sorting_Order, string Search_Data, string Filter_Value, int?Page_No)
        {
            ViewBag.CurrentSortOrder = Sorting_Order;
            ViewBag.SortingName      = String.IsNullOrEmpty(Sorting_Order) ? "FirstName" : "";
            ViewBag.SortingDate      = Sorting_Order == "LastName" ? "City" : "Country";

            if (Search_Data != null)
            {
                Page_No = 1;
            }
            else
            {
                Search_Data = Filter_Value;
            }

            ViewBag.FilterValue = Search_Data;

            var students = from stu in Context.Emplyoees select stu;

            if (!String.IsNullOrEmpty(Search_Data))
            {
                students = students.Where(stu => stu.FirstName.ToUpper().Contains(Search_Data.ToUpper()) ||
                                          stu.LastName.ToUpper().Contains(Search_Data.ToUpper()));
            }
            switch (Sorting_Order)
            {
            case "FirstName":
                students = students.OrderByDescending(stu => stu.FirstName);
                break;

            case "LastName":
                students = students.OrderBy(stu => stu.LastName);
                break;

            case "Date_Description":
                students = students.OrderByDescending(stu => stu.EmailID);
                break;

            case "City":
                students = students.OrderByDescending(stu => stu.City);
                break;

            case "Country":
                students = students.OrderByDescending(stu => stu.Country);
                break;

            default:
                students = students.OrderBy(stu => stu.FirstName);
                break;
            }

            int Size_Of_Page = 4;
            int No_Of_Page   = (Page_No ?? 1);

            return(View(students.ToPagedList(No_Of_Page, Size_Of_Page)));
        }
示例#6
0
        // GET: Campaign
        public ActionResult Index(string Sorting_Order, string Search_Data, string Filter_Value, int?Page_No)
        {
            ViewBag.CurrentSortOrder = Sorting_Order;
            ViewBag.SortingId        = string.IsNullOrEmpty(Sorting_Order) ? "Id" : "";
            ViewBag.SortingName      = string.IsNullOrEmpty(Sorting_Order) ? "Name" : "";
            ViewBag.SortingDate      = string.IsNullOrEmpty(Sorting_Order) ? "Date" : "";
            ViewBag.SortingOrgName   = string.IsNullOrEmpty(Sorting_Order) ? "OrgName" : "";

            if (Search_Data != null)
            {
                Page_No = 1;
            }
            else
            {
                Search_Data = Filter_Value;
            }

            ViewBag.Filter_Value = Search_Data;

            var camps = from camp in dbcon.Campaigns.Include(a => a.Organisation) select camp;

            if (!string.IsNullOrEmpty(Search_Data))
            {
                camps = camps.Where(camp => camp.CampaignName.ToUpper().Contains(Search_Data.ToUpper() ?? string.Empty));
            }

            switch (Sorting_Order)
            {
            case "Id":
                camps = camps.OrderByDescending(camp => camp.Campid);
                break;

            case "Name":
                camps = camps.OrderByDescending(camp => camp.CampaignName);
                break;

            case "Date":
                camps = camps.OrderByDescending(camp => camp.StartDate);
                break;

            case "OrgName":
                camps = camps.OrderBy(camp => camp.Organisation.Name);
                break;

            default:
                camps = camps.OrderBy(camp => camp.Campid);
                break;
            }

            int Size_Of_Page = 5;
            int No_Of_Page   = (Page_No ?? 1);

            return(View(camps.ToPagedList(No_Of_Page, Size_Of_Page)));
        }
        // GET: Admin/Product
        public ActionResult Index(string Sorting_Order, string Search_Data, string Filter_Value, int?Page_No)
        {
            ViewBag.CurrentSortOrder = Sorting_Order == null ? "Id" : "";
            if (Search_Data != null)
            {
                Page_No = 1;
            }
            else
            {
                Search_Data = Filter_Value;
            }

            ViewBag.FilterValue = Search_Data;

            var products = ProductModel.Instance.GetAllProduct();

            if (!String.IsNullOrEmpty(Search_Data))
            {
                products = products.Where(s => s.ProductName.ToUpper().Contains(Search_Data.ToUpper()) ||
                                          s.Category.CategoryName.ToUpper().Contains(Search_Data.ToUpper())).ToList();
            }
            switch (Sorting_Order)
            {
            case "Id":
                products = products.OrderBy(s => s.ProductID).ToList();
                break;

            case "Product_Name":
                products = products.OrderBy(s => s.ProductName).ToList();
                break;

            case "Category":
                products = products.OrderBy(s => s.Category.CategoryName).ToList();
                break;

            case "Quantity_Per_Unit":
                products = products.OrderBy(s => s.QuantityPerUnit).ToList();
                break;

            case "Unit_Price":
                products = products.OrderBy(s => s.UnitPrice).ToList();
                break;

            default:
                products = products.OrderBy(s => s.ProductID).ToList();
                break;
            }

            int Size_Of_Page = 10;
            int No_Of_Page   = (Page_No ?? 1);

            return(View(products.ToPagedList(No_Of_Page, Size_Of_Page)));
        }
示例#8
0
        public IActionResult FetchStudents(string Sorting_Order, string Search_Data, string Filter_Value, int?Page_No)
        {
            ViewBag.CurrentSortOrder = Sorting_Order;
            ViewBag.SortingName      = String.IsNullOrEmpty(Sorting_Order) ? "Name_Description" : "";
            ViewBag.SortingAge       = String.IsNullOrEmpty(Sorting_Order) ? "Age_Description" : "StudentAge";

            if (Search_Data != null)
            {
                Page_No = 1;
            }
            else
            {
                Search_Data = Filter_Value;
            }

            ViewBag.FilterValue = Search_Data;
            var students = from stu in _studentComponent.GetCustomStudentData() select stu;

            {
                if (!String.IsNullOrEmpty(Search_Data))
                {
                    students = students.Where(x => x.StudentFirstName.ToUpper().Contains(Search_Data.ToUpper()) ||
                                              x.StudentLastName.ToUpper().Contains(Search_Data.ToUpper()));
                }
            }
            switch (Sorting_Order)
            {
            case "Name_Description":
                students = students.OrderByDescending(stu => stu.StudentFirstName);
                break;

            case "StudentAge":
                students = students.OrderBy(stu => stu.StudentAge);
                break;

            case "Age_Description":
                students = students.OrderByDescending(stu => stu.StudentAge);
                break;

            default:
                students = students.OrderBy(stu => stu.StudentFirstName);
                break;
            }
            int Size_Of_Page = 4;
            int No_Of_Page   = (Page_No ?? 1);

            return(View(students.ToPagedList(No_Of_Page, Size_Of_Page)));
        }
        public ActionResult Index(string Sorting_Order, string Search_Data, string Filter_Value, int?Page_No)
        {
            ViewBag.CurrentSortOrder = Sorting_Order;
            ViewBag.SortingName      = String.IsNullOrEmpty(Sorting_Order) ? "Name_Description" : "";
            ViewBag.SortingDate      = Sorting_Order == "Date_Enroll" ? "Date_Description" : "Date";

            if (Search_Data != null)
            {
                Page_No = 1;
            }
            else
            {
                Search_Data = Filter_Value;
            }

            ViewBag.FilterValue = Search_Data;

            var orders = from ord in db.Orders select ord;

            if (!String.IsNullOrEmpty(Search_Data))
            {
                orders = orders.Where(ord => ord.Employee.FirstName.ToUpper().Contains(Search_Data.ToUpper()) ||
                                      ord.Employee.LastName.ToUpper().Contains(Search_Data.ToUpper()));
            }
            switch (Sorting_Order)
            {
            case "Name_Description":
                orders = orders.OrderByDescending(ord => ord.Employee.FirstName);
                break;

            case "Date_Enroll":
                orders = orders.OrderBy(ord => ord.OrderDate);
                break;

            case "Date_Description":
                orders = orders.OrderByDescending(ord => ord.OrderDate);
                break;

            default:
                orders = orders.OrderBy(ord => ord.Employee.FirstName);
                break;
            }

            int Size_Of_Page = 10;
            int No_Of_Page   = (Page_No ?? 1);

            return(View(orders.ToPagedList(No_Of_Page, Size_Of_Page)));
        }
示例#10
0
        // GET: Student
        public ActionResult Index(string Sorting_Order, string Search_Data, string Filter_Value, int?Page_No)
        {
            using (var db = new Model2())
            {
                ViewBag.CurrentSortOrder = Sorting_Order;
                ViewBag.SortingName      = String.IsNullOrEmpty(Sorting_Order) ? "Name_Description" : "";
                ViewBag.SortingDate      = Sorting_Order == "Date_Enroll" ? "Date_Description" : "Date";
                if (Search_Data != null)
                {
                    Page_No = 1;
                }
                else
                {
                    Search_Data = Filter_Value;
                }
                ViewBag.FilterValue = Search_Data;
                var students = from stu in db.Students select stu;

                if (!String.IsNullOrEmpty(Search_Data))
                {
                    students = students.Where(stu => stu.FIrstName.ToUpper().Contains(Search_Data.ToUpper()) ||
                                              stu.LastName.ToUpper().Contains(Search_Data.ToUpper()));
                }


                switch (Sorting_Order)
                {
                case "Name_Description":
                    students = students.OrderByDescending(stu => stu.FIrstName);
                    break;

                case "Date_Enroll":
                    students = students.OrderBy(stu => stu.EnrollmentDate);
                    break;

                case "Date_Description":
                    students = students.OrderByDescending(stu => stu.EnrollmentDate);
                    break;

                default:
                    students = students.OrderBy(stu => stu.FIrstName);
                    break;
                }
                int Size_Of_Page = 3;
                int No_Of_Page   = (Page_No ?? 1);
                return(View(students.ToPagedList(No_Of_Page, Size_Of_Page)));
            }
        }
示例#11
0
        // GET: Movie
        public ActionResult Index(string Search_Data, string Filter_Value, int?Page_No)
        {
            IEnumerable <MovieModel> movies = null;

            if (Search_Data != null)
            {
                Page_No = 1;
            }
            else
            {
                Search_Data = Filter_Value;
            }

            ViewBag.FilterValue = Search_Data;
            int Size_Of_Page = 4;
            int No_Of_Page   = (Page_No ?? 1);

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri("https://localhost:44329/api/");
                var responseTask = client.GetAsync("movies");

                var result = responseTask.Result;

                if (result.IsSuccessStatusCode)
                {
                    var readTask = result.Content.ReadAsAsync <IList <MovieModel> >();
                    readTask.Wait();

                    ViewBag.FilterValue = Search_Data;
                    movies = readTask.Result;
                    if (!String.IsNullOrEmpty(Search_Data))
                    {
                        movies = movies.Where(s => s.title.ToLower() == Search_Data.ToLower()).OrderByDescending(s => s.year);
                    }
                    else
                    {
                        movies = movies.OrderByDescending(s => s.year);
                    }
                }
                else
                {
                    movies = Enumerable.Empty <MovieModel>();
                    ModelState.AddModelError(string.Empty, "Server error. Please contact administrator.");
                }
            }
            return(View(movies.ToPagedList(No_Of_Page, Size_Of_Page)));
        }
        // GET: Employees
        public ActionResult Index(string Sorting_Order, string Search_Data, string Filter_Value, int?Page_No)
        {
            ViewBag.CurrentSortOrder = Sorting_Order;
            ViewBag.SortingName      = String.IsNullOrEmpty(Sorting_Order) ? "Name_Description" : "";
            ViewBag.SortingDate      = Sorting_Order == "Date_of_Birth" ? "Date_Description" : "Date";

            if (Search_Data != null)
            {
                Page_No = 1;
            }
            else
            {
                Search_Data = Filter_Value;
            }

            ViewBag.FilterValue = Search_Data;
            var emps = from emp in db.Employees select emp;

            if (!String.IsNullOrEmpty(Search_Data))
            {
                emps = emps.Where(emp => emp.FirstName.ToUpper().Contains(Search_Data.ToUpper()) ||
                                  emp.LastName.ToUpper().Contains(Search_Data.ToUpper()));
            }
            switch (Sorting_Order)
            {
            case "Name_Description":
                emps = emps.OrderByDescending(emp => emp.FirstName);
                break;

            case "Date_of_Birth":
                emps = emps.OrderBy(emp => emp.DateOfBirth);
                break;

            case "Date_Description":
                emps = emps.OrderByDescending(emp => emp.DateOfBirth);
                break;

            default:
                emps = emps.OrderBy(emp => emp.FirstName);
                break;
            }
            int Size_Of_Page = 4;
            int No_Of_Page   = (Page_No ?? 1);

            return(View(emps.ToPagedList(No_Of_Page, Size_Of_Page)));
        }
示例#13
0
        public ActionResult DataSets(string Sorting_Order, string Search_Data, string Filter_Value, int?Page_No)
        {
            ViewBag.CurrentSortOrder = Sorting_Order;
            ViewBag.SortingName      = String.IsNullOrEmpty(Sorting_Order) ? "Name_Description" : "";

            if (Search_Data != null)
            {
                Page_No = 1;
            }
            else
            {
                Search_Data = Filter_Value;
            }

            ViewBag.FilterValue = Search_Data;
            var dataSetList = (from dataset in db.DataSets
                               join category in db.Categories on dataset.CategoryId equals category.Id
                               join organization in db.Organizations on dataset.OrganizationId equals organization.Id
                               join format in db.Formats on dataset.FormatId equals format.Id
                               join license in db.Licenses on dataset.LicenseId equals license.Id
                               join label in db.Labels on dataset.LabelId equals label.Id
                               select new DataSetViewModel
            {
                Id = dataset.Id,
                Title = dataset.Title,
                Description = dataset.Description,
                LabelName = label.Name,
                CategoryName = category.Name,
                OrganizationName = organization.Name,
                FormatName = format.Name,
                LicenseName = license.Name
            });

            if (!String.IsNullOrEmpty(Search_Data))
            {
                dataSetList = dataSetList.Where(stu => stu.Title.ToUpper().Contains(Search_Data.ToUpper()) || stu.CategoryName.ToUpper().Contains(Search_Data.ToUpper()) || stu.OrganizationName.ToUpper().Contains(Search_Data.ToUpper()));
            }

            dataSetList = dataSetList.OrderBy(stu => stu.Description);

            int Size_Of_Page = 10;
            int No_Of_Page   = (Page_No ?? 1);

            return(View(dataSetList.ToPagedList(No_Of_Page, Size_Of_Page)));
        }
示例#14
0
        // GET: Home
        public ActionResult GetAllRecipe(string Sorting_Order, string Search_Data, string Filter_Value, int?Page_No)
        {
            ViewBag.ProductName = Sorting_Order;

            if (Search_Data != null)
            {
                Page_No = 1;
            }
            else
            {
                Search_Data = Filter_Value;
            }

            ViewBag.FilterValue = Search_Data;
            var recipe = from s in recipeRepository.GetAll()
                         select s;

            if (!String.IsNullOrEmpty(Search_Data))
            {
                recipe = recipe.Where(s => s.ProductName.ToUpper().Contains(Search_Data.ToUpper()) ||
                                      s.date_creation.ToString().Contains(Search_Data.ToUpper()) ||
                                      s.Variation.ToUpper().Contains(Search_Data.ToUpper()));
            }

            //IEnumerable<RecipeModel> listOfRecipe = recipeRepository.GetAll();

            //if (!String.IsNullOrEmpty(Search_Data))
            //{
            //    var recipes = RecipeModel.Recipe.Where(i => i.ProductName.ToUpper().Contains(Search_Data.ToUpper()));

            //}
            //if (!String.IsNullOrEmpty(Search_Data))
            //       {
            //    //var RecipeModel= recipe.ProductName.Where(recipe=> recipe.)
            //    //RecipeModel = recipe..Where(i => i.Name.ToUpper().Contains(Search_Data.ToUpper())
            //    //   || i.Category.ToUpper().Contains(Search_Data.ToUpper()));
            //    //var RecipeModel= recipe1.Recipes.Where(i=> i.)

            //}
            int Size_Of_Page = 10;
            int No_Of_Page   = (Page_No ?? 1);

            return(View(recipe.ToPagedList(No_Of_Page, Size_Of_Page)));
        }
        // GET: Organisation
        public ActionResult Index(string Sorting_Order, string Search_Data, string Filter_Value, int?Page_No)
        {
            ViewBag.CurrentSortOrder = Sorting_Order;
            ViewBag.SortingId        = string.IsNullOrEmpty(Sorting_Order) ? "Id" : "";
            ViewBag.SortingName      = string.IsNullOrEmpty(Sorting_Order) ? "Name" : "";

            if (Search_Data != null)
            {
                Page_No = 1;
            }
            else
            {
                Search_Data = Filter_Value;
            }

            ViewBag.Filter_Value = Search_Data;

            var orgs = from org in dbcon.Organisations select org;

            if (!string.IsNullOrEmpty(Search_Data))
            {
                orgs = orgs.Where(org => org.Name.ToUpper().Contains(Search_Data.ToUpper() ?? string.Empty));
            }

            switch (Sorting_Order)
            {
            case "Id":
                orgs = orgs.OrderByDescending(org => org.id);
                break;

            case "Name":
                orgs = orgs.OrderByDescending(org => org.Name);
                break;

            default:
                orgs = orgs.OrderBy(org => org.id);
                break;
            }

            int Size_Of_Page = 5;
            int No_Of_Page   = (Page_No ?? 1);

            return(View(orgs.ToPagedList(No_Of_Page, Size_Of_Page)));
        }
        // GET: Products

        /*public ActionResult Index()
         * {
         *  var products = db.Products.Include(p => p.Cat);
         *  return View(products.ToList());
         * }*/
        public ActionResult Index(string Sorting_Order, string Search_Data, string Filter_Value, int?Page_No)
        {
            ViewBag.CurrentSortOrder = Sorting_Order;
            ViewBag.SortingName      = String.IsNullOrEmpty(Sorting_Order) ? "Name_Description" : "";
            if (Search_Data != null)
            {
                Page_No = 1;
            }
            else
            {
                Search_Data = Filter_Value;
            }

            ViewBag.FilterValue = Search_Data;
            //var store = from s in db.Stores select s;
            //store = store.Where(s);
            var pro = from p in db.Products select p;

            if (!String.IsNullOrEmpty(Search_Data))
            {
                pro = pro.Where(c => c.ProductName.ToUpper().Contains(Search_Data.ToUpper()));
            }
            switch (Sorting_Order)
            {
            case "Name_Description":
                pro = pro.OrderByDescending(c => c.ProductName);
                break;

            default:
                pro = pro.OrderBy(c => c.ProductName);
                break;
            }
            int Size_Of_Page = 5;
            int No_Of_Page   = (Page_No ?? 1);

            return(View(pro.ToPagedList(No_Of_Page, Size_Of_Page)));
        }
示例#17
0
        // GET: Cats
        public ActionResult Index(string Sorting_Order, string Search_Data, string Filter_Value, int?Page_No)
        {
            ViewBag.CurrentSortOrder = Sorting_Order;
            ViewBag.SortingName      = String.IsNullOrEmpty(Sorting_Order) ? "Name_Description" : "";
            if (Search_Data != null)
            {
                Page_No = 1;
            }
            else
            {
                Search_Data = Filter_Value;
            }

            ViewBag.FilterValue = Search_Data;
            var category = from c in db.Cats select c;

            if (!String.IsNullOrEmpty(Search_Data))
            {
                category = category.Where(c => c.Name.ToUpper().Contains(Search_Data.ToUpper()));
            }
            switch (Sorting_Order)
            {
            case "Name_Description":
                category = category.OrderByDescending(c => c.Name);
                break;

            default:
                category = category.OrderBy(c => c.Name);
                break;
            }
            int Size_Of_Page = 3;
            int No_Of_Page   = (Page_No ?? 1);

            return(View(category.ToPagedList(No_Of_Page, Size_Of_Page)));
            //return View(db.Cats.ToList());
        }
        // GET: /Storage/Attachment
        public ActionResult AttachmentEmbed(int?Page_No, string Search_Data, string Filter_Value)
        {
            ViewBag.postnum   = db.EP_POST.ToArray().Where(EP_POST => EP_POST.UserID == User.Identity.GetUserId() && EP_POST.Type == "Post").Count();
            ViewBag.attachnum = db.EP_POST.ToArray().Where(EP_POST => EP_POST.UserID == User.Identity.GetUserId() && EP_POST.Type == "Attachment").Count();
            ViewBag.imagenum  = db.EP_POST.ToArray().Where(EP_POST => EP_POST.UserID == User.Identity.GetUserId() && EP_POST.Type == "Image").Count();
            ViewBag.videonum  = db.EP_POST.ToArray().Where(EP_POST => EP_POST.UserID == User.Identity.GetUserId() && EP_POST.Type == "Video").Count();
            ViewBag.linknum   = db.EP_POST.ToArray().Where(EP_POST => EP_POST.UserID == User.Identity.GetUserId() && EP_POST.Type == "Link").Count();

            //if (Page_No == null)
            //{
            //    Page_No = 1;
            //}
            if (Search_Data != null)
            {
                Page_No = 1;
            }
            else
            {
                Search_Data = Filter_Value;
            }

            ViewBag.FilterValue = Search_Data;

            int Size_Of_Page = 4;
            int No_Of_Page   = (Page_No ?? 1);
            var posts        = db.EP_POST.ToList().Where(EP_POST => EP_POST.UserID == User.Identity.GetUserId() && EP_POST.Type == "Attachment").OrderByDescending(EP_POST => EP_POST.ID).ToPagedList(No_Of_Page, Size_Of_Page);

            if (Search_Data != null)
            {
                posts = db.EP_POST.ToList().Where(pst => pst.Title.ToUpper().Contains(Search_Data.ToUpper()) && pst.UserID == User.Identity.GetUserId()).OrderByDescending(pst => pst.ID).ToPagedList(No_Of_Page, Size_Of_Page);
            }

            return(View(posts));
        }
示例#19
0
        // GET: Ingredient
        public ActionResult GetAllIngredients(string Sorting_Order, string Search_Data, string Filter_Value, int?Page_No)
        {
            ViewBag.Name = Sorting_Order;

            if (Search_Data != null)
            {
                Page_No = 1;
            }
            else
            {
                Search_Data = Filter_Value;
            }

            ViewBag.FilterValue = Search_Data;
            var ingredients = ingredientRepository.GetAllIngredients();

            if (!String.IsNullOrEmpty(Search_Data))
            {
                ingredients = ingredients.Where(x => !string.IsNullOrEmpty(x.Category) && x.Category.ToLower().Contains(Search_Data.Trim().ToLower()));
            }

            int Size_Of_Page = 10;
            int No_Of_Page   = (Page_No ?? 1);

            return(View(ingredients.ToPagedList(No_Of_Page, Size_Of_Page)));
        }
示例#20
0
        public ActionResult CandidatList(string Sorting_Order, string Search_Data, string Filter_Value, int?Page_No, string OrderType)
        {
            ViewBag.OrderType        = OrderType ?? "desc";
            ViewBag.CurrentSortOrder = Sorting_Order;
            Sorting_Order            = Sorting_Order ?? "FirstName";

            if (Search_Data != null)
            {
                Page_No = 1;
            }
            else
            {
                Search_Data = Filter_Value;
            }

            ViewBag.FilterValue = Search_Data;

            var workers = hrServices.GetAllCandidats();

            if (!String.IsNullOrEmpty(Search_Data))
            {
                workers = workers.Where(stu => stu.FirstName.ToUpper().Contains(Search_Data.ToUpper()) ||
                                        stu.Surname.ToUpper().Contains(Search_Data.ToUpper()) ||
                                        stu.FirstName.ToUpper().Contains(Search_Data.ToUpper()));       ///reszta
            }
            switch (Sorting_Order)
            {
            case "FirstName":
                if (ViewBag.OrderType == "desc")
                {
                    workers           = workers.OrderByDescending(stu => stu.FirstName);
                    ViewBag.OrderType = "asc";
                }
                else
                {
                    workers           = workers.OrderBy(stu => stu.FirstName);
                    ViewBag.OrderType = "desc";
                }
                break;

            case "Surname":
                if (ViewBag.OrderType == "desc")
                {
                    workers           = workers.OrderByDescending(stu => stu.Surname);
                    ViewBag.OrderType = "asc";
                }
                else
                {
                    workers           = workers.OrderBy(stu => stu.Surname);
                    ViewBag.OrderType = "desc";
                }
                break;

            case "Date":
                if (ViewBag.OrderType == "desc")
                {
                    workers           = workers.OrderByDescending(stu => stu.DateOfBirth);
                    ViewBag.OrderType = "asc";
                }
                else
                {
                    workers           = workers.OrderBy(stu => stu.DateOfBirth);
                    ViewBag.OrderType = "desc";
                }
                break;

            case "Employment":
                if (ViewBag.OrderType == "desc")
                {
                    workers           = workers.OrderByDescending(stu => stu.Employment.EmploymentType);
                    ViewBag.OrderType = "asc";
                }
                else
                {
                    workers           = workers.OrderBy(stu => stu.Employment.EmploymentType);
                    ViewBag.OrderType = "desc";
                }
                break;

            case "Position":
                if (ViewBag.OrderType == "desc")
                {
                    workers           = workers.OrderByDescending(stu => stu.Employment.PositionCode);
                    ViewBag.OrderType = "asc";
                }
                else
                {
                    workers           = workers.OrderBy(stu => stu.Employment.PositionCode);
                    ViewBag.OrderType = "desc";
                }
                break;

            //cd
            default:
                workers = workers.OrderBy(stu => stu.FirstName);
                break;
            }

            int Size_Of_Page = 10;
            int No_Of_Page   = (Page_No ?? 1);

            WorkersListViewModel wlVM = new WorkersListViewModel();

            wlVM.Workers    = workers.ToPagedList(No_Of_Page, Size_Of_Page);
            wlVM.PageCount  = (int)Math.Ceiling((double)workers.Count() / Size_Of_Page);
            wlVM.PageNumber = Page_No ?? 1;

            return(View(wlVM));
        }
示例#21
0
        // GET: CRUD
        public ActionResult Index(string Sorting_Order, string Search_Data, string Filter_Value, int?Page_No)
        {
            IEnumerable <ProductDetail> proobj = null;
            HttpClient h = new HttpClient();

            h.BaseAddress = new Uri("https://localhost:44366/api/ProductCrud");

            var consumeapi = h.GetAsync("ProductCrud");

            consumeapi.Wait();

            var readdata = consumeapi.Result;

            if (readdata.IsSuccessStatusCode)
            {
                var displaydata = readdata.Content.ReadAsAsync <IList <ProductDetail> >();
                displaydata.Wait();

                proobj = displaydata.Result;
            }

            ViewBag.CurrentSortOrder = Sorting_Order;
            ViewBag.ProductName      = String.IsNullOrEmpty(Sorting_Order) ? "ProductName" : "";
            ViewBag.CategoryName     = String.IsNullOrEmpty(Sorting_Order) ? "CategoryName" : "";


            if (Search_Data != null)
            {
                Page_No = 1;
            }
            else
            {
                Search_Data = Filter_Value;
            }

            ViewBag.FilterValue = Search_Data;

            var prod = from prodt in db.ProductDetails select prodt;

            if (!String.IsNullOrEmpty(Search_Data))
            {
                prod = prod.Where(prodt => prodt.ProductName.ToUpper().Contains(Search_Data.ToUpper()) ||
                                  prodt.CategoryName.ToUpper().Contains(Search_Data.ToUpper()));
            }

            switch (Sorting_Order)
            {
            case "ProductName":
                prod = prod.OrderByDescending(x => x.ProductName);
                break;

            case "CategoryName":
                prod = prod.OrderByDescending(x => x.CategoryName);
                break;

            case "Category":
                prod = prod.OrderBy(x => x.CategoryName);
                break;

            default:
                prod = prod.OrderBy(prodt => prodt.ID);
                break;
            }

            int Size_Of_Page = 4;
            int No_Of_Page   = (Page_No ?? 1);

            return(View(prod.ToPagedList(No_Of_Page, Size_Of_Page)));
        }
        public ActionResult EachArea(int?id, string Sorting_Order, string Search_Data, string Filter_Value, string Searchby, int?Page_No)
        {
            ViewBag.CurrentSortOrder = Sorting_Order;
            ViewBag.SortingName      = String.IsNullOrEmpty(Sorting_Order) ? "Name" : "";
            ViewBag.SortingDate      = Sorting_Order == "Year" ? "descending year" : "Year";

            if (Search_Data != null)
            {
                Page_No = 1;
            }
            else
            {
                Search_Data = Filter_Value;
            }

            ViewBag.FilterValue = Search_Data;

            var students = (from m in db.SeniorProjects
                            join s in db.ProjectsAOIs on m.SPtId equals s.SPtId
                            where s.AOIId == id
                            select m
                            );


            bool sby = false;

            if (Searchby == "1")//title
            {
                students = students.Where(stu => stu.SPName.ToUpper().Contains(Search_Data.ToUpper()));
                sby      = true;
            }
            if (Searchby == "2")//year
            {
                students = students.Where(stu => stu.Year.ToString().Contains(Search_Data.ToUpper()));
                sby      = true;
            }
            if (Searchby == "3")//programming l
            {
                students = students.Where(stu => stu.progLang.ToUpper().Contains(Search_Data.ToUpper()));
                sby      = true;
            }
            if (!String.IsNullOrEmpty(Search_Data) && sby == false)
            {
                students = students.Where(stu => stu.SPName.ToUpper().Contains(Search_Data.ToUpper()));
            }

            switch (Sorting_Order)
            {
            case "Name":
                students = students.OrderByDescending(stu => stu.SPName);
                break;

            case "Year":
                students = students.OrderBy(stu => stu.Year);
                break;

            case "descending year":
                students = students.OrderByDescending(stu => stu.Year);
                break;

            default:
                students = students.OrderBy(stu => stu.SPName);
                break;
            }


            int Size_Of_Page = 6;
            int No_Of_Page   = (Page_No ?? 1);

            return(View(students.ToPagedList(No_Of_Page, Size_Of_Page)));
        }
示例#23
0
        public ActionResult DataRequests(string Sorting_Order, string Search_Data, string Filter_Value, int?Page_No)
        {
            ViewBag.CurrentSortOrder = Sorting_Order;
            ViewBag.SortingName      = String.IsNullOrEmpty(Sorting_Order) ? "Name_Description" : "";

            if (Search_Data != null)
            {
                Page_No = 1;
            }
            else
            {
                Search_Data = Filter_Value;
            }

            ViewBag.FilterValue = Search_Data;
            var dataRequestList = (from dataRequest in db.DataRequests
                                   join status in db.Status on dataRequest.StatusId equals status.Id
                                   select new DataRequestViewModel
            {
                Id = dataRequest.Id,
                Title = dataRequest.Title,
                Description = dataRequest.Description,
                StatusName = status.Name
            });

            if (!String.IsNullOrEmpty(Search_Data))
            {
                dataRequestList = dataRequestList.Where(stu => stu.Title.ToUpper().Contains(Search_Data.ToUpper()) || stu.Description.ToUpper().Contains(Search_Data.ToUpper()) || stu.StatusName.ToUpper().Contains(Search_Data.ToUpper()));
            }

            dataRequestList = dataRequestList.OrderBy(stu => stu.Description);

            int Size_Of_Page = 10;
            int No_Of_Page   = (Page_No ?? 1);

            return(View(dataRequestList.ToPagedList(No_Of_Page, Size_Of_Page)));
        }