public async Task <IActionResult> GetTopicById(int Id) { JsonResponse <TopicList> objResult = new JsonResponse <TopicList>(); try { TopicList list = await this._superAdminService.GetTopicById(Id); if (list != null) { objResult.Data = list; objResult.Status = StaticResource.SuccessStatusCode; objResult.Message = StaticResource.SuccessMessage; return(new OkObjectResult(objResult)); } } catch (Exception ex) { HttpContext.RiseError(ex); objResult.Data = null; objResult.Status = StaticResource.FailStatusCode; objResult.Message = StaticResource.FailMessage; } return(new OkObjectResult(objResult)); }
private void onDeliveryMove(string strmissionid, int actidx) { if (Data.Instance.isConnected) { try { string strRobot_id = cboRobotID.SelectedItem.ToString(); WAS_GOAL work_data = onMissionDataRead(strmissionid, actidx); string strobj = JsonConvert.SerializeObject(work_data); JObject obj = JObject.Parse(strobj); TopicList list = new TopicList(); rosinterface ros = new rosinterface(); Thread.Sleep(500); ros.PublisherTopicMsgtype(strRobot_id + list.topic_goal, list.msg_goal); Thread.Sleep(200); ros.publisher(obj); Thread.Sleep(200); } catch (Exception ex) { Console.Out.WriteLine("onDeliveryMove err :={0}", ex.Message.ToString()); } } else { MessageBox.Show("서버에 연결하세요."); } }
public void Run(String[] args) { if (!ParseCommandLine(args)) { return; } SessionOptions sessionOptions = new SessionOptions(); sessionOptions.ServerHost = d_serverHost; sessionOptions.ServerPort = d_serverPort; sessionOptions.AuthenticationOptions = d_authOptions; System.Console.WriteLine("Connecting to " + d_serverHost + ":" + d_serverPort); ProviderSession session = new ProviderSession(sessionOptions, ProcessEvent); if (!session.Start()) { Console.Error.WriteLine("Failed to start session"); return; } Identity identity = null; if (d_authOptions.Length != 0) { if (!Authorize(out identity, session)) { return; } } TopicList topicList = new TopicList(); topicList.Add( d_serviceName + "/220/660/1", new CorrelationID(new MyStream("220/660/1"))); session.CreateTopics( topicList, ResolveMode.AUTO_REGISTER_SERVICES, identity); List <MyStream> myStreams = new List <MyStream>(); for (int i = 0; i < topicList.Size; ++i) { if (topicList.StatusAt(i) == TopicList.TopicStatus.CREATED) { Topic topic = session.GetTopic(topicList.MessageAt(i)); MyStream stream = (MyStream)topicList.CorrelationIdAt(i).Object; stream.SetTopic(topic); myStreams.Add(stream); } } PublishEvents(session, myStreams); session.Stop(); }
public ActionResult Delete(TopicClass t) { TopicList tList = new TopicList(); tList.DeleteAccount(t); return(RedirectToAction("Index")); }
private void btnMappingMode_Click(object sender, EventArgs e) { try { if (Data.Instance.isConnected) { if (m_strRobotID != "") { commBridge.onSP_routine_publish(m_strRobotID, "SLAM"); onModeDp(string.Format("RobotID={0}, mode =SLAM", m_strRobotID)); m_strCurrMode = "SLAM"; onBtnModeChg(m_strCurrMode); TopicList list = new TopicList(); commBridge.onDeleteSelectSubscribe(m_strRobotID + list.topic_staticMap); onSelectRobotMap_monitor(m_strRobotID); //onSelectRobotLocalCostMap_monitor(m_strRobotID); } } } catch (Exception ex) { Console.WriteLine("btnMappingMode_Click err=" + ex.Message.ToString()); } }
public ActionResult Edit(TopicClass t) { TopicList tList = new TopicList(); tList.UpdateTopic(t); return(RedirectToAction("Index")); }
public ActionResult Delete(string id = null) { TopicList tList = new TopicList(); List <TopicClass> obj = tList.GetTopicClasses(id); return(View(obj.FirstOrDefault())); }
private void FillTopicList() { foreach (string keyWord in _keyWords.KeyWordList) { TopicList.Add(keyWord); } }
protected void IndexChanging(object sender, CommandEventArgs e) { string strCommand = e.CommandArgument.ToString(); int pageindex = int.Parse(ViewState["pageindex"].ToString()); if (strCommand == "convert") { if (int.Parse(pg.Value.ToString()) > topicPage) { Response.Write("<script>alert('咿呀,超过最大页码了')</script>"); } else { pageindex = int.Parse(pg.Value.ToString()) - 1; } } else if (strCommand == "pre") { pageindex = pageindex - 1; } else { pageindex = pageindex + 1; } ViewState["pageindex"] = pageindex; PagedDataSource pds = new PagedDataSource(); pds = BindData(ds); TopicList.DataSource = pds; TopicList.DataBind(); }
public IViewComponentResult Invoke() { TopicList topicList = new TopicList(); var items = topicList.GetList(); return(View(items)); }
public static void Main(string[] args) { //a_admin = new Admin(); a_proxy = new Proxy(); a_userList = new UserList(); a_topicList = new TopicList(); new GUILogin(); }
public static void ChangeParent(string idChild, string idParent) { Topic child = (Topic)TopicList.Search(t => ((Topic)t).Id == new Guid(idChild)); Topic parent = (Topic)TopicList.Search(t => ((Topic)t).Id == new Guid(idParent)); child.Parent = parent; child.Update(); }
public void SetTopicView(TopicList topicList) { for (int i = 0; i < topicList.topics.Length; i++) { GameObject temp = Instantiate <GameObject>(templeView); ItemView item = temp.GetComponent <ItemView>(); } }
public static string TopicAdd() { Topic topic = ((TopicArgs)PSCDialog.DataShare).Topic; TopicList.AddDB(((TopicArgs)PSCDialog.DataShare).Topic); TopicList.UpdateLastPosition(((TopicArgs)PSCDialog.DataShare).Topic); System.Web.Script.Serialization.JavaScriptSerializer js = new System.Web.Script.Serialization.JavaScriptSerializer(); return(js.Serialize(((TopicArgs)PSCDialog.DataShare).Topic)); }
public static string GetArticleCommentNewList(string topicId, int startIndex, int maximumRows, string sortExpressions) { Guid idTopic = new Guid(topicId); Topic topic = (Topic)TopicList.Search(o => ((Topic)o).Id == idTopic); ArticleListCommentNew = ArticleCollection.GetArticleCollectionPublishCommentNew(topic); System.Web.Script.Serialization.JavaScriptSerializer js = new System.Web.Script.Serialization.JavaScriptSerializer(); return(js.Serialize(ArticleListCommentNew.GetSegment(startIndex, maximumRows, sortExpressions))); }
public static string AddTopicBelong(string Id) { Guid topicId = new Guid(Id); Topic topic = (Topic)TopicList.Search(t => ((Topic)t).Id == topicId); TopicBelongList.Add(topic); System.Web.Script.Serialization.JavaScriptSerializer js = new System.Web.Script.Serialization.JavaScriptSerializer(); return(js.Serialize(TopicBelongList)); }
public ActionResult Create(TopicClass t) { if (ModelState.IsValid) { TopicList tList = new TopicList(); tList.AddTopic(t); return(RedirectToAction("Index")); } return(View()); }
public async Task <bool> ChangeTopicStatus(TopicList request) { try { return(await this._superAdminRepo.ChangeTopicStatus(request)); } catch (Exception ex) { throw ex; } }
public static string DeleteTopicBelong(string[] arrId) { foreach (string Id in arrId) { Guid topicId = new Guid(Id); Topic topic = (Topic)TopicList.Search(t => ((Topic)t).Id == topicId); TopicBelongList.Remove(topic); } System.Web.Script.Serialization.JavaScriptSerializer js = new System.Web.Script.Serialization.JavaScriptSerializer(); return(js.Serialize(TopicBelongList)); }
// GET: Topic public ActionResult Index(string strSearch) { TopicList tList = new TopicList(); List <TopicClass> obj = tList.GetTopicClasses(string.Empty).OrderBy(x => x.Id_Topic).ToList(); if (!string.IsNullOrEmpty(strSearch)) { obj = obj.Where(x => x.Name.Contains(strSearch) || x.Course.Contains(strSearch) || x.Trainer.Contains(strSearch)).ToList(); } @ViewBag.strSearch = strSearch; return(View(obj)); }
/// <summary> /// Get list of all topics /// </summary> /// <returns>List of topic</returns> public TopicList GetListTopics() { _semaphore.WaitOne(); var topics = new TopicList(); foreach (var cut in _list) { topics.List.Add(cut.Key); } _semaphore.Release(); return(topics); }
public static void ArticleNew(Guid idTopic) { Article item = new Article(); item.Id = Guid.NewGuid(); item.UserAdd = System.Web.HttpContext.Current.User.Identity.Name; item.CreatedDate = DateTime.Now; item.ModifiedDate = DateTime.Now; Topic topic = (Topic)TopicList.Search(o => ((Topic)o).Id == idTopic); item.PageId = topic.PageId; PSCDialog.DataShare = new ArticleArgs(item, item.GetDescription(), item.GetContent(), false); }
public void Run(String[] args) //throws Exception { if (!ParseCommandLine(args)) { return; } SessionOptions sessionOptions = new SessionOptions(); sessionOptions.ServerHost = d_host; sessionOptions.ServerPort = d_port; sessionOptions.AuthenticationOptions = d_authOptions; System.Console.WriteLine("Connecting to " + d_host + ":" + d_port); ProviderSession session = new ProviderSession(sessionOptions, ProcessEvent); if (!session.Start()) { System.Console.WriteLine("Failed to start session"); return; } Identity identity = null; if (d_authOptions.Length != 0) { if (!Authorize(out identity, session)) { return; } } TopicList topicList = new TopicList(); topicList.Add( d_service + "/1245/4/5", new CorrelationID(new MyStream("1245/4/5"))); topicList.Add( d_service + "/330/1/1", new CorrelationID(new MyStream("330/1/1"))); session.CreateTopics( topicList, ResolveMode.AUTO_REGISTER_SERVICES, identity); // createTopics() is synchronous, topicList will be updated // with the results of topic creation (resolution will happen // under the covers) Publish(topicList, session); }
protected void LoadData() { if (System.Web.HttpContext.Current.Request.QueryString["Id"] == null) { rtvTopic.DataSource = TopicList.GetBindingSource(); rtvTopic.DataBind(); } else { art = PSCPortal.CMS.Article.GetArticle(System.Web.HttpContext.Current.Request.QueryString["Id"]); rtvTopic.DataSource = TopicBelongArticle.GetBindingSource(); rtvTopic.DataBind(); } }
public static string SecurityUI(string id) { Guid topicId = new Guid(id); Topic topic = (Topic)TopicList.Search(t => ((Topic)t).Id == topicId); TopicAuthentication ta = TopicAuthentication.GetTopicAuthentication(topic); bool allowNew = ta.IsAllow(TopicPermission.PERMISSION.ARTICLE_NEW); bool allowEdit = ta.IsAllow(TopicPermission.PERMISSION.ARTICLE_EDIT); bool allowDelete = ta.IsAllow(TopicPermission.PERMISSION.ARTICLE_DELETE); bool allowAprove = ta.IsAllow(TopicPermission.PERMISSION.ARTICLE_APROVE); var result = new { AllowNew = allowNew, AllowEdit = allowEdit, AllowDelete = allowDelete, AllowAprove = allowAprove }; System.Web.Script.Serialization.JavaScriptSerializer js = new System.Web.Script.Serialization.JavaScriptSerializer(); return(js.Serialize(result)); }
public async Task <bool> ChangeTopicStatus(TopicList request) { try { MasterTopic masterTopic = new MasterTopic(); masterTopic = await this.therapistContext.MasterTopic.Where(x => x.TopicId == request.TopicId).FirstOrDefaultAsync(); masterTopic.IsActive = request.IsActive; await this.therapistContext.SaveChangesAsync(); return(true); } catch (Exception ex) { throw ex; } }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public async void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseMetricServer(); app.UseWebSockets(new WebSocketOptions { KeepAliveInterval = TimeSpan.FromSeconds(120), ReceiveBufferSize = 4 * 1024 }); app.Use(async(context, next) => { if (context.Request.Path == "/ws") { if (context.WebSockets.IsWebSocketRequest) { var webSocket = await context.WebSockets.AcceptWebSocketAsync(); await new MessageHandler().Handle(context, webSocket); } else { context.Response.StatusCode = 400; } } else { await next(); } }); var client = env.IsDevelopment() ? new EtcdClient("http://localhost") : new EtcdClient("http://etcd"); var me = Guid.NewGuid().ToString(); var brokerTable = new BrokerTable(client); await brokerTable.ImHere(); var topicList = new TopicList(client, me); await topicList.SetupTopicListWatch(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["UserID"] == null) { Response.Write("alert('您还未登陆!');</script>"); Response.Redirect("Login.aspx", true); } else { if (!IsPostBack) { ViewState["pageindex"] = "0"; } string method = Request["method"]; studentid = 1; SqlConnection con = new SqlConnection(connStr); con.Open(); string sqltopic = "select max(CommunityTopic.TopicID)as topicid, max(communityTopic.TopicTime) as TopicTime,max(student.StudentName) as StudentName,max(communityTopic.TopicTitle) as TopicTitle ,max(communityTopic.TopicContent) as TopicContent,count(communityreply.replyid)as replycount from communityTopic inner join student on student.studentid=communityTopic.studentid full join communityreply on communityreply.topicid=communityTopic.TopicID group by communityTopic.TopicID order by max(communityTopic.TopicTime) desc;select top 10 LEFT(CommunityReply.ReplyContent,15)as replycontent,Student.studentname from CommunityReply join student on student.studentid=CommunityReply.StudentID order by ReplyTime;select count(case CommunityReply.Studentid when 1 then 1 else null end)as reply,COUNT(distinct(case CommunityTopic.Studentid when " + studentid + " then CommunityTopic.topicid else null end )) as topic,max(student.studentname) as studentname from CommunityReply full join CommunityTopic on CommunityReply.TopicID=CommunityTopic.TopicID join student on student.studentid=CommunityTopic.studentid where CommunityTopic.StudentID = " + studentid; SqlDataAdapter dpt = new SqlDataAdapter(sqltopic, con); ds = new DataSet(); dpt.Fill(ds); replylist.DataSource = ds.Tables[1]; replylist.DataBind(); reply = int.Parse(ds.Tables[2].Rows[0]["reply"].ToString()); topic = int.Parse(ds.Tables[2].Rows[0]["topic"].ToString()); name = ds.Tables[2].Rows[0]["studentname"].ToString(); if (method == null) { topicCount = ds.Tables[0].Rows.Count; double count = topicCount / 6.0 + 0.5; topicPage = Convert.ToInt32(count); PagedDataSource pds = new PagedDataSource(); pds = BindData(ds); TopicList.DataSource = pds; TopicList.DataBind(); xsTopicList.DataSource = ds.Tables[0]; xsTopicList.DataBind(); } else if (method.Equals("DBind")) { DataBinder(); } con.Close(); } }
public async Task <TopicList> GetTopicById(int TypeId) { try { TopicList topic = new TopicList(); MasterTopic master = await this.therapistContext.MasterTopic.Where(x => x.TopicId == TypeId).FirstOrDefaultAsync(); topic.TopicId = master.TopicId; topic.TopicName = master.TopicName; topic.IsActive = master.IsActive; topic.IsDeleted = master.IsDeleted; topic.Total = 0; return(topic); } catch (Exception ex) { throw ex; } }
public async Task Init() { var list = await _service.GetAll <List <Topic> >(null); TopicList.Clear(); foreach (var topic in list) { var user = await _userService.GetById <User>(topic.UserId); topic.User = user.FirstName + user.LastName; //User that posted topic request.TopicId = topic.Id; var _commentList = await _commentService.GetAll <List <Comment> >(request); topic.Comments = _commentList.Count; // Number of comments var _lastComment = _commentList[_commentList.Count - 1]; // Last comment of topic var user_lastComment = await _userService.GetById <User>(_lastComment.UserId); topic.LastComment = user_lastComment.FirstName + " " + user_lastComment.LastName; TopicList.Add(topic); } }