Beispiel #1
0
 public void AddEx(string Content, EnumHelper.ReferType Type, int TargetId, string CreateNickName = "")
 {
     Maticsoft.Model.SNS.ReferUsers model = new Maticsoft.Model.SNS.ReferUsers();
     Users users2 = new Users();
     if (!string.IsNullOrWhiteSpace(Content))
     {
         MatchCollection matchs = Regex.Matches(Content, @"@[\u4e00-\u9fa5\w\-]+");
         List<string> list = new List<string>();
         if (!string.IsNullOrEmpty(CreateNickName))
         {
             list.Add(CreateNickName);
         }
         foreach (Match match in matchs)
         {
             int num;
             string item = match.Value.Trim(new char[] { '@' });
             if ((!list.Contains(item) && !string.IsNullOrEmpty(item)) && ((num = users2.GetUserIdByNickName(item)) > 0))
             {
                 list.Add(item);
                 model.CreatedDate = DateTime.Now;
                 model.IsRead = false;
                 model.ReferUserID = num;
                 model.ReferNickName = item;
                 model.Type = (int) Type;
                 model.TagetID = TargetId;
                 this.Add(model);
             }
         }
     }
 }
 public ActionResult AjaxPostForward(FormCollection Fm)
 {
     int postId = 0;
     string str = ViewModelBase.ReplaceFace(InjectionFilter.Filter(Fm["content"]));
     int num2 = Globals.SafeInt(Fm["origid"], 0);
     int num3 = Globals.SafeInt(Fm["origuserid"], 0);
     string str2 = Fm["orignickname"];
     int num4 = Globals.SafeInt(Fm["forwardid"], 0);
     if ((num2 == 0) || (num3 == 0))
     {
         return base.Content("No");
     }
     base.PostsModel.CreatedDate = DateTime.Now;
     base.PostsModel.CreatedNickName = base.currentUser.NickName;
     base.PostsModel.CreatedUserID = base.currentUser.UserID;
     base.PostsModel.Description = str;
     base.PostsModel.ForwardedID = new int?(num4);
     base.PostsModel.HasReferUsers = str.Contains("@");
     base.PostsModel.OriginalID = num2;
     base.PostsModel.Type = 0;
     postId = base.PostsBll.AddForwardPost(base.PostsModel);
     base.list = base.PostsBll.GetForPostByPostId(postId, base.IncludeProduct);
     Maticsoft.BLL.SNS.ReferUsers users = new Maticsoft.BLL.SNS.ReferUsers();
     Maticsoft.Model.SNS.ReferUsers model = new Maticsoft.Model.SNS.ReferUsers {
         CreatedDate = DateTime.Now,
         IsRead = false,
         ReferUserID = num3,
         ReferNickName = str2,
         Type = 0,
         TagetID = postId
     };
     users.Add(model);
     return this.PartialView(base.CurrentThemeViewPath + "/UserProfile/LoadPostData.cshtml", base.list);
 }
Beispiel #3
0
 public int PostForWard(string PostContent, int Origid, int ForWardid, int OrigUserId, string OrigNickName, int CurrentUserID, string CurrentNickName, string UserIp)
 {
     new Users();
     Maticsoft.BLL.SNS.ReferUsers users = new Maticsoft.BLL.SNS.ReferUsers();
     Maticsoft.Model.SNS.ReferUsers model = new Maticsoft.Model.SNS.ReferUsers();
     Maticsoft.Model.SNS.Posts posts = new Maticsoft.Model.SNS.Posts {
         CreatedDate = DateTime.Now,
         Description = PostContent,
         CreatedNickName = CurrentNickName,
         CreatedUserID = CurrentUserID,
         ForwardedID = new int?(ForWardid),
         HasReferUsers = PostContent.Contains<char>('@') ? true : false,
         OriginalID = (Origid == 0) ? ForWardid : Origid,
         UserIP = UserIp,
         Status = 1
     };
     int targetId = this.AddForwardPost(posts);
     users.AddEx(PostContent, EnumHelper.ReferType.Post, targetId, "");
     model.CreatedDate = DateTime.Now;
     model.IsRead = false;
     model.ReferUserID = OrigUserId;
     model.ReferNickName = OrigNickName;
     model.Type = 0;
     model.TagetID = targetId;
     users.Add(model);
     return targetId;
 }