Example #1
0
        protected void projectsControl_OnEditItem(object sender, GenericEventArgs <Guid> e)
        {
            var entity = DataContext.LP_Projects.FirstOrDefault(n => n.ID == e.Value);

            if (entity == null)
            {
                return;
            }

            var converter = new ProjectEntityModelConverter(DataContext);
            var model     = converter.Convert(entity);

            if (model.ParentID == null)
            {
                mainProjectControl.Visible = true;
                subProjectControl.Visible  = false;
            }
            else
            {
                mainProjectControl.Visible = false;
                subProjectControl.Visible  = true;
            }

            mainProjectControl.Model = model;
            subProjectControl.Model  = model;

            mpeAddEdit.Show();
        }
Example #2
0
        protected void projectsControl_OnEdit(object sender, GenericEventArgs <Guid> e)
        {
            var entity = HbSession.Query <UM_Project>().FirstOrDefault(n => n.ID == e.Value);

            if (entity == null)
            {
                return;
            }

            var converter = new ProjectEntityModelConverter(HbSession);
            var model     = converter.Convert(entity);

            projectControl.Model = model;
            mpeProject.Show();
        }
Example #3
0
        protected void FillProjectsGrid()
        {
            var projects = HbSession.Query <UM_Project>().Where(n => n.DateDeleted == null).ToList();

            var converter = new ProjectEntityModelConverter(HbSession);

            var model = new ProjectsModel
            {
                List = projects.Select(n => converter.Convert(n)).ToList()
            };

            projectsControl.Model = model;
            projectsControl.DataBind();

            //ucMessage.Update();
        }
Example #4
0
        private void FillDataGrid()
        {
            var entities = (from n in DataContext.LP_Projects
                            where n.DateDeleted == null
                            orderby n.OrderIndex, n.DateCreated
                            select n).ToList();

            var converter = new ProjectEntityModelConverter(DataContext);

            var models = (from n in entities
                          let m = converter.Convert(n)
                                  select m).ToList();

            var model = new ProjectsModel();

            model.List = models;

            projectsControl.Model = model;
        }
Example #5
0
        private void FillProjects()
        {
            var parentID = DataConverter.ToNullableGuid(Request["ID"]);

            var currentLanguage = LanguageUtil.GetLanguage();

            var query = from n in DataContext.LP_Projects
                        where n.DateDeleted == null && (n.Language == currentLanguage || n.Language == null || n.Language == "")
                        select n;

            if (parentID == null)
            {
                query = from n in query
                        where n.ParentID == null
                        select n;
            }
            else
            {
                query = from n in query
                        where n.ParentID == parentID
                        select n;
            }

            query = from n in query
                    orderby n.OrderIndex, n.DateCreated
            select n;

            var entities = query.ToList();

            var converter = new ProjectEntityModelConverter(DataContext);

            var models = (from n in entities
                          let m = converter.Convert(n)
                                  select m).ToList();

            var model = new ProjectsModel();

            model.List = models;

            projectsControl.Model = model;
        }