Example #1
0
        /// <summary>
        /// obtains a detail of modules module
        /// </summary>
        /// <param name="id">identifier of module</param>
        /// <returns>returns the result to action</returns>
        public ActionResult Detail(int?id)
        {
            ModulRepository objmod = new ModulRepository(SessionCustom);

            Domain.Entities.Modul objmodul = null;
            objmod.Entity.LanguageId = CurrentLanguage.LanguageId;

            if (id != null)
            {
                objmod.Entity.ModulId = id;
                objmod.Load();
                objmodul      = objmod.Entity;
                objmod.Entity = new Domain.Entities.Modul()
                {
                    LanguageId = CurrentLanguage.LanguageId
                };
                ViewBag.id = id;
            }

            return(this.View(new Modulos()
            {
                UserPrincipal = CustomUser,
                Module = this.Module,
                Modul = objmodul,
                ColModul = CustomMemberShipProvider.GetModuls(CustomUser.UserId, SessionCustom, HttpContext),
                CollModuls = objmod.GetAllReadOnly(),
                CurrentLanguage = CurrentLanguage
            }));
        }
Example #2
0
        /// <summary>
        /// obtains the role detail
        /// </summary>
        /// <param name="id">identifier of role</param>
        /// <returns>returns the result to action</returns>
        public ActionResult Detail(int?id)
        {
            RolRepository      objrol      = new RolRepository(SessionCustom);
            ModulRepository    objmod      = new ModulRepository(SessionCustom);
            RolmodulRepository objrolmodul = new RolmodulRepository(SessionCustom);

            objmod.Entity.LanguageId = CurrentLanguage.LanguageId.Value;
            Domain.Entities.Rol rol = null;

            if (id != null)
            {
                objrolmodul.Entity.RolId = objrol.Entity.RolId = id;
                objrol.Load();
                rol        = objrol.Entity;
                ViewBag.id = id;
            }

            return(this.View(new Roles()
            {
                UserPrincipal = CustomUser,
                Module = this.Module,
                RolCustom = rol,
                ColModul = CustomMemberShipProvider.GetModuls(CustomUser.UserId, SessionCustom, HttpContext),
                CollModuls = objmod.GetAllReadOnly(),
                CollRolmodul = id != null ? objrolmodul.GetAllReadOnly() : null,
                CurrentLanguage = CurrentLanguage
            }));
        }
Example #3
0
        /// <summary>
        /// gets the index of the idea report module
        /// </summary>
        /// <returns>returns the result to action</returns>
        public ActionResult Index()
        {
            IdeaReportRepository ideaReport = new IdeaReportRepository(SessionCustom);
            ModulRepository      modul      = new ModulRepository(SessionCustom);

            modul.Entity.ModulId    = 56;
            modul.Entity.LanguageId = CurrentLanguage.LanguageId;
            modul.Load();

            PaginInfo paginInfo = new PaginInfo()
            {
                PageIndex = 1
            };

            return(this.View(new Models.IdeaReport()
            {
                UserPrincipal = CustomUser,
                Module = modul.Entity,
                CollIdeaReport = ideaReport.GetAllPaging(null, paginInfo),
                ColModul = CustomMemberShipProvider.GetModuls(CustomUser.UserId, SessionCustom, HttpContext),
                Total = paginInfo.TotalCount,
                Controller = modul.Entity.Controller,
                CurrentLanguage = CurrentLanguage
            }));
        }
Example #4
0
        public ActionResult Detail(int id, int?mod, int?sectionId)
        {
            SuccessStoryPostulateFacade successStoryPostulateFacade = new SuccessStoryPostulateFacade();
            TagFacade       tagFacade = new TagFacade();
            ModulRepository modul     = new ModulRepository(SessionCustom);

            modul.Entity.ModulId    = mod;
            modul.Entity.LanguageId = this.CurrentLanguage.LanguageId;
            modul.Load();
            this.ViewBag.SectionId = sectionId;

            SuccessStoryPostulate successStoryPostulate = successStoryPostulateFacade.GetById(id, (int)this.CurrentLanguage.LanguageId);

            successStoryPostulate.State = (byte)SuccessStoryPostulateStateEnum.Pending;
            successStoryPostulateFacade.Update(successStoryPostulate);

            return(this.View(new DetailModel
            {
                SuccessStoryPostulate = successStoryPostulate,
                TagsText = string.Join(", ", tagFacade.GetBySuccessStoryPostulate(id).Select(t => t.Name)),
                UserPrincipal = this.CustomUser,
                ColModul = CustomMemberShipProvider.GetModuls(this.CustomUser.UserId, this.SessionCustom, HttpContext),
                Module = modul.Entity,
                CurrentLanguage = this.CurrentLanguage,
            }));
        }
Example #5
0
        /// <summary>
        /// Obtiene las postulaciones
        /// </summary>
        /// <param name="page">page index</param>
        /// <param name="mod">Identificador del modulo</param>
        /// <param name="sectionId">Identificador de la seccion</param>
        /// <returns>Vista de las postulaciones</returns>
        public ActionResult List(int?page, int?mod, int?sectionId)
        {
            int total      = 0;
            int pageSize   = 10;
            int pageNumber = page ?? 1;
            SuccessStoryPostulateFacade        postulates = new SuccessStoryPostulateFacade();
            ModulRepository                    modul      = new ModulRepository(SessionCustom);
            List <SuccessStoryPostulatePaging> paging     = postulates.GetPaging(pageNumber, pageSize, out total, this.CurrentLanguage.LanguageId.Value).ToList();

            modul.Entity.ModulId    = mod;
            modul.Entity.LanguageId = this.CurrentLanguage.LanguageId;
            modul.Load();
            decimal nropagesdec = decimal.Parse(total.ToString()) / decimal.Parse(pageSize.ToString());
            decimal nropagesint = (int)(total / pageSize);

            this.ViewBag.CurrentPage = pageNumber;
            this.ViewBag.TotalRows   = total;
            this.ViewBag.SizePage    = pageSize;
            this.ViewBag.NroPages    = nropagesdec > nropagesint ? nropagesint + 1 : nropagesint;
            this.ViewBag.SectionId   = sectionId;

            return(this.View(
                       "List",
                       new SuccessStoryPostulateModel()
            {
                UserPrincipal = this.CustomUser,
                ListaSuccessStoryPostulate = paging,
                ColModul = CustomMemberShipProvider.GetModuls(this.CustomUser.UserId, this.SessionCustom, HttpContext),

                Module = modul.Entity,
                CurrentLanguage = this.CurrentLanguage,
            }));
        }
Example #6
0
        /// <summary>
        /// obtains user modules
        /// </summary>
        /// <param name="userId">identifier of user</param>
        /// <param name="session">framework that establishes communication between the application and the database</param>
        /// <param name="context">HTTP context</param>
        /// <returns>returns a list of modules</returns>
        public static List <Modul> GetModuls(int userId, ISession session, HttpContextBase context)
        {
            Language language = null;

            if (context.Session["lang"] != null)
            {
                language = (Language)context.Session["lang"];
            }

            if (language == null || !language.LanguageId.HasValue)
            {
                LanguageRepository languagerepo = new LanguageRepository(session);
                languagerepo.GetByUser(userId);
                language = languagerepo.Entity;
                context.Session.Add("lang", language);

                if (!language.LanguageId.HasValue)
                {
                    language.LanguageId = 2;
                }
            }

            ModulRepository objmodul = new ModulRepository(session);

            return(objmodul.GetModulsbyuser(userId, language.LanguageId.Value));
        }
Example #7
0
        /// <summary>
        /// deletes a module
        /// </summary>
        /// <param name="id">identifier of module</param>
        /// <returns>returns the result to action</returns>
        public ActionResult Delete(int id)
        {
            ModulRepository objmod = new ModulRepository(SessionCustom);

            objmod.Entity.ModulId = id;
            objmod.Delete();

            this.InsertAudit("Delete", this.Module.Name + " -> " + id);

            return(this.RedirectToAction("Index", "Modulos"));
        }
Example #8
0
        /// <summary>
        /// Creates an action invoker.
        /// </summary>
        /// <returns>An action invoker.</returns>
        protected override IActionInvoker CreateActionInvoker()
        {
            string controller = HttpContext.Request.RequestContext.RouteData.Values["controller"].ToString();

            if (HttpContext.User.Identity.IsAuthenticated)
            {
                string     cookieName = FormsAuthentication.FormsCookieName;
                HttpCookie authCookie = HttpContext.Request.Cookies[cookieName];
                FormsAuthenticationTicket authTicket = FormsAuthentication.Decrypt(authCookie.Value);

                string[] data = authTicket.UserData.Split('|');

                FormsIdentity id = new FormsIdentity(authTicket);
                HttpContext.User = this.CustomUser = new CustomPrincipal(id, data);

                if (HttpContext.Session["lang"] != null)
                {
                    this.CurrentLanguage = (Language)HttpContext.Session["lang"];
                }
                else
                {
                    LanguageRepository languagerepo = new LanguageRepository(this.SessionCustom);
                    languagerepo.GetByUser(this.CustomUser.UserId);
                    this.CurrentLanguage = languagerepo.Entity;
                    HttpContext.Session.Add("lang", this.CurrentLanguage);
                }

                Thread.CurrentThread.CurrentCulture   = new CultureInfo(this.CurrentLanguage.Culturename);
                Thread.CurrentThread.CurrentUICulture = new CultureInfo(this.CurrentLanguage.Culturename);
            }
            else
            {
                this.CustomUser = new CustomPrincipal(HttpContext.User.Identity);
                LanguageRepository languagerepo = new LanguageRepository(this.SessionCustom);
                languagerepo.Entity.IsDefault = true;
                languagerepo.Load();
            }

            if (controller != null)
            {
                ModulRepository modulrepo = new ModulRepository(this.SessionCustom);
                modulrepo.Entity.Controller = controller;
                if (this.CurrentLanguage != null)
                {
                    modulrepo.Entity.LanguageId = this.CurrentLanguage.LanguageId;
                }

                modulrepo.Load();
                this.Module = modulrepo.Entity;
            }

            return(base.CreateActionInvoker());
        }
Example #9
0
        public ActionResult Detail(int?id, Modulos model)
        {
            ModulRepository         objmod    = new ModulRepository(SessionCustom);
            ModullanguageRepository modullang = new ModullanguageRepository(SessionCustom);

            objmod.Entity = model.Modul;

            try
            {
                SessionCustom.Begin();
                if (id != null)
                {
                    objmod.Entity.ModulId = id;
                    objmod.Update();

                    modullang.Entity.ModulId    = id;
                    modullang.Entity.LanguageId = CurrentLanguage.LanguageId;
                    modullang.Load();

                    if (modullang.Entity.Name != null)
                    {
                        modullang.Entity.Name = model.Modul.Name;
                        modullang.Update();
                    }
                    else
                    {
                        modullang.Entity.Name = model.Modul.Name;
                        modullang.Insert();
                    }

                    this.InsertAudit("Update", this.Module.Name + " -> " + objmod.Entity.Name);
                }
                else
                {
                    objmod.Entity.IsBasic = false;
                    int modulId = Convert.ToInt32(objmod.Insert());
                    modullang.Entity.ModulId    = modulId;
                    modullang.Entity.LanguageId = CurrentLanguage.LanguageId;
                    modullang.Entity.Name       = model.Modul.Name;
                    modullang.Insert();
                    this.InsertAudit("Insert", this.Module.Name + " -> " + objmod.Entity.Name);
                }

                this.SessionCustom.Commit();
            }
            catch (Exception ex)
            {
                this.SessionCustom.RollBack();
                Utils.InsertLog(this.SessionCustom, "Error " + this.Module.Name, ex.ToString());
            }

            return(this.RedirectToAction("Index", "Modulos"));
        }
Example #10
0
        /// <summary>
        /// gets the home of modules module
        /// </summary>
        /// <returns>returns the result to action</returns>
        public ActionResult Index()
        {
            ModulRepository objmod = new ModulRepository(SessionCustom);

            objmod.Entity.LanguageId = CurrentLanguage.LanguageId;
            return(this.View(new Modulos()
            {
                UserPrincipal = CustomUser,
                Module = this.Module,
                CollModuls = objmod.GetAll(),
                ColModul = CustomMemberShipProvider.GetModuls(CustomUser.UserId, SessionCustom, HttpContext),
                CurrentLanguage = CurrentLanguage
            }));
        }
Example #11
0
        public ActionResult Index(int mod)
        {
            ContentRepository content    = new ContentRepository(SessionCustom);
            ModulRepository   modul      = new ModulRepository(SessionCustom);
            SectionRepository objsection = new SectionRepository(SessionCustom);

            PaginInfo paginInfo = new PaginInfo()
            {
                PageIndex = 1
            };

            content.Entity.ModulId    = mod;
            modul.Entity.ModulId      = content.Entity.ModulId = mod;
            content.Entity.LanguageId = modul.Entity.LanguageId = CurrentLanguage.LanguageId;
            modul.Load();

            ////objsection.Entity.Active = true;
            objsection.Entity.LanguageId = CurrentLanguage.LanguageId;

            if (HttpContext.Session["CollClones"] != null)
            {
                ViewBag.CollClone = (List <int>)HttpContext.Session["CollClones"];
            }

            return(this.View(new Models.Content()
            {
                UserPrincipal = CustomUser,
                Module = modul.Entity,
                CollSection = objsection.GetAll().Where(t => t.ParentId == null),
                ColModul = CustomMemberShipProvider.GetModuls(CustomUser.UserId, SessionCustom, HttpContext),
                CollContent = content.GetAllPaging(null, paginInfo),
                Total = paginInfo.TotalCount,
                Controller = modul.Entity.Controller,
                CurrentLanguage = CurrentLanguage
            }));
        }