示例#1
0
 public void ExistsNickName(FormCollection collection)
 {
     if (!HttpContext.User.Identity.IsAuthenticated || CurrentUser == null)
     {
         RedirectToAction(ViewBag.BasePath + "Account/Login");//去登录
     }
     else
     {
         JsonObject json     = new JsonObject();
         string     nickname = collection["NickName"];
         if (!string.IsNullOrWhiteSpace(nickname))
         {
             BLL.Members.Users bll = new BLL.Members.Users();
             if (bll.ExistsNickName(nickname))
             {
                 json.Accumulate("STATUS", "EXISTS");
             }
             else
             {
                 json.Accumulate("STATUS", "NOTEXISTS");
             }
         }
         else
         {
             json.Accumulate("STATUS", "NOTNULL");
         }
         Response.Write(json.ToString());
     }
 }
示例#2
0
 public void SendMsg(FormCollection collection)
 {
     ViewBag.Title = "发信息";
     if (!HttpContext.User.Identity.IsAuthenticated || CurrentUser == null)
     {
         RedirectToAction(ViewBag.BasePath + "Account/Login");//去登录
     }
     else
     {
         JsonObject json     = new JsonObject();
         string     nickname = collection["NickName"];
         string     title    = collection["Title"];
         string     content  = collection["Content"];
         if (string.IsNullOrWhiteSpace(nickname))
         {
             json.Accumulate("STATUS", "NICKNAMENULL");
         }
         else if (string.IsNullOrWhiteSpace(title))
         {
             json.Accumulate("STATUS", "TITLENULL");
         }
         else if (string.IsNullOrWhiteSpace(content))
         {
             json.Accumulate("STATUS", "CONTENTNULL");
         }
         else
         {
             BLL.Members.Users bll = new BLL.Members.Users();
             if (bll.ExistsNickName(nickname))
             {
                 int ReceiverID = bll.GetUserIdByNickName(nickname);
                 YSWL.MALL.Model.Members.SiteMessage modeSiteMessage = new YSWL.MALL.Model.Members.SiteMessage();
                 modeSiteMessage.Title          = title;
                 modeSiteMessage.Content        = content;
                 modeSiteMessage.SenderID       = CurrentUser.UserID;
                 modeSiteMessage.ReaderIsDel    = false;
                 modeSiteMessage.ReceiverIsRead = false;
                 modeSiteMessage.SenderIsDel    = false;
                 modeSiteMessage.ReceiverID     = ReceiverID;
                 modeSiteMessage.SendTime       = DateTime.Now;
                 if (bllSM.Add(modeSiteMessage) > 0)
                 {
                     json.Accumulate("STATUS", "SUCC");
                 }
                 else
                 {
                     json.Accumulate("STATUS", "FAIL");
                 }
             }
             else
             {
                 json.Accumulate("STATUS", "NICKNAMENOTEXISTS");
             }
         }
         Response.Write(json.ToString());
     }
 }