public ActionResult AjaxGetComment(FormCollection Fm) { Maticsoft.BLL.SNS.Comments comments = new Maticsoft.BLL.SNS.Comments(); int postID = Globals.SafeInt(Fm["PostId"], 0); if (postID > 0) { this.PostsModel = this.PostsBll.GetModel(postID); List<Maticsoft.Model.SNS.Comments> commentByPost = comments.GetCommentByPost(this.PostsModel); if (commentByPost.Count > 0) { return base.Content(this.jss.Serialize(commentByPost)); } } return base.Content("No"); }
public ActionResult AjaxGetCommentByPostId(FormCollection Fm) { Maticsoft.BLL.SNS.Comments comments = new Maticsoft.BLL.SNS.Comments(); int postID = Globals.SafeInt(Fm["PostId"], 0); if (postID > 0) { this.PostsModel = this.PostsBll.GetModel(postID); List<Maticsoft.Model.SNS.Comments> commentByPost = comments.GetCommentByPost(this.PostsModel); if (commentByPost.Count > 0) { ((dynamic) base.ViewBag).PostId = postID; return base.View(base.CurrentThemeViewPath + "/UserProfile/postCommentList.cshtml", commentByPost); } } return base.Content("No"); }
public bool DeleteEx(int PostID) { List<CommandInfo> sqllist = new List<CommandInfo>(); new Maticsoft.SQLServerDAL.SNS.Comments(); Maticsoft.Model.SNS.Posts model = new Maticsoft.Model.SNS.Posts(); model = this.GetModel(PostID); int? type = model.Type; if (type.HasValue) { if ((type.Value == 0) || (type.Value == 3)) { this.DeleteNormal(sqllist, PostID); StringBuilder builder = new StringBuilder(); builder.Append("delete from SNS_Comments "); builder.Append(" where TargetId=@TargetId AND Type=@Type"); SqlParameter[] para = new SqlParameter[] { new SqlParameter("@TargetId", SqlDbType.Int, 4), new SqlParameter("@Type", SqlDbType.Int, 4) }; para[0].Value = PostID; para[1].Value = type; CommandInfo item = new CommandInfo(builder.ToString(), para); sqllist.Add(item); if (DbHelperSQL.ExecuteSqlTran(sqllist) <= 0) { return false; } return true; } if (type.Value == 1) { int num; new Maticsoft.SQLServerDAL.SNS.Photos().DeleteListEx(model.TargetId.ToString(), out num); if (num == 1) { return true; } } else if (type.Value == 2) { int num2; new Maticsoft.SQLServerDAL.SNS.Products().DeleteListEx(model.TargetId.ToString(), out num2); if (num2 == 1) { return true; } } } return false; }
public Maticsoft.Model.SNS.Posts DataRowToModel(DataRow row) { Maticsoft.Model.SNS.Posts posts = new Maticsoft.Model.SNS.Posts(); if (row != null) { if ((row["PostID"] != null) && (row["PostID"].ToString() != "")) { posts.PostID = int.Parse(row["PostID"].ToString()); } if ((row["CreatedUserID"] != null) && (row["CreatedUserID"].ToString() != "")) { posts.CreatedUserID = int.Parse(row["CreatedUserID"].ToString()); } if (row["CreatedNickName"] != null) { posts.CreatedNickName = row["CreatedNickName"].ToString(); } if ((row["OriginalID"] != null) && (row["OriginalID"].ToString() != "")) { posts.OriginalID = int.Parse(row["OriginalID"].ToString()); } if ((row["ForwardedID"] != null) && (row["ForwardedID"].ToString() != "")) { posts.ForwardedID = new int?(int.Parse(row["ForwardedID"].ToString())); } if (row["Description"] != null) { posts.Description = row["Description"].ToString(); } if ((row["HasReferUsers"] != null) && (row["HasReferUsers"].ToString() != "")) { if ((row["HasReferUsers"].ToString() == "1") || (row["HasReferUsers"].ToString().ToLower() == "true")) { posts.HasReferUsers = true; } else { posts.HasReferUsers = false; } } if ((row["CommentCount"] != null) && (row["CommentCount"].ToString() != "")) { posts.CommentCount = int.Parse(row["CommentCount"].ToString()); } if ((row["ForwardCount"] != null) && (row["ForwardCount"].ToString() != "")) { posts.ForwardCount = int.Parse(row["ForwardCount"].ToString()); } if ((row["Type"] != null) && (row["Type"].ToString() != "")) { posts.Type = new int?(int.Parse(row["Type"].ToString())); } if (row["PostExUrl"] != null) { posts.PostExUrl = row["PostExUrl"].ToString(); } if (row["VideoUrl"] != null) { posts.VideoUrl = row["VideoUrl"].ToString(); } if (row["AudioUrl"] != null) { posts.AudioUrl = row["AudioUrl"].ToString(); } if (row["ImageUrl"] != null) { posts.ImageUrl = row["ImageUrl"].ToString(); } if ((row["TargetId"] != null) && (row["TargetId"].ToString() != "")) { posts.TargetId = int.Parse(row["TargetId"].ToString()); } if (row["TopicTitle"] != null) { posts.TopicTitle = row["TopicTitle"].ToString(); } if ((row["Price"] != null) && (row["Price"].ToString() != "")) { posts.Price = new decimal?(decimal.Parse(row["Price"].ToString())); } if (row["ProductLinkUrl"] != null) { posts.ProductLinkUrl = row["ProductLinkUrl"].ToString(); } if (row["ProductName"] != null) { posts.ProductName = row["ProductName"].ToString(); } if ((row["FavCount"] != null) && (row["FavCount"].ToString() != "")) { posts.FavCount = new int?(int.Parse(row["FavCount"].ToString())); } if (row["UserIP"] != null) { posts.UserIP = row["UserIP"].ToString(); } if ((row["Status"] != null) && (row["Status"].ToString() != "")) { posts.Status = int.Parse(row["Status"].ToString()); } if ((row["CreatedDate"] != null) && (row["CreatedDate"].ToString() != "")) { posts.CreatedDate = DateTime.Parse(row["CreatedDate"].ToString()); } if ((row["IsRecommend"] != null) && (row["IsRecommend"].ToString() != "")) { if ((row["IsRecommend"].ToString() == "1") || (row["IsRecommend"].ToString().ToLower() == "true")) { posts.IsRecommend = true; } else { posts.IsRecommend = false; } } if ((row["Sequence"] != null) && (row["Sequence"].ToString() != "")) { posts.Sequence = int.Parse(row["Sequence"].ToString()); } if (row["Tags"] != null) { posts.Tags = row["Tags"].ToString(); } } return posts; }
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; }
public ActionResult AjaxAddImage(FormCollection Fm) { bool flag = true; Maticsoft.BLL.SNS.Posts posts = new Maticsoft.BLL.SNS.Posts(); Maticsoft.Model.SNS.Posts post = new Maticsoft.Model.SNS.Posts(); string str = Fm["List"]; if (!string.IsNullOrWhiteSpace(str)) { foreach (JsonObject obj2 in JsonConvert.Import<JsonArray>(str)) { string address = obj2["ImageUrl"].ToString(); string str3 = InjectionFilter.Filter(obj2["ShareDec"].ToString()); int ablumId = Globals.SafeInt(obj2["AlbumId"].ToString(), 0); post.Description = str3; post.CreatedDate = DateTime.Now; post.CreatedNickName = base.currentUser.NickName; post.CreatedUserID = base.currentUser.UserID; post.Type = 1; post.UserIP = base.Request.UserHostAddress; string valueByCache = Maticsoft.BLL.SysManage.ConfigSystem.GetValueByCache("SNS_ImageStoreWay"); string path = ""; string imgname = this.CreateIDCode() + ".jpg"; using (System.Net.WebClient client = new System.Net.WebClient()) { if (valueByCache != "1") { string str7 = "/Upload/SNS/Images/Photos/" + DateTime.Now.ToString("yyyyMMdd") + "/"; string str8 = "/Upload/SNS/Images/PhotosThumbs/" + DateTime.Now.ToString("yyyyMMdd") + "/"; if (!Directory.Exists(base.Server.MapPath(str7))) { Directory.CreateDirectory(base.Server.MapPath(str7)); } if (!Directory.Exists(base.Server.MapPath(str8))) { Directory.CreateDirectory(base.Server.MapPath(str8)); } path = str7 + imgname; client.DownloadFile(address, base.Server.MapPath(path)); } else { byte[] buffer = client.DownloadData(address); if ((buffer == null) || (buffer.Length == 0)) { flag = false; } string fileName = this.CreateIDCode() + ".jpg"; if (UpYunManager.UploadExecute(buffer, fileName, ApplicationKeyType.SNS, out path)) { post.ImageUrl = path + "|" + path; post = posts.AddPost(post, ablumId, -1L, 0, "", "", "", true); } } } if (valueByCache != "1") { string thumbImagePath = ""; this.MakeThumbnail(imgname, out thumbImagePath); post.ImageUrl = path + "|" + thumbImagePath; post = posts.AddPost(post, ablumId, -1L, 0, "", "", "", true); } } if (flag) { return base.Json(new { Data = true }); } } return base.Json(new { Data = false }); }