Exemplo n.º 1
0
        /// <summary>
        /// gets the home of BlogEntry module
        /// </summary>
        /// <returns>returns the result to action</returns>
        public ActionResult Index()
        {
            SetLabel();
            Business.Services.CustomPrincipal currentUserInfo = (Business.Services.CustomPrincipal)User;
            if (Utils.IsBlogAdmin(currentUserInfo.UserId))
            {
                int mod       = 54;
                int sectionId = 34;

                ContentManagement  objcontentman = new ContentManagement(this.SessionCustom, HttpContext);
                SectionRepository  objsection    = new SectionRepository(this.SessionCustom);
                TemplateRepository objtemplate   = new TemplateRepository(this.SessionCustom);
                objtemplate.Entity.Type = 0;

                return(this.View(new BlogEntryModel()
                {
                    UserPrincipal = this.CustomUser,
                    Module = this.Module,
                    ColModul = CustomMemberShipProvider.GetModuls(this.CustomUser.UserId, this.SessionCustom, HttpContext),
                    Templates = objtemplate.GetAll().Select(t => t.TemplateId),
                    DeepFollower = Business.Utils.GetDeepFollower(objsection.GetAll(), sectionId),
                    IContent = new Domain.Entities.Content()
                    {
                        ModulId = mod,
                        SectionId = sectionId
                    },
                    CurrentLanguage = this.CurrentLanguage
                }));
            }

            return(null);
        }
Exemplo n.º 2
0
        /// <summary>
        /// gets the home of challenge module
        /// </summary>
        /// <param name="mod">identifier of module</param>
        /// <param name="sectionId">identifier of section</param>
        /// <returns>returns the result to action</returns>
        public ActionResult Index(int mod, int?sectionId)
        {
            ContentManagement  objcontentman = new ContentManagement(this.SessionCustom, HttpContext);
            SectionRepository  objsection    = new SectionRepository(this.SessionCustom);
            TemplateRepository objtemplate   = new TemplateRepository(this.SessionCustom);
            ContentRepository  objcontent    = new ContentRepository(SessionCustom);
            TagFacade          tagFacade     = new TagFacade();

            objtemplate.Entity.Type = 0;

            return(this.View(new ChallengeModel()
            {
                UserPrincipal = this.CustomUser,
                Module = this.Module,
                ColModul = CustomMemberShipProvider.GetModuls(this.CustomUser.UserId, this.SessionCustom, HttpContext),
                Templates = objtemplate.GetAll().Select(t => t.TemplateId),
                DeepFollower = sectionId != null ? Business.Utils.GetDeepFollower(objsection.GetAll(), sectionId.Value) : null,
                IContent = new Domain.Entities.Content()
                {
                    ModulId = mod,
                    SectionId = sectionId
                },
                CurrentLanguage = this.CurrentLanguage,
                Categories = objcontent.Categories(),
                Tags = tagFacade.GetAll().Select(t => new SelectListItem {
                    Text = t.Name, Value = t.TagId.ToString()
                })
            }));
        }
Exemplo n.º 3
0
        /// <summary>
        /// obtains the idea detail
        /// </summary>
        /// <param name="mod">identifier of module</param>
        /// <param name="id">identifier of section</param>
        /// <returns>returns the result to action</returns>
        public ActionResult Detail(int mod, int id)
        {
            QuestionRepository   objquestion   = new QuestionRepository(SessionCustom);
            ContentManagement    objcontentman = new ContentManagement(SessionCustom, HttpContext);
            ContentRepository    objcontent    = new ContentRepository(SessionCustom);
            IdeaRepository       objidea       = new IdeaRepository(SessionCustom);
            FileattachRepository objfiles      = new FileattachRepository(SessionCustom);
            TagRepository        objtag        = new TagRepository(SessionCustom);
            SectionRepository    objsection    = new SectionRepository(SessionCustom);
            TemplateRepository   objtemplate   = new TemplateRepository(SessionCustom);
            CommentRepository    objcomment    = new CommentRepository(SessionCustom);

            objtemplate.Entity.Type = 0;

            objidea.Entity.IdeaId        =
                objcomment.Entity.IdeaId = id;
            objidea.LoadByKey();

            objquestion.Entity.ContentId    =
                objcontent.Entity.ContentId = objidea.Entity.ContentId;
            objcontent.LoadByKey();
            objquestion.LoadByKey();

            if (objquestion.Entity != null && objquestion.Entity.Type.Equals(Domain.Entities.Question.TypeQuestion.Ubicacion))
            {
                ViewBag.Location = true;
            }
            else
            {
                ViewBag.Location = false;
            }

            int totalComments = 0;
            List <CommentsPaging> comments = objcomment.CommentsPaging(0, 50, out totalComments, id);

            ViewBag.TotalComments = totalComments;

            IEnumerable <Tag> SelectedTags = objtag.GetTagbycontent(id);

            this.ViewBag.SelectedTags = string.Join("|", SelectedTags.Select(t => t.TagId));
            this.ViewBag.NewsTags     = string.Empty;

            return(this.View(
                       "Detail",
                       new IdeaModel()
            {
                UserPrincipal = this.CustomUser,
                ColModul = CustomMemberShipProvider.GetModuls(this.CustomUser.UserId, this.SessionCustom, HttpContext),
                Module = this.Module,
                ListFiles = objfiles.GetAllReadOnly(),
                Idea = objidea.Entity,
                IContent = objcontent.Entity,
                Templates = objtemplate.GetAll().Select(t => t.TemplateId),
                ListContent = objcontent.GetContentRelation(CurrentLanguage.LanguageId.Value),
                ListTags = SelectedTags,
                DeepFollower = Business.Utils.GetDeepFollower(objsection.GetAll(), objcontent.Entity.SectionId.Value),
                CurrentLanguage = this.CurrentLanguage,
                ListComments = comments
            }));
        }
        //[AdminAuthorization]
        public IHttpActionResult GetAllClassesSections()
        {
            List <Section> s = secrepo.GetAll();

            if (s == null)
            {
                return(StatusCode(HttpStatusCode.NoContent));
            }
            return(Ok(s));
        }
Exemplo n.º 5
0
        /// <summary>
        /// gets the detail of a banner
        /// </summary>
        /// <param name="id">identifier of banner</param>
        /// <returns>returns the result to action</returns>
        public ActionResult Detail(int?id)
        {
            BannerRepository   objbanner         = new BannerRepository(SessionCustom);
            SectionManagement  objsection        = new SectionManagement(SessionCustom, HttpContext);
            SectionRepository  sectionrepository = new SectionRepository(SessionCustom);
            PositionRepository objposition       = new PositionRepository(SessionCustom);

            Domain.Entities.Banner banner = null;
            bool?isHome = null;

            if (id != null)
            {
                objbanner.Entity.BannerId = id;
                objbanner.Load();
                banner     = objbanner.Entity;
                ViewBag.id = id;

                BannersectionRepository objbannersection = new BannersectionRepository(SessionCustom);
                objbannersection.Entity.BannerId = id;

                List <Bannersection> collsections = objbannersection.GetAll();
                objsection.CreateTreeViewCheck(sectionrepository.GetAll().FindAll(t => t.LanguageId == CurrentLanguage.LanguageId), collsections);
                isHome = collsections.Exists(t => t.SectionId == 0);
            }
            else
            {
                objsection.CreateTreeViewCheck(sectionrepository.GetAll().FindAll(t => t.LanguageId == CurrentLanguage.LanguageId), null);
            }

            return(this.View(new Banners()
            {
                UserPrincipal = CustomUser,
                Banner = banner,
                ColModul = CustomMemberShipProvider.GetModuls(CustomUser.UserId, SessionCustom, HttpContext),
                Module = this.Module,
                TreeView = objsection.Tree,
                Collposition = objposition.GetAll(),
                IsHome = isHome,
                CurrentLanguage = CurrentLanguage
            }));
        }
Exemplo n.º 6
0
        /// <summary>
        /// obtains the challenge detail
        /// </summary>
        /// <param name="mod">identifier of module</param>
        /// <param name="id">identifier of section</param>
        /// <param name="sectionId">seccion del molulo</param>
        /// <returns>returns the result to action</returns>
        public ActionResult Detail(int mod, int id, int?sectionId)
        {
            ContentManagement      objcontentman   = new ContentManagement(SessionCustom, HttpContext);
            ContentRepository      objcontent      = new ContentRepository(SessionCustom);
            SuccessStoryRepository objSuccessStory = new SuccessStoryRepository(SessionCustom);
            FileattachRepository   objfiles        = new FileattachRepository(SessionCustom);
            TagRepository          objtag          = new TagRepository(SessionCustom);
            SectionRepository      objsection      = new SectionRepository(SessionCustom);
            TemplateRepository     objtemplate     = new TemplateRepository(SessionCustom);
            CommentRepository      objcomment      = new CommentRepository(SessionCustom);
            TagFacade tagFacade = new TagFacade();

            objtemplate.Entity.Type = 0;

            objSuccessStory.Entity.ContentId        =
                objfiles.Entity.ContentId           =
                    objcomment.Entity.ContentId     =
                        objcontent.Entity.ContentId = id;

            objSuccessStory.LoadByKey();
            objcontent.LoadByKey();

            int totalComments = 0;
            List <CommentsPaging> comments = objcomment.CommentsPagingContent(0, 50, out totalComments, id);

            ViewBag.TotalComments = totalComments;

            IEnumerable <Tag> SelectedTags = objtag.GetTagbycontent(id);

            this.ViewBag.SelectedTags = string.Join("|", SelectedTags.Select(t => t.TagId));
            this.ViewBag.NewsTags     = string.Empty;

            return(this.View(
                       "Index",
                       new SuccessStoryModel()
            {
                UserPrincipal = this.CustomUser,
                ColModul = CustomMemberShipProvider.GetModuls(this.CustomUser.UserId, this.SessionCustom, HttpContext),
                Module = this.Module,
                ListFiles = objfiles.GetAllReadOnly(),
                SuccessStory = objSuccessStory.Entity,
                IContent = objcontent.Entity,
                Templates = objtemplate.GetAll().Select(t => t.TemplateId),
                ListContent = objcontent.GetContentRelation(CurrentLanguage.LanguageId.Value),
                ListTags = SelectedTags,
                DeepFollower = Business.Utils.GetDeepFollower(objsection.GetAll(), objcontent.Entity.SectionId.Value),
                CurrentLanguage = this.CurrentLanguage,
                ListComments = comments,
                Tags = tagFacade.GetAll().Select(t => new SelectListItem {
                    Text = t.Name, Value = t.TagId.ToString()
                })
            }));
        }
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            ISectionRepository sectionRepo = new SectionRepository();
            await sectionRepo.Insert(new Section()
            {
                SectionName = "Section1",
                Students = new List<Student>() { new Student() { Name = "Student1" }, new Student() { Name = "Student2" } }
            });

            var sections = await sectionRepo.GetAll();

            base.OnNavigatedTo(e);
        }
Exemplo n.º 8
0
 /// <summary>
 /// obtains a list of section with parent null
 /// </summary>
 /// <param name="languageId">identifier language</param>
 /// <returns>returns a list of sections</returns>
 public IEnumerable <Section> GetSectionsParentNull(int languageId)
 {
     try
     {
         SectionRepository objsection = new SectionRepository(this.session);
         objsection.Entity.LanguageId = languageId;
         return(objsection.GetAll().Where(t => t.ParentId == null));
     }
     catch (Exception ex)
     {
         Utils.InsertLog(
             this.session,
             "Load Sections",
             ex.Message + " - " + ex.StackTrace);
         return(null);
     }
 }
Exemplo n.º 9
0
        public ActionResult ReadData([DataSourceRequest] DataSourceRequest request)
        {
            bool hasPermissions = sectionRpstry.GetPermission(sectionName, loggedUser.UserId, canRead);

            if (hasPermissions)
            {
                return(Json(rpstry.GetAll().Select(x => new
                {
                    id = x.id,
                    title = x.title,
                    dateModified = x.dateModified
                }).ToDataSourceResult(request)));
            }
            else
            {
                return(View("Error", "You do not have permissions to access this section."));
            }
        }
Exemplo n.º 10
0
        public ActionResult ViewDetail(int id)
        {
            ContentRepository         objcont    = new ContentRepository(SessionCustom);
            UserRepository            objuser    = new UserRepository(SessionCustom);
            SectionRepository         objSection = new SectionRepository(SessionCustom);
            ContentrelationRepository objrel     = new ContentrelationRepository(SessionCustom);

            objrel.Entity.ContentId = id;

            objcont.Entity.ContentId = id;
            objcont.Load();

            objuser.Entity.UserId = objcont.Entity.UserId;
            objuser.Load();

            return(this.View(new InfoContent()
            {
                Content = objcont.Entity,
                Autor = objuser.Entity.Names,
                DeepFollower = Business.Utils.GetDeepFollower(objSection.GetAll(), objcont.Entity.SectionId.Value),
                CountContent = objrel.GetAllReadOnly().Count
            }));
        }
Exemplo n.º 11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FrontEndManagement"/> class
        /// </summary>
        /// <param name="session">framework that establishes communication between the application and the database</param>
        /// <param name="context">HTTP Context</param>
        /// <param name="type">Type of front end object</param>
        /// <param name="language">language of thread</param>
        public FrontEndManagement(ISession session, HttpContextBase context, Type type, Language language)
        {
            this.session  = session;
            this.context  = context;
            this.language = language;
            this.type     = type;

            SectionRepository objsec = new SectionRepository(session);

            this.sections = new List <Section>();
            InfoCache <List <Section> > cache = new InfoCache <List <Section> >(context)
            {
                TimeOut = 120
            };

            this.sections = cache.GetCache("sectionsactive");

            if (this.sections == null)
            {
                objsec.Entity.Active = true;
                this.sections        = objsec.GetAll();
                cache.SetCache("sectionsactive", this.sections);
            }
        }
Exemplo n.º 12
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
            }));
        }
Exemplo n.º 13
0
        /// <summary>
        /// change the section parent
        /// </summary>
        /// <param name="sectionId">identifier of section</param>
        /// <param name="parentId">identifier of parent section</param>
        /// <returns>returns the result to action</returns>
        public JsonResult ChangeParent(int sectionId, int parentId)
        {
            SectionRepository objsection = new SectionRepository(SessionCustom);
            SectionManagement objman     = new SectionManagement(SessionCustom, HttpContext);

            objsection.Entity.SectionId = sectionId;
            objsection.LoadByKey();

            if (parentId != 0)
            {
                objsection.Entity.ParentId = parentId;
            }
            else
            {
                objsection.Entity.ParentId = null;
            }

            objsection.Update();
            objsection.Entity = new Section();

            objman.CreateTreeView(sectionId, objsection.GetAll());

            return(this.Json(new { result = true, html = objman.Tree }));
        }
Exemplo n.º 14
0
 public IEnumerable <Section> GetAllSections()
 {
     return(sectionRepository.GetAll());
 }
Exemplo n.º 15
0
        /// <summary>
        /// obtains the news detail
        /// </summary>
        /// <param name="mod">identifier of module</param>
        /// <param name="id">identifier of section</param>
        /// <returns>returns the result to action</returns>
        public ActionResult Detail(int mod, int id)
        {
            ContentManagement    objcontentman = new ContentManagement(SessionCustom, HttpContext);
            ContentRepository    objcontent    = new ContentRepository(SessionCustom);
            NewsRepository       objnews       = new NewsRepository(SessionCustom);
            FileattachRepository objfiles      = new FileattachRepository(SessionCustom);
            TagRepository        objtag        = new TagRepository(SessionCustom);
            SectionRepository    objsection    = new SectionRepository(SessionCustom);
            TemplateRepository   objtemplate   = new TemplateRepository(SessionCustom);
            MoldRepository       objMold       = new MoldRepository(SessionCustom);
            XmlNodeList          collXmlNode   = null;
            TagFacade            tagFacade     = new TagFacade();

            List <Domain.Entities.Mold> collMold = objMold.GetAll();

            collMold.Insert(
                0,
                new Domain.Entities.Mold()
            {
                Name = Resources.Global.Messages.SELECT
            });

            objtemplate.Entity.Type = 0;

            objnews.Entity.ContentId            =
                objfiles.Entity.ContentId       =
                    objcontent.Entity.ContentId = id;

            objnews.LoadByKey();
            objcontent.LoadByKey();

            if (objnews.Entity.MoldId != null)
            {
                XmlDocument objXmlDocument = new XmlDocument();
                objXmlDocument.LoadXml(objnews.Entity.Xmlcontent);
                collXmlNode = objXmlDocument.GetElementsByTagName("node");
            }

            IEnumerable <Tag> SelectedTags = objtag.GetTagbycontent(id);

            this.ViewBag.SelectedTags = string.Join("|", SelectedTags.Select(t => t.TagId));
            this.ViewBag.NewsTags     = string.Empty;

            return(this.View(
                       "Index",
                       new NewsModel()
            {
                UserPrincipal = this.CustomUser,
                ColModul = CustomMemberShipProvider.GetModuls(this.CustomUser.UserId, this.SessionCustom, HttpContext),
                Module = this.Module,
                ListFiles = objfiles.GetAllReadOnly(),
                News = objnews.Entity,
                IContent = objcontent.Entity,
                Templates = objtemplate.GetAll().Select(t => t.TemplateId),
                ListContent = objcontent.GetContentRelation(CurrentLanguage.LanguageId.Value),
                ListTags = SelectedTags,
                DeepFollower = Business.Utils.GetDeepFollower(objsection.GetAll(), objcontent.Entity.SectionId.Value),
                CurrentLanguage = this.CurrentLanguage,
                CollMold = collMold,
                CollXmlNode = collXmlNode,
                Categories = objcontent.Categories(),
                Tags = tagFacade.GetAll().Select(t => new SelectListItem {
                    Text = t.Name, Value = t.TagId.ToString()
                })
            }));
        }
 /// <summary>
 /// Get All Sections
 /// </summary>
 /// <returns></returns>
 public ObservableCollection <GEN_Sections_Lookup> GetAllSections()
 {
     return(new ObservableCollection <GEN_Sections_Lookup>(_SectionRepository.GetAll()));
 }
Exemplo n.º 17
0
        /// <summary>
        /// inserts or updates a section object
        /// </summary>
        /// <param name="objSection">object section</param>
        /// <returns>returns true if operation successful</returns>
        public bool SaveSection(Section objSection)
        {
            try
            {
                SectionRepository sectionRepository = new SectionRepository(this.session);

                string section = objSection.Name;

                sectionRepository.Entity = objSection;
                if (sectionRepository.Entity.SectionId != null)
                {
                    if (null != objSection.OldOrder && objSection.Sectionorder != null && objSection.Sectionorder != objSection.OldOrder)
                    {
                        sectionRepository.ChangeOrder(sectionRepository.Entity.Sectionorder.Value, objSection.OldOrder.Value);
                    }

                    sectionRepository.Update();

                    FriendlyurlRepository friendlyrepo = new FriendlyurlRepository(this.session);
                    friendlyrepo.Entity.Id            = sectionRepository.Entity.SectionId;
                    friendlyrepo.Entity.Friendlyurlid = sectionRepository.Entity.Friendlyname;
                    friendlyrepo.Entity.Type          = Friendlyurl.FriendlyType.Section;
                    friendlyrepo.Update();

                    InfoCache <List <Section> > cache = new InfoCache <List <Section> >(this.context)
                    {
                        TimeOut = 120
                    };
                    sectionRepository.Entity = new Section();
                    cache.SetCache("sections", sectionRepository.GetAll());

                    Utils.InsertAudit(
                        this.session,
                        new Audit()
                    {
                        Auditaction = "Update",
                        Description = "Section -> " + section,
                        Joindate    = DateTime.Now,
                        Username    = (this.context.User as CustomPrincipal).UserId
                    });
                }
                else
                {
                    sectionRepository.Entity.Sectionorder = sectionRepository.GetMaxOrder();
                    sectionRepository.Entity.Friendlyname = Utils.GetFindFrienlyName(
                        this.session,
                        sectionRepository.Entity.Name,
                        sectionRepository.Entity.Sectionorder.Value);
                    sectionRepository.Entity.SectionId = Convert.ToInt32(sectionRepository.Insert());

                    FriendlyurlRepository friendlyrepo = new FriendlyurlRepository(this.session);
                    friendlyrepo.Entity.Id            = sectionRepository.Entity.SectionId;
                    friendlyrepo.Entity.Friendlyurlid = sectionRepository.Entity.Friendlyname;
                    friendlyrepo.Entity.Type          = Friendlyurl.FriendlyType.Section;
                    friendlyrepo.Entity.LanguageId    = sectionRepository.Entity.LanguageId;
                    friendlyrepo.Insert();

                    Utils.InsertAudit(
                        this.session,
                        new Audit()
                    {
                        Auditaction = "Insert",
                        Description = "Section -> " + section,
                        Joindate    = DateTime.Now,
                        Username    = (this.context.User as CustomPrincipal).UserId
                    });
                }

                return(true);
            }
            catch (Exception ex)
            {
                Utils.InsertLog(
                    this.session,
                    "Insert Section",
                    ex.Message + " - " + ex.StackTrace);
                return(false);
            }
        }
Exemplo n.º 18
0
        static void Main()
        {
            Model1Container model = new Model1Container();

            // création repositories

            SectionRepository   repoSect      = new SectionRepository(model);
            StudentRepository   repoStud      = new StudentRepository(model);
            CourseRepository    repoCourse    = new CourseRepository(model);
            ProfessorRepository repoProfessor = new ProfessorRepository(model);

            // ajout de 2 sections
            Section sectInfo = new Section {
                Name = "Info"
            };

            repoSect.Save(sectInfo, s => s.Name.Equals(sectInfo.Name));
            Section sectDiet = new Section {
                Name = "Diet"
            };

            repoSect.Save(sectDiet, s => s.Name.Equals(sectDiet.Name));

            // renvoyer toutes les sections

            IList <Section> sections = repoSect.GetAll().ToList();

            Console.WriteLine("----------- SECTIONS --------------------");
            foreach (Section s in sections)
            {
                Console.WriteLine(s.Name);
            }
            Console.WriteLine("-----------------------------------------");


            // ajout de 3 étudiants
            Student studinfo = new Student
            {
                Firstname  = "studinfo",
                Name       = "studinfo",
                Section    = sectInfo,
                YearResult = 100
            };

            Student studdiet = new Student
            {
                Firstname  = "studdiet",
                Name       = "studdiet",
                Section    = sectDiet,
                YearResult = 150
            };


            Student studinfo2 = new Student
            {
                Firstname  = "studinfo2",
                Name       = "studinfo2",
                Section    = sectInfo,
                YearResult = 110
            };

            repoStud.Save(studinfo, s => s.Name.Equals(studinfo.Name) && s.Firstname.Equals(studinfo.Firstname));
            repoStud.Save(studinfo2, s => s.Name.Equals(studinfo2.Name) && s.Firstname.Equals(studinfo2.Firstname));
            repoStud.Save(studdiet, s => s.Name.Equals(studdiet.Name) && s.Firstname.Equals(studdiet.Firstname));

            IList <Student> studs = repoStud.GetStudentBySectionOrderByYearResult();

            foreach (Student s in studs)
            {
                Console.WriteLine("SECTION : " + s.Section.Name + " STUD : " + s.Name + " YEAR_RESULT : " + s.YearResult);
            }



            // créer 2 professeurs
            Professor profDiet = new Professor {
                Firstname = "profDiet", Name = "profDiet", Section = sectDiet
            };

            repoProfessor.Save(profDiet, p => p.Name.Equals(profDiet.Name));
            Professor profInfo = new Professor {
                Firstname = "profInfo", Name = "profInfo", Section = sectInfo
            };

            repoProfessor.Save(profInfo, p => p.Name.Equals(profInfo.Name));

            // créer 3 cours
            Course techCulinaire = new Course {
                Name = "Technique Culinaire", Professor = profDiet
            };

            repoCourse.Save(techCulinaire, c => c.Name.Equals(techCulinaire.Name));
            Course mathDiet = new Course {
                Name = "Math", Professor = profDiet
            };

            repoCourse.Save(mathDiet, c => c.Name.Equals(mathDiet.Name));
            Course mathInfo = new Course {
                Name = "Math", Professor = profInfo
            };

            repoCourse.Save(mathInfo, c => c.Name.Equals(mathInfo.Name));

            // liste des cours de la section diet
            IList <Course> courses = repoCourse.GetCoursesForSection("Diet");

            Console.WriteLine("Cours de la section Diet : ");
            foreach (Course c in courses)
            {
                Console.WriteLine("COURS : " + c.Name + "PROFESSOR " + c.Professor.Firstname);
            }

            Console.ReadLine();
        }
 public ActionResult Index(Section sk)
 {
     return(View(rp.GetAll()));
 }
Exemplo n.º 20
0
        /// <summary>
        /// gets the home of SuccessStoryEntry module
        /// </summary>
        /// <param name="mod">identifier of module</param>
        /// <param name="sectionId">identifier of section</param>
        /// <param name="idpostulate">Id de la postulacion</param>
        /// <returns>returns the result to action</returns>
        public ActionResult Index(int mod, int?sectionId, int?idpostulate)
        {
            ContentManagement  objcontentman = new ContentManagement(this.SessionCustom, HttpContext);
            SectionRepository  objsection    = new SectionRepository(this.SessionCustom);
            TemplateRepository objtemplate   = new TemplateRepository(this.SessionCustom);
            TagFacade          tagFacade     = new TagFacade();

            objtemplate.Entity.Type = 2;

            if (idpostulate != null)
            {
                Core.Facades.SuccessStoryPostulateFacade dbpostulate = new SuccessStoryPostulateFacade();

                Domain.Entities.Generic.SuccessStoryPostulate postulate = dbpostulate.GetById(idpostulate.Value, this.CurrentLanguage.LanguageId.Value);
                Domain.Entities.SuccessStory successtory = new Domain.Entities.SuccessStory();
                Domain.Entities.Content      content     = new Domain.Entities.Content();

                content.ModulId   = mod;
                content.SectionId = sectionId;

                if (postulate.LanguageId == (int)Domain.Entities.Enums.LanguageEnum.English)
                {
                    content.NameIngles               = postulate.Name;
                    successtory.DescriptionIngles    = postulate.Description;
                    successtory.ProblemsSolvedIngles = postulate.ConcreteProblems;
                    successtory.SocialImpactIngles   = postulate.InnovativeUrbanSolution;
                }
                else
                {
                    content.Name               = postulate.Name;
                    successtory.Description    = postulate.Description;
                    successtory.ProblemsSolved = postulate.ConcreteProblems;
                    successtory.SocialImpact   = postulate.InnovativeUrbanSolution;
                }

                content.Category   = postulate.CategoryName;
                content.UserId     = postulate.UserId;
                content.LanguageId = postulate.LanguageId;
                successtory.InstitutionImplements = postulate.ResponsibleOrganization;
                successtory.InstitutionSource     = postulate.ResponsibleNames;
                successtory.Category = postulate.CategoryName;
                successtory.Url      = postulate.Documents;
                successtory.CityID   = postulate.CityId;

                IList <Tag> listaTags    = tagFacade.GetBySuccessStoryPostulate(idpostulate.Value);
                string      tagsNews     = string.Empty;
                string      existingTags = string.Empty;

                foreach (Tag temp in listaTags)
                {
                    if (temp.TagId != null)
                    {
                        existingTags += temp.TagId + "|";
                    }
                    else
                    {
                        tagsNews += temp.Name + "|";
                    }
                }

                if (tagsNews.EndsWith("|"))
                {
                    tagsNews = tagsNews.Substring(0, tagsNews.Length - 1);
                }

                if (existingTags.EndsWith("|"))
                {
                    existingTags = existingTags.Substring(0, existingTags.Length - 1);
                }

                this.ViewBag.SelectedTags = existingTags;
                this.ViewBag.NewsTags     = tagsNews;

                return(this.View(new SuccessStoryModel()
                {
                    PostulateId = idpostulate,
                    SuccessStory = successtory,
                    IContent = content,
                    UserPrincipal = this.CustomUser,
                    Module = this.Module,
                    ColModul = CustomMemberShipProvider.GetModuls(this.CustomUser.UserId, this.SessionCustom, HttpContext),
                    Templates = objtemplate.GetAll().Select(t => t.TemplateId),
                    DeepFollower = sectionId != null ? Business.Utils.GetDeepFollower(objsection.GetAll(), sectionId.Value) : null,
                    CurrentLanguage = this.CurrentLanguage,
                    Tags = tagFacade.GetAll().Select(t => new SelectListItem {
                        Text = t.Name, Value = t.TagId.ToString()
                    })
                }));
            }

            return(this.View(new SuccessStoryModel()
            {
                UserPrincipal = this.CustomUser,
                Module = this.Module,
                ColModul = CustomMemberShipProvider.GetModuls(this.CustomUser.UserId, this.SessionCustom, HttpContext),
                Templates = objtemplate.GetAll().Select(t => t.TemplateId),
                DeepFollower = sectionId != null ? Business.Utils.GetDeepFollower(objsection.GetAll(), sectionId.Value) : null,
                IContent = new Domain.Entities.Content()
                {
                    ModulId = mod,
                    SectionId = sectionId
                },
                CurrentLanguage = this.CurrentLanguage,
                Tags = tagFacade.GetAll().Select(t => new SelectListItem {
                    Text = t.Name, Value = t.TagId.ToString()
                })
            }));
        }