Beispiel #1
0
 public int AddEx(Maticsoft.Model.SNS.GroupTopics TModel, long Pid)
 {
     Maticsoft.Model.SNS.Products pModel = new Maticsoft.Model.SNS.Products();
     Maticsoft.BLL.SNS.Products products2 = new Maticsoft.BLL.SNS.Products();
     if (Pid > 0L)
     {
         pModel.ProductID = Pid;
         pModel.CreateUserID = TModel.CreatedUserID;
         pModel.CreatedNickName = TModel.CreatedNickName;
         pModel.CreatedDate = DateTime.Now;
         pModel = products2.GetProductModel(pModel);
     }
     string valueByCache = Maticsoft.BLL.SysManage.ConfigSystem.GetValueByCache("SNS_check_product");
     pModel.Status = (valueByCache == "0") ? 1 : 0;
     bool boolValueByCache = Maticsoft.BLL.SysManage.ConfigSystem.GetBoolValueByCache("SNS_Check_GroupTopic");
     TModel.Status = boolValueByCache ? 0 : 1;
     bool contains = false;
     if (FilterWords.ContainsModWords(TModel.Description))
     {
         pModel.Status = 0;
         TModel.Status = 0;
         contains = true;
     }
     else
     {
         TModel.Description = FilterWords.ReplaceWords(TModel.Description, out contains);
     }
     if (contains && BanUserCheck(TModel.CreatedUserID))
     {
         return -2;
     }
     Maticsoft.BLL.SNS.Groups groups = new Maticsoft.BLL.SNS.Groups();
     Maticsoft.Model.SNS.Groups model = new Maticsoft.Model.SNS.Groups();
     model = groups.GetModel(TModel.GroupID);
     TModel.GroupName = model.GroupName;
     return this.dal.AddEx(TModel, pModel);
 }
 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 NewTopic(int GroupId)
 {
     ((dynamic) base.ViewBag).Title = "发表主题";
     Maticsoft.Model.SNS.Groups model = new Maticsoft.Model.SNS.Groups();
     model = this.bllGroups.GetModel(GroupId);
     return base.View(model);
 }
Beispiel #4
0
 public Maticsoft.Model.SNS.Groups DataRowToModel(DataRow row)
 {
     Maticsoft.Model.SNS.Groups groups = new Maticsoft.Model.SNS.Groups();
     if (row != null)
     {
         if ((row["GroupID"] != null) && (row["GroupID"].ToString() != ""))
         {
             groups.GroupID = int.Parse(row["GroupID"].ToString());
         }
         if (row["GroupName"] != null)
         {
             groups.GroupName = row["GroupName"].ToString();
         }
         if (row["GroupDescription"] != null)
         {
             groups.GroupDescription = row["GroupDescription"].ToString();
         }
         if ((row["GroupUserCount"] != null) && (row["GroupUserCount"].ToString() != ""))
         {
             groups.GroupUserCount = int.Parse(row["GroupUserCount"].ToString());
         }
         if ((row["CreatedUserId"] != null) && (row["CreatedUserId"].ToString() != ""))
         {
             groups.CreatedUserId = int.Parse(row["CreatedUserId"].ToString());
         }
         if (row["CreatedNickName"] != null)
         {
             groups.CreatedNickName = row["CreatedNickName"].ToString();
         }
         if ((row["CreatedDate"] != null) && (row["CreatedDate"].ToString() != ""))
         {
             groups.CreatedDate = DateTime.Parse(row["CreatedDate"].ToString());
         }
         if (row["GroupLogo"] != null)
         {
             groups.GroupLogo = row["GroupLogo"].ToString();
         }
         if (row["GroupLogoThumb"] != null)
         {
             groups.GroupLogoThumb = row["GroupLogoThumb"].ToString();
         }
         if (row["GroupBackground"] != null)
         {
             groups.GroupBackground = row["GroupBackground"].ToString();
         }
         if (row["ApplyGroupReason"] != null)
         {
             groups.ApplyGroupReason = row["ApplyGroupReason"].ToString();
         }
         if ((row["IsRecommand"] != null) && (row["IsRecommand"].ToString() != ""))
         {
             groups.IsRecommand = int.Parse(row["IsRecommand"].ToString());
         }
         if ((row["TopicCount"] != null) && (row["TopicCount"].ToString() != ""))
         {
             groups.TopicCount = int.Parse(row["TopicCount"].ToString());
         }
         if ((row["TopicReplyCount"] != null) && (row["TopicReplyCount"].ToString() != ""))
         {
             groups.TopicReplyCount = int.Parse(row["TopicReplyCount"].ToString());
         }
         if ((row["Status"] != null) && (row["Status"].ToString() != ""))
         {
             groups.Status = int.Parse(row["Status"].ToString());
         }
         if ((row["Sequence"] != null) && (row["Sequence"].ToString() != ""))
         {
             groups.Sequence = int.Parse(row["Sequence"].ToString());
         }
         if ((row["Privacy"] != null) && (row["Privacy"].ToString() != ""))
         {
             groups.Privacy = int.Parse(row["Privacy"].ToString());
         }
         if (row["Tags"] != null)
         {
             groups.Tags = row["Tags"].ToString();
         }
     }
     return groups;
 }