/// <summary> /// Fixed: /// </summary> public static string Search() { var dataSet = Get( searchIndexes: QueryStrings.Data("text").SearchIndexes(), offset: QueryStrings.Int("offset"), pageSize: Parameters.General.SearchPageSize); return(MainContainer( text: QueryStrings.Data("text"), offset: 0, results: dataSet?.Tables["Main"].AsEnumerable(), count: Rds.Count(dataSet)).ToString()); }
/// <summary> /// Fixed: /// </summary> public static string Search() { var ss = new SiteSettings(); var dataSet = Get( searchText: QueryStrings.Data("text"), dataTableName: "SearchResults", offset: QueryStrings.Int("offset"), pageSize: Parameters.General.SearchPageSize); return(MainContainer( ss: ss, text: QueryStrings.Data("text"), offset: 0, results: dataSet?.Tables["SearchResults"].AsEnumerable(), count: Rds.Count(dataSet)).ToString()); }
/// <summary> /// Fixed: /// </summary> public static string SearchJson(Context context) { var ss = new SiteSettings(); var offset = QueryStrings.Int("offset"); var searchText = QueryStrings.Data("text"); var dataSet = Get( context: context, searchText: searchText, dataTableName: "SearchResults", offset: offset, pageSize: Parameters.General.SearchPageSize); var dataRows = dataSet?.Tables["SearchResults"].AsEnumerable(); var res = new ResponseCollection(); return(offset == 0 ? res .ReplaceAll( "#MainContainer", MainContainer( context: context, ss: ss, text: searchText, offset: 0, results: dataRows, count: Rds.Count(dataSet))) .Focus("#Search") .ToJson() : res .Append( "#SearchResults", new HtmlBuilder().Results( context: context, ss: ss, text: searchText, offset: offset, dataRows: dataRows)) .Val( "#SearchOffset", (dataRows != null && dataRows.Any() && dataRows.Count() == Parameters.General.SearchPageSize ? offset + Parameters.General.SearchPageSize : -1).ToString()) .ToJson()); }
/// <summary> /// Fixed: /// </summary> public static bool Login(Context context) { var demoModel = new DemoModel().Get( context: context, where : Rds.DemosWhere() .Passphrase(QueryStrings.Data("passphrase")) .CreatedTime( DateTime.Now.AddDays(Parameters.Service.DemoUsagePeriod * -1), _operator: ">=")); if (demoModel.AccessStatus == Databases.AccessStatuses.Selected) { var loginId = LoginId(demoModel, "User1"); var password = Strings.NewGuid().Sha512Cng(); if (!demoModel.Initialized) { var idHash = new Dictionary <string, long>(); demoModel.Initialize(context: context, idHash: idHash, password: password); } else { Rds.ExecuteNonQuery( context: context, statements: Rds.UpdateUsers( param: Rds.UsersParam().Password(password), where : Rds.UsersWhere().LoginId(loginId))); } new UserModel() { LoginId = loginId, Password = password }.Authenticate( context: context, returnUrl: string.Empty); SiteInfo.Reflesh(context: context, force: true); return(Sessions.LoggedIn()); } else { return(false); } }
/// <summary> /// Fixed: /// </summary> public static string SearchJson() { var offset = QueryStrings.Int("offset"); var text = QueryStrings.Data("text"); var dataSet = Get( searchIndexes: text.SearchIndexes(), offset: offset, pageSize: Parameters.General.SearchPageSize); var results = dataSet?.Tables["Main"].AsEnumerable(); var res = new ResponseCollection(); if (offset == 0) { res .ReplaceAll( "#MainContainer", MainContainer( text: text, offset: 0, results: results, count: Rds.Count(dataSet))) .Focus("#Search"); } else { res .Append( "#SearchResults", new HtmlBuilder().Results(text: text, offset: offset, results: results)) .Val( "#SearchOffset", (results != null && results.Any() && results.Count() == Parameters.General.SearchPageSize ? offset + Parameters.General.SearchPageSize : -1).ToString()); } return(res.ToJson()); }