protected void Page_Load(object sender, EventArgs e)
        {
            Session["checkBoxMainNavigation"]    = checkBoxMainNavigation.Checked;
            Session["checkBoxObjectsNavigation"] = checkBoxObjectsNavigation.Checked;

            var userID             = Convert.ToInt32(Session["SystemUser.objID"]);
            var ReadUserPermission = StorageUserObgects.Select <UserEntityPermission>(userID, userID).getReadPermittedEntities().AsEnumerable().Select(x => x["entityID"].ToString()).ToList <string>();
            var Ent = Global.GetDataTable(@"SELECT [isLogicMain], b.alias tblAlias, b.object_id tblID 
                    FROM model.BTables b join model.AppTypes at on at.name='Base' and b.appTypeID=at.object_ID");

            listView.DataSource = Ent.AsEnumerable().Where(x => ReadUserPermission.Contains(x["tblID"].ToString())).CopyToDataTable();
            listView.DataBind();

            //var userID = Convert.ToInt32(Session["SystemUser.objID"]);

            //var PermittedEntities = StorageUserObgects.Select<UserEntityPermission>(userID, userID).getReadPermittedEntities().AsEnumerable().Select(x => x["entityID"].ToString()).ToList<string>();

            //var query = "SELECT [isLogicMain], b.alias tblAlias, b.object_id tblID FROM model.BTables b join model.AppTypes at on at.name='Base' and b.appTypeID=at.object_ID";

            //var dt = Global.GetDataTable(query);

            //var dataSource = dt.AsEnumerable().Where(x => PermittedEntities.Contains(x["tblID"].ToString())).CopyToDataTable();

            //listView.DataSource = dataSource;
            //listView.DataBind();
        }
示例#2
0
        private IEnumerable <Teleform.Reporting.Attribute> GetAttributes()
        {
            IEnumerable <Teleform.Reporting.Attribute> FilteredAttrsList;

            if (FilterAttributeIDList != null)
            {
                FilteredAttrsList = Entity.Attributes.Where(o => !FilterAttributeIDList.Contains(o.ID));
            }
            else
            {
                FilteredAttrsList = Entity.Attributes;
            }

            if (userID != null)
            {
                var PermittedEntitieNamesList = StorageUserObgects.Select <UserEntityPermission>(userID, userID).getReadPermittedEntities().AsEnumerable().Select(x => x["entityID"].ToString()).ToList <string>();

                foreach (var item in PermittedEntitieNamesList)
                {
                    if (item == "202535855")
                    {
                    }
                }


                FilteredAttrsList = FilteredAttrsList.Where(x => PermittedEntitieNamesList.Contains(x.EntityID.ToString()));

                foreach (var item in FilteredAttrsList)
                {
                    if (item.EntityID == "202535855")
                    {
                    }
                }
            }

            if (string.IsNullOrEmpty(AttributeFilterBox.Text))
            {
                return(FilteredAttrsList.Where(o => !o.Name.ToLower().Contains("objid") && !o.Name.ToLower().Contains("parentid")));
            }
            else
            {
                return(FilteredAttrsList.Where(o => !o.Name.ToLower().Contains("objid") && !o.Name.ToLower().Contains("parentid") && o.Name.ToLower().Contains(AttributeFilterBox.Text.ToLower())));
            }
        }
示例#3
0
        public void SetFieldsTaboo(int userID, Card card)
        {
            if (userID == null)
            {
                userID = 0;
            }

            var deniedEntity = StorageUserObgects.Select <UserEntityPermission>(userID, userID).getReadDeniedEntities().AsEnumerable().Select(x => x["entity"].ToString()).ToList <string>();

            foreach (var field in card.Fields)
            {
                var entityName = deniedEntity.FirstOrDefault(e => e == field.NativeEntityName);
                if (entityName != null)
                {
                    field.IsForbidden = true;
                }
                else
                {
                    field.IsForbidden = false;
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                var dataKeys = EventListGridView.DataKeys;

                if (Request["t"] != null && Request["c"] != null)
                {
                    for (int i = 0; i < dataKeys.Count; i++)
                    {
                        var key = dataKeys[i];

                        if (key["tableID"].ToString() == Request["t"] && key["columnID"].ToString() == Request["c"])
                        {
                            EventListGridView.SelectedIndex = i;
                            EventListGridView_SelectedIndexChanged(EventListGridView, EventArgs.Empty);
                            break;
                        }
                    }
                }
            }

            var userID = Convert.ToInt32(Session["SystemUser.objID"]);

            #region заполнение gridview разрешенными на просмотр entity
            var allowedEntities = StorageUserObgects.Select <UserEntityPermission>(userID, userID).getReadPermittedEntities();
            var query           = "EXEC [Report].[GetCountedEventList] 0";

            var EventListDataSource = Storage.GetDataTable(query).AsEnumerable().Where(x => allowedEntities.AsEnumerable().Select(o => o["entity"].ToString()).Contains(x["tableName"]));
            if (EventListDataSource.Count() == 0)
            {
                return;
            }

            EventListGridView.DataSource = EventListDataSource.CopyToDataTable();
            EventListGridView.DataBind();
            #endregion
        }
        protected override void OnInit(EventArgs e)
        {
            var userType = Convert.ToInt32(Session["SystemUser.typeID"]);
            var userID   = Convert.ToInt32(Session["SystemUser.objID"]);


            var entityID   = Request.QueryString["entity"];
            var templateID = Request.QueryString["templateID"];

            if (!IsPostBack)
            {
                var permittedEntities = StorageUserObgects.Select <UserEntityPermission>(userID, userID).getReadPermittedEntities().AsEnumerable();

                var list = this.GetSchema().Entities.Where(o => !o.IsEnumeration && permittedEntities.Select(x => x["entity"].ToString()).Contains(o.SystemName)).OrderBy(o => o.Name).ToList();

                EntityList.Items.Add(new ListItem {
                    Text = "Не выбрано", Value = ""
                });
                for (int i = 0; i < list.Count; i++)
                {
                    EntityList.Items.Add(new ListItem {
                        Text = list[i].Name, Value = list[i].ID.ToString()
                    });
                }

                if (entityID != null)
                {
                    EntityList.SelectedValue = entityID;

                    FillTemplateList(EntityList.SelectedValue);

                    if (templateID != null)
                    {
                        TemplateList.SelectedValue = templateID;
                        if (AuthorizationRules.TemplateResolution(ActionType.update, Session["SystemUser.objID"].ToString(), templateID))
                        {
                            ConstructorButton.Enabled = true;
                        }
                        else
                        {
                            ConstructorButton.Enabled = false;
                        }
                    }
                    else
                    {
                        if (string.IsNullOrEmpty(TemplateList.SelectedValue))
                        {
                            if (AuthorizationRules.TemplateResolution(ActionType.create, Session["SystemUser.objID"].ToString()))
                            {
                                ConstructorButton.Enabled = true;
                            }
                            else
                            {
                                ConstructorButton.Enabled = false;
                            }
                        }
                    }
                }

                EntityList.DataBind();
                //VerifyRenderingInServerForm(EntityList);
            }

            //var templatePermission = StorageUserObgects.Select<UserTemplatePermission>(userID, userID).Permission.Substring(1, 2).Contains('1');

            //if (!templatePermission && userType != 1 && userType != 0)
            //    ConstructorButton.Enabled = false;

            base.OnInit(e);
        }