コード例 #1
0
        private void AddDefaultData()
        {
            UpdateProgress(0, "Adding default data<br/>");
            //Add Admin Account
            string aUsername     = adminUsername.Value ?? "Admin";
            string adminpassword = adminPassword.Value ?? "P@ssword01!!";
            string adminemail    = adminEmail.Value ?? "*****@*****.**";

            MembershipCreateStatus status;
            MembershipUser         admin = Membership.GetUser(aUsername);

            if (admin == null || admin.UserName != aUsername)
            {
                admin = Membership.CreateUser(aUsername, adminpassword, adminemail, ".", ".", true, out status);
            }
            Membership.UpdateUser(admin);
            Roles.AddUserToRoles(admin.UserName, new string[] { "Administrator", "Member" });

            var newadmin = "UPDATE FORUM_MEMBERS SET M_TITLE='Forum Administrator', M_SUBSCRIPTION=1,M_LEVEL=3,M_STATUS=1,M_HIDE_EMAIL = 1,M_RECEIVE_EMAIL = 1,M_VOTED = 0 WHERE M_NAME='" + aUsername + "'";

            Snitz.BLL.Admin.ExecuteScript(newadmin);
            Snitz.BLL.Admin.ExecuteScript("INSERT INTO FORUM_TOTALS (P_COUNT,P_A_COUNT,T_COUNT,T_A_COUNT,U_COUNT) VALUES (0,0,0,0,1)");
            CategoryInfo cat   = new CategoryInfo();
            ForumInfo    forum = new ForumInfo();
            TopicInfo    topic = new TopicInfo();

            cat.Id                = -1;
            cat.Name              = "Snitz .Net Forums";
            cat.Order             = 0;
            cat.Status            = (int)Enumerators.PostStatus.Open;
            cat.SubscriptionLevel = 0;
            cat.ModerationLevel   = 0;

            int catid = Categories.AddCategory(cat);

            forum.CatId             = catid;
            forum.Id                = -1;
            forum.Status            = (int)Enumerators.PostStatus.Open;
            forum.AllowPolls        = false;
            forum.Description       = "This forum gives you a chance to become more familiar with how this product responds to different features and keeps testing in one place instead of posting tests all over. Happy Posting! [:)]";
            forum.Subject           = "Testing Forum";
            forum.SubscriptionLevel = 0;
            forum.ModerationLevel   = 0;
            forum.Order             = 0;
            forum.PostCount         = 0;
            forum.UpdatePostCount   = true;

            int forumid = Forums.SaveForum(forum);

            topic.CatId    = catid;
            topic.ForumId  = forumid;
            topic.Status   = 1;
            topic.Message  = "Thank you for downloading Snitz Forums 2000. We hope you enjoy this great tool to support your organization!" + 0x13 + 0x10 + 0x13 + 0x10 + "Many thanks go out to John Penfold &lt;[email protected]&gt; and Tim Teal &lt;[email protected]&gt; for the original source code and to all the people of Snitz Forums 2000 at http://forum.snitz.com for continued support of this product.";
            topic.Subject  = "Welcome to Snitz .Net Forums";
            topic.AuthorId = (int)admin.ProviderUserKey;
            topic.Date     = DateTime.UtcNow;
            topic.PosterIp = "0.0.0.0";

            Topics.Add(topic);
        }
コード例 #2
0
ファイル: Lecture.cs プロジェクト: ShadowyLuke/WPI_MQP_PLR
 // Internal Methods
 internal void AddTopics(int count = 1)
 {
     for (int i = 0; i < count; i++)
     {
         Topics.Add(new Topic());
     }
 }
コード例 #3
0
        private void TopicTapToAddMethod(Topic topic)
        {
            if (topic == null)
            {
                return;
            }
            if (Topics == null)
            {
                Topics = new ObservableCollection <Topic>();
            }

            if (Topics.Contains(topic) == false)
            {
                Topics.Add(topic);
            }

            RaisePropertyChanged(() => Topics);

            if (_navigate == null)
            {
                return;
            }

            _navigate.GoBack();
        }
コード例 #4
0
 public ListenVideoPlaybackRequest(ulong[] channelIds, string authToken = null)
     : base("LISTEN", authToken)
 {
     foreach (var channelId in channelIds)
     {
         Topics.Add($"video-playback.{channelId}");
     }
 }
コード例 #5
0
 public ListenBitsRequest(ulong[] channelIds, string authtoken)
     : base("LISTEN", authtoken)
 {
     foreach (var channelId in channelIds)
     {
         Topics.Add($"channel-bits-events-v1.{channelId}");
     }
 }
コード例 #6
0
 public void Subscribe(string topic)
 {
     if (_broker != null)
     {
         Topics.Add(topic);
         _broker.Subscribe(new string[] { topic }, new byte[] { MqttMsgBase.QOS_LEVEL_EXACTLY_ONCE });
     }
 }
コード例 #7
0
 public ListenWhispersRequest(ulong[] userIds, string authtoken)
     : base("LISTEN", authtoken)
 {
     foreach (var userId in userIds)
     {
         Topics.Add($"whispers.{userId}");
     }
 }
コード例 #8
0
 public void AddTopic(Topic newTopic)
 {
     if (Topics == null)
     {
         Topics = new List <Topic>();
     }
     newTopic.Id = 0;
     Topics.Add(newTopic);
 }
コード例 #9
0
        /// <summary>
        /// Add a new external topic.
        /// </summary>
        /// <param name="name">Topic Name</param>
        public KafkaStreamOptions AddExternalTopic(string name)
        {
            Topics.Add(new TopicConfig
            {
                IsExternal = true,
                Name       = name,
            });

            return(this);
        }
コード例 #10
0
ファイル: MainModel.cs プロジェクト: AYzamri/PartnersMatcher
        private void LoadTopics()
        {
            Topics.Add(DEFAULT_VALUE);
            DataTable dt = ExecuteReadQuery("Select * From Topics");

            foreach (DataRow row in dt.Rows)
            {
                Topics.Add(row["TopicName"].ToString());
            }
        }
コード例 #11
0
 public void AddTopic(string topic)
 {
     try
     {
         Topics.Add(topic, (byte)PublishQoSLevel);
     }
     catch (Exception e)
     {
         OnErrorOccured("AddTopic - Error occured : " + e.Message);
     }
 }
コード例 #12
0
        /// <summary>
        /// Reads the object data from a dump store
        /// </summary>
        /// <param name="reader">reader to read the data</param>
        /// <param name="filesList">filelist from helpsystem</param>
        internal bool ReadDump(ref BinaryReader reader, ArrayList filesList)
        {
            int i = 0;

            _keyWord     = reader.ReadString();
            _isSeeAlso   = reader.ReadBoolean();
            _indent      = reader.ReadInt32();
            _chmFileName = reader.ReadString();

            foreach (CHMFile curFile in filesList)
            {
                if (curFile.ChmFilePath == _chmFileName)
                {
                    _chmFile = curFile;
                    break;
                }
            }

            if (_chmFile == null)
            {
                return(false);
            }

            int nCnt = reader.ReadInt32();

            for (i = 0; i < nCnt; i++)
            {
                string sIT = reader.ReadString();
                _infoTypeStrings.Add(sIT);
            }

            nCnt = reader.ReadInt32();

            _seeAlso = new string[nCnt];

            for (i = 0; i < nCnt; i++)
            {
                _seeAlso[i] = reader.ReadString();
            }

            nCnt = reader.ReadInt32();

            for (i = 0; i < nCnt; i++)
            {
                IndexTopic topic = new IndexTopic("", "", "", "");
                topic.SetChmInfo(_chmFile.CompileFile, _chmFile.ChmFilePath);
                topic.AssociatedFile = _chmFile;
                topic.ReadDump(ref reader);

                Topics.Add(topic);
            }

            return(true);
        }
コード例 #13
0
ファイル: TopicsListViewModel.cs プロジェクト: forki/MiniTD
        void AddNewTopicCommand_Executed(object prm)
        {
            var t = new MiniTopic();
            var r = new Random(DateTime.Now.GetHashCode());

            t.Color = System.Windows.Media.Color.FromRgb((byte)r.Next(255), (byte)r.Next(255), (byte)r.Next(255));
            t.Title = NewTopicTitle;
            var tvm = new MiniTopicViewModel(t, _OrganizerVM);

            Topics.Add(tvm);

            NewTopicTitle = "";
        }
コード例 #14
0
        private void CategoryChecked(object sender, EventArgs args)
        {
            var txt = (sender as CheckBox).Text;

            if (Topics.Any(o => o == txt))
            {
                Topics.Remove(txt);
            }
            else
            {
                Topics.Add(txt);
            }
        }
コード例 #15
0
ファイル: EventBroker.cs プロジェクト: fecktty/Event_Broker
 /// <summary>
 /// 注册订阅者
 /// </summary>
 /// <param name="target"></param>
 /// <param name="bindings"></param>
 private void RegisterSubscription(object target, BindingFlags bindings)
 {
     foreach (var info in target.GetType().GetMethods(bindings))
     {
         foreach (EventSubscriptionAttribute attr in
                  info.GetCustomAttributes(typeof(EventSubscriptionAttribute), true))
         {
             var        subscriber = new EventSubscription(target, info.Name);
             var        topicName  = attr.Topic;
             EventTopic topic      = Topics[topicName] ?? Topics.Add(topicName);
             topic.AddSubscription(subscriber);
         }
     }
 }
コード例 #16
0
ファイル: EventBroker.cs プロジェクト: fecktty/Event_Broker
 /// <summary>
 /// 注册发布者
 /// </summary>
 private void RegisterPublication(object target, BindingFlags bindings)
 {
     foreach (var info in target.GetType().GetEvents(bindings))
     {
         foreach (EventPublicationAttribute attr in
                  info.GetCustomAttributes(typeof(EventPublicationAttribute), false))
         {
             var        publisher = new EventPublication(target, info.Name);
             var        topicName = attr.Topic;
             EventTopic topic     = Topics[topicName] ?? Topics.Add(topicName);
             topic.AddPublication(publisher);
         }
     }
 }
コード例 #17
0
ファイル: PublishMessageModel.cs プロジェクト: zhanghz/nmqtt
        private void OnTopicSubscribed(object sender, TopicSubscribedEventArgs e)
        {
            if (Topics.Contains(e.Topic))
            {
                return;
            }

            Topics.Add(e.Topic);

            if (Topics.Count == 1)
            {
                Topic = e.Topic;
            }
        }
コード例 #18
0
        public void Subscribe()
        {
            if (!Topics.Contains(Topic))
            {
                Topics.Add(Topic);
            }
            if (!subscribedToEvent)
            {
                subscribedToEvent = true;
                MqttHandler.Instance.ClientMessageArrived += HandleMqttHandlerInstanceClientMessageArrived;
            }

            MqttHandler.Instance.Subscribe(Topic, Qos);
            MessageHistory += Environment.NewLine + "Subscribed to: " + Topic;
        }
コード例 #19
0
        /// <summary>
        /// Add a new internal topic.
        /// </summary>
        /// <param name="name">Topic Name</param>
        /// <param name="topicCreationConfig"></param>
        public KafkaStreamOptions AddTopic(string name, TopicCreationConfig topicCreationConfig = null)
        {
            var config = new TopicConfig {
                IsExternal = false, Name = name
            };

            if (topicCreationConfig != null)
            {
                config.AutoCreate        = topicCreationConfig.AutoCreate;
                config.Partitions        = topicCreationConfig.Partitions;
                config.ReplicationFactor = topicCreationConfig.ReplicationFactor;
            }

            Topics.Add(config);

            return(this);
        }
コード例 #20
0
        public async Task AddTopic(List <WebSocketTopic> topics, CancellationToken cancellationToken = default)
        {
            var addTopicObject = new { command = WebSocketCommands.AddTopics, topics = new List <object>() };

            foreach (var topic in topics)
            {
                var type      = topic.GetType();
                var fieldInfo = type.GetField(topic.ToString());

                var attribute =
                    fieldInfo.GetCustomAttribute(typeof(WebSocketTopicStringValueAttribute), false) as WebSocketTopicStringValueAttribute;

                Topics.Add(attribute.Value);
                addTopicObject.topics.Add(new { topic = attribute.Value });
            }

            await Send(JsonConvert.SerializeObject(addTopicObject), cancellationToken);
        }
コード例 #21
0
 public long AddTopic(string title, int num)
 {
     if (Topics != null)
     {
         if (!Topics.Exists(x => ((Topic)x).Title == title || ((Topic)x).Num == num))
         {
             long  id    = GetID();
             Topic topic = ContentFactory.CreateCompositeComponent(id, 0, title, num, true);
             ComponentsCache[id] = topic;
             Topics.Add(topic);
             LogChange(topic, ContentStatus.Add);
             return(id);
         }
         return(0);
         //log message if course exist
     }
     return(-1);
     //log message if courses is null
 }
コード例 #22
0
ファイル: MathIO.cs プロジェクト: JakeCode11/Math.IO
        private void LoadTopics()
        {
            var currentAssembly = Assembly.GetExecutingAssembly();
            var resourceName    = "MathIO.Source.Topics.json";

            using (Stream stream = currentAssembly.GetManifestResourceStream(resourceName))
                using (var file = new StreamReader(stream))
                    using (var reader = new JsonTextReader(file))
                    {
                        var jArray = (JArray)JToken.ReadFrom(reader);
                        foreach (JToken jt in jArray)
                        {
                            var jo = jt as JObject;
                            Debug.Assert(jo != null);

                            var newTopic = new TopicNode((string)jo.GetValue("topic"));
                            Topics.Add(newTopic);
                        }
                    }
        }
コード例 #23
0
        /// <summary>
        /// Add a new external topic.
        /// </summary>
        /// <param name="type">The data type that this contract will use.</param>
        /// <param name="name">Topic Name</param>
        /// <param name="topicCreationConfig"></param>
        public KafkaStreamOptions AddExternalTopic(
            Type type,
            string name,
            TopicCreationConfig topicCreationConfig = null
            )
        {
            var config = new TopicConfig {
                IsExternal = true, Name = name, ExternalContractType = type
            };

            if (topicCreationConfig != null)
            {
                config.AutoCreate        = topicCreationConfig.AutoCreate;
                config.Partitions        = topicCreationConfig.Partitions;
                config.ReplicationFactor = topicCreationConfig.ReplicationFactor;
            }

            Topics.Add(config);

            return(this);
        }
コード例 #24
0
        /// <summary>
        /// Trata de suscribir a un topic que recibe como parámetro
        /// </summary>
        /// <param name="topic"></param>
        public static void Suscribir(Topic topic)
        {
            try
            {
                client.SubscribeAsync(topic.Nombre, (MQTTnet.Protocol.MqttQualityOfServiceLevel)topic.QOS);
                //client.Subscribe(new string[] { topic.Nombre }, new byte[] { topic.QOS });

                //Desuscribir(topic);
                if (Topics.FirstOrDefault(x => x.Nombre == topic.Nombre && x.IdHandler == topic.IdHandler) != null)
                {
                }
                else
                {
                    Topics.Add(topic);
                }
            }
            catch (Exception ex)
            {
                new Log().Escribir(ex);
            }
        }
コード例 #25
0
ファイル: Library.cs プロジェクト: charliedua/Library-GUI
 private void LoadTopics()
 {
     if (TopicsInitialize())
     {
         string          query       = "SELECT * FROM `Topics`;";
         var             reader_temp = SQL.ExecuteQuery(query);
         MySqlDataReader reader;
         if (reader_temp.Item2)
         {
             reader = reader_temp.Item1;
             DataTable dt = new DataTable();
             dt.Load(reader);
             string topic;
             foreach (DataRow row in dt.Rows)
             {
                 topic = row["Topic"].ToString();
                 Topics.Add(topic);
             }
         }
     }
 }
コード例 #26
0
        /// <summary>
        /// Reads the object data from a dump store
        /// </summary>
        /// <param name="reader">reader to read the data</param>
        internal void ReadDump(ref BinaryReader reader)
        {
            int i = 0;

            _keyWord   = reader.ReadString();
            _isSeeAlso = reader.ReadBoolean();
            _indent    = reader.ReadInt32();

            int nCnt = reader.ReadInt32();

            for (i = 0; i < nCnt; i++)
            {
                string sIT = reader.ReadString();
                _infoTypeStrings.Add(sIT);
            }

            nCnt = reader.ReadInt32();

            _seeAlso = new string[nCnt];

            for (i = 0; i < nCnt; i++)
            {
                _seeAlso[i] = reader.ReadString();
            }

            nCnt = reader.ReadInt32();

            for (i = 0; i < nCnt; i++)
            {
                IndexTopic topic = new IndexTopic("", "", "", "");
                topic.AssociatedFile = _chmFile;
                topic.SetChmInfo(_chmFile.CompileFile, _chmFile.ChmFilePath);
                topic.ReadDump(ref reader);
                Topics.Add(topic);
            }
        }
コード例 #27
0
        public static void Iniciar()
        {
            client = new MqttClient("192.168.0.104");
            string clientId = string.Format("{0}_{1}", "arn-monitor-bancada", Sesion.Operario != null?Sesion.Operario.CodigoObrero:Guid.NewGuid().ToString());

            client.Connect(clientId, "", "", true, 10);
            client.MqttMsgPublishReceived += Client_MqttMsgPublishReceived;
            Conectado = true;
            //Topics.Add(new Topic(1, "/moldeado/plc/+/asociarTarea", new Regex(@"^\/moldeado\/plc\/\s?[0-9]+\/asociarTarea$"), 3, 1, qos: 1));
            //Topics.Add(new Topic(2, "/moldeado/plc/+/normal", new Regex(@"^\/moldeado\/plc\/\s?[0-9]+\/normal$"), 3, 1, qos: 2));
            //Topics.Add(new Topic(3, "/pegado/plc/+/asociarTarea", new Regex(@"^\/pegado\/plc\/\s?[0-9]+\/asociarTarea$"), 3, 1, qos: 1));
            //Topics.Add(new Topic(4, "/pegado/plc/+/normal", new Regex(@"^\/pegado\/plc\/\s?[0-9]+\/normal$"), 3, 1, qos: 2));
            //Topics.Add(new Topic(5, "/moldes/normal/sinProducir", new Regex(@"^\/moldes\/normal\/sinProducir"), -1, -1, qos: 0));
            //Topics.Add(new Topic(6, "/moldes/calentar/sinProducir", new Regex(@"^\/moldes\/calentar\/sinProducir"), -1, -1, qos: 0));
            //Topics.Add(new Topic(7, "/bancada/+/maquina/+/programacion", new Regex(@"^\/bancada\/\s?[0-9]+\/maquina\/\s?[0-9]+\/programacion"), -1, -1, qos: 1));
            //Topics.Add(new Topic(8, "/operario/+/imprimir/hojaProduccion", new Regex(@"^\/operario\/\s?[0-9]+\/imprimir\/hojaProduccion"), 2, -1, qos: 1));
            Topics.Add(new Topic(1, "/moldeado/plc/+/asociarTarea", new Regex(@"^\/moldeado\/plc\/\s?[0-9]+\/asociarTarea$"), 3, 1, qos: 1));
            Topics.Add(new Topic(2, "/moldeado/plc/+/normal", new Regex(@"^\/moldeado\/plc\/\s?[0-9]+\/normal$"), 3, 1, qos: 2));
            Topics.Add(new Topic(3, "/moldeado/plc/+/calentar", new Regex(@"^\/moldeado\/plc\/\s?[0-9]+\/calentar"), 3, 1, qos: 1));

            client.ConnectionClosed += Client_ConnectionClosed;

            Suscribir();
        }
コード例 #28
0
        public Topics GetTopics(string id)
        {
            Topics topics = new Topics();

            try
            {
                string query = $"select * from dsto_Topic where yref_training = '{id}' and Deleted=0";
                var    table = DbInfo.ExecuteSelectQuery(query);
                if (table.Rows.Count > 0)
                {
                    foreach (DataRow row in table.Rows)
                    {
                        Topic topic = topics.Add();
                        InitTopic(topic, row);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(topics);
        }
コード例 #29
0
 public ISubscriptionConfiguration WithTopic(string topic)
 {
     Topics.Add(topic);
     return(this);
 }
コード例 #30
0
 public IPublishConfiguration <T> WithTopic(string topic)
 {
     Topics.Add(topic);
     return(this);
 }