Пример #1
0
        /// <summary>
        /// 修改群组信息
        /// </summary>
        /// <param name="groupName"></param>
        /// <param name="groupIntro"></param>
        /// <param name="groupID"></param>
        /// <returns></returns>
        public ActionResult ModifyUserGroupInfo(string groupName, string groupIntro, long groupID)
        {
            long          uid    = UILoginHelper.GetUIDFromHttpContext(HttpContext);
            BizResultInfo result = new BizResultInfo();

            if (string.IsNullOrEmpty(groupName))
            {
                result.IsSuccess    = false;
                result.ErrorMessage = "群组名称不能为空呀....";
                return(Json(result));
            }


            if (groupID == 0)
            {
                result.IsSuccess    = false;
                result.ErrorMessage = "群组ID不能为空呀,这个数据目测有问题....";
                return(Json(result));
            }

            BizGroupInfo groupInfo = BizGroupInfo.LoadByGroupID(groupID);

            if (groupInfo != null)
            {
                groupInfo.GroupName  = groupName;
                groupInfo.GroupIntro = !string.IsNullOrEmpty(groupIntro) ? groupIntro : "";
                groupInfo.Save();
            }

            result.IsSuccess      = true;
            result.SuccessMessage = "保存成功!";
            return(Json(result));
        }
Пример #2
0
        /// <summary>
        /// 保存群组信息
        /// </summary>
        /// <param name="groupName"></param>
        /// <param name="groupIntro"></param>
        /// <returns></returns>
        public ActionResult SaveUserGroupInfo(string groupName, string groupIntro)
        {
            long          uid    = UILoginHelper.GetUIDFromHttpContext(HttpContext);
            BizResultInfo result = new BizResultInfo();

            if (string.IsNullOrEmpty(groupName))
            {
                result.IsSuccess    = false;
                result.ErrorMessage = "群组名称不能为空呀....";
                return(Json(result));
            }
            BizGroupInfo groupInfo = new BizGroupInfo();

            groupInfo.CreateTime    = DateTime.Now;
            groupInfo.CreateUesrID  = uid;
            groupInfo.GroupName     = groupName;
            groupInfo.GroupIntro    = !string.IsNullOrEmpty(groupIntro) ? groupIntro : "";
            groupInfo.ObjectHascode = groupInfo.GetHashCode();
            groupInfo.Save();

            BizGroupUser groupUser = new BizGroupUser();

            groupUser.UserInfoID  = uid;
            groupUser.GroupInfoID = groupInfo.GroupInfoID;
            groupUser.IsPass      = (int)ApplyStatus.Pass;
            groupUser.CreateTime  = DateTime.Now;
            groupUser.Save();
            result.IsSuccess      = true;
            result.SuccessMessage = "创建成功!";
            return(Json(result));
        }