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

            if (entity == null)
            {
                return;
            }

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

            if (model.ParentID == null)
            {
                mainUserReportControl.Visible = true;
                subUserReportControl.Visible  = false;
            }
            else
            {
                mainUserReportControl.Visible = false;
                subUserReportControl.Visible  = true;
            }

            mainUserReportControl.Model = model;
            subUserReportControl.Model  = model;

            mpeAddEdit.Show();
        }
Beispiel #2
0
        private void FillDataGrid()
        {
            var entities = (from n in DataContext.LP_UserReports
                            where n.DateDeleted == null
                            orderby n.OrderIndex, n.DateCreated
                            select n).ToList();

            var converter = new UserReportEntityModelConverter(DataContext);

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

            var model = new UserReportsModel();

            model.List = models;

            userReportsControl.Model = model;
        }
Beispiel #3
0
        private void FillUserReports()
        {
            var parentID = DataConverter.ToNullableGuid(Request["ID"]);


            var currentLanguage = LanguageUtil.GetLanguage();

            var query = from n in DataContext.LP_UserReports
                        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 UserReportEntityModelConverter(DataContext);

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

            var model = new UserReportsModel();

            model.List = models;

            userReportsControl.Model = model;
        }