当前位置: 首页>>代码示例>>C#>>正文


C# TextFolder.CreateQuery方法代码示例

本文整理汇总了C#中Kooboo.CMS.Content.Models.TextFolder.CreateQuery方法的典型用法代码示例。如果您正苦于以下问题:C# TextFolder.CreateQuery方法的具体用法?C# TextFolder.CreateQuery怎么用?C# TextFolder.CreateQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Kooboo.CMS.Content.Models.TextFolder的用法示例。


在下文中一共展示了TextFolder.CreateQuery方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HttpPost

        public System.Web.Mvc.ActionResult HttpPost(Page_Context context, PagePositionContext positionContext)
        {
            HttpRequestBase request = context.ControllerContext.HttpContext.Request;
            Controller controller = (Controller)context.ControllerContext.Controller;
            string username = request.Form["username"];
            string email = request.Form["email"];
            try
            {
                if (string.IsNullOrEmpty(username) && string.IsNullOrEmpty(email))
                {
                    controller.ViewData.ModelState.AddModelError("", "Username or Email is required.".Localize());
                    return null;
                }
                else if (controller.ViewData.ModelState.IsValid)
                {
                    var repository = Repository.Current;
                    var textFolder = new TextFolder(repository, "Members");
                    TextContent content = null;
                    if (!string.IsNullOrEmpty(username))
                    {
                        content = textFolder.CreateQuery().WhereEquals("UserName", username).FirstOrDefault();
                        email = content.Get<string>("Email");
                    }
                    else
                    {
                        content = textFolder.CreateQuery().WhereEquals("Email", email).FirstOrDefault();
                        username = content.Get<string>("UserName");
                    }
                    if (content != null)
                    {
                        string randomValue = Kooboo.UniqueIdGenerator.GetInstance().GetBase32UniqueId(16);
                        ServiceFactory.TextContentManager.Update(textFolder, content.UUID, new string[] { "ForgotPWToken" }, new object[] { randomValue });

                        string link = new Uri(request.Url, string.Format("ResetPassword?UserName={0}&token={1}".RawLabel().ToString(), username, randomValue)).ToString();
                        string emailBody = "<b>{0}</b> <br/><br/> To change your password, click on the following link:<br/> <br/> <a href='{1}'>{1}</a> <br/>".RawLabel().ToString();
                        string subject = "Reset your password".RawLabel().ToString();
                        string body = string.Format(emailBody, username, link);
                        SendMail(email, subject, body, false);
                    }
                    else
                    {
                        controller.ViewData.ModelState.AddModelError("", "The user does not exists.".RawLabel().ToString());
                    }
                    controller.ViewBag.Message = "An email with instructions to choose a new password has been sent to you.".RawLabel().ToString();
                }
            }
            catch (Exception e)
            {
                controller.ViewData.ModelState.AddModelError("", e.Message);
            }

            return null;
        }
开发者ID:Qupy,项目名称:Extensions,代码行数:53,代码来源:ForgotPasswordPlugin.cs

示例2: List

        public ActionResult List(string userKey,int? pageIndex, int? pageSize)
        {
            var repository = Repository.Current;
            var categoryFolder = new TextFolder(repository, "Category");
            var articleFolder = new TextFolder(repository, "Article");

            var articleQuery = articleFolder.CreateQuery();

            //var userKey = Page_Context.Current.PageRequestContext.AllQueryString["UserKey"];

            if (!string.IsNullOrEmpty(userKey))
            {
                articleQuery = articleQuery.WhereCategory(categoryFolder.CreateQuery().WhereEquals("UserKey", userKey));
            }

            if (!pageIndex.HasValue)
            {
                pageIndex = 1;
            }
            if (!pageSize.HasValue)
            {
                pageSize = 2;
            }
            var pageData = articleQuery.Skip((pageIndex.Value - 1) * pageSize.Value).Take(pageSize.Value);

            DataRulePagedList pagedList = new DataRulePagedList(pageData,
                pageIndex.Value, pageSize.Value, articleQuery.Count());
            return View(pagedList);
        }
开发者ID:Epitomy,项目名称:CMS,代码行数:29,代码来源:ArticleController.cs

示例3: Categories

        public ActionResult Categories()
        {
            var repository = Repository.Current;
            var categoryFolder = new TextFolder(repository, "Category");

            return View(categoryFolder.CreateQuery());
        }
开发者ID:Epitomy,项目名称:CMS,代码行数:7,代码来源:ArticleController.cs

示例4: Index

 public ActionResult Index(string repositoryName, string folder, string parentFolder, string parentUUID)
 {
     IContentQuery<TextContent> contentQuery = null;
     var repository = new Repository(repositoryName);
     var textFolder = new TextFolder(repository, folder);
     if (string.IsNullOrEmpty(parentFolder))
     {
         contentQuery = textFolder.CreateQuery()
             .Where(new OrElseExpression(new WhereEqualsExpression(null, "ParentUUID", null), new WhereEqualsExpression(null, "ParentUUID", "")));
     }
     else
     {
         contentQuery = textFolder.CreateQuery().WhereEquals("ParentFolder", parentFolder).WhereEquals("ParentUUID", parentUUID);
     }
     var data = contentQuery.ToDictionary(it => it.UUID, it => it.GetSummary());
     return Json(data, JsonRequestBehavior.AllowGet);
 }
开发者ID:Qupy,项目名称:Extensions,代码行数:17,代码来源:CascadingController.cs

示例5: Test1

        public void Test1()
        {
            Repository repository = new Repository("TextTranslatorTests");

            MediaFolder binaryFolder = new MediaFolder(repository, "image");

            var binaryQuery = binaryFolder.CreateQuery().WhereEquals("Title", "title1");

            Assert.AreEqual("[MediaContent] SELECT * FROM [TextTranslatorTests.image] WHERE Title = title1 ORDER  | OP:Unspecified PageSize:0 TOP:0 Skip:0 ", TextTranslator.Translate(binaryQuery));

            Schema schema = new Schema(repository, "news") { IsDummy = false };

            TextFolder textFolder = new TextFolder(repository, "news") { SchemaName = "news", IsDummy = false };

            var textQuery = textFolder.CreateQuery().WhereEquals("Title", "title1").WhereCategory(textFolder.CreateQuery());

            Assert.AreEqual("[TextContent] SELECT * FROM [TextTranslatorTests.news$news] WHERE Title = title1 Category:([TextContent] SELECT * FROM [TextTranslatorTests.news$news] WHERE  Category:() ORDER  | OP:Unspecified PageSize:0 TOP:0 Skip:0 ) ORDER  | OP:Unspecified PageSize:0 TOP:0 Skip:0 ", TextTranslator.Translate(textQuery));
        }
开发者ID:Epitomy,项目名称:CMS,代码行数:18,代码来源:TextTranslatorTests.cs

示例6: DeleteChildContents

 private static void DeleteChildContents(TextContent textContent, TextFolder parentFolder, TextFolder childFolder)
 {
     var repository = textContent.GetRepository();
     var childContents = childFolder.CreateQuery().WhereEquals("ParentFolder", parentFolder.FullName)
         .WhereEquals("ParentUUID", textContent.UUID);
     foreach (var content in childContents)
     {
         Services.ServiceFactory.TextContentManager.Delete(repository, childFolder, content.UUID);
     }
 }
开发者ID:Godoy,项目名称:CMS,代码行数:10,代码来源:CascadingContentDeletingSubscriber.cs

示例7: HttpPost

        public System.Web.Mvc.ActionResult HttpPost(Page_Context context, PagePositionContext positionContext)
        {
            HttpRequestBase request = context.ControllerContext.HttpContext.Request;
            Controller controller = (Controller)context.ControllerContext.Controller;
            string username = request.Params["UserName"];
            string token = request.Params["token"];
            if (!ValidateMemberPasswordToken(username, token))
            {
                context.ControllerContext.Controller.ViewData.ModelState.AddModelError("", "The password token is invalid.".Localize());
                return null;
            }
            AntiForgery.Validate();

            var newPassword = request.Form["newpassword"];
            var confirmPassword = request.Form["confirmPassword"];
            if (newPassword != confirmPassword)
            {
                context.ControllerContext.Controller.ViewData.ModelState.AddModelError("", "The passwords do not match.".RawLabel().ToString());
                return null;
            }
            try
            {
                var httpContext = context.ControllerContext.HttpContext;
                var repository = Repository.Current;
                var textFolder = new TextFolder(repository, "Members");
                var content = textFolder.CreateQuery().WhereEquals("UserName", username).FirstOrDefault();

                var passwordSalt = "";
                if (content["PasswordSalt"] == null)
                {
                    passwordSalt = MemberAuth.GenerateSalt();
                }
                else
                {
                    passwordSalt = content["PasswordSalt"].ToString();
                }

                newPassword = MemberAuth.EncryptPassword(newPassword, passwordSalt);

                ServiceFactory.TextContentManager.Update(textFolder, content.UUID,
                    new string[] { "Password", "ForgotPWToken", "PasswordSalt" }, new object[] { newPassword, "", passwordSalt });
                context.ControllerContext.Controller.ViewBag.Message = "The password has been changed.".Label();

                MemberAuth.SetAuthCookie(username, false);
                return new RedirectResult(context.Url.FrontUrl().PageUrl("Dashboard").ToString());
            }
            catch (Exception e)
            {
                context.ControllerContext.Controller.ViewData.ModelState.AddModelError("", e.Message);
                Kooboo.HealthMonitoring.Log.LogException(e);
            }
            return null;
        }
开发者ID:Qupy,项目名称:Extensions,代码行数:53,代码来源:ResetPasswordPlugin.cs

示例8: Export

        public virtual void Export(string formatter, string folderName, string[] docs)
        {
            var exporter = Kooboo.CMS.Common.Runtime.EngineContext.Current.Resolve<ITextContentFormater>((formatter ?? ""));
            var fileName = folderName + exporter.FileExtension;
            Response.AttachmentHeader(fileName);

            var textFolder = new TextFolder(Repository, folderName);

            var contentQuery = textFolder.CreateQuery();
            foreach (var item in docs)
            {
                contentQuery = contentQuery.Or(new WhereEqualsExpression(null, "UUID", item));
            }
            exporter.Export(contentQuery, Response.OutputStream);
        }
开发者ID:Qupy,项目名称:Extensions,代码行数:15,代码来源:TextContentController.cs

示例9: HttpPost

        public System.Web.Mvc.ActionResult HttpPost(Page_Context context, PagePositionContext positionContext)
        {
            AntiForgery.Validate();

            try
            {
                var httpContext = context.ControllerContext.HttpContext;
                var repository = Repository.Current;
                var textFolder = new TextFolder(repository, "Members");

                string username = httpContext.Request.Form["username"];
                string password = httpContext.Request.Form["password"];

                var member = textFolder.CreateQuery().WhereEquals("UserName", username).FirstOrDefault();

                if (member != null)
                {
                    var encryptedPassword = password;
                    if (member["PasswordSalt"] != null)
                    {
                        var passwordSalt = member["PasswordSalt"].ToString();
                        encryptedPassword = MemberAuth.EncryptPassword(password, passwordSalt);
                    }
                    if (encryptedPassword == member["Password"].ToString())
                    {
                        var rememberme = httpContext.Request.Form["rememberMe"].Contains("true");
                        var returnUrl = httpContext.Request.QueryString["returnUrl"];
                        if (string.IsNullOrEmpty(returnUrl))
                        {
                            returnUrl = context.Url.FrontUrl().PageUrl("Dashboard").ToString();
                        }
                        MemberAuth.SetAuthCookie(username, rememberme);
                        return new RedirectResult(returnUrl);
                    }
                }
                context.ControllerContext.Controller.ViewData.ModelState.AddModelError("", "Username or password is invalid".RawLabel().ToString());
                return null;

            }
            catch (Exception e)
            {
                context.ControllerContext.Controller.ViewData.ModelState.AddModelError("", e);
                Kooboo.HealthMonitoring.Log.LogException(e);
            }
            return null;
        }
开发者ID:Qupy,项目名称:Extensions,代码行数:46,代码来源:SignInPlugin.cs

示例10: Rebuild

 public virtual void Rebuild(TextFolder textFolder)
 {
     var isBuilding = IsRebuilding(textFolder);
     if (!isBuilding)
     {
         var key = GetIndexThreadKey(textFolder);
         Thread thread = new Thread(delegate()
         {
             var searchService = SearchHelper.OpenService(textFolder.Repository);
             searchService.BatchDelete(textFolder.FullName);
             var folderQuery = textFolder.CreateQuery().WhereEquals("Published", true);
             searchService.BatchAdd(folderQuery);
             indexThreads.Remove(key);
         });
         indexThreads.Add(key, thread);
         thread.Start();
     }
 }
开发者ID:Godoy,项目名称:CMS,代码行数:18,代码来源:IndexSummaryService.cs

示例11: HttpPost

        public System.Web.Mvc.ActionResult HttpPost(Page_Context context, PagePositionContext positionContext)
        {
            AntiForgery.Validate();

            try
            {
                var httpContext = context.ControllerContext.HttpContext;
                var repository = Repository.Current;
                var textFolder = new TextFolder(repository, "Members");
                var values = new NameValueCollection(httpContext.Request.Form);
                values["Published"] = true.ToString();

                var member = textFolder.CreateQuery().WhereEquals("UserName", values["username"]).FirstOrDefault();
                if (member != null)
                {
                    context.ControllerContext.Controller.ViewData.ModelState.AddModelError("UserName", "The user already exists.".RawLabel().ToString());
                }
                else
                {
                    values["PasswordSalt"] = MemberAuth.GenerateSalt();
                    values["Password"] = MemberAuth.EncryptPassword(values["Password"], values["PasswordSalt"]);

                    var textContext = ServiceFactory.TextContentManager.Add(repository, textFolder, null, null,
                       values, httpContext.Request.Files, null, httpContext.User.Identity.Name);

                    MemberAuth.SetAuthCookie(textContext["UserName"].ToString(), false);

                    return new RedirectResult(context.Url.FrontUrl().PageUrl("Dashboard").ToString());
                }

            }
            catch (Exception e)
            {
                context.ControllerContext.Controller.ViewData.ModelState.AddModelError("", e);
                Kooboo.HealthMonitoring.Log.LogException(e);
            }
            return null;
        }
开发者ID:Qupy,项目名称:Extensions,代码行数:38,代码来源:RegisterPlugin.cs

示例12: editPost

        public object editPost(string postid, string username, string password, CookComputing.MetaWeblog.Post post, bool publish)
        {
            CheckUserPassword(username, password);
            string folderName;
            string userKey;
            string contentId = MetaWeblogHelper.ParsePostId(postid, out folderName, out userKey);
            var textFolder = new TextFolder(Repository, FolderHelper.SplitFullName(folderName));
            var content = textFolder.CreateQuery().WhereEquals("UUID", contentId).First();

            var values = new NameValueCollection();
            values["title"] = post.title;
            values["description"] = post.description;
            values["body"] = post.description;
            values["userKey"] = userKey;

            ServiceFactory.GetService<TextContentManager>().Update(Repository, textFolder, content.UUID, values);

            var old_categories = GetCategories(textFolder, content);

            var removedCategories = old_categories.Where(it => !post.categories.Any(c => string.Compare(c, it, true) == 0));
            var addedCategories = post.categories.Where(it => !old_categories.Any(c => string.Compare(c, it, true) == 0));

            var removed = GetCategories(textFolder, removedCategories).ToArray();
            if (removed.Length > 0)
            {
                ServiceFactory.GetService<TextContentManager>().RemoveCategories(Repository, (TextContent)content, removed);
            }

            var added = GetCategories(textFolder, addedCategories).ToArray();
            if (added.Length > 0)
            {
                ServiceFactory.GetService<TextContentManager>().AddCategories(Repository, (TextContent)content, added);
            }

            return MetaWeblogHelper.CompositePostId(content);
        }
开发者ID:Epitomy,项目名称:CMS,代码行数:36,代码来源:MetaWeblogAPIHandler.cs

示例13: PublishTextContent

 public ActionResult PublishTextContent(CreateTextContentPublishingQueueViewModel model, string @return)
 {           
     if (model.TextFolderMappings == null || model.TextFolderMappings.Length == 0)
     {
         ModelState.AddModelError("TextFolderMappings", "Required".Localize());
     }
     var resultEntry = new JsonResultData(ModelState);
     if (ModelState.IsValid)
     {
         if (model.Schedule && !model.UtcTimeToPublish.HasValue && !model.UtcTimeToUnpublish.HasValue)
         {
             resultEntry.AddErrorMessage("UtcTimeToPublish and UtcTimeToUnpublish can not be both empty.");
         }
         else
         {
             TextFolder textFolder = new TextFolder(Repository.Current, model.LocalFolderId).AsActual();
             for (int i = 0, j = model.TextContents.Length; i < j; i++)
             {
                 var content = textFolder.CreateQuery().WhereEquals("UUID", model.TextContents[i]).FirstOrDefault();
                 if (content != null)
                 {
                     foreach (string mapping in model.TextFolderMappings)
                     {
                         var queue = new RemotePublishingQueue()
                         {
                             PublishingObject = PublishingObject.TextContent,
                             SiteName = Site.Name,
                             UserId = User.Identity.Name,
                             UtcCreationDate = DateTime.UtcNow,
                             TextFolderMapping = mapping,
                             ObjectUUID = content.IntegrateId,
                             ObjectTitle = model.ObjectTitles[i],
                             Status = QueueStatus.Pending
                         };
                         if (model.Schedule)
                         {
                             if (model.UtcTimeToPublish.HasValue)
                             {
                                 queue.UtcTimeToPublish = model.UtcTimeToPublish.Value.ToUniversalTime();
                             }
                             if (model.UtcTimeToUnpublish.HasValue)
                             {
                                 queue.UtcTimeToUnpublish = model.UtcTimeToUnpublish.Value.ToUniversalTime();
                             }
                         }
                         else
                         {
                             queue.UtcTimeToPublish = DateTime.UtcNow;
                         }
                         resultEntry.RunWithTry((data) =>
                         {
                             _manager.Add(queue);
                         });
                     }
                 }
             }
             resultEntry.RedirectUrl = @return;
         }
     }
     return Json(resultEntry);
 }
开发者ID:XitasoChris,项目名称:CMS,代码行数:61,代码来源:RemotePublishingQueueController.cs

示例14: PublishTextContent

        public ActionResult PublishTextContent(CreateTextContentPublishingQueueViewModel model, string @return)
        {
            var resultEntry = new JsonResultData(ModelState);
            if (ModelState.IsValid)
            {
                if (model.Schedule && !model.UtcTimeToPublish.HasValue && !model.UtcTimeToUnpublish.HasValue)
                {
                    resultEntry.AddErrorMessage("UtcTimeToPublish and UtcTimeToUnpublish can not be both empty".Localize());
                }
                else if (model.Schedule)
                {
                    TextFolder textFolder = new TextFolder(Repository.Current, model.LocalFolderId).AsActual();
                    for (int i = 0, j = model.TextContents.Length; i < j; i++)
                    {
                        var content = textFolder.CreateQuery().WhereEquals("UUID", model.TextContents[i]).FirstOrDefault();
                        var queue = new LocalPublishingQueue(Site, Kooboo.UniqueIdGenerator.GetInstance().GetBase32UniqueId(10))
                        {
                            PublishingObject = PublishingObject.TextContent,
                            UserId = User.Identity.Name,
                            UtcCreationDate = DateTime.UtcNow,
                            ObjectUUID = content.IntegrateId,
                            ObjectTitle = model.ObjectTitles[i],
                            Status = QueueStatus.Pending
                        };
                        if (model.UtcTimeToPublish.HasValue)
                        {
                            queue.UtcTimeToPublish = model.UtcTimeToPublish.Value.ToUniversalTime();
                        }
                        if (model.UtcTimeToUnpublish.HasValue)
                        {
                            queue.UtcTimeToUnpublish = model.UtcTimeToUnpublish.Value.ToUniversalTime();
                        }

                        resultEntry.RunWithTry((data) =>
                        {
                            _manager.Add(queue);
                        });
                    }
                    resultEntry.RedirectUrl = @return;
                }
                else
                {
                    TextFolder textFolder = new TextFolder(Repository.Current, model.LocalFolderId).AsActual();
                    foreach (string uuid in model.TextContents)
                    {
                        Kooboo.CMS.Content.Services.ServiceFactory.TextContentManager.Update(textFolder, uuid, "Published", true, User.Identity.Name);
                    }
                    resultEntry.RedirectUrl = @return;
                }
            }
            return Json(resultEntry);
        }
开发者ID:Godoy,项目名称:CMS,代码行数:52,代码来源:LocalPublishingQueueController.cs

示例15: DeleteTextContent

 public void DeleteTextContent(Site site, TextFolder textFolder, string uuid, string vendor)
 {
     var integrateId = new ContentIntegrateId(uuid);
     var content = textFolder.CreateQuery().WhereEquals("UUID", integrateId.ContentUUID).FirstOrDefault();
     if (content != null)
     {
         IncomingQueue incomeQueue = new IncomingQueue()
         {
             Message = null,
             Object = null,
             ObjectUUID = uuid,
             ObjectTitle = content.GetSummary(),
             Vendor = vendor,
             PublishingObject = PublishingObject.TextContent,
             Action = PublishingAction.Unbpulish,
             SiteName = site.FullName,
             Status = QueueStatus.Pending,
             UtcCreationDate = DateTime.UtcNow,
             UtcProcessedTime = null,
             UUID = Kooboo.UniqueIdGenerator.GetInstance().GetBase32UniqueId(10)
         };
         _incomeQueueProvider.Add(incomeQueue);
     }
 }
开发者ID:Tsingbo-Kooboo,项目名称:KoobooMvc5,代码行数:24,代码来源:CmisIncomeDataManager.cs


注:本文中的Kooboo.CMS.Content.Models.TextFolder.CreateQuery方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。