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


C# ReturnValue.PutValue方法代码示例

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


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

示例1: AddTag

 /// <summary>
 /// 添加标签信息
 /// </summary>
 /// <param name="tagNamestr"></param>
 /// <param name="tagType"></param>
 /// <returns></returns>
 public ReturnValue AddTag(string tagNamestr, int tagType)
 {
     string[] tags = tagNamestr.Split(new char[] { ' ', ',', '-', ';' });
     ReturnValue retValue = new ReturnValue();
     using (TagInfoDal dal = new TagInfoDal())
     {
         foreach (string item in tags)
         {
             if (dal.AddTag(item, tagType))
             {
                 retValue.PutValue("ok", retValue.GetInt("ok") + 1);
             }
             else
             {
                 retValue.PutValue("error", retValue.GetInt("error") + 1);
             }
         }
     }
     log.Info(string.Format("Add Tags : ok {0} ,error {1}", retValue.GetInt("ok"), retValue.GetInt("error")));
     return retValue;
 }
开发者ID:fengpb,项目名称:CodeNote,代码行数:27,代码来源:TagInfoManager.cs

示例2: DoReg

        /// <summary>
        /// 执行注册方法
        /// </summary>
        /// <returns></returns>
        public ActionResult DoReg(string email)
        {
            ReturnValue retValue = new ReturnValue();
            if (!CodeNote.Common.Validation.Email(email))
            {
                retValue.IsExists = false;
                retValue.Message = "电子邮件格式不正确";
                return View("Result", new ReturnMessage("参数错误", retValue.Message));
            }
            LoginUser entity = this.LoginUserMg.Get(email);

            if (entity != null && entity.Type != (int)Constans.UserType.NoReg)
            {
                retValue.IsExists = false;
                retValue.Message = "此用户已经注册";

                return View("Result", new ReturnMessage("注册错误", retValue.Message));
            }
            if (entity != null && entity.Type == (int)Constans.UserType.NoReg)
            {
                entity.PassWord = CodeNote.Common.Encryption.MD5(CodeNote.Common.IDentity.CreateNew().AddStr(10).StrID());
            }
            else
            {
                entity = new LoginUser();
                entity.LoginName = email;
                entity.Email = email;
                entity.PassWord = CodeNote.Common.Encryption.MD5(CodeNote.Common.IDentity.CreateNew().AddStr(10).StrID());
                entity.Type = (int)Constans.UserType.NoReg;//未完成注册的用户
                entity.CreateDate = DateTime.Now;
            }

            retValue = this.LoginUserMg.AddOrEdit(entity);//保存和修改信息

            if (retValue.IsExists)
            {
                string url = this.UrlPath("Valid", "User", new { email = email, valid = entity.PassWord, type = "reg" });
                Antlr.StringTemplate.StringTemplate st = CodeNote.Common.TemplateWrap.GetSt("register_email");
                if (st != null)
                {
                    st.SetAttribute("url", url);

                    if (CodeNote.Common.Net.Mail.EmailWrap.Default.Send(email, "注册验证 - Register validation", st.ToString(), true))
                    {
                        retValue.IsExists = true;
                        retValue.Message = "电子邮件发送成功";
                        retValue.PutValue("emailserver", CodeNote.Common.Net.Mail.EmailWrap.EmailServer(email));
                        return View("DoReg", retValue);
                    }
                    else
                    {
                        retValue.IsExists = false;
                        retValue.Message = "电子邮件发送错误,请重新发送";
                        return View("Result", new ReturnMessage("参数错误", retValue.Message));
                    }
                }
                else
                {
                    retValue.IsExists = false;
                    retValue.Message = "注册电子邮件未发送";
                    return View("Result", new ReturnMessage("服务器错误", retValue.Message));
                }
            }
            else
            {
                return View("Result", new ReturnMessage("服务器错误", retValue.Message));
            }
        }
开发者ID:fengpb,项目名称:CodeNote,代码行数:72,代码来源:UserController.cs

示例3: Delete

        public ReturnValue Delete(string ids)
        {
            ReturnValue retValue = new ReturnValue();

            string[] categoryIdArr = ids.Split(new Char[] { ',' });
            using (CategoryDal dal = new CategoryDal())
            {
                foreach (string item in categoryIdArr)
                {
                    if (dal.Delete(item))
                    {
                        retValue.PutValue("ok", retValue.GetInt("ok"));
                    }
                    else
                    {
                        retValue.PutValue("error", retValue.GetInt("error"));
                    }
                }
            }
            if (retValue.GetInt("error") != 0)
            {
                retValue.IsExists = false;
                retValue.Message = string.Format("删除分类失败,成功{0},失败{1}!", retValue.GetInt("ok"), retValue.GetInt("error"));
            }
            else
            {
                retValue.IsExists = true;
                retValue.Message = "删除分类成功!";
                ClearCache();//清除缓存
            }
            return retValue;
        }
开发者ID:fengpb,项目名称:CodeNote,代码行数:32,代码来源:CategoryManager.cs

示例4: AddOrEdit

        public ReturnValue AddOrEdit(Article entity)
        {
            ReturnValue retValue = new ReturnValue();
            if (string.IsNullOrEmpty(entity.Subject))
            {
                retValue.IsExists = false;
                retValue.Message = "标题不能为空";
                return retValue;
            }
            if (string.IsNullOrEmpty(entity.Body))
            {
                retValue.IsExists = false;
                retValue.Message = "正文不能为空";
                return retValue;
            }
            VwArticle old = null;
            using (ArticleDal dal = new ArticleDal())
            {

                if (entity.ID > 0)
                {
                    old = dal.GetVw(entity.ID);
                }
                if (old == null)
                {
                    if (dal.Add(entity))
                    {
                        retValue.IsExists = true;
                        retValue.Message = "保存成功";
                        old = dal.GetVw(entity.ID);
                    }
                    else
                    {
                        retValue.IsExists = false;
                        retValue.Message = "保存失败";
                    }
                }
                else //修改
                {
                    if (dal.Modify(entity))
                    {
                        retValue.IsExists = true;
                        retValue.Message = "修改成功";
                        old = dal.GetVw(entity.ID);
                    }
                    else
                    {
                        retValue.IsExists = false;
                        retValue.Message = "修改失败";
                    }
                }
            }

            if (retValue.IsExists)
            {
                //TODO: 修改Html
                HtmlManager htmMg = new HtmlManager();
                htmMg.CreateHtml(old);
            }
            retValue.PutValue("vw", old);

            return retValue;
        }
开发者ID:fengpb,项目名称:CodeNote,代码行数:63,代码来源:ArticleManager.cs


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