Example #1
0
 public ActionResult Create()
 {
     RegisterGroup model = new RegisterGroup();
     List<Maticsoft.Model.SNS.GroupTags> modelList = this.bllGroupTags.GetModelList("Status = 1");
     if (modelList == null)
     {
     }
     model.TagList = (CS$<>9__CachedAnonymousMethodDelegate8 != null) ? "" : string.Join(",", modelList.Select<Maticsoft.Model.SNS.GroupTags, string>(CS$<>9__CachedAnonymousMethodDelegate8));
     ((dynamic) base.ViewBag).Title = "申请注册小组";
     return base.View(model);
 }
Example #2
0
 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);
 }