public Maticsoft.Model.SNS.GroupUsers DataRowToModel(DataRow row) { Maticsoft.Model.SNS.GroupUsers users = new Maticsoft.Model.SNS.GroupUsers(); if (row != null) { if ((row["GroupID"] != null) && (row["GroupID"].ToString() != "")) { users.GroupID = int.Parse(row["GroupID"].ToString()); } if ((row["UserID"] != null) && (row["UserID"].ToString() != "")) { users.UserID = int.Parse(row["UserID"].ToString()); } if (row["NickName"] != null) { users.NickName = row["NickName"].ToString(); } if ((row["JoinTime"] != null) && (row["JoinTime"].ToString() != "")) { users.JoinTime = DateTime.Parse(row["JoinTime"].ToString()); } if ((row["Role"] != null) && (row["Role"].ToString() != "")) { users.Role = int.Parse(row["Role"].ToString()); } if (row["ApplyReason"] != null) { users.ApplyReason = row["ApplyReason"].ToString(); } if ((row["IsRecommend"] != null) && (row["IsRecommend"].ToString() != "")) { if ((row["IsRecommend"].ToString() == "1") || (row["IsRecommend"].ToString().ToLower() == "true")) { users.IsRecommend = true; } else { users.IsRecommend = false; } } if ((row["Sequence"] != null) && (row["Sequence"].ToString() != "")) { users.Sequence = int.Parse(row["Sequence"].ToString()); } if ((row["Status"] != null) && (row["Status"].ToString() != "")) { users.Status = int.Parse(row["Status"].ToString()); } } return users; }
public ActionResult Create(RegisterGroup model) { ((dynamic) base.ViewBag).Title = "申请注册小组"; if (!base.ModelState.IsValid) { List<Maticsoft.Model.SNS.GroupTags> modelList = this.bllGroupTags.GetModelList("Status = 1"); if (modelList == null) { } model.TagList = (CS$<>9__CachedAnonymousMethodDelegated != null) ? "" : string.Join(",", modelList.Select<Maticsoft.Model.SNS.GroupTags, string>(CS$<>9__CachedAnonymousMethodDelegated)); return base.View(model); } Maticsoft.Model.SNS.Groups groups = new Maticsoft.Model.SNS.Groups { GroupName = model.GroupName, GroupDescription = model.GroupDescription, GroupUserCount = 1, CreatedUserId = base.CurrentUser.UserID, CreatedNickName = base.CurrentUser.NickName, CreatedDate = DateTime.Now, Tags = model.Tags }; if (!string.IsNullOrWhiteSpace(model.GroupLogo)) { string path = string.Format(model.GroupLogo, ""); string str2 = base.HttpContext.Server.MapPath(SNSAreaRegistration.PathUploadImgGroupThumb); string str3 = base.HttpContext.Server.MapPath(SNSAreaRegistration.PathUploadImgGroup); try { if (Maticsoft.BLL.SysManage.ConfigSystem.GetValueByCache("SNS_ImageStoreWay") == "1") { groups.GroupLogoThumb = model.GroupLogo; groups.GroupLogo = model.GroupLogo; } else { if (!Directory.Exists(str2)) { Directory.CreateDirectory(str2); } if (!Directory.Exists(str3)) { Directory.CreateDirectory(str3); } List<Maticsoft.Model.Ms.ThumbnailSize> thumSizeList = Maticsoft.BLL.Ms.ThumbnailSize.GetThumSizeList(Maticsoft.Model.Ms.EnumHelper.AreaType.SNS, ""); if ((thumSizeList != null) && (thumSizeList.Count > 0)) { string str4 = ""; foreach (Maticsoft.Model.Ms.ThumbnailSize size in thumSizeList) { str4 = string.Format(model.GroupLogo, size.ThumName); if (File.Exists(base.Server.MapPath(str4))) { FileInfo info = new FileInfo(base.HttpContext.Server.MapPath(str4)); info.MoveTo(str2 + info.Name); } } } FileInfo info2 = new FileInfo(base.HttpContext.Server.MapPath(path)); info2.MoveTo(str3 + info2.Name); groups.GroupLogoThumb = SNSAreaRegistration.PathUploadImgGroupThumb + "{0}" + info2.Name; groups.GroupLogo = SNSAreaRegistration.PathUploadImgGroup + info2.Name; } } catch (Exception) { base.ModelState.AddModelError("Message", "您上传的文件保存失败, 请重新上传!"); List<Maticsoft.Model.SNS.GroupTags> source = this.bllGroupTags.GetModelList("Status = 1"); if (source == null) { } model.TagList = (CS$<>9__CachedAnonymousMethodDelegatee != null) ? "" : string.Join(",", source.Select<Maticsoft.Model.SNS.GroupTags, string>(CS$<>9__CachedAnonymousMethodDelegatee)); return base.View(model); } } groups.Status = 1; groups.IsRecommand = 0; groups.GroupID = this.bllGroups.Add(groups); if (groups.GroupID > 0) { Maticsoft.Model.SNS.GroupUsers users = new Maticsoft.Model.SNS.GroupUsers { GroupID = groups.GroupID, JoinTime = DateTime.Now, UserID = groups.CreatedUserId, NickName = groups.CreatedNickName, Role = 2, Status = 1 }; this.bllGroupUser.Add(users); return base.RedirectToAction("GroupInfo", new { GroupId = groups.GroupID }); } return base.View(model); }
public ActionResult AjaxJoinGroup(FormCollection fm) { Maticsoft.Model.SNS.GroupUsers model = new Maticsoft.Model.SNS.GroupUsers(); Maticsoft.BLL.SNS.GroupUsers users2 = new Maticsoft.BLL.SNS.GroupUsers(); int groupID = Globals.SafeInt(fm["GroupId"], 0); if (users2.Exists(groupID, base.currentUser.UserID)) { return base.Content("joined"); } model.GroupID = groupID; model.JoinTime = DateTime.Now; model.NickName = base.currentUser.NickName; model.UserID = base.currentUser.UserID; model.Status = 1; if (users2.AddEx(model)) { return base.Content("Yes"); } return base.Content("No"); }