public virtual void CreateRank() { String target = ctx.Post("Name"); if (strUtil.IsNullOrEmpty(target)) { errors.Add(lang("exName")); run(AddRank); return; } int credit = ctx.PostInt("Credit"); List <SiteRank> ranks = roleService.GetRankAll(); SiteRank lastRank = ranks[ranks.Count - 1]; if (credit <= lastRank.Credit) { String msg = lang("exRankError"); errors.Add(string.Format(msg, KeyCurrency.Instance.Name, lastRank.Credit)); run(AddRank); return; } SiteRank rank = new SiteRank(); rank.Name = target; rank.Credit = credit; roleService.InsertRank(rank); log(SiteLogString.InsertSiteRank(), rank); echoToParentPart(lang("opok")); }
public virtual void Admin() { String ids = ctx.Post("choice"); String cmd = ctx.Post("action"); if (strUtil.IsNullOrEmpty(cmd) || cvt.IsIdListValid(ids) == false) { echoText(lang("exCmd")); return; } if ("delete".Equals(cmd)) { postService.Delete(ids); log(SiteLogString.SystemDeleteContentPost(), ids); echoAjaxOk(); } else if ("deletetrue".Equals(cmd)) { postService.DeleteTrue(ids); log(SiteLogString.SystemDeleteContentPost(), ids); echoAjaxOk(); } else { echoText(lang("exUnknowCmd")); } }
public virtual void Update(long id) { IMenu menu = menuService.FindById(ctx.owner.Id, id); if (menu == null) { echoRedirect(lang("exDataNotFound")); return; } menu = validateMenu(menu); if (ctx.HasErrors) { run(Edit, id); return; } Result result = menuService.Update(menu); if (result.HasErrors) { errors.Join(result); run(Edit, id); return; } log(SiteLogString.UpdateMenu(), menu); ctx.SetItem("currentMenu", menu); echoToParentPart(lang("opok")); }
public void Create(int id) { Page data = validate(new Page()); if (ctx.HasErrors) { run(Add, id); return; } data.Category = new PageCategory { Id = id }; populateOwner(data); pageService.Insert(data); if (ctx.HasErrors) { run(Add, id); return; } log(SiteLogString.AddPage(), data); golist(data.Category.Id); }
public void SavePwd() { // 1、验证密码是否正确 String pwd = ctx.Post("Pwd"); // 2、修改密码 String idsStr = ctx.PostIdList("UserIds"); List <User> users = userService.GetByIds(idsStr); if (users.Count == 0) { echoRedirectPart(lang("exUserNotFound")); return; } foreach (User user in users) { userService.UpdatePwd(user, pwd); logUser(SiteLogString.UpdateUserPwd(), user); } // 3、发送到邮箱 Boolean isSendMail = (ctx.PostIsCheck("chkSendEmail") == 1); if (isSendMail) { sendPwdToEmail(users, pwd); } else { echoRedirectPart(lang("pwdUpdated"), to(Index)); } }
public void SavePermissionAdminAll() { string[] actionIds = ctx.web.postValuesByKey(typeof(SiteAdminOperation).Name); getSecurityTool().SaveActionAll(actionIds); log(SiteLogString.UpdateAdminPermission(), typeof(SiteAdminOperation)); echoRedirect(lang("saved")); }
public void Create() { String name = ctx.Post("Name"); if (strUtil.IsNullOrEmpty(name)) { errors.Add(lang("exName")); run(Add); return; } Group friend = groupService.GetByName(name); if (friend == null) { errors.Add(lang("exFriendGroupNotFound")); run(Add); return; } Result result = gfService.AddFriend(ctx.owner.obj, name); if (result.HasErrors) { errors.Join(result); run(Add); } else { log(SiteLogString.AddFriendGroup(), friend); echoToParentPart(lang("opok")); } }
public void CreateSubPage(int id) { Page page = pageService.GetPostById(id, ctx.owner.obj); if (page == null) { echoRedirect(lang("exParentPageNotFound")); return; } Page data = validate(new Page()); if (ctx.HasErrors) { run(AddSubPage, id); return; } data.ParentId = id; data.Category = new PageCategory { Id = page.Category.Id }; populateOwner(data); pageService.Insert(data); log(SiteLogString.AddPage(), data); golist(data.Category.Id); }
public void EmailSave() { String SmtpUrl = ctx.Post("SmtpUrl"); String SmtpUser = ctx.Post("SmtpUser"); String SmtpPwd = ctx.Post("SmtpPwd"); Boolean SmtpEnableSsl = ctx.PostInt("SmtpEnableSsl") == 1 ? true : false; //if (strUtil.IsNullOrEmpty( SmtpUrl )) errors.Add( lang( "exServer" ) ); //if (strUtil.IsNullOrEmpty( SmtpUser )) errors.Add( lang( "exUserName" ) ); //if (strUtil.IsNullOrEmpty( SmtpPwd )) errors.Add( lang( "exPwd" ) ); if (ctx.HasErrors) { echoError(); } else { config.Instance.Site.SmtpUrl = SmtpUrl; config.Instance.Site.Update("SmtpUrl", SmtpUrl); config.Instance.Site.SmtpUser = SmtpUser; config.Instance.Site.Update("SmtpUser", SmtpUser); config.Instance.Site.SmtpPwd = SmtpPwd; config.Instance.Site.Update("SmtpPwd", SmtpPwd); config.Instance.Site.SmtpEnableSsl = SmtpEnableSsl; config.Instance.Site.Update("SmtpEnableSsl", SmtpEnableSsl); log(SiteLogString.EditSiteSettingEmail()); echoRedirect(lang("opok")); } }
public void Update(int id) { Page data = pageService.GetPostById(id, ctx.owner.obj); if (data == null) { echoRedirect(lang("exDataNotFound")); return; } data = validate(data); if (ctx.HasErrors) { run(Edit, id); return; } int ParentId = ctx.PostInt("ParentId"); data.ParentId = ParentId; pageService.Update(data); log(SiteLogString.UpdatePage(), data); golist(data.Category.Id); }
public virtual void SetRanksByOther(long id) { SiteRankOther otherRank = roleService.GetRankOtherById(id); roleService.UpdateRankByOther(otherRank); log(SiteLogString.SetRanksByOther()); echoToParentPart(lang("opok")); }
public void UpdateKeyRule(int ruleId) { KeyIncomeRule rule = currencyService.GetKeyRuleById(ruleId); rule.Income = ctx.PostInt("Income"); rule.update(); log(SiteLogString.UpdateKeyCurrencyRule(), typeof(KeyIncomeRule)); echoToParentPart(lang("saved")); }
public virtual void UpdateKeyInit() { KeyCurrency c = KeyCurrency.Instance; c.InitValue = ctx.PostInt("InitValue"); c.update(); log(SiteLogString.UpdateKeyCurrencyInit(), typeof(KeyCurrency)); echoToParentPart(lang("saved")); }
public virtual void UpdateInit(long currencyId) { Currency c = currencyService.GetCurrencyById(currencyId); c.InitValue = ctx.PostInt("InitValue"); c.update(); log(SiteLogString.UpdateCurrencyInit(), typeof(Currency)); echoToParentPart(lang("saved")); }
public virtual void Delete(long id) { Group g = groupService.GetById(id); groupService.Delete(id); log(SiteLogString.DeleteGroup(), g); echoRedirect(lang("deleted")); }
public virtual void UpdateRule(long ruleId) { IncomeRule rule = currencyService.GetRuleById(ruleId); rule.Income = ctx.PostInt("Income"); rule.update(); log(SiteLogString.UpdateIncomeRule(), typeof(IncomeRule)); echoToParentPart(lang("saved")); }
public virtual void Start(long id) { IMemberApp app = getApp(id); String appUrl = UrlConverter.clearUrl(app, ctx); userAppService.Start(app, appUrl); log(SiteLogString.StartApp(), app); echoRedirectPart(lang("opok"), to(Index), 0); }
public virtual void Delete(long id) { IMemberApp app = getApp(id); String appUrl = UrlConverter.clearUrl(app, ctx); userAppService.Delete(app, appUrl); log(SiteLogString.DeleteApp(), app); echoRedirect(lang("opok"), Index); }
public void Delete( int id ) { BlogSysCategory c = categoryService.GetById( id ); if (c == null) { echoRedirect( lang( "exDataNotFound" ) ); return; } db.delete( c ); log( SiteLogString.DeleteBlogSysCategory(), c ); redirect( List ); }
public virtual void Delete(long currencyId) { currencyService.GetCurrencyById(currencyId).delete(); IList incomeRules = currencyService.GetIncomeRules(currencyId); foreach (IncomeRule rule in incomeRules) { rule.delete(); } log(SiteLogString.DeleteCurrency(), typeof(Currency)); echoRedirectPart(lang("deleted")); }
public virtual void Admin() { String ids = ctx.Post("choice"); String cmd = ctx.Post("action"); long categoryId = ctx.PostLong("categoryId"); if (strUtil.IsNullOrEmpty(cmd) || cvt.IsIdListValid(ids) == false) { content(lang("exCmd")); return; } String condition = string.Format("Id in ({0}) ", ids); if ("pick".Equals(cmd)) { pickedService.PickPost(ids); log(SiteLogString.PickPhotoPost(), ids); echoAjaxOk(); } else if ("delete".Equals(cmd)) { PhotoPost.updateBatch("set SaveStatus=" + SaveStatus.SysDelete, condition); log(SiteLogString.DeleteSysPhotoPost(), ids); echoAjaxOk(); } else if ("category".Equals(cmd)) { if (categoryId < 0) { content(lang("exCategoryNotFound")); return; } if (categoryId == zeroCatId) { categoryId = 0; } PhotoPost.updateBatch("set SysCategoryId=" + categoryId, condition); log(SiteLogString.MovePhotoPost(), ids); echoAjaxOk(); } else { content(lang("exCmd")); } }
public void Admin() { String ids = ctx.PostIdList("choice"); String cmd = ctx.Post("action"); if (strUtil.IsNullOrEmpty(cmd)) { echoText(lang("exCmd")); return; } if (strUtil.IsNullOrEmpty(ids)) { echoText(lang("plsSelect")); return; } if ("pick".Equals(cmd)) { pickedService.PickPost(ids); log(SiteLogString.PickBlogPost(), ids); echoAjaxOk(); } else if ("unpick".Equals(cmd)) { pickedService.UnPickPost(ids); log(SiteLogString.UnPickBlogPost(), ids); echoAjaxOk(); } else if ("delete".Equals(cmd)) { sysblogService.Delete(ids); log(SiteLogString.DeleteBlogPost(), ids); echoAjaxOk(); } else if ("undelete".Equals(cmd)) { sysblogService.UnDelete(ids); log(SiteLogString.UnDeleteBlogPost(), ids); echoAjaxOk(); } else if ("deletetrue".Equals(cmd)) { sysblogService.DeleteTrue(ids); log(SiteLogString.DeleteBlogPostTrue(), ids); echoAjaxOk(); } else { echoText(lang("exUnknowCmd")); } }
public void UnDelete(int id) { BlogPost post = postService.GetById_ForAdmin(id); if (post == null) { echoRedirect(lang("exDataNotFound")); return; } sysblogService.SystemUnDelete(post); log(SiteLogString.SystemUnDeleteBlogPost(), post); redirect(Trash); }
public virtual void UnDelete(long id) { ContentPost post = postService.GetById_ForAdmin(id); if (post == null) { echoRedirect(lang("exDataNotFound")); return; } postService.UnDelete(post); log(SiteLogString.SystemUnDeleteContentPost(), post); redirect(Trash); }
public void Create() { BlogSysCategory c = validate( null ); if (ctx.HasErrors) { run( Add ); return; } db.insert( c ); log( SiteLogString.InsertBlogSysCategory(), c ); echoToParentPart( lang("opok") ); }
public virtual void Update(long id) { IMemberApp app = getApp(id); String appUrl = UrlConverter.clearUrl(app, ctx); String name = ctx.Post("Name"); userAppService.Update(app, name, appUrl); log(SiteLogString.UpdateApp(), app); echoToParentPart(lang("opok"), to(Index), 0); }
public void Operation() { String userIds = ctx.PostIdList("choice"); if (strUtil.IsNullOrEmpty(userIds)) { redirect(Index); return; } String condition = "Id in (" + userIds + ") "; String cmd = ctx.Post("action"); String action = ""; if ("pick" == cmd) { action = "set Status=" + MemberStatus.Pick; } else if ("unpick" == cmd) { action = "set Status=" + MemberStatus.Normal; } else if ("approve" == cmd) { action = "set Status=" + MemberStatus.Normal; } else if ("delete" == cmd) { action = "set Status=" + MemberStatus.Deleted; } else if ("undelete" == cmd) { action = "set Status=" + MemberStatus.Normal; } else if ("deletetrue" == cmd) { User.deleteBatch(condition); redirect(Index); return; } else if ("category" == cmd) { int roleId = ctx.PostInt("categoryId"); action = "set RoleId=" + roleId; } User.updateBatch(action, condition); logUser(SiteLogString.AdminUser(cmd), userIds); content("ok"); }
public void FilterSave() { String BadWordsStr = ctx.Post("BadWords"); String BadWordsReplacement = ctx.Post("BadWordsReplacement"); config.Instance.Site.BadWords = SiteSetting.GetArrayValueByString(BadWordsStr); config.Instance.Site.Update("BadWords", BadWordsStr); config.Instance.Site.BadWordsReplacement = BadWordsReplacement; config.Instance.Site.Update("BadWordsReplacement", BadWordsReplacement); log(SiteLogString.EditSiteSettingFilter()); echoRedirect(lang("opok")); }
public void SaveInfo() { //String target = ctx.Post( "Name" ); //String url = ctx.Post( "Url" ); int categoryId = ctx.PostInt("Category"); int accessId = ctx.PostInt("AccessStatus"); String description = ctx.Post("Description"); //if (strUtil.IsNullOrEmpty( target )) errors.Add( lang( "exGroupName" ) ); //if (strUtil.IsNullOrEmpty( url )) errors.Add( lang( "exGroupUrl" ) ); //if (strUtil.HasText( target ) && (target.Length > 30)) errors.Add( lang( "exGroupNameMaxLength" ) ); if (categoryId <= 0) { errors.Add(lang("exGroupCategory")); } if (accessId < 0) { errors.Add(lang("exGroupSecurity")); } if (strUtil.IsNullOrEmpty(description)) { errors.Add(lang("exGroupDescription")); } if (errors.HasErrors) { run(Index); return; } Group group = ctx.owner.obj as Group; group.Category = new GroupCategory(categoryId); group.AccessStatus = accessId; group.Description = description; group.IsCloseJoinCmd = ctx.PostIsCheck("IsCloseJoinCmd"); Result result = db.update(group); if (result.IsValid) { log(SiteLogString.UpdateGroupInfo(), group); echoRedirect(lang("opok"), Index); } else { errors.Join(result); run(Index); } }
public virtual void Stop(long id) { IMemberApp app = getApp(id); String appUrl = UrlConverter.clearUrl(app, ctx); logger.Info("stoped app url : " + appUrl); userAppService.Stop(app, appUrl); log(SiteLogString.StopApp(), app); //redirect( Index ); //echoRedirect( lang( "opok" ), Index ); echoRedirectPart(lang("opok"), to(Index), 0); }