private void GetList(HttpContext context) { int num = 1; int num2 = 10; num = base.GetIntParam(context, "page", false).Value; if (num < 1) { num = 1; } num2 = base.GetIntParam(context, "rows", false).Value; if (num2 < 1) { num2 = 10; } HelpQuery helpQuery = new HelpQuery(); helpQuery.Keywords = context.Request["Keywords"]; if (!string.IsNullOrEmpty(context.Request["CategoryId"])) { helpQuery.CategoryId = base.GetIntParam(context, "CategoryId", false).Value; } helpQuery.StartArticleTime = base.GetDateTimeParam(context, "FromDate"); helpQuery.EndArticleTime = base.GetDateTimeParam(context, "ToDate"); helpQuery.SortBy = "AddedDate"; helpQuery.SortOrder = SortAction.Desc; helpQuery.PageIndex = num; helpQuery.PageSize = num2; DataGridViewModel <Dictionary <string, object> > dataList = this.GetDataList(helpQuery); string s = base.SerializeObjectToJson(dataList); context.Response.Write(s); context.Response.End(); }
private void BindList() { HelpQuery helpQuery = this.GetHelpQuery(); DbQueryResult dbQueryResult = new DbQueryResult(); dbQueryResult = CommentBrowser.GetHelpList(helpQuery); this.rptHelps.DataSource = dbQueryResult.Data; this.rptHelps.DataBind(); this.pager.TotalRecords = dbQueryResult.TotalRecords; }
public static String GetMshcTopicID(String url) { if (!String.IsNullOrEmpty(url) && UrlType(url) == TopicLinkType.mshc) { HelpQuery helpQuery = new HelpQuery(url); if (!String.IsNullOrEmpty(helpQuery.Method) && helpQuery.Method.Equals("page", StringComparison.OrdinalIgnoreCase)) { return(helpQuery.AssetId); // ms-xhelp:///?method=page&id=AssetId (return AssetID) } } return(""); }
public void Ctor_Called_PropertieSetUp() { // * Arrange var fh = new Mock <IInformationRepository>(MockBehavior.Loose); // * Act var q = new HelpQuery { InformationRepository = fh.Object }; // * Assert Assert.That(!String.IsNullOrWhiteSpace(q.Description)); Assert.That(q.PrivilegeLevel, Is.Not.EqualTo(QueryPrivilegeLevel.Undefined)); }
public void CanExecute_InvalidCall_False() { // * Arrange var fh = new Mock <IInformationRepository>(MockBehavior.Loose); // * Act var q = new HelpQuery { InformationRepository = fh.Object }; var canExecute = q.CanExecute("foobar"); // * Assert Assert.That(!canExecute); }
private DataGridViewModel <Dictionary <string, object> > GetDataList(HelpQuery query) { DataGridViewModel <Dictionary <string, object> > dataGridViewModel = new DataGridViewModel <Dictionary <string, object> >(); if (query != null) { DbQueryResult helpList = ArticleHelper.GetHelpList(query); dataGridViewModel.rows = DataHelper.DataTableToDictionary(helpList.Data); dataGridViewModel.total = helpList.TotalRecords; foreach (Dictionary <string, object> row in dataGridViewModel.rows) { } } return(dataGridViewModel); }
private HelpQuery GetHelpQuery() { HelpQuery helpQuery = new HelpQuery(); if (!string.IsNullOrEmpty(this.Page.Request.QueryString["categoryId"])) { int value = 0; if (int.TryParse(this.Page.Request.QueryString["categoryId"], out value)) { helpQuery.CategoryId = new int?(value); } } helpQuery.PageIndex = this.pager.PageIndex; helpQuery.PageSize = this.pager.PageSize; helpQuery.SortBy = "AddedDate"; helpQuery.SortOrder = SortAction.Desc; return helpQuery; }
private HelpQuery GetHelpQuery() { HelpQuery query = new HelpQuery(); if (!string.IsNullOrEmpty(this.Page.Request.QueryString["categoryId"])) { int result = 0; if (int.TryParse(this.Page.Request.QueryString["categoryId"], out result)) { query.CategoryId = new int?(result); } } query.PageIndex = this.pager.PageIndex; query.PageSize = this.pager.PageSize; query.SortBy = "AddedDate"; query.SortOrder = SortAction.Desc; return(query); }
private HelpQuery GetHelpQuery() { HelpQuery helpQuery = new HelpQuery(); if (!string.IsNullOrEmpty(base.GetParameter("categoryId", false))) { int value = 0; if (int.TryParse(base.GetParameter("categoryId", false), out value)) { helpQuery.CategoryId = value; } } helpQuery.PageIndex = this.pager.PageIndex; helpQuery.PageSize = this.pager.PageSize; helpQuery.SortBy = "AddedDate"; helpQuery.SortOrder = SortAction.Desc; return(helpQuery); }
private void BindSearch() { HelpQuery helpQuery = new HelpQuery(); helpQuery.StartArticleTime = this.startTime; helpQuery.EndArticleTime = this.endTime; helpQuery.Keywords = Globals.HtmlEncode(this.keywords); helpQuery.CategoryId = this.categoryId; helpQuery.PageIndex = this.pager.PageIndex; helpQuery.PageSize = this.pager.PageSize; helpQuery.SortBy = this.grdHelpList.SortOrderBy; helpQuery.SortOrder = SortAction.Desc; DbQueryResult helpList = SubsiteCommentsHelper.GetHelpList(helpQuery); this.grdHelpList.DataSource = helpList.Data; this.grdHelpList.DataBind(); this.pager.TotalRecords = helpList.TotalRecords; this.pager1.TotalRecords = helpList.TotalRecords; }
public void Execute_InvalidCall_Throws() { // * Arrange var fh = new Mock <IInformationRepository>(MockBehavior.Loose); fh.Setup(x => x.ReadAllFromFile("help.txt", It.IsAny <Encoding>())).Returns("Test"); var bot = new Mock <IBot>(); var user = new Mock <IUser>(); var channel = new Mock <IChannel>(); var context = new QueryContext(bot.Object, user.Object, channel.Object, false); // * Act var q = new HelpQuery { InformationRepository = fh.Object }; q.Execute("foobar", context); }
private void BindSearch() { HelpQuery helpQuery = new HelpQuery(); helpQuery.StartArticleTime = startTime; helpQuery.EndArticleTime = endTime; helpQuery.Keywords = Globals.HtmlEncode(keywords); helpQuery.CategoryId = categoryId; helpQuery.PageIndex = pager.PageIndex; helpQuery.PageSize = pager.PageSize; helpQuery.SortBy = grdHelpList.SortOrderBy; helpQuery.SortOrder = SortAction.Desc; DbQueryResult helpList = ArticleHelper.GetHelpList(helpQuery); grdHelpList.DataSource = helpList.Data; grdHelpList.DataBind(); pager.TotalRecords = helpList.TotalRecords; pager1.TotalRecords = helpList.TotalRecords; }
public override DbQueryResult GetHelpList(HelpQuery helpQuery) { StringBuilder builder = new StringBuilder(); builder.AppendFormat("Title LIKE '%{0}%'", helpQuery.Keywords); if (helpQuery.CategoryId.HasValue) { builder.AppendFormat(" AND CategoryId = {0}", helpQuery.CategoryId.Value); } if (helpQuery.StartArticleTime.HasValue) { builder.AppendFormat(" AND AddedDate >= '{0}'", helpQuery.StartArticleTime.Value); } if (helpQuery.EndArticleTime.HasValue) { builder.AppendFormat(" AND AddedDate <= '{0}'", helpQuery.EndArticleTime.Value); } return(DataHelper.PagingByTopnotin(helpQuery.PageIndex, helpQuery.PageSize, helpQuery.SortBy, helpQuery.SortOrder, helpQuery.IsCount, "vw_Hishop_Helps", "HelpId", builder.ToString(), "*")); }
public override DbQueryResult GetHelpList(HelpQuery helpQuery) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendFormat("Title LIKE '%{0}%'", helpQuery.Keywords); if (helpQuery.CategoryId.HasValue) { stringBuilder.AppendFormat(" AND CategoryId = {0}", helpQuery.CategoryId.Value); } if (helpQuery.StartArticleTime.HasValue) { stringBuilder.AppendFormat(" AND AddedDate >= '{0}'", helpQuery.StartArticleTime.Value); } if (helpQuery.EndArticleTime.HasValue) { stringBuilder.AppendFormat(" AND AddedDate <= '{0}'", helpQuery.EndArticleTime.Value); } stringBuilder.AppendFormat(" AND DistributorUserId = {0}", HiContext.Current.SiteSettings.UserId.Value); return(DataHelper.PagingByTopnotin(helpQuery.PageIndex, helpQuery.PageSize, helpQuery.SortBy, helpQuery.SortOrder, helpQuery.IsCount, "vw_distro_Helps", "HelpId", stringBuilder.ToString(), "*")); }
// Update Details view when user clicks a link in the browser private void webBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs e) { String url = e.Url.AbsoluteUri; if (url.StartsWith("ms-xhelp:", StringComparison.OrdinalIgnoreCase)) { HelpQuery helpQuery = new HelpQuery(url); if (helpQuery.Method.Equals("page", StringComparison.OrdinalIgnoreCase)) { //get topic from ID try { Topic topic = (Topic)Globals.catalogRead.GetIndexedTopicDetails(Globals.catalog, helpQuery.AssetId, null); UpdateTopicDetails(topic); //update details only } catch { } } } }
public void Execute_ValidCall_MessagesUser() { // * Arrange var fh = new Mock <IInformationRepository>(MockBehavior.Loose); fh.Setup(x => x.ReadAllFromFile("help.txt", It.IsAny <Encoding>())).Returns("Test"); var bot = new Mock <IBot>(); var user = new Mock <IUser>(); var channel = new Mock <IChannel>(); var context = new QueryContext(bot.Object, user.Object, channel.Object, false); // * Act var q = new HelpQuery { InformationRepository = fh.Object }; q.Execute("help", context); // * Assert bot.Verify(x => x.MessageUser(user.Object, "Test"), Times.Once); }
public abstract DbQueryResult GetHelpList(HelpQuery helpQuery);
public static DbQueryResult GetHelpList(HelpQuery helpQuery) { return(CommentProvider.Instance().GetHelpList(helpQuery)); }
public IHttpActionResult HelpByCategory(int categoryId, string accessToken, int channel, int platform, string ver) { Logger.WriterLogger("Common.HelpByCategory, Params: " + string.Format("accessToken={0}&channel={1}&platform={2}&ver={3}&categoryId={4}", accessToken, channel, platform, ver, categoryId), LoggerType.Info); // 保存访问信息 base.SaveVisitInfo("", channel, platform, ver); // 验证令牌 int accessTookenCode = VerifyAccessToken(accessToken); if (accessTookenCode > 0) { return(base.JsonFaultResult(new CommonException(accessTookenCode).GetMessage(), "Common.HelpByCategory")); } IList <HelpCategoryInfo> categories = CommentBrowser.GetHelpCategorys(); HelpQuery helpQuery = new HelpQuery(); if (categoryId > 0) { helpQuery.CategoryId = categoryId; } helpQuery.PageIndex = 1; helpQuery.PageSize = int.MaxValue; helpQuery.SortBy = "AddedDate"; helpQuery.SortOrder = EcShop.Core.Enums.SortAction.Desc; List <HelpListItem> items = new List <HelpListItem>(); DbQueryResult dbQueryResult = CommentBrowser.GetHelpList(helpQuery); DataTable dt = dbQueryResult.Data as DataTable; if (dt != null) { HelpListItem item = null; foreach (DataRow row in dt.Rows) { item = new HelpListItem(); item.CategoryId = (int)row["CategoryId"]; item.Id = (int)row["HelpId"]; item.Title = (string)row["Title"]; item.Description = ""; if (row["Description"] != DBNull.Value) { item.Description = (string)row["Description"]; } item.AddedDate = ""; if (row["AddedDate"] != DBNull.Value) { item.AddedDate = ((DateTime)row["AddedDate"]).ToString("yyyy-MM-dd HH:mm:ss"); } items.Add(item); } } return(base.JsonActionResult(new StandardResult <ListResult <HelpListItem> >() { code = 0, msg = "", data = new ListResult <HelpListItem>() { TotalNumOfRecords = items.Count, Results = items } })); }
public static DbQueryResult GetHelpList(HelpQuery helpQuery) { return(new HelpDao().GetHelpList(helpQuery)); }