public KnowledgeBaseVM(BaseEAForm form)
 {
     _mainForm = form;
     Perspective = emotionalAppraisalAsset.Perspective.ToString();
     Beliefs = new BindingListView<BeliefDTO>(new List<BeliefDTO>());
     UpdateBeliefList();
 }
 public AttributionRuleVM(BaseSIForm parent)
 {
     _parent = parent;
     RuleList = new BindingListView<AttributionRuleDTO>((IList)null);
     ConditionSetView = new ConditionSetView();
     ConditionSetView.OnDataChanged += ConditionSetView_OnDataChanged;
 }
Esempio n. 3
0
 public QueryRequestor(BindingListView bindingListView)
 {
     _bindingListView = bindingListView;
     // ReSharper disable once PossiblyMistakenUseOfParamsMethod
     _cancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(bindingListView.CancellationToken);
     _queryParameters = QueryParameters.Empty;
     _rowSourceWrapper = RowSourceWrapper.Empty;
 }
Esempio n. 4
0
        public static DailyMileEntries MergeEntries(string fileName, DailyMileEntries entries)
        {
            BindingListView<DailyMileEntry> fileentries;
            BindingListView<DailyMileEntry> downloadedEntries;

            DailyMileEntries murgedEntries;

            murgedEntries = new DailyMileEntries();

            try
            {

                //convert downloaded entries to BLV
                downloadedEntries = new BindingListView<DailyMileEntry>(entries.Entries);

                //Read stored collection

                fileentries = new BindingListView<DailyMileEntry>(DailyMileAPI.GetStoredEntries(fileName).Entries);

                foreach (DailyMileEntry entry in downloadedEntries)
                {
                    if (fileentries != null)
                    {
                        if (fileentries.Exists("ID", entry.ID) == true)
                        {
                            fileentries.RemoveItems("ID", entry.ID);
                        }
                    }

                    fileentries.Add(entry);
                }

                using (FileStream fs = new FileStream(fileName, FileMode.Create, FileAccess.Write, FileShare.None))
                {

                    using (BinaryWriter binWriter = new BinaryWriter(fs))
                    {
                        murgedEntries = new DailyMileEntries();
                        fileentries.SortDirection = ListSortDirection.Descending;
                        fileentries.SortFields = "ID";
                        murgedEntries.Entries = fileentries.GetList();

                        binWriter.Write(SerializersJSON.Serialize<DailyMileEntries>(murgedEntries));
                    }
                }

            }
            catch (VSException ve)
            {
                throw ve;
            }
            catch (System.Exception ex)
            {
                throw new VSException(string.Format("MergeEntries FileName({0}) Exception {1}", fileName, ex.Message));
            }

            return murgedEntries;
        }
Esempio n. 5
0
        public MainForm()
        {
            InitializeComponent();

            _conditionSetView = new ConditionSetView();
            conditionSetEditor.View = _conditionSetView;
            _conditionSetView.OnDataChanged += conditionSetView_OnDataChanged;

            this._reactiveActions = new BindingListView<ReactionDTO>((IList)null);
            dataGridViewReactiveActions.DataSource = this._reactiveActions;
        }
Esempio n. 6
0
        private void LoadFeed()
        {
            // Get the BBC news RSS feed
            Feed feed = new Feed("http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml");
            feed.Update();

            // Create a view of the items
            itemsView = new BindingListView<Item>(feed.Items);
            // Make the grid display this view
            itemsGrid.DataSource = itemsView;
        }
 public BindingListView<PayPaymentOrderPackPayment> FindByPaymentOrderPackId(long paymentOrderPackId)
 {
     System.Data.SqlClient.SqlParameter[] parameters = new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@paymentOrderPackId", System.Data.SqlDbType.BigInt) };
     parameters[0].set_Value((long) paymentOrderPackId);
     BindingListView<PayPaymentOrderPackPayment> view = new BindingListView<PayPaymentOrderPackPayment>();
     foreach (System.Data.DataRow row in DALSql.ExecuteDataTable(this.SelectQuery + "where [email protected]", parameters).Rows)
     {
         PayPaymentOrderPackPayment owid = new PayPaymentOrderPackPayment();
         this.Load(row, owid);
         view.Add(owid);
     }
     return view;
 }
Esempio n. 8
0
 public static BindingListView<Role> Get()
 {
     BindingListView<Role> view = new BindingListView<Role>();
     foreach (Role role in GetRoles())
     {
         view.Add(role);
     }
     foreach (Role role2 in GetRights())
     {
         view.Add(role2);
     }
     return view;
 }
Esempio n. 9
0
        private void btnReset_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Do you want rest the factors", "", MessageBoxButtons.OKCancel) == DialogResult.OK)
            {
                HelperEstimation.ResetProfile();

                _factors = UMLFactorCollection.GetFactors(true);

                BindingListView<UMLFactor> view = new BindingListView<UMLFactor>(_factors);
                this.uMLFactorCollectionBindingSource.DataSource = view;
                view.RemovingItem += new RemoveEventHandler<UMLFactor>(view_RemovingItem);
            }
        }                
Esempio n. 10
0
        public Form1()
        {
            InitializeComponent();

            // Create view of customers list
            BindingListView<Customer> view = new BindingListView<Customer>(GetCustomers());
            // Data bind to the view
            customerBindingSource.DataSource = view;

            // Change the orders binding source to use the auto provided view
            // instead of the normal list.
            ordersBindingSource.DataMember = "OrdersView";
            detailsBindingSource.DataMember = "DetailsView";
        }
 public BindingListView<FixedSummServiceView> Find(ServiceOld serviceOld, LocalAddress address)
 {
     BindingListView<FixedSummServiceView> view = new BindingListView<FixedSummServiceView>();
     System.Data.SqlClient.SqlParameter[] parameters = new System.Data.SqlClient.SqlParameter[2];
     parameters[0] = new System.Data.SqlClient.SqlParameter("@serviceId", System.Data.SqlDbType.BigInt);
     parameters[0].set_Value((long) serviceOld.Id);
     parameters[1] = new System.Data.SqlClient.SqlParameter("@addrId", System.Data.SqlDbType.BigInt);
     parameters[1].set_Value((long) address.Id);
     foreach (System.Data.DataRow row in DALSql.ExecuteDataTable(this.SelectFields + " from [sn].[GetFixedSummServices](@serviceId ,@addrId) t", parameters).Rows)
     {
         FixedSummServiceView view2 = this.Load(row);
         view.Add(view2);
     }
     return view;
 }
Esempio n. 12
0
        public frmViewFriends(List<DailyMileFriend> friendEntries, DailyMileAPI api, string logedInUser)
            : base()
        {
            _api = api;
            _loggedInUser = logedInUser;
            BindingListView<DailyMileFriend> friends = new BindingListView<DailyMileFriend>(friendEntries);
            friends.SortFields = "Display_Name";

            InitializeComponent();

            display_nameComboBox.DataSource = friends.GetList();
            if (friendEntries.Count > 0)
            {
                display_nameComboBox.SelectedIndex = 0;
                UpdateControls();
            }
        }
Esempio n. 13
0
        private void btnViewEntries_Click(object sender, EventArgs e)
        {
            string dataPath;
            string fileName;
            DailyMileEntries entries;

            dataPath = HelperFunctions.GetAssemblyRunPath();
            dataPath += "\\Data\\Friends";
            DailyMileFriend friend = display_nameComboBox.SelectedItem as DailyMileFriend;

            fileName = string.Format("{0}\\Dailymile_{1}_Entries.dat", dataPath, friend.Username);

            entries = DailyMileAPI.GetStoredEntries(fileName);

            BindingListView<DailyMileEntry> viewEntries = new BindingListView<DailyMileEntry>(entries.Entries);
            frmViewEntries frmView = new frmViewEntries(_api, _loggedInUser, viewEntries, frmViewEntries.enumViewType.Friend);
            frmView.Text = "DMBackUp - View Friends Entries";
            frmView.Show();
        }
Esempio n. 14
0
    public UAUserInterface(UAEngine xa)
    {
        InitializeComponent();

        //When xa is loaded settings are loaded..
        this.xa = xa;

        //SetState sets up the different check boxes based on the settings.
        SetState();

        //Setting the textbox with the default value.
        this.tbCanary.Text = xa.Settings.canary;

        //Setup the databinding for results view
        this.matches = new SortableBindingList<ResponseResult>();
        this.view = new BindingListView<ResponseResult>(this.matches);
        this.ResultsDataGridView.DataSource = this.view;

        //Some other defaults
        this.lbDomainFilters.DataSource = xa.Settings.domainFilters;
        this.dgUnicodeTestMappings.DataSource = xa.Settings.UnicodeTestMappings.GetAll();

        //Add the default items to the filter ComboBox.
        this.cbFilter.Items.Add("All");
        this.cbFilter.Items.Add("Transformable");
        this.cbFilter.Items.Add("Traditional");
        this.cbFilter.Items.Add("Overlong");
        this.cbFilter.SelectedItem = "Traditional";

        // Initialize the throttle UI values
        this.tbBatchSize.Text = String.Format("{0}", this.xa.Settings.throttleBatchSize);
        this.tbDelayPeriod.Text = String.Format("{0}", this.xa.Settings.throttleDelayPeriod);

        //Delegate method to ensure when adding data to the datasource it origanates from the creating thread.
        ar = new AddRow(AddRowMethod);

        //Set columns to sortable
        this.scas = new SetColumnAutoSort(setColumnAutoSort);
        this.Dock = DockStyle.Fill;
    }
Esempio n. 15
0
        internal void ApplyFilter(BindingListView<Message> view)
        {
            Predicate<Message> predicate = msg => true;

            if (facilities.Any())
            {
                Predicate<Message> predicateFacility = msg => false;
                foreach (FacilityType item in facilities)
                    predicateFacility = predicateFacility.Or(msg => msg.Facility == item);
                predicate = predicate.And(predicateFacility);
            }

            if (severities.Any())
            {
                Predicate<Message> predicateSeverity = msg => false;
                foreach (SeverityType item in severities)
                    predicateSeverity = predicateSeverity.Or(msg => msg.Severity == item);
                predicate = predicate.And(predicateSeverity);
            }

            if (contents.Any())
            {
                Predicate<Message> predicateContents = msg => false;
                foreach (string item in contents)
                    predicateContents = predicateContents.Or(msg => msg.Content.ToLower().Contains(item.ToLower()));
                predicate = predicate.And(predicateContents);
            }

            if (hosts.Any())
            {
                Predicate<Message> predicateHosts = msg => false;
                foreach (string item in hosts)
                    predicateHosts = predicateHosts.Or(msg => msg.Hostname.ToLower().Contains(item.ToLower()));
                predicate = predicate.And(predicateHosts);
            }

            view.ApplyFilter(predicate);
        }
Esempio n. 16
0
 public BindingListView<OldRole> GetRoles(string typeRole)
 {
     System.Data.SqlClient.SqlParameter[] parameters = new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@typeRole", System.Data.SqlDbType.VarChar) };
     parameters[0].set_Value(typeRole);
     BindingListView<OldRole> view = new BindingListView<OldRole>();
     foreach (System.Data.DataRow row in DALSql.ExecuteDataTable(this.SelectQuery + " where typeRole = @typeRole", parameters).Rows)
     {
         OldRole owid = new OldRole();
         this.Load(row, owid);
         view.Add(owid);
     }
     return view;
 }
Esempio n. 17
0
 public BindingListView<Role> FindIncludeRightsBy(User user)
 {
     System.Data.SqlClient.SqlParameter[] parameters = new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@userId", System.Data.SqlDbType.BigInt) };
     parameters[0].set_Value((long) user.Id);
     string sql = this.SelectQuery + "\tinner join sn.UserRights ur on ur.RightId = t.id\r\n\tinner join sn.Users u on ur.UserId = u.id\r\nwhere u.id = @userId and t.TypeId not in (select id from sn.RightTypes where [name] like 'Роль%')";
     BindingListView<Role> view = new BindingListView<Role>();
     foreach (System.Data.DataRow row in DALSql.ExecuteDataTable(sql, parameters).Rows)
     {
         Role owid = new Role();
         this.Load(row, owid);
         view.Add(owid);
     }
     return view;
 }
Esempio n. 18
0
 public BindingListView<OldRole> FindIncludeRolesBy(OldRole role)
 {
     System.Data.SqlClient.SqlParameter[] parameters = new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@id", System.Data.SqlDbType.BigInt) };
     parameters[0].set_Value((long) role.Id);
     string sql = this.SelectQuery + " inner join sys.database_role_members rm on t.id = rm.role_principal_id \r\n                                          where\trm.member_principal_id = @id";
     BindingListView<OldRole> view = new BindingListView<OldRole>();
     foreach (System.Data.DataRow row in DALSql.ExecuteDataTable(sql, parameters).Rows)
     {
         OldRole owid = new OldRole();
         this.Load(row, owid);
         view.Add(owid);
     }
     return view;
 }
Esempio n. 19
0
 public BindingListView<OldRole> FindIncludeRolesBy(User user)
 {
     System.Data.SqlClient.SqlParameter[] parameters = new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@name", System.Data.SqlDbType.VarChar) };
     parameters[0].set_Value(user.Login);
     string sql = this.SelectQuery + " \r\n                                                inner join sys.database_role_members rm on t.id = rm.role_principal_id \r\n\t\t                                        inner join sys.database_principals pr on rm.member_principal_id = pr.principal_id\r\n                                        where pr.type='S' /*and t.typeRole in ('РОЛЬ')*/ and pr.[name] =  @name\r\n                                        union\r\n                                        " + this.SelectQueryAR + "\r\n                                                               inner join sn.UserRights ur on tar.id = ur.RightId\r\n                                                               inner join sn.Users u on ur.UserId = u.id and u.login = @name\r\n\t                                            where tar.TypeId = 4";
     BindingListView<OldRole> view = new BindingListView<OldRole>();
     foreach (System.Data.DataRow row in DALSql.ExecuteDataTable(sql, parameters).Rows)
     {
         OldRole owid = new OldRole();
         this.Load(row, owid);
         view.Add(owid);
     }
     return view;
 }
Esempio n. 20
0
 public BindingListView<OldRole> FindExcludeRolesBy(OldRole role)
 {
     System.Data.SqlClient.SqlParameter[] parameters = new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@id", System.Data.SqlDbType.BigInt) };
     parameters[0].set_Value((long) role.Id);
     string sql = this.SelectQuery + " where\t/*t.typeRole in ('РОЛЬ','ПРАВО')\r\n\t\t                            and*/ t.id <> @id\r\n                                    and not t.id in\t(select role_principal_id\r\n\t\t\t\t\t                                 from\tsys.database_role_members \r\n\t\t\t\t\t                                 where\tmember_principal_id = @id)";
     BindingListView<OldRole> view = new BindingListView<OldRole>();
     foreach (System.Data.DataRow row in DALSql.ExecuteDataTable(sql, parameters).Rows)
     {
         OldRole owid = new OldRole();
         this.Load(row, owid);
         view.Add(owid);
     }
     return view;
 }
Esempio n. 21
0
 public BindingListView<OldRole> FindIncludeRoleRightsBy(User user, OldRole r)
 {
     System.Data.SqlClient.SqlParameter[] parameters = new System.Data.SqlClient.SqlParameter[2];
     parameters[0] = new System.Data.SqlClient.SqlParameter("@name", System.Data.SqlDbType.VarChar);
     parameters[0].set_Value(user.Login);
     parameters[1] = new System.Data.SqlClient.SqlParameter("@role", System.Data.SqlDbType.VarChar);
     parameters[1].set_Value((long) r.Id);
     string sql = this.SelectQuery + "       inner join sys.database_role_members rm on t.id = rm.role_principal_id\r\n                                                inner join sn.RolesView rv on rv.id = rm.member_principal_id\r\n                                                inner join sys.database_role_members rm2 on rv.id = rm2.role_principal_id /*and rv.typeRole in ('РОЛЬ')*/ and rv.id = @role\r\n                                                inner join sys.database_principals pr on rm2.member_principal_id = pr.principal_id and pr.type = 'S' and pr.name = @name\r\n                                        ";
     BindingListView<OldRole> view = new BindingListView<OldRole>();
     foreach (System.Data.DataRow row in DALSql.ExecuteDataTable(sql, parameters).Rows)
     {
         OldRole owid = new OldRole();
         this.Load(row, owid);
         view.Add(owid);
     }
     return view;
 }
Esempio n. 22
0
 public BindingListView<Role> FindIncludeRolesBy(User user)
 {
     System.Data.SqlClient.SqlParameter[] parameters = new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@name", System.Data.SqlDbType.VarChar) };
     parameters[0].set_Value(user.Login);
     string sql = this.RoleSelectQuery + " \t\tinner join sys.database_role_members rm on t.id = rm.role_principal_id\r\n\t\t                                        inner join sys.database_principals pr on rm.member_principal_id = pr.principal_id\r\n                                        where pr.type='S' and t.typeRole in ('РОЛЬ') and pr.[name] =  @name";
     BindingListView<Role> view = new BindingListView<Role>();
     foreach (System.Data.DataRow row in DALSql.ExecuteDataTable(sql, parameters).Rows)
     {
         Role owid = new Role();
         this.Load(row, owid);
         view.Add(owid);
     }
     return view;
 }
Esempio n. 23
0
 public BindingListView<OldRole> FindExcludeRightsCurrentUser()
 {
     System.Data.SqlClient.SqlParameter[] parameters = new System.Data.SqlClient.SqlParameter[0];
     string sql = this.SelectField + " from sn.GetExcludeUserRoles t ";
     BindingListView<OldRole> view = new BindingListView<OldRole>();
     foreach (System.Data.DataRow row in DALSql.ExecuteDataTable(sql, parameters).Rows)
     {
         OldRole owid = new OldRole();
         this.Load(row, owid);
         view.Add(owid);
     }
     return view;
 }
Esempio n. 24
0
 public BindingListView<Role> GetRoles(RightTypesEnum rType)
 {
     System.Data.SqlClient.SqlParameter[] parameters = new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@type", System.Data.SqlDbType.BigInt) };
     parameters[0].set_Value((long) rType);
     BindingListView<Role> view = new BindingListView<Role>();
     foreach (System.Data.DataRow row in DALSql.ExecuteDataTable(this.SelectQuery + " where TypeId = @type", parameters).Rows)
     {
         Role owid = new Role();
         this.Load(row, owid);
         view.Add(owid);
     }
     return view;
 }
Esempio n. 25
0
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                if (treeView1.SelectedNode == this.allStocksNode)
                {
                    this.toolStripButton_filterInsuff.Enabled = true;

                    BindingList<Model_ViewResult> modelList = new BindingList<Model_ViewResult>();

                    foreach (string fileName in Directory.GetFiles(Config.STAT_PATH_DEFAULT))
                    {
                        if (fileName.EndsWith(".xml") && !fileName.EndsWith(Statistic.FAKE_FILE_FILE_NAME + ".xml"))
                        {
                            try
                            {
                                Statistic eachStat = (Statistic)XMLHelper.ObjectFromXML(fileName, typeof(Statistic));
                                Model_ViewResult eachItemInTable = new Model_ViewResult(eachStat);
                                modelList.Add(eachItemInTable);
                            }
                            catch (Exception ex)
                            {
                                LogHelper.GetLogger(typeof(MainForm)).FullLog(ex.ToString(), "IGNORE");
                            }
                        }
                    }

                    BindingListView<Model_ViewResult> temp = new BindingListView<Model_ViewResult>(modelList);
                    this.dataGridView1.DataSource = temp;
                    if (portfolioLinked) maintainPortfolioLinkage();
                }
                else if (treeView1.SelectedNode == this.mainNode)
                {
                    this.toolStripButton_filterInsuff.Enabled = false;
                    this.dataGridView1.DataSource = null;
                }
                else
                {
                    this.toolStripButton_filterInsuff.Enabled = false;
                    string clusterPath = Config.CLUSTER_PATH_DEFAULT + treeView1.SelectedNode.Name;

                    if (File.Exists(clusterPath))
                    {
                        if (clusterPath.EndsWith(".xml"))
                        {
                            // **********
                            // Binding list view by http://blw.sourceforge.net/
                            // **********

                            Cluster cluster = XMLHelper.ClusterFromXML(clusterPath);
                            BindingList<Model_ViewResult> modelList = new BindingList<Model_ViewResult>();

                            foreach (int eachStockCode in cluster.stockCodeList)
                            {
                                string statPath = Config.STAT_PATH_DEFAULT + @"\" + eachStockCode + ".xml";

                                Statistic eachStat = (Statistic)XMLHelper.ObjectFromXML(statPath, typeof(Statistic));
                                Model_ViewResult eachItemInTable = new Model_ViewResult(eachStat);
                                modelList.Add(eachItemInTable);
                            }

                            BindingListView<Model_ViewResult> temp = new BindingListView<Model_ViewResult>(modelList);
                            this.dataGridView1.DataSource = temp;
                            if (portfolioLinked) maintainPortfolioLinkage();
                        }
                        else
                        {
                            return;
                        }

                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.GetLogger(typeof(MainForm)).FullLog(ex.ToString(), "IGNORE");
                MessageBox.Show("Statistic files corrupted, please rerun compile statistic module.",
                    "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 26
0
        private void RefreshData()
        {
            var sites = sm.Sites;
            var appPools = sm.ApplicationPools;
            var tmpList = new List<SiteRecord>();
            BindingListView<SiteRecord> tmpView;

            foreach (var site in sm.Sites)
            {
                var record = new SiteRecord();
                var pool = appPools.SingleOrDefault(a => a.Name == site.Applications[0].ApplicationPoolName);
                var application = site.Applications[0];
                if (pool == null)
                {
                    System.Diagnostics.Trace.WriteLine(string.Format("no app pool for site {0}", site.Name));
                    continue;
                }
                record.Site = site;
                record.Application = application;
                record.Name = site.Name;
                record.ID = site.Id;
                record.SiteState = site.State;
                record.AppPoolName = application.ApplicationPoolName;
                record.AppPool = pool;
                record.AppPoolState = pool.State;
                record.Path = application.VirtualDirectories[0].PhysicalPath;
                record.VDir = application.VirtualDirectories[0];
                record.Populate();
                tmpList.Add(record);
            }
            sitesGrid.AutoGenerateColumns = false;

            tmpView = new BindingListView<SiteRecord>(tmpList);

            siteRecords = tmpList;
            siteRecordsView = tmpView;

            sitesGrid.DataSource = siteRecordsView;
        }
Esempio n. 27
0
        private void loadFontsWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            var fonts = (List<Font>)e.Result;

            fontsBindingListView = new BindingListView<Font>(fonts);

            //fontsListBox.BeginUpdate();
            fontsListBox.DataSource = fontsBindingListView;
            //fontsListBox.EndUpdate();

            fontsListBox.Enabled = true;
            filterTextBox.Enabled = true;

            loadingProgressBar.Visible = false;
        }
Esempio n. 28
0
 private void LoadFactors()
 {
     _factors = UMLFactorCollection.GetFactors(false);
     BindingListView<UMLFactor> view = new BindingListView<UMLFactor>(_factors);
     this.uMLFactorCollectionBindingSource.DataSource = view;            
     view.RemovingItem += new RemoveEventHandler<UMLFactor>(view_RemovingItem);
 }
Esempio n. 29
0
 public BindingListView<OldRole> FindExcludeRightsBy(User user)
 {
     System.Data.SqlClient.SqlParameter[] parameters = new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@name", System.Data.SqlDbType.VarChar) };
     parameters[0].set_Value(user.Login);
     string sql = this.SelectQuery + " where\t/*t.typeRole in ('РОЛЬ','ПРАВО') \r\n                                                and*/ not t.id in  (\tselect\tt.id\r\n\t                                                                from\tsn.RolesView t\r\n                                                                            inner join sys.database_role_members rm on t.id = rm.role_principal_id\r\n\t\t                                                                    inner join sys.database_principals pr on rm.member_principal_id = pr.principal_id\r\n                                                                                inner join sys.database_role_members rm2 on pr.principal_id = rm2.role_principal_id\r\n\t\t                                                                        inner join sys.database_principals pr2 on rm2.member_principal_id = pr2.principal_id\r\n                                                                                    inner join sys.database_role_members rm3 on pr2.principal_id = rm3.role_principal_id\r\n\t\t                                                                            inner join sys.database_principals pr3 on rm3.member_principal_id = pr3.principal_id\r\n                                                                                        inner join sys.database_role_members rm4 on pr3.principal_id = rm4.role_principal_id\r\n\t    \t                                                                            inner join sys.database_principals pr4 on rm4.member_principal_id = pr4.principal_id\r\n                                                                    where pr4.type='S' \r\n                                                                          /*and t.typeRole in ('РОЛЬ','ПРАВО') */\r\n                                                                          and pr4.[name] = @name  \r\n                                                                    union\r\n                                                                    select\tt.id\r\n\t                                                                from\tsn.RolesView t\r\n                                                                            inner join sys.database_role_members rm on t.id = rm.role_principal_id\r\n\t\t                                                                    inner join sys.database_principals pr on rm.member_principal_id = pr.principal_id\r\n                                                                                inner join sys.database_role_members rm2 on pr.principal_id = rm2.role_principal_id\r\n\t\t                                                                        inner join sys.database_principals pr2 on rm2.member_principal_id = pr2.principal_id\r\n                                                                                    inner join sys.database_role_members rm3 on pr2.principal_id = rm3.role_principal_id\r\n\t\t                                                                            inner join sys.database_principals pr3 on rm3.member_principal_id = pr3.principal_id\r\n                                                                    where pr3.type='S' \r\n                                                                          /*and t.typeRole in ('РОЛЬ','ПРАВО') */\r\n                                                                          and pr3.[name] = @name\r\n                                                                    union \r\n                                                                    select\tt.id\r\n\t                                                                from\tsn.RolesView t\r\n                                                                            inner join sys.database_role_members rm on t.id = rm.role_principal_id\r\n\t\t                                                                    inner join sys.database_principals pr on rm.member_principal_id = pr.principal_id\r\n                                                                                inner join sys.database_role_members rm2 on pr.principal_id = rm2.role_principal_id\r\n\t\t                                                                        inner join sys.database_principals pr2 on rm2.member_principal_id = pr2.principal_id\r\n                                                                    where pr2.type='S' \r\n                                                                          /*and t.typeRole in ('РОЛЬ','ПРАВО') */\r\n                                                                          and pr2.[name] = @name\r\n                                                                    union\r\n                                                                    select\tt.id\r\n\t                                                                from\tsn.RolesView t\r\n                                                                            inner join sys.database_role_members rm on t.id = rm.role_principal_id\r\n\t\t                                                                    inner join sys.database_principals pr on rm.member_principal_id = pr.principal_id\r\n                                                                    where pr.type='S' \r\n                                                                          /*and t.typeRole in ('РОЛЬ','ПРАВО') */\r\n                                                                          and pr.[name] = @name)  ";
     BindingListView<OldRole> view = new BindingListView<OldRole>();
     foreach (System.Data.DataRow row in DALSql.ExecuteDataTable(sql, parameters).Rows)
     {
         OldRole owid = new OldRole();
         this.Load(row, owid);
         view.Add(owid);
     }
     return view;
 }
Esempio n. 30
0
 public BindingListView<Role> FindIncludeRolesBy(Role role)
 {
     System.Data.SqlClient.SqlParameter[] parameters = new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@id", System.Data.SqlDbType.BigInt) };
     parameters[0].set_Value((int) role.Id);
     string sql = this.SelectQuery + " inner join sn.RightGroups rg on rg.RightId = t.id\r\n                                          where\trg.GroupId = @id";
     BindingListView<Role> view = new BindingListView<Role>();
     foreach (System.Data.DataRow row in DALSql.ExecuteDataTable(sql, parameters).Rows)
     {
         Role owid = new Role();
         this.Load(row, owid);
         view.Add(owid);
     }
     return view;
 }