Ejemplo n.º 1
0
        public ActionResult NotifIndex(SearchModelDate searchModel)
        {
            ViewBag.Home = true;
            if (Session["UserId"] != null)
            {
                int UserId = (int)Session["UserId"];

                ViewHome model     = new ViewHome();
                DateTime?startDate = null;
                DateTime?endDate   = null;

                if (!string.IsNullOrEmpty(searchModel.startDate))
                {
                    startDate = DateTime.ParseExact(searchModel.startDate, "dd.MM.yyyy", CultureInfo.InvariantCulture);
                }
                if (!string.IsNullOrEmpty(searchModel.endDate))
                {
                    endDate = DateTime.ParseExact(searchModel.endDate, "dd.MM.yyyy", CultureInfo.InvariantCulture);
                }

                model.Notifications = db.Notifications.Where(av => (av.UserId == UserId) &&
                                                             (startDate != null ? av.AddingDate >= startDate : true) &&
                                                             (endDate != null ? av.AddingDate <= endDate : true)
                                                             ).OrderByDescending(av => av.AddingDate).ToList();
                model.SearchDate = searchModel;
                return(View(model));
            }
            else
            {
                return(RedirectToAction("login", "home"));
            }
        }
Ejemplo n.º 2
0
        // GET: Holiday
        public ActionResult Index()
        {
            ViewHome data = new ViewHome
            {
                Holidays = db.Holidays.ToList()
            };

            return(View(data));
        }
Ejemplo n.º 3
0
        // GET: Departments
        public ActionResult Index()
        {
            ViewHome data = new ViewHome
            {
                Departments = db.Departments.ToList(),
                Employees   = db.Employees.ToList()
            };

            return(View(data));
        }
        public ActionResult UsrOprCreate()
        {
            ViewBag.Administrative = true;
            ViewHome model = new ViewHome()
            {
                Employees = db.Employees.ToList()
            };

            return(View(model));
        }
Ejemplo n.º 5
0
        public ActionResult MngOprIndex()
        {
            ViewBag.Administrative = true;
            ViewHome model = new ViewHome
            {
                Operations = db.Operations.ToList(),
            };

            return(View(model));
        }
Ejemplo n.º 6
0
        public ActionResult ActOprMngCreate()
        {
            ViewBag.Administrative = true;

            ViewHome model = new ViewHome()
            {
                Operations = db.Operations.ToList()
            };

            return(View(model));
        }
        public ActionResult UsrOprIndex()
        {
            ViewBag.Administrative = true;

            ViewHome model = new ViewHome
            {
                Users = db.Users.ToList(),
            };

            return(View(model));
        }
Ejemplo n.º 8
0
        public ActionResult Department()
        {
            ViewHome data = new ViewHome
            {
                Employees   = db.Employees.ToList(),
                Departments = db.Departments.ToList(),
                Roles       = db.Roles.ToList()
            };

            return(View(data));
        }
        public ActionResult AccCreate(int?id)
        {
            ViewBag.Administrative = true;
            ViewBag.UserId         = id;
            ViewHome model = new ViewHome()
            {
                Operations = db.Operations.ToList()
            };

            return(View(model));
        }
Ejemplo n.º 10
0
        public ActionResult Index(int page = 1)
        {
            int      count = (page - 1) * 4;
            ViewHome data  = new ViewHome
            {
                Events     = db.Events.OrderBy(e => e.StartDate).Skip(count).Take(4).ToList(),
                EventTypes = db.EventTypes.ToList()
            };

            ViewBag.EventCount = db.Events.Count();
            return(View(data));
        }
Ejemplo n.º 11
0
        // GET: Reports
        public ActionResult Index()
        {
            ViewHome data = new ViewHome
            {
                Employees     = db.Employees.ToList(),
                Attendances   = db.Attendances.ToList(),
                Holidays      = db.Holidays.ToList(),
                LeaveRequests = db.LeaveRequests.Where(l => l.IsAccepted == true).ToList(),
                LeaveTypes    = db.LeaveTypes.ToList()
            };

            return(View(data));
        }
Ejemplo n.º 12
0
        public ActionResult AccIndex(int?id)
        {
            ViewBag.Administrative = true;
            ViewBag.UserId         = id;
            ViewBag.User           = db.Users.Find(id);

            ViewHome model = new ViewHome()
            {
                Permissions = db.Permissions.Where(p => p.UserId == id).ToList()
            };

            return(View(model));
        }
Ejemplo n.º 13
0
        public ActionResult ActOprMngUpdate(int id)
        {
            ViewBag.Administrative = true;

            ViewHome model = new ViewHome()
            {
                Operations = db.Operations.ToList()
            };
            Actions act = db.Actions.Find(id);

            ViewBag.Act = act;
            return(View(model));
        }
Ejemplo n.º 14
0
        public ActionResult Index()
        {
            Employee emp      = (Employee)Session["user"];
            int      userId   = db.Users.FirstOrDefault(u => u.EmployeeId == emp.Id).Id;
            var      todoList = db.Todolists.Where(l => l.UserId == userId);

            ViewHome data = new ViewHome()
            {
                Todolists = todoList.Where(t => t.Date >= remove).ToList(),
                Employees = db.Employees.ToList()
            };

            return(View(data));
        }
Ejemplo n.º 15
0
        public IActionResult Index()
        {
            List <Balo> balos     = baloRepository.Gets().Take(20).ToList();
            List <Balo> balossale = (from balo in baloRepository.Gets() where balo.Sale > 0 select balo).Take(10).ToList();
            var         model     = new ViewHome()
            {
                balos     = balos,
                balossale = balossale
            };
            List <Category> categories = GetCategories();

            ViewBag.Advertises = advertisesRepository.Gets();
            ViewBag.Categories = categories;
            return(View(model));
        }
Ejemplo n.º 16
0
        public ActionResult searchUserIndex(UniversalSearch universalSearch)
        {
            ViewBag.Administrative = true;
            ViewHome model = new ViewHome();

            model.Actions = db.Actions.ToList();

            if (universalSearch.actionId != null && universalSearch.actionId != 0)
            {
                model.Users = db.Users.Where(u => u.Permissions.FirstOrDefault(p => p.ActionId == universalSearch.actionId).ActionId == universalSearch.actionId).ToList();
            }

            model.UniversalSearch = universalSearch;

            return(View(model));
        }
Ejemplo n.º 17
0
        public ActionResult Index()
        {
            ViewHome model = new ViewHome();

            model.About     = db.Abouts.FirstOrDefault();
            model.Slide     = db.slides.ToList();
            model.icon      = db.icons.ToList();
            model.service   = db.Services.ToList();
            model.range     = db.ranges.ToList();
            model.news      = db.news.ToList();
            model.team      = db.teams.ToList();
            model.gallery   = db.galleries.ToList();
            model.helpdesk  = db.helpdesks.FirstOrDefault();
            model.subscribe = db.subscribes.ToList();
            return(View(model));
        }
Ejemplo n.º 18
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            bool Access = false;

            string action = (string)filterContext.RouteData.Values["action"];

            int ActionId = 0;

            if (db.Actions.FirstOrDefault(a => a.Name == action) != null)
            {
                ActionId = db.Actions.FirstOrDefault(a => a.Name == action).Id;
            }

            int  UserId = (int)HttpContext.Current.Session["UserId"];
            bool Status = false;

            if (db.Users.Find(UserId).IsAdmin == true)
            {
                Status = true;
            }

            ViewHome model = new ViewHome();

            model.Permissions = db.Permissions.ToList();

            if (Status)
            {
                Access = true;
            }
            else
            {
                foreach (var item in model.Permissions)
                {
                    if (item.UserId == UserId && item.ActionId == ActionId)
                    {
                        Access = true;
                    }
                }
            }

            if (Access == false)
            {
                filterContext.Result = new RedirectResult("~/home/index");
                return;
            }
            base.OnActionExecuting(filterContext);
        }
Ejemplo n.º 19
0
        public ActionResult ActOprMngIndex(string searchData)
        {
            ViewBag.Administrative = true;
            ViewBag.SearchData     = searchData;
            ViewHome model = new ViewHome();

            if (searchData != null)
            {
                model.Actions = db.Actions.Where(d => d.Name.ToString().Contains(searchData) == true).ToList();
            }
            else
            {
                model.Actions = db.Actions.ToList();
            }

            return(View(model));
        }
Ejemplo n.º 20
0
        public ActionResult Index()
        {
            ViewHome data = new ViewHome
            {
                Slides      = db.Slides.ToList(),
                Adds        = db.Ads.ToList(),
                TopRated    = db.Products.OrderByDescending(p => p.Reviews.Count()).Take(10).ToList(),
                NewArrivals = db.Products.OrderByDescending(p => p.CreatedAt).Take(10).ToList(),
                Featured    = db.Products.OrderByDescending(p => p.view).Take(10).ToList(),
                SaleOff     = db.Products.OrderByDescending(p => p.DiscountPrice != null).ToList(),
                Tags        = db.Tags.Take(10).ToList(),
                Reviews     = db.Reviews.ToList(),
            };

            ViewBag.Tags = db.Tags.ToList();
            return(View(data));
        }
Ejemplo n.º 21
0
        // GET: Home
        public ActionResult Index()
        {
            List <category> category = db.categories.ToList();
            Random          rd1      = new Random();
            Random          rd2      = new Random();
            int             skip     = rd1.Next(1, db.products.Count() - 6);
            int             skip2    = rd2.Next(1, db.products.Count() - 9);
            List <product>  product  = db.products.Where(x => x.status == true).OrderByDescending(x => x.product_id).Skip(skip).ToList();
            List <product>  product2 = db.products.Where(x => x.status == true).OrderBy(x => x.product_id).Skip(skip2).ToList();
            var             view     = new ViewHome
            {
                category = category,
                product  = product,
                product2 = product2
            };

            return(View(view));
        }
Ejemplo n.º 22
0
        public ActionResult Index()
        {
            ViewHome data = new ViewHome
            {
                Setting      = db.Settings.FirstOrDefault(),
                Services     = db.Services.ToList(),
                Skills       = db.Skills.ToList(),
                Numbers      = db.Numbers.ToList(),
                Categories   = db.Categories.ToList(),
                Portfolios   = db.Portfolios.ToList(),
                ChooesUs     = db.ChooesUs.ToList(),
                Members      = db.Members.ToList(),
                Packages     = db.Packages.ToList(),
                Clients      = db.Clients.ToList(),
                Testimonials = db.Testimonials.ToList()
            };

            return(View(data));
        }
Ejemplo n.º 23
0
        public IActionResult Detail(int id)
        {
            Balo balo = baloRepository.Get(id);

            if (balo == null)
            {
                return(View("~/Views/Error/ProductNotFound.cshtml", id));
            }
            List <Balo> balos = (from b in baloRepository.Gets() where b.CategoryId == balo.CategoryId select b).Take(10).ToList();
            var         model = new ViewHome()
            {
                balo  = balo,
                balos = balos
            };
            List <Category> categories = GetCategories();

            ViewBag.Categories = categories;
            return(View(model));
        }
Ejemplo n.º 24
0
        public IActionResult Search(ViewHome model)
        {
            if (model.key == null)
            {
                return(RedirectToAction("index", "home"));
            }
            List <Balo> balos       = (from balo in baloRepository.Gets() where balo.KeySearch.Contains(model.key.ToLower()) select balo).ToList();
            List <Balo> balossale   = (from balo in baloRepository.Gets() where balo.Sale > 0 select balo).Take(10).ToList();
            var         modelreturl = new ViewHome()
            {
                balos     = balos,
                balossale = balossale
            };
            List <Category> categories = GetCategories();

            ViewBag.Advertises = advertisesRepository.Gets();
            ViewBag.Categories = categories;
            return(View(modelreturl));
        }
Ejemplo n.º 25
0
        public ActionResult UsrOprUpdate(int id)
        {
            ViewBag.Administrative = true;

            Users usr = db.Users.Find(id);

            if (usr == null)
            {
                return(RedirectToAction("UsrOprIndex"));
            }
            ViewHome model = new ViewHome()
            {
                Employees = db.Employees.ToList()
            };

            ViewBag.User = usr;

            return(View(model));
        }
        public ActionResult Index()
        {
            ViewBag.Setting = db.Settings.First();
            ViewHome model = new ViewHome
            {
                Features     = db.Features.ToList(),
                About        = db.Abouts.FirstOrDefault(),
                Services     = db.Services.ToList(),
                Skills       = db.Skills.ToList(),
                Categories   = db.Categories.ToList(),
                Projects     = db.Projects.ToList(),
                Stats        = db.Stats.ToList(),
                Packages     = db.Packages.ToList(),
                Packageinfos = db.Packageinfos.ToList(),
                Feedbacks    = db.Feedbacks.ToList(),
                Posts        = db.Posts.ToList()
            };

            return(View(model));
        }
Ejemplo n.º 27
0
        public ActionResult Requests()
        {
            //var shouldBeDeleted = db.LeaveRequests.Where(l =>(l.FinishDate) < DateTime.Now).ToList();
            //db.LeaveRequests.RemoveRange(shouldBeDeleted);
            //db.SaveChanges();
            ViewHome data = new ViewHome();

            data.LeaveRequests = db.LeaveRequests.ToList();
            List <LeaveType> list = new List <LeaveType>();

            foreach (var item in db.LeaveTypes)
            {
                if (db.LeaveRequests.FirstOrDefault(l => l.LeaveTypeId == item.Id) != null)
                {
                    list.Add(item);
                }
            }
            data.LeaveTypes = list.ToList();


            return(View(data));
        }
Ejemplo n.º 28
0
        public IActionResult Balos(int id)
        {
            var catory = categoryRepository.Get(id);

            if (catory == null)
            {
                return(View("~/Views/Error/CategoryNotFound.cshtml", id));
            }
            List <Balo> balos     = (from balo in baloRepository.Gets() where balo.CategoryId == catory.CategoryId select balo).ToList();
            List <Balo> balossale = (from balo in baloRepository.Gets() where balo.Sale > 0 select balo).Take(10).ToList();
            var         model     = new ViewHome()
            {
                balos     = balos,
                balossale = balossale
            };
            List <Category> categories = GetCategories();

            ViewBag.Advertises = advertisesRepository.Gets();
            ViewBag.category   = catory;
            ViewBag.Categories = categories;
            return(View(model));
        }