Exemplo n.º 1
0
        public List <EmployeeDCR_Vw> getEmployeeBySupervisor(String Supervisor)
        {
            PartialViewModel model = new PartialViewModel();

            model.EmployeeDCR_Vws = ldcr.EmployeeDCR_Vw.Where(emp => emp.CurrentSupervisor.Equals(Supervisor) && emp.Job_Status.ToUpper().Contains("CURRENT")).ToList();
            return(model.EmployeeDCR_Vws);
        }
Exemplo n.º 2
0
        public ActionResult EmployeeByYear(int?page, String Year, String searchInput = "")
        {
            ViewBag.Year = Year;
            PartialViewModel model = new PartialViewModel();
            var certificate        = ldcr.CertificationTrackers.ToList();

            foreach (var cert in certificate)
            {
                System.Diagnostics.Debug.WriteLine(Convert.ToDateTime(cert.DateCertified).Year.ToString().ToUpper());
                if (Convert.ToDateTime(cert.DateCertified).Year.ToString().ToUpper().Equals(Year.ToUpper()))
                {
                    var employee = ldcr.EmployeeDCR_Vw.Where(emp => emp.Employee_ID == cert.EmpBadgeNo).FirstOrDefault();
                    if (!model.EmployeeDCR_Vws.Any(x => x.Employee_ID == employee.Employee_ID))
                    {
                        model.EmployeeDCR_Vws.Add(employee);
                    }
                }
            }
            List <EmployeeDCR_Vw> employees = model.EmployeeDCR_Vws;

            ViewBag.EmpCount = employees.Count();
            if (!string.IsNullOrEmpty(searchInput))
            {
                // get employee/employees with the same lastname with the input
                employees = model.EmployeeDCR_Vws.Where(a => a.Last_Name.ToLower().Contains(searchInput.ToLower()) || a.Employee_ID.Contains(searchInput)).ToList();
            }
            int pageSize   = 7; // pagelist number of page
            int pageNumber = (page ?? 1);

            return(View(employees.ToPagedList(pageNumber, pageSize)));
        }
Exemplo n.º 3
0
        public List <EmployeeDCR_Vw> getEmployeeByMedal(String Medal)
        {
            PartialViewModel model = new PartialViewModel();

            if (Medal != null)
            {
                if (Medal.ToString().ToUpper().Equals("BRONZE"))
                {
                    model.EmployeeDCR_Vws = ldcr.EmployeeDCR_Vw.Where(emp => emp.Medal.ToUpper().Equals("BRONZE") && emp.Job_Status.ToUpper().Contains("CURRENT")).ToList();
                    return(model.EmployeeDCR_Vws);
                }
                else if (Medal.ToString().ToUpper().Equals("SILVER"))
                {
                    model.EmployeeDCR_Vws = ldcr.EmployeeDCR_Vw.Where(emp => emp.Medal.ToUpper().Equals("SILVER") && emp.Job_Status.ToUpper().Contains("CURRENT")).ToList();
                    return(model.EmployeeDCR_Vws);
                }
                else if (Medal.ToString().ToUpper().Equals("GOLD"))
                {
                    model.EmployeeDCR_Vws = ldcr.EmployeeDCR_Vw.Where(emp => emp.Medal.ToUpper().Equals("GOLD") && emp.Job_Status.ToUpper().Contains("CURRENT")).ToList();
                    return(model.EmployeeDCR_Vws);
                }
                return(model.EmployeeDCR_Vws);
            }
            return(model.EmployeeDCR_Vws);
        }
Exemplo n.º 4
0
        public List <EmployeeDCR_Vw> getEmployeeByCell(String Cell)
        {
            PartialViewModel model = new PartialViewModel();

            model.EmployeeDCR_Vws = ldcr.EmployeeDCR_Vw.Where(emp => emp.HRCCell.Equals(Cell) && emp.Job_Status.ToUpper().Contains("CURRENT")).ToList();
            return(model.EmployeeDCR_Vws);
        }
Exemplo n.º 5
0
        // GET: Roles
        public ActionResult Index(short?idempresa)
        {
            if (Session["StringToken"] == null)
            {
                return(RedirectToAction("Index", "Home", AutenticacionServicio.InitIndex(new Models.Seguridad.LoginModel())));
            }
            _tok = Session["StringToken"].ToString();
            //ViewBag.listaEmpresas = AutenticacionServicio.EmpresasLogin();
            ViewBag.EsAdmin = TokenServicio.ObtenerEsAdministracionCentral(_tok);
            if (ViewBag.EsAdmin)
            {
                ViewBag.Empresas = CatalogoServicio.Empresas(_tok);
            }
            else
            {
                ViewBag.Empresas = CatalogoServicio.Empresas(_tok).SingleOrDefault().NombreComercial;
            }
            ViewBag.listaEmpresas = CatalogoServicio.Empresas(_tok);

            var _IdEmpresa = idempresa ?? ((List <EmpresaDTO>)ViewBag.listaEmpresas).FirstOrDefault().IdEmpresa;

            ViewBag.IdEmpresa = _IdEmpresa;
            List <RolDto>          lstGral    = CatalogoServicio.ObtenerRoles(_tok, _IdEmpresa);
            List <RolCompras>      _lstCompra = CatalogoServicio.getListcompras(lstGral);
            List <RolRequsicion>   _lstReq    = CatalogoServicio.getListrequisicion(lstGral);
            List <RolMovilCompra>  _lstMC     = CatalogoServicio.getListmc(lstGral);
            List <RolMovilVenta>   _lstMV     = CatalogoServicio.getListmv(lstGral);
            List <RolSistemaVenta> _lstSV     = CatalogoServicio.getListsv(lstGral);
            List <RolTransporte>   _lstST     = CatalogoServicio.getListTr(lstGral);
            PartialViewModel       rolCat     = new PartialViewModel()
            {
                ListaRoles        = lstGral,
                ListaRolesCom     = _lstCompra,
                ListaRequsicion   = _lstReq,
                ListaMovilCompra  = _lstMC,
                ListaMovilVenta   = _lstMV,
                ListaSistemaVenta = _lstSV,
                ListaTransporte   = _lstST
            };

            if (TempData["RespuestaDTO"] != null)
            {
                ViewBag.MessageExito = TempData["RespuestaDTO"];
            }

            if (TempData["RespuestaDTOError"] != null)
            {
                ViewBag.MessageError = Validar((RespuestaDTO)TempData["RespuestaDTOError"]);
            }
            TempData["RespuestaDTOError"] = ViewBag.MessageError;
            ViewBag.MessageError          = TempData["RespuestaDTOError"];

            return(View(rolCat));
        }
Exemplo n.º 6
0
        public ActionResult Chat(ChatRequestModel request)
        {
            var response = new PartialViewModel();

            var user = UserService.GetUser(request.User.Id);

            if (user == null || user.Role == Models.User_Model.RoleLevel.Blocked)
            {
                response.Logout = true;
                return(Json(response));
            }

            int chatroomId = 0;

            if (request.RawChatroomIdValue != null)
            {
                chatroomId = request.RawChatroomIdValue.GetHashCode();
            }
            int parentChatroomId = chatroomId; //temporary during initial testing

            string chatroomName = request.ChatroomName;

            if (!ChatroomService.DoesChatroomExist(chatroomId))
            {
                ChatroomService.CreateChatroom(chatroomId, chatroomName);
            }

            var joinErrors = SecurityService.CanUserJoinChatroom(request);

            response.Errors.AddRange(joinErrors);

            if (joinErrors.Count == 0)
            {
                if (!ChatroomService.AddUserToChatroom(chatroomId, parentChatroomId, request.User.Id, request.UserHandle))
                {
                    response.AddError("Error adding user into chatroom.");
                }
            }

            var chatroomModel = new ChatroomModel()
            {
                ChatroomId       = chatroomId,
                ChatroomName     = chatroomName,
                ParentChatroomId = parentChatroomId,
                UserHandle       = request.UserHandle,
                UserId           = request.User.Id
            };

            //response.Data = PartialView("~/Views/Chatroom/_Chat.cshtml", chatroomModel);
            response.Data = RenderPartialViewToString(this.ControllerContext, "~/Views/Chatroom/_Chat.cshtml", chatroomModel);

            return(Json(response));
        }
Exemplo n.º 7
0
        public JsonResult AddPartial(string paramdata)
        {
            var model = new PartialViewModel {
                Data = paramdata, ID = Guid.NewGuid().ToString()                              /*This is NOT a placeholder ID - advantage of the out-of-the-box, GUIDs-as-IDs EF/MySQL setup */
            };

            return(Json(new
            {
                markup = RenderViewToString("/Views/Home/_Partial.cshtml", model),
                model = model,
            }));
        }
Exemplo n.º 8
0
        public ActionResult GetJoinChatroomForm(GetJoinChatroomFormRequestModel request)
        {
            var response = new PartialViewModel();

            var model = new GetJoinChatroomFormResponseModel();

            model.HasPassword  = ChatroomService.HasPassword(request.ParentChatroomId, request.ChatroomId);
            model.ChatroomName = ChatroomService.GetChatroomName(request.ParentChatroomId, request.ChatroomId);

            model.NewChatroomId = request.ChatroomId;

            response.Data = RenderPartialViewToString(this.ControllerContext, "~/Views/Chatroom/_JoinChatroomForm.cshtml", model);

            return(Json(response));
        }
Exemplo n.º 9
0
        public List <EmployeeDCR_Vw> getEmployeeByCertificates(String Certificate)
        {
            PartialViewModel model = new PartialViewModel();
            var Certificates       = ldcr.CertificationTrackers.Where(cert => cert.CertificationCode.Contains(Certificate)).ToList();

            foreach (var certific in Certificates)
            {
                var employee = ldcr.EmployeeDCR_Vw.Where(emp => emp.Employee_ID.Equals(certific.EmpBadgeNo) && emp.Job_Status.ToUpper().Contains("CURRENT")).FirstOrDefault();
                if (employee != null)
                {
                    model.EmployeeDCR_Vws.Add(employee);
                }
            }
            return(model.EmployeeDCR_Vws);
        }
Exemplo n.º 10
0
        public ActionResult _DynamicTableBody(String Type, String data)
        {
            ViewBag.KeyName = Type;
            PartialViewModel model = new PartialViewModel();

            if (Request.IsAjaxRequest())
            {
                if (Type.ToString().ToUpper().Equals("BYMONTH"))
                {
                    model.EmployeeDCR_Vws = getEmployeeByMonth(data);
                }
                return(PartialView(model)); // Here must be return PartialView, not View.
            }
            else
            {
                return(View());
            }
        }
Exemplo n.º 11
0
    ///<note>You could certainly replace this functionality with a Factory object</note>
    private void SetPartialProperties(string name)
    {
        string root = "~/Areas/Administration/Views/Lookups/Partials/";

        switch (name.ToLower())
        {
        case "andsoon":
            PartialRelativePath = root + "AndSoOnPartial.cshtml";
            PartialModel        = new PartialViewModel();
            break;

        case "areas":
            PartialRelativePath = root + "AreasPartial.cshtml";
            PartialModel        = new PartialViewModel();
            break;

        case "locations":
            PartialRelativePath = root + "LocationsPartial.cshtml";
            PartialModel        = new PartialViewModel();
            break;

        case "products":
            PartialRelativePath = root + "ProductsPartial.cshtml";
            PartialModel        = new PartialViewModel();
            break;

        case "someotherthing":
            PartialRelativePath = root + "SomeOtherThingPartial.cshtml";
            PartialModel        = new PartialViewModel();
            break;

        case "storageyards":
            PartialRelativePath = root + "StorageYardsPartial.cshtml";
            PartialModel        = new PartialViewModel();
            break;

        case "yetanotherthing":
            PartialRelativePath = root + "YetAnotherThingPartial.cshtml";
            PartialModel        = new PartialViewModel();
            break;
        }
    }
Exemplo n.º 12
0
        public string ReturnPartialContent(PartialViewModel model)
        {
            switch (model.Cate.DisplayType)
            {
            case "Blog":
                return(RenderViewToString("~/Views/Shared/_BlogType.cshtml", model));

            case "List":
                return(RenderViewToString("~/Views/Shared/_ListType.cshtml", model));

            case "Grid":
                return(RenderViewToString("~/Views/Shared/_GridType.cshtml", model));

            case "Content":
                return(RenderViewToString("~/Views/Shared/_ContentType.cshtml", model));

            default:
                return(RenderViewToString("~/Views/Shared/_ListType.cshtml", model));
            }
        }
Exemplo n.º 13
0
        public List <EmployeeDCR_Vw> getEmployeeByMonthAndYear(String Year, String Month)
        {
            PartialViewModel model = new PartialViewModel();
            var certificate        = ldcr.CertificationTrackers.ToList();

            foreach (var cert in certificate)
            {
                if (Convert.ToDateTime(cert.DateCertified).Year.ToString().ToUpper().Equals(Year.ToUpper()) && Convert.ToDateTime(cert.DateCertified).ToString("MMMM").ToUpper().Equals(Month.ToUpper()))
                {
                    var employee = ldcr.EmployeeDCR_Vw.Where(emp => emp.Employee_ID == cert.EmpBadgeNo && emp.Job_Status.ToUpper().Contains("CURRENT")).FirstOrDefault();
                    if (employee != null)
                    {
                        if (!model.EmployeeDCR_Vws.Any(x => x.Employee_ID == employee.Employee_ID))
                        {
                            model.EmployeeDCR_Vws.Add(employee);
                        }
                    }
                }
            }
            return(model.EmployeeDCR_Vws);
        }
Exemplo n.º 14
0
        public int getCertifiedEmployeeByMonthThisYear(String Month)
        {
            var certificate = ldcr.certificateTracker_Vw.ToList();
            var dateNow     = Convert.ToDateTime(DateTime.Now);

            PartialViewModel model = new PartialViewModel();

            foreach (var cert in certificate)
            {
                if (Convert.ToDateTime(cert.DateCertified).Year.ToString().ToUpper().Equals(dateNow.Year.ToString().ToUpper()) && Convert.ToDateTime(cert.DateCertified).ToString("MMMM").ToUpper().Equals(Month.ToUpper()))
                {
                    var employee = ldcr.EmployeeDCR_Vw.Where(emp => emp.Employee_ID == cert.EmpBadgeNo).FirstOrDefault();
                    if (employee != null)
                    {
                        if (!model.EmployeeDCR_Vws.Any(x => x.Employee_ID == employee.Employee_ID))
                        {
                            model.EmployeeDCR_Vws.Add(employee);
                        }
                    }
                }
            }
            System.Diagnostics.Debug.WriteLine(model.EmployeeDCR_Vws.Count() + "fdjglkfdglfjhlkjgfkhjlkgfjhlkgfjhgfkhlgklkglhkglhkglhjklhgkjkhjgkjlghk");
            return(model.EmployeeDCR_Vws.Count());
        }
Exemplo n.º 15
0
        public ActionResult Index()
        {
            var listLevel = CommonConstants.GetListLevel();

            /*BANNER
             * --------------------------------------------*/
            var banners = _bannerRepo.GetMany(t => t.IsDeleted == false && t.IsLock == true && t.IsHeader == false).OrderBy(banner => banner.BannerIndex).ToList();

            ViewBag.Banners = banners;

            /*
             * --------------------------------------------*/
            var testimonials = _testimonialRepo.GetMany(t => t.IsDeleted == false).ToList();

            ViewBag.Testimonials = testimonials;

            /*HEADER MENU
             * --------------------------------------------*/
            var categories = _categoryRepo.GetMany(t => t.ParentId == 1).OrderBy(t => t.OrderNumber).ToList();

            ViewBag.Categories = categories;

            var ieltCat = _categoryRepo.GetMany(c => c.Name.Contains("IELT") && c.IsDeleted == false).Where(c => c.Name == "IELTS Foundation" || c.Name == "IELTS 5.5" || c.Name == "IELTS 6.5" || c.Name == "IELTS >7.5").OrderBy(c => c.OrderNumber).ToList();
            var satCat  = _categoryRepo.GetMany(c => c.Name.Contains("SAT") && c.IsDeleted == false).Where(c => c.Name == "SAT Beginner" || c.Name == "SAT Intermediate" || c.Name == "SAT Advanced" || c.Name == "SAT Super Advanced").OrderBy(c => c.OrderNumber).ToList();

            if (ieltCat != null)
            {
                ieltCat.AddRange(satCat);
                ViewBag.ListCat = ieltCat;
            }



            /*TOP NEWS
             * --------------------------------------------*/
            var usAbroad = db.Categories.FirstOrDefault(t => t.Id == 7);
            var handbook = db.Categories.FirstOrDefault(t => t.Id == 6);
            var ieenews  = db.Categories.FirstOrDefault(t => t.Id == 8);
            var hostnew  = db.Categories.FirstOrDefault(t => t.Id == 19);

            ViewBag.UsAbord  = usAbroad;
            ViewBag.Handbook = handbook;
            ViewBag.IeeNews  = ieenews;

            /*TOP NEWS
             * --------------------------------------------*/
            IEnumerable <Post> posts = null;

            if (hostnew != null)
            {
                // hostnew.PostCategories = db.PostCategories.Where(p => p.PostID == hostnew.Id).ToList();
                if (hostnew.PostCategories.Select(p => p.Post).Count() > 0)
                {
                    posts = hostnew.PostCategories.Select(p => p.Post).Take(2).ToList();
                }



                //_postRepo.GetMany(t => t.Categories.Where(c => t.Id == hostnew.Id).Any() == true).Take(2);
            }

            ViewBag.Top = posts;

            /*Khai giang
             * --------------------------------------------*/
            var openingPost = (from p in dbContext.DataContext.Posts
                               join pc in dbContext.DataContext.PostCategories
                               on p.Id equals pc.PostID
                               join c in dbContext.DataContext.Categories
                               on pc.CategoryID equals c.Id
                               where c.Name == "Thông tin khai giảng" && c.Position != null && c.Position.Contains("Home")
                               select p
                               ).OrderByDescending(a => a.Id).Take(4).ToList();

            ViewBag.OpeningPostCat = "Thông tin khai giảng";
            ViewBag.OpeningPost    = openingPost;

            /*blog du hoc
             * --------------------------------------------*/
            var blog = (from p in dbContext.DataContext.Posts
                        join pc in dbContext.DataContext.PostCategories
                        on p.Id equals pc.PostID
                        join c in dbContext.DataContext.Categories
                        on pc.CategoryID equals c.Id
                        where c.Name.Contains("Blog") && c.Position != null && c.Position.Contains("Home")
                        select p
                        ).Take(4).ToList();

            ViewBag.Blog = blog;

            /*Hoạt động IEE
             * --------------------------------------------*/
            var ieeActivity = (from p in dbContext.DataContext.Posts
                               join pc in dbContext.DataContext.PostCategories
                               on p.Id equals pc.PostID
                               join c in dbContext.DataContext.Categories
                               on pc.CategoryID equals c.Id
                               where c.Name.Contains("Hoạt động IEE") && c.Position != null && c.Position.Contains("Home")
                               select p
                               ).Take(3).ToList();

            ViewBag.IeeActivityCat  = "Hoạt động IEE".ToSeoUrl();
            ViewBag.IeeActivityPost = ieeActivity;

            /*other homepage cate
             * --------------------------------------------*/
            var listPartialViewModel = new List <PartialViewModel>();
            var others = dbContext.DataContext.Categories.Where(c => c.IsSystem.HasValue && !c.IsSystem.Value && c.Position != null && c.Position.Contains("Home")).ToList();

            foreach (var item in others)
            {
                var partialViewModel = new PartialViewModel();
                partialViewModel.Cate = item;
                if (item.PostCategories.Where(c => c.CategoryID == item.Id) != null && item.PostCategories.Where(c => c.CategoryID == item.Id).Count() > 0)
                {
                    var list = item.PostCategories.Where(c => c.CategoryID == item.Id).Select(p => p.Post).OrderByDescending(p => p.CreatedDate).ToList();
                    if (item.DisplayType == "List")
                    {
                        list = list.Take(3).ToList();
                    }
                    else if (item.DisplayType == "Grid")
                    {
                        list = list.Take(6).ToList();
                    }
                    else if (item.DisplayType == "Blog")
                    {
                        list = list.Take(4).ToList();
                    }
                    else if (item.DisplayType == "Content")
                    {
                        list = list.Take(1).ToList();
                    }
                    partialViewModel.ListPost = list;
                }
                listPartialViewModel.Add(partialViewModel);
            }
            ViewBag.ListPartialViewModel = listPartialViewModel;

            /*
             * --------------------------------------------*/

            //var calendar = dbContext.GetRepository<Calendar>().GetMany(x => DbFunctions.DiffDays(x.CreatedDate, DateTime.Now) >=0 ).OrderBy(c => c.CreatedDate).Take(3).ToList();
            //ViewBag.Calendar = calendar;

            var files = dbContext.GetRepository <Medium>().GetMany(m => m.Type == 2).OrderByDescending(f => f.CreatedDate).ToList();//uploaded document

            ViewBag.Files = files;

            var topUniversity = _universityHighlight.GetTop(6).OrderBy(r => r.Ranking).ToList();

            ViewBag.University = topUniversity;

            var topTeacher = _teacherHighlight.GetAll().ToList();

            ViewBag.Teacher = topTeacher;

            var allStudent = _studentHighlight.GetAll().ToList();
            var topSat     = allStudent.Where(t => t.SAT != null).OrderByDescending(s => s.SAT).Take(6).ToList();

            ViewBag.TopSAT = topSat;

            var topIELT = allStudent.Where(t => t.IELTS != null).OrderByDescending(s => s.IELTS).Take(6).ToList();

            ViewBag.TopIELT = topIELT;

            ViewBag.Facebook  = _settingRepo.Get(t => t.Id == 2).Value;
            ViewBag.Youtube   = _settingRepo.Get(t => t.Id == 3).Value;
            ViewBag.Linked    = _settingRepo.Get(t => t.Id == 6).Value;
            ViewBag.Gplus     = _settingRepo.Get(t => t.Id == 5).Value;
            ViewBag.Instagram = _settingRepo.Get(t => t.Id == 4).Value;

            ViewBag.Hotline = _settingRepo.Get(t => t.Id == 1).Value;
            ViewBag.Address = _settingRepo.Get(t => t.Key == "address").Value;
            ViewBag.Phone   = _settingRepo.Get(t => t.Key.Equals("phone")).Value;

            ViewBag.Title           = db.Settings.FirstOrDefault(t => t.Key.Equals("title")).Value;
            ViewBag.MetaKeys        = db.Settings.FirstOrDefault(t => t.Key.Equals("meta_key")).Value;
            ViewBag.MetaDescription = db.Settings.FirstOrDefault(t => t.Key.Equals("meta_description")).Value;

            return(View());
        }