• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Utility.AjaxResponse类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ASC.Web.Studio.Utility.AjaxResponse的典型用法代码示例。如果您正苦于以下问题:C# AjaxResponse类的具体用法?C# AjaxResponse怎么用?C# AjaxResponse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AjaxResponse类属于ASC.Web.Studio.Utility命名空间,在下文中一共展示了AjaxResponse类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: SaveUserLanguageSettings

        public AjaxResponse SaveUserLanguageSettings(string lng)
        {
            var resp = new AjaxResponse();
            try
            {                
                var user = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);

                var changelng = false;
                if (SetupInfo.EnabledCultures.Find(c => String.Equals(c.Name, lng, StringComparison.InvariantCultureIgnoreCase)) != null)
                {
                    if (user.CultureName != lng)
                    {
                        user.CultureName = lng;
                        changelng = true;
                    }
                }
                CoreContext.UserManager.SaveUserInfo(user);
                if (changelng)
                {
                    resp.rs1 = "1";
                }
                else
                {
                    resp.rs1 = "2";
                    resp.rs2 = "<div class=\"okBox\">" + Resources.Resource.SuccessfullySaveSettingsMessage + "</div>";
                }
            }
            catch (Exception e)
            {
                resp.rs1 = "0";
                resp.rs2 = "<div class=\"errorBox\">" + e.Message.HtmlEncode() + "</div>";
            }
            return resp;
        }
开发者ID:ridhouan,项目名称:teamlab.v6.5,代码行数:34,代码来源:UserCustomisationControl.ascx.cs


示例2: RemoveUser

        public AjaxResponse RemoveUser(Guid userID)
        {
            var resp = new AjaxResponse();
            try
            {
                SecurityContext.DemandPermissions(Constants.Action_AddRemoveUser);

                var user = CoreContext.UserManager.GetUsers(userID);
                var userName = user.DisplayUserName(false);

                UserPhotoManager.RemovePhoto(Guid.Empty, userID);
                CoreContext.UserManager.DeleteUser(userID);

                MessageService.Send(HttpContext.Current.Request, MessageAction.UserDeleted, userName);

                resp.rs1 = "1";
                resp.rs2 = Resource.SuccessfullyDeleteUserInfoMessage;
            }
            catch(Exception e)
            {
                resp.rs1 = "0";
                resp.rs2 = HttpUtility.HtmlEncode(e.Message);
            }

            return resp;
        }
开发者ID:haoasqui,项目名称:ONLYOFFICE-Server,代码行数:26,代码来源:ConfirmationDeleteUser.ascx.cs


示例3: RemaindPwd

        public AjaxResponse RemaindPwd(string email)
        {
            AjaxResponse responce = new AjaxResponse();
            responce.rs1 = "0";

            if (!email.TestEmailRegex())
            {
                responce.rs2 = "<div>" + Resources.Resource.ErrorNotCorrectEmail + "</div>";
                return responce;
            }

            try
            {
                UserManagerWrapper.SendUserPassword(email);

                responce.rs1 = "1";
                responce.rs2 = String.Format(Resources.Resource.MessageYourPasswordSuccessfullySendedToEmail, email);
            }
            catch (Exception exc)
            {
                responce.rs2 = "<div>" + HttpUtility.HtmlEncode(exc.Message) + "</div>";
            }

            return responce;
        }
开发者ID:ridhouan,项目名称:teamlab.v6.5,代码行数:25,代码来源:PwdTool.ascx.cs


示例4: SubscribeOnTopic

        public AjaxResponse SubscribeOnTopic(int idTopic, int statusNotify)
        {
            var resp = new AjaxResponse();

            if (statusNotify == 1 && Subscribe != null)
            {
                Subscribe(this, new SubscribeEventArgs(SubscriptionConstants.NewPostInTopic,
                                                       idTopic.ToString(),
                                                       SecurityContext.CurrentAccount.ID));

                resp.rs1 = "1";
                resp.rs2 = RenderTopicSubscription(false, idTopic);
                resp.rs3 = "subscribed";
            }
            else if (UnSubscribe != null)
            {
                UnSubscribe(this, new SubscribeEventArgs(SubscriptionConstants.NewPostInTopic,
                                                         idTopic.ToString(),
                                                         SecurityContext.CurrentAccount.ID));

                resp.rs1 = "1";
                resp.rs2 = RenderTopicSubscription(true, idTopic);
                resp.rs3 = "unsubscribed";
            }
            else
            {
                resp.rs1 = "0";
                resp.rs2 = Resources.ForumResource.ErrorSubscription;
            }
            return resp;
        }
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:31,代码来源:Subscriber.cs


示例5: RemindPwd

        public AjaxResponse RemindPwd(string email)
        {
            var responce = new AjaxResponse {rs1 = "0"};

            if (!email.TestEmailRegex())
            {
                responce.rs2 = "<div>" + Resource.ErrorNotCorrectEmail + "</div>";
                return responce;
            }

            try
            {
                UserManagerWrapper.SendUserPassword(email);

                responce.rs1 = "1";
                responce.rs2 = String.Format(Resource.MessageYourPasswordSuccessfullySendedToEmail, "<b>" + email + "</b>");

                var user = CoreContext.UserManager.GetUserByEmail(email).DisplayUserName(false);
                MessageService.Send(HttpContext.Current.Request, MessageAction.UserSentPasswordChangeInstructions, user);
            }
            catch(Exception exc)
            {
                responce.rs2 = "<div>" + HttpUtility.HtmlEncode(exc.Message) + "</div>";
            }

            return responce;
        }
开发者ID:haoasqui,项目名称:ONLYOFFICE-Server,代码行数:27,代码来源:PwdTool.ascx.cs


示例6: SendJoinInviteMail

        public AjaxResponse SendJoinInviteMail(string email)
        {

            email = (email ?? "").Trim();
            AjaxResponse resp = new AjaxResponse();
            resp.rs1 = "0";

            try
            {
                if (!email.TestEmailRegex())
                    resp.rs2 = Resources.Resource.ErrorNotCorrectEmail;

                var user = CoreContext.UserManager.GetUserByEmail(email);
                if (!user.ID.Equals(ASC.Core.Users.Constants.LostUser.ID))
                {
                    resp.rs1 = "0";
                    resp.rs2 = CustomNamingPeople.Substitute<Resources.Resource>("ErrorEmailAlreadyExists").HtmlEncode();
                    return resp;
                }

                var tenant = CoreContext.TenantManager.GetCurrentTenant();

                if (tenant.TrustedDomainsType == TenantTrustedDomainsType.Custom)
                {
                    var address = new MailAddress(email);
                    foreach (var d in tenant.TrustedDomains)
                    {
                        if (address.Address.EndsWith("@" + d, StringComparison.InvariantCultureIgnoreCase))
                        {
                            StudioNotifyService.Instance.InviteUsers(email, "", true, false);
                            resp.rs1 = "1";
                            resp.rs2 = Resources.Resource.FinishInviteJoinEmailMessage;
                            return resp;
                        }
                    }
                }
                else if (tenant.TrustedDomainsType == TenantTrustedDomainsType.All)
                {
                    StudioNotifyService.Instance.InviteUsers(email, "", true, false);
                    resp.rs1 = "1";
                    resp.rs2 = Resources.Resource.FinishInviteJoinEmailMessage;
                    return resp;
                }

                resp.rs2 = Resources.Resource.ErrorNotCorrectEmail;
            }
            catch (FormatException)
            {
                resp.rs2 = Resources.Resource.ErrorNotCorrectEmail;
            }
            catch (Exception e)
            {
                resp.rs2 = HttpUtility.HtmlEncode(e.Message);
            }

            return resp;
        }
开发者ID:ridhouan,项目名称:teamlab.v6.5,代码行数:57,代码来源:AuthCommunications.ascx.cs


示例7: SendInviteMails

		public AjaxResponse SendInviteMails(string text, string emails, bool withFullAccessPrivileges)
		{
            SecurityContext.DemandPermissions(ASC.Core.Users.Constants.Action_AddRemoveUser);

			AjaxResponse resp = new AjaxResponse();
			resp.rs1 = "0";
			try
			{
                SecurityContext.DemandPermissions(ASC.Core.Users.Constants.Action_AddRemoveUser);

				string[] addresses = null;
				try
				{
					addresses = StudioNotifyService.Instance.GetEmails(emails);
					if (addresses == null || addresses.Length == 0)
						resp.rs2 = Resources.Resource.ErrorNoEmailsForInvite;
					else
					{
						foreach (var emailStr in addresses)
						{
							var email = (emailStr ?? "").Trim();
							if (!email.TestEmailRegex())
							{
								resp.rs1 = "0";
								resp.rs2 = email + " - " + Resources.Resource.ErrorNotCorrectEmail;
								return resp;
							}

							var user = CoreContext.UserManager.GetUserByEmail(email);
							if (!user.ID.Equals(ASC.Core.Users.Constants.LostUser.ID))
							{
								resp.rs1 = "0";
								resp.rs2 = email + " - " + CustomNamingPeople.Substitute<Resources.Resource>("ErrorEmailAlreadyExists").HtmlEncode();
								return resp;
							}
						}

						StudioNotifyService.Instance.InviteUsers(emails, text, false, withFullAccessPrivileges);
						resp.rs1 = "1";
						resp.rs2 = Resources.Resource.FinishInviteEmailTitle;
					}
				}
				catch
				{
					resp.rs2 = Resources.Resource.ErrorNoEmailsForInvite;
				}

			}
			catch (Exception e)
			{
				resp.rs2 = HttpUtility.HtmlEncode(e.Message);
			}

			return resp;
		}
开发者ID:ridhouan,项目名称:teamlab.v6.5,代码行数:55,代码来源:InviteEmployeeControl.ascx.cs


示例8: TestSmtpSettings

        public object TestSmtpSettings(string email)
        {

            AjaxResponse resp = new AjaxResponse();
            if (!email.TestEmailRegex())            
                return new { Status = 0, Message = Resources.Resource.ErrorNotCorrectEmail };                            

            try
            {
                SecurityContext.DemandPermissions(SecutiryConstants.EditPortalSettings);

                MailMessage mail = new MailMessage();
                mail.To.Add(email);

                mail.Subject = Resources.Resource.TestSMTPEmailSubject;
                mail.Priority = MailPriority.Normal;
                mail.IsBodyHtml = false;
                mail.BodyEncoding = System.Text.Encoding.UTF8;
                mail.From = new MailAddress(CoreContext.Configuration.SmtpSettings.SenderAddress,
                                                    CoreContext.Configuration.SmtpSettings.SenderDisplayName,
                                                    System.Text.Encoding.UTF8);


                mail.Body = Resources.Resource.TestSMTPEmailBody;

                SmtpClient client = new SmtpClient(CoreContext.Configuration.SmtpSettings.Host, CoreContext.Configuration.SmtpSettings.Port ?? 25);
                client.EnableSsl = CoreContext.Configuration.SmtpSettings.EnableSSL;

                if (client.EnableSsl)
                {
                    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Ssl3;
                }

                if (String.IsNullOrEmpty(CoreContext.Configuration.SmtpSettings.CredentialsUserName))
                {
                    client.UseDefaultCredentials = true;
                }
                else
                {
                    client.Credentials = new NetworkCredential(
                        CoreContext.Configuration.SmtpSettings.CredentialsUserName,
                        CoreContext.Configuration.SmtpSettings.CredentialsUserPassword,
                        CoreContext.Configuration.SmtpSettings.CredentialsDomain);
                }
                client.Send(mail);

                return new { Status = 1, Message = Resources.Resource.SuccessfullySMTPTestMessage };         
            }
            catch (Exception e)
            {
                return new { Status = 0, Message = e.Message.HtmlEncode() };  
            }
        }
开发者ID:ridhouan,项目名称:teamlab.v6.5,代码行数:53,代码来源:MailSettings.ascx.cs


示例9: RequestPayPal

        public AjaxResponse RequestPayPal(int qoutaId)
        {
            var res = new AjaxResponse();

            try
            {
                if (!HttpRuntime.Cache.Get(PartnerCache).Equals(DateTime.UtcNow))
                    HttpRuntime.Cache.Insert(PartnerCache, DateTime.UtcNow);

                var partnerId = CoreContext.TenantManager.GetCurrentTenant().PartnerId;
                var partner = CoreContext.PaymentManager.GetPartner(partnerId);

                if (partner == null || partner.Status != PartnerStatus.Approved || partner.Removed || partner.PaymentMethod != PartnerPaymentMethod.PayPal)
                {
                    throw new MethodAccessException(Resource.PartnerPayPalExc);
                }

                var tenantQuota = TenantExtra.GetTenantQuota(qoutaId);

                var curruntQuota = TenantExtra.GetTenantQuota();
                if (TenantExtra.GetCurrentTariff().State == TariffState.Paid
                    && tenantQuota.ActiveUsers < curruntQuota.ActiveUsers
                    && tenantQuota.Year == curruntQuota.Year)
                {
                    throw new MethodAccessException(Resource.PartnerPayPalDowngrade);
                }

                if (tenantQuota.Price > partner.AvailableCredit)
                {
                    CoreContext.PaymentManager.RequestClientPayment(partnerId, qoutaId, false);
                    throw new Exception(Resource.PartnerRequestLimitInfo);
                }

                var usersCount = TenantStatisticsProvider.GetUsersCount();
                var usedSize = TenantStatisticsProvider.GetUsedSize();

                if (tenantQuota.ActiveUsers < usersCount || tenantQuota.MaxTotalSize < usedSize)
                {
                    res.rs2 = "quotaexceed";
                    return res;
                }

                res.rs1 = CoreContext.PaymentManager.GetButton(partner.Id, qoutaId);
            }
            catch (Exception e)
            {
                res.message = e.Message;
            }
            return res;
        }
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:50,代码来源:TariffPartner.ascx.cs


示例10: JoinToAffiliateProgram

        public AjaxResponse JoinToAffiliateProgram()
        {
            var resp = new AjaxResponse();
            try
            {
                resp.rs1 = "1";
                resp.rs2 = AffiliateHelper.Join();
            }
            catch (Exception e)
            {
                resp.rs1 = "0";
                resp.rs2 = HttpUtility.HtmlEncode(e.Message);
            }
            return resp;

        }
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:16,代码来源:Banner.ascx.cs


示例11: RemindPwd

        public AjaxResponse RemindPwd(string email)
        {
            var response = new AjaxResponse {rs1 = "0"};

            if (!email.TestEmailRegex())
            {
                response.rs2 = "<div>" + Resource.ErrorNotCorrectEmail + "</div>";
                return response;
            }

            var tenant = CoreContext.TenantManager.GetCurrentTenant();
            if (tenant != null)
            {
                var settings = SettingsManager.Instance.LoadSettings<IPRestrictionsSettings>(tenant.TenantId);
                if (settings.Enable && !IPSecurity.IPSecurity.Verify(tenant.TenantId))
                {
                    response.rs2 = "<div>" + Resource.ErrorAccessRestricted + "</div>";
                    return response;
                }
            }

            try
            {
                UserManagerWrapper.SendUserPassword(email);

                response.rs1 = "1";
                response.rs2 = String.Format(Resource.MessageYourPasswordSuccessfullySendedToEmail, "<b>" + email + "</b>");
                var userInfo = CoreContext.UserManager.GetUserByEmail(email);

                if (userInfo.Sid != null)
                {
                    response.rs2 = "<div>" + Resource.CouldNotRecoverPasswordForLdapUser + "</div>";
                    return response;
                }

                string displayUserName = userInfo.DisplayUserName(false);

                MessageService.Send(HttpContext.Current.Request, MessageAction.UserSentPasswordChangeInstructions, displayUserName);
            }
            catch(Exception ex)
            {
                response.rs2 = "<div>" + HttpUtility.HtmlEncode(ex.Message) + "</div>";
            }

            return response;
        }
开发者ID:vipwan,项目名称:CommunityServer,代码行数:46,代码来源:PwdTool.ascx.cs


示例12: SaveNotifyBarSettings

        public AjaxResponse SaveNotifyBarSettings(bool showPromotions)
        {
            AjaxResponse resp = new AjaxResponse();
            _studioNotifyBarSettings = SettingsManager.Instance.LoadSettings<StudioNotifyBarSettings>(TenantProvider.CurrentTenantID);
            _studioNotifyBarSettings.ShowPromotions = showPromotions;
            if (SettingsManager.Instance.SaveSettings<StudioNotifyBarSettings>(_studioNotifyBarSettings, TenantProvider.CurrentTenantID))
            {
                resp.rs1 = "1";
                resp.rs2 = "<div class=\"okBox\">" + Resources.Resource.SuccessfullySaveSettingsMessage + "</div>";
            }
            else
            {
                resp.rs1 = "0";
                resp.rs2 = "<div class=\"errorBox\">" + Resources.Resource.UnknownError + "</div>";
            }

            return resp;
        }
开发者ID:ridhouan,项目名称:teamlab.v6.5,代码行数:18,代码来源:PromoSettings.ascx.cs


示例13: SaveLanguageTimeSettings

        public object SaveLanguageTimeSettings(string lng, string timeZoneID)
        {
            var resp = new AjaxResponse();
            try
            {
                SecurityContext.DemandPermissions(SecutiryConstants.EditPortalSettings);

                var tenant = CoreContext.TenantManager.GetCurrentTenant();
                var culture = CultureInfo.GetCultureInfo(lng);

                var changelng = false;
                if (SetupInfo.EnabledCultures.Find(c => String.Equals(c.Name, culture.Name, StringComparison.InvariantCultureIgnoreCase)) != null)
                {
                    if (!String.Equals(tenant.Language, culture.Name, StringComparison.InvariantCultureIgnoreCase))
                    {
                        tenant.Language = culture.Name;
                        changelng = true;
                    }
                }

                var oldTimeZone = tenant.TimeZone;
                tenant.TimeZone = new List<TimeZoneInfo>(TimeZoneInfo.GetSystemTimeZones()).Find(tz => String.Equals(tz.Id, timeZoneID));

                CoreContext.TenantManager.SaveTenant(tenant);
                
                if (!tenant.TimeZone.Id.Equals(oldTimeZone.Id) || changelng)
                {
                    AdminLog.PostAction("Settings: saved language and time zone settings with parameters language={0},time={1}", lng, timeZoneID);
                }

                if (changelng)
                {
                    return new { Status = 1, Message = String.Empty };
                }
                else
                {
                    return new { Status = 2, Message = Resources.Resource.SuccessfullySaveSettingsMessage };
                }
            }
            catch (Exception e)
            {
                return new { Status = 0, Message = e.Message.HtmlEncode() };
            }
        }       
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:44,代码来源:TimeAndLanguage.ascx.cs


示例14: GetSuggest

        public AjaxResponse GetSuggest(Guid settingsID, string text, string varName)
        {
            AjaxResponse resp = new AjaxResponse();

            string startSymbols = text;
            int ind = startSymbols.LastIndexOf(",");
            if (ind != -1)
                startSymbols = startSymbols.Substring(ind + 1);

            startSymbols = startSymbols.Trim();

            var tags = new List<Tag>();

            if (!String.IsNullOrEmpty(startSymbols))
                tags = ForumDataProvider.SearchTags(TenantProvider.CurrentTenantID, startSymbols);

            int counter = 0;
            string resNames = "", resHelps = "";

            foreach (var tag in tags)
            {
                if (counter > 10)
                    break;

                resNames += tag.Name + "$";
                resHelps += tag.ID + "$";
                counter++;
            }

            resNames = resNames.TrimEnd('$');
            resHelps = resHelps.TrimEnd('$');
            resp.rs1 = resNames;
            resp.rs2 = resHelps;
            resp.rs3 = text;
            resp.rs4 = varName;

            return resp;
        }
开发者ID:haoasqui,项目名称:ONLYOFFICE-Server,代码行数:38,代码来源:TagSuggest.cs


示例15: SubscribeOnComments

        public AjaxResponse SubscribeOnComments(Guid postID, int statusNotify)
        {
            var resp = new AjaxResponse();
            try
            {
                if (statusNotify == 1)
                {
                    _subscriptionProvider.Subscribe(
                        ASC.Blogs.Core.Constants.NewComment,
                        postID.ToString(),
                        IAmAsRecipient
                        );


                    resp.rs1 = "1";
                    resp.rs2 = RenderCommentsSubscription(false, postID);
                }
                else
                {

                    _subscriptionProvider.UnSubscribe(
                        ASC.Blogs.Core.Constants.NewComment,
                        postID.ToString(),
                        IAmAsRecipient
                        );

                    resp.rs1 = "1";
                    resp.rs2 = RenderCommentsSubscription(true, postID);
                }
            }
            catch (Exception e)
            {
                resp.rs1 = "0";
                resp.rs2 = HttpUtility.HtmlEncode(e.Message);
            }

            return resp;
        }
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:38,代码来源:Subscriber.cs


示例16: SubscribePersonalBlog

        public AjaxResponse SubscribePersonalBlog(Guid userID, int statusNotify)
        {
            var resp = new AjaxResponse();
            try
            {
                if (statusNotify == 1)
                {
                    _subscriptionProvider.Subscribe(
                        ASC.Blogs.Core.Constants.NewPostByAuthor,
                        userID.ToString(),
                        IAmAsRecipient
                        );


                    resp.rs1 = "1";
                    resp.rs2 = RenderPersonalBlogSubscriptionLink(false, userID);
                }
                else
                {
                    _subscriptionProvider.UnSubscribe(
                        ASC.Blogs.Core.Constants.NewPostByAuthor,
                        userID.ToString(),
                        IAmAsRecipient
                        );

                    resp.rs1 = "1";
                    resp.rs2 = RenderPersonalBlogSubscriptionLink(true, userID);
                }
            }
            catch (Exception e)
            {
                resp.rs1 = "0";
                resp.rs2 = HttpUtility.HtmlEncode(e.Message);
            }

            return resp;
        }
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:37,代码来源:Subscriber.cs


示例17: UpdateComment

        public AjaxResponse UpdateComment(string commentID, string text, string pid)
        {
            var resp = new AjaxResponse { rs1 = commentID };

            Guid? id = null;
            try
            {
                if (!String.IsNullOrEmpty(commentID))
                    id = new Guid(commentID);
            }
            catch
            {
                return new AjaxResponse();
            }

            var engine = GetEngine();

            var comment = engine.GetCommentById(id.Value);
            if (comment == null)
                throw new ApplicationException("Comment not found");

            CommunitySecurity.DemandPermissions(comment, Constants.Action_EditRemoveComment);

            comment.Content = text;

            var post = engine.GetPostById(comment.PostId);
            engine.UpdateComment(comment, post);

            resp.rs2 = text + CodeHighlighter.GetJavaScriptLiveHighlight(true);

            return resp;
        }
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:32,代码来源:ViewBlog.aspx.cs


示例18: AddComment

        public AjaxResponse AddComment(string parrentCommentID, string blogID, string text, string pid)
        {
            Guid postId;
            Guid? parentId = null;
            try
            {
                postId = new Guid(blogID);

                if (!String.IsNullOrEmpty(parrentCommentID))
                    parentId = new Guid(parrentCommentID);
            }
            catch
            {
                return new AjaxResponse();
            }

            var engine = GetEngine();

            var resp = new AjaxResponse { rs1 = parrentCommentID };

            var post = engine.GetPostById(postId);

            if (post == null)
            {
                return new AjaxResponse { rs10 = "postDeleted", rs11 = Constants.DefaultPageUrl };
            }

            CommunitySecurity.DemandPermissions(post, Constants.Action_AddComment);

            var newComment = new Comment
                {
                    PostId = postId,
                    Content = text,
                    Datetime = ASC.Core.Tenants.TenantUtil.DateTimeNow(),
                    UserID = SecurityContext.CurrentAccount.ID
                };

            if (parentId.HasValue)
                newComment.ParentId = parentId.Value;

            engine.SaveComment(newComment, post);

            //mark post as seen for the current user
            engine.SavePostReview(post, SecurityContext.CurrentAccount.ID);
            resp.rs2 = GetHTMLComment(newComment, false);

            return resp;
        }
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:48,代码来源:ViewBlog.aspx.cs


示例19: DoDeleteTopic

        public AjaxResponse DoDeleteTopic(int idTopic, Guid settingsID)
        {
            _forumManager = ForumManager.GetForumManager(settingsID);
            var resp = new AjaxResponse { rs2 = idTopic.ToString() };

            var topic = ForumDataProvider.GetTopicByID(TenantProvider.CurrentTenantID, idTopic);
            if (topic == null)
            {
                resp.rs1 = "0";
                resp.rs3 = Resources.ForumUCResource.ErrorAccessDenied;
                return resp;
            }

            if (!_forumManager.ValidateAccessSecurityAction(ForumAction.TopicDelete, topic))
            {
                resp.rs1 = "0";
                resp.rs3 = Resources.ForumUCResource.ErrorAccessDenied;
                return resp;
            }

            try
            {
                List<int> removedPostIDs;
                var attachmantOffsetPhysicalPaths = ForumDataProvider.RemoveTopic(TenantProvider.CurrentTenantID, topic.ID, out removedPostIDs);

                resp.rs1 = "1";
                resp.rs3 = Resources.ForumUCResource.SuccessfullyDeleteTopicMessage;
                resp.rs4 = topic.ThreadID.ToString();
                _forumManager.RemoveAttachments(attachmantOffsetPhysicalPaths.ToArray());

                removedPostIDs.ForEach(idPost => CommonControlsConfigurer.FCKUploadsRemoveForItem(_forumManager.Settings.FileStoreModuleID, idPost.ToString()));
            }
            catch (Exception ex)
            {
                resp.rs1 = "0";
                resp.rs3 = ex.Message.HtmlEncode();
            }

            return resp;
        }
开发者ID:vipwan,项目名称:CommunityServer,代码行数:40,代码来源:TopicControl.ascx.cs


示例20: DoStickyTopic

        public AjaxResponse DoStickyTopic(int idTopic, Guid settingsID)
        {
            _forumManager = ForumManager.GetForumManager(settingsID);
            var resp = new AjaxResponse { rs2 = idTopic.ToString() };

            var topic = ForumDataProvider.GetTopicByID(TenantProvider.CurrentTenantID, idTopic);
            if (topic == null)
            {
                resp.rs1 = "0";
                resp.rs3 = Resources.ForumUCResource.ErrorAccessDenied;
                return resp;
            }

            if (!_forumManager.ValidateAccessSecurityAction(ForumAction.TopicSticky, topic))
            {
                resp.rs1 = "0";
                resp.rs3 = Resources.ForumUCResource.ErrorAccessDenied;
                return resp;
            }

            topic.Sticky = !topic.Sticky;
            try
            {
                ForumDataProvider.UpdateTopic(TenantProvider.CurrentTenantID, topic.ID, topic.Title, topic.Sticky, topic.Closed);

                resp.rs1 = "1";
                if (topic.Sticky)
                {

                    resp.rs3 = Resources.ForumUCResource.SuccessfullyStickyTopicMessage;
                    resp.rs4 = Resources.ForumUCResource.ClearStickyTopicButton;
                }
                else
                {
                    resp.rs3 = Resources.ForumUCResource.SuccessfullyClearStickyTopicMessage;
                    resp.rs4 = Resources.ForumUCResource.StickyTopicButton;
                }
            }
            catch (Exception e)
            {
                resp.rs1 = "0";
                resp.rs3 = HttpUtility.HtmlEncode(e.Message);
            }
            return resp;
        }
开发者ID:vipwan,项目名称:CommunityServer,代码行数:45,代码来源:TopicControl.ascx.cs



注:本文中的ASC.Web.Studio.Utility.AjaxResponse类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# client.IQ类代码示例发布时间:2022-05-24
下一篇:
C# Domain.TaskFilter类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap