Example #1
0
        private void bindContact(User m)
        {
            set("m.Email", m.Email);
            set("m.EmailNotify", Html.RadioList(AppResource.EmailNotify, "EmailNotify", "Name", "Value", m.Profile.EmailNotify));

            set("m.QQ", m.QQ);
            set("m.MSN", m.MSN);

            set("m.Address", m.Profile.Address);
            set("m.Tel", m.Profile.Tel);
            set("m.IM", m.Profile.IM);
            set("m.WebSite", m.Profile.WebSite);

            String confirmTip = "";

            if (m.IsEmailConfirmed == EmailConfirm.Confirmed)
            {
                confirmTip = string.Format("<img src=\"{0}\"/> ÓÊÏäÒѼ¤»î", strUtil.Join(sys.Path.Img, "ok.gif"));
            }
            else if (config.Instance.Site.EnableEmail)
            {
                KeyIncomeRule rule = currencyService.GetKeyIncomeRulesByAction(18);
                confirmTip = string.Format("<img src=\"{3}\"/> ÌáÐÑ£ºÄúµÄÓÊÏäÉÐδ¼¤»î¡£¼¤»î<span class=\"red\">¿É½±Àø{0}{1}</span>£»<br/><span class=\"left20\">Çë²é¿´ÄúµÄÓÊÏä(°üÀ¨À¬»øÏä)ÊÇ·ñÓ줻îÓʼþ£¬Èç¹ûûÓУ¬Çë <a href=\"{2}\" target=\"_blank\">µã»÷´Ë´¦</a> ÖØ·¢¼¤»îÓʼþ</span>",
                                           rule.Income, rule.CurrencyUnit, Link.To(Site.Instance, new Common.ActivationController().SendEmailLogin),
                                           strUtil.Join(sys.Path.Img, "info.gif")
                                           );
            }

            set("confirmTip", confirmTip);
        }
Example #2
0
        public virtual void EditKeyRule(long ruleId)
        {
            target(UpdateKeyRule, ruleId);
            KeyIncomeRule rule = currencyService.GetKeyRuleById(ruleId);

            bind("rule", rule);
        }
Example #3
0
        private void bindContact(User m)
        {
            set("m.Email", m.Email);
            set("m.EmailNotify", Html.RadioList(AppResource.EmailNotify, "EmailNotify", "Name", "Value", m.Profile.EmailNotify));

            set("m.QQ", m.QQ);
            set("m.MSN", m.MSN);

            set("m.Address", m.Profile.Address);
            set("m.Tel", m.Profile.Tel);
            set("m.IM", m.Profile.IM);
            set("m.WebSite", m.Profile.WebSite);

            String confirmTip = "";

            if (m.IsEmailConfirmed == EmailConfirm.Confirmed)
            {
                confirmTip = string.Format("<img src=\"{0}\"/> 邮箱已激活", strUtil.Join(sys.Path.Img, "ok.gif"));
            }
            else if (config.Instance.Site.EnableEmail)
            {
                KeyIncomeRule rule = currencyService.GetKeyIncomeRulesByAction(18);
                confirmTip = string.Format("<img src=\"{3}\"/> 提醒:您的邮箱尚未激活。激活<span class=\"red\">可奖励{0}{1}</span>;<br/><span class=\"left20\">请查看您的邮箱(包括垃圾箱)是否有激活邮件,如果没有,请 <a href=\"{2}\" target=\"_blank\">点击此处</a> 重发激活邮件</span>",
                                           rule.Income, rule.CurrencyUnit, Link.To(Site.Instance, new Common.ActivationController().SendEmailLogin),
                                           strUtil.Join(sys.Path.Img, "info.gif")
                                           );
            }

            set("confirmTip", confirmTip);
        }
Example #4
0
        private string getEmailConfirmCredit(int actionId)
        {
            // 获取当前操作action收入规则。
            // 这里获取的是中心货币,你也可以使用 GetRulesByAction(actionId) 获取其他所有货币的收入规则
            KeyIncomeRule rule = currencyService.GetKeyIncomeRulesByAction(actionId);

            return(string.Format("可奖励{0}{1}", rule.Income, rule.CurrencyUnit));
        }
Example #5
0
        public virtual void UpdateKeyRule(long ruleId)
        {
            KeyIncomeRule rule = currencyService.GetKeyRuleById(ruleId);

            rule.Income = ctx.PostInt("Income");
            rule.update();
            log(SiteLogString.UpdateKeyCurrencyRule(), typeof(KeyIncomeRule));
            echoToParentPart(lang("saved"));
        }
Example #6
0
        public void IncomeRule()
        {
            IList currencyList = currencyService.GetCurrencyAll();
            IList actions      = currencyService.GetUserActions();


            StringBuilder builder = new StringBuilder();

            builder.Append("<table style='width:100%;' id='dataAdminList' cellspacing='0'>");

            // header
            builder.Append("<tr class='tableHeader'><td></td>");
            builder.AppendFormat("<td><strong>{0}</strong>(" + lang("keyCurrency") + ")</td>", KeyCurrency.Instance.Name);


            foreach (ICurrency c in currencyList)
            {
                builder.AppendFormat("<td>{0}</td>", c.Name);
            }
            builder.Append("</tr>");
            builder.Append(Environment.NewLine);

            // init value
            builder.Append("<tr class='tableItems'>");
            builder.AppendFormat("<td>{0}</td>", lang("initValueWithReg"));
            builder.AppendFormat("<td>{0}</td>", KeyCurrency.Instance.InitValue);
            foreach (ICurrency c in currencyList)
            {
                builder.AppendFormat("<td>{0}</td>", c.InitValue);
            }

            // items
            foreach (UserAction a in actions)
            {
                builder.Append("<tr class='tableItems'>");
                builder.AppendFormat("<td>{0}</td>", a.Name);

                // keyCurrency rule
                KeyIncomeRule keyrule = currencyService.GetKeyIncomeRulesByAction(a.Id);
                builder.AppendFormat("<td>{0}</td>", keyrule.Income);


                IList rules = currencyService.GetRulesByAction(a.Id);
                foreach (IncomeRule rule in rules)
                {
                    builder.AppendFormat("<td>{0}</td>", rule.Income);
                }

                builder.Append("</tr>");
                builder.Append(Environment.NewLine);
            }

            builder.Append("</table>");

            set("ruleTable", builder);
        }
Example #7
0
        private string getMsgBody(User user, long actionId)
        {
            KeyIncomeRule rule        = currencyService.GetKeyIncomeRulesByAction(actionId); // 获取当前操作action收入规则。这里获取的是中心货币,你也可以使用 GetRulesByAction(actionId) 获取其他所有货币的收入规则
            int           creditValue = rule.Income;                                         // 收入的值
            String        creditName  = rule.CurrencyName;                                   // 货币的名称。这里是获取的中心货币。

            String msgBody = string.Format("{0}:<br/>您好!<br/>感谢您激活邮件,您因此获得{1}奖励,共{2}。<br/>欢迎继续参与,谢谢。", user.Name, creditName, creditValue);

            return(msgBody);
        }
Example #8
0
        private void bindIncomeRule(IList currencyList, IList actions)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("<table style='width:100%;' id='dataAdminList' cellspacing='0'>");

            // header
            builder.Append("<tr class='tableHeader'><td></td>");
            builder.AppendFormat("<td><strong>{0}</strong>(" + lang("keyCurrency") + ")</td>", KeyCurrency.Instance.Name);


            foreach (ICurrency c in currencyList)
            {
                builder.AppendFormat("<td>{0}</td>", c.Name);
            }
            builder.Append("</tr>");
            builder.Append(Environment.NewLine);

            // init value
            builder.Append("<tr class='tableItems'>");
            builder.Append("<td>" + lang("initValueWithReg") + "</td>");
            builder.AppendFormat("<td><a href='{0}' class='frmBox' title='" + lang("editValue") + "'>{1}</a></td>", to(EditKeyInit), KeyCurrency.Instance.InitValue);
            foreach (ICurrency c in currencyList)
            {
                builder.AppendFormat("<td><a href='{0}' class='frmBox' title='" + lang("editValue") + "'>{1}</a></td>", to(EditInit, c.Id), c.InitValue);
            }

            // items
            foreach (UserAction a in actions)
            {
                builder.Append("<tr class='tableItems'>");
                builder.AppendFormat("<td>{0}</td>", a.Name);

                // keyCurrency rule
                KeyIncomeRule keyrule = currencyService.GetKeyIncomeRulesByAction(a.Id);
                builder.AppendFormat("<td><a href='{0}' class='frmBox' title='" + lang("editValue") + "'>{1}</a></td>", to(EditKeyRule, keyrule.Id), keyrule.Income);


                IList rules = currencyService.GetRulesByAction(a.Id);
                foreach (IncomeRule rule in rules)
                {
                    builder.AppendFormat("<td><a href='{0}' class='frmBox' title='" + lang("editValue") + "'>{1}</a></td>", to(EditRule, rule.Id), rule.Income);
                }

                builder.Append("</tr>");
                builder.Append(Environment.NewLine);
            }

            set("ruleTable", builder);
        }
Example #9
0
        private void addIncomeAndSendMsg(User user)
        {
            int           actionId = 17;
            KeyIncomeRule rule     = currencyService.GetKeyIncomeRulesByAction(actionId);

            int    creditValue = rule.Income;
            String creditName  = rule.CurrencyName;

            userIncomeService.AddIncome(user, actionId);

            String msgTitle = "感谢您上传头像";
            String msgBody  = string.Format("{0}:<br/>您好!<br/>感谢您上传头像,您因此获得{1}奖励,共{2}分。<br/>欢迎继续参与,谢谢。<br/>------------------------------------------<br/>这是系统自动发信,请勿回复。", user.Name, creditName, creditValue);


            MessageService msgService = new MessageService();

            msgService.SiteSend(msgTitle, msgBody, user);
        }
        //---------------------------------- (中心货币的)收入规则操作 ---------------------------------------------

        public virtual KeyIncomeRule GetKeyIncomeRulesByAction(int actionId)
        {
            List <KeyIncomeRule> savedRules = cdb.findAll <KeyIncomeRule>();

            foreach (KeyIncomeRule r in savedRules)
            {
                if (r.ActionId == actionId)
                {
                    return(r);
                }
            }

            KeyIncomeRule rule = new KeyIncomeRule();

            rule.ActionId = actionId;
            rule.insert();
            return(rule);
        }
Example #11
0
        private void addIncomeAndMsg(User user)
        {
            int actionId = 18;

            userIncomeService.AddIncome(user, actionId);

            KeyIncomeRule rule = currencyService.GetKeyIncomeRulesByAction(actionId); // 获取当前操作action收入规则。这里获取的是中心货币,你也可以使用 GetRulesByAction(actionId) 获取其他所有货币的收入规则

            int    creditValue = rule.Income;                                         // 收入的值
            String creditName  = rule.CurrencyName;                                   // 货币的名称。这里是获取的中心货币。

            userIncomeService.AddIncome(user, actionId);                              // 给用户增加收入

            String msgTitle = "感谢您激活邮件";
            String msgBody  = string.Format("{0}:<br/>您好!<br/>感谢您激活邮件,您因此获得{1}奖励,共{2}。<br/>欢迎继续参与,谢谢。", user.Name, creditName, creditValue);

            msgService.SiteSend(msgTitle, msgBody, user);   // 给用户发送站内私信
        }
Example #12
0
        public virtual void AddIncomeReverse(User user, long actionId, string msg)
        {
            // 添加基础货币:积分
            KeyIncomeRule keyRule = KeyIncomeRule.GetByAction(actionId);

            if (keyRule != null)
            {
                addKeyIncome(user, -keyRule.Income, msg);
            }

            // 其他货币计算
            IList rules = currencyService.GetRulesByAction(actionId);

            foreach (IncomeRule rule in rules)
            {
                if (rule.Income != 0)
                {
                    UpdateUserIncome(user, rule.CurrencyId, -rule.Income, msg);
                }
            }
        }
        public virtual void Save(KeyIncomeRule rule)
        {
            if (rule == null)
            {
                return;
            }

            List <KeyIncomeRule> list = cdb.findAll <KeyIncomeRule>();

            foreach (KeyIncomeRule savedRule in list)
            {
                if (rule.ActionId == savedRule.ActionId)
                {
                    if (rule.Income != savedRule.Income)
                    {
                        savedRule.Income = rule.Income;
                        savedRule.update();
                    }
                    return;
                }
            }
            rule.insert();
        }
Example #14
0
        public virtual void AddIncome(User user, int actionId)
        {
            // 添加基础货币:积分
            KeyIncomeRule keyRule = KeyIncomeRule.GetByAction(actionId);

            if (keyRule != null)
            {
                addKeyIncome(user, keyRule.Income);
            }

            // 其他货币计算
            IList rules = currencyService.GetRulesByAction(actionId);

            foreach (IncomeRule rule in rules)
            {
                if (rule.Income != 0)
                {
                    UpdateUserIncome(user, rule.CurrencyId, rule.Income);
                }
            }

            // TODO添加历史记录
        }