Exemplo n.º 1
0
        public void SaveInfo()
        {
            //String target = ctx.Post( "Name" );
            //String url = ctx.Post( "Url" );
            int    categoryId  = ctx.PostInt("Category");
            int    accessId    = ctx.PostInt("AccessStatus");
            String description = ctx.Post("Description");

            //if (strUtil.IsNullOrEmpty( target )) errors.Add( lang( "exGroupName" ) );
            //if (strUtil.IsNullOrEmpty( url )) errors.Add( lang( "exGroupUrl" ) );
            //if (strUtil.HasText( target ) && (target.Length > 30)) errors.Add( lang( "exGroupNameMaxLength" ) );
            if (categoryId <= 0)
            {
                errors.Add(lang("exGroupCategory"));
            }
            if (accessId < 0)
            {
                errors.Add(lang("exGroupSecurity"));
            }
            if (strUtil.IsNullOrEmpty(description))
            {
                errors.Add(lang("exGroupDescription"));
            }

            if (errors.HasErrors)
            {
                run(Index); return;
            }

            Group group = ctx.owner.obj as Group;

            group.Category     = new GroupCategory(categoryId);
            group.AccessStatus = accessId;
            group.Description  = description;

            group.IsCloseJoinCmd = ctx.PostIsCheck("IsCloseJoinCmd");

            Result result = db.update(group);

            if (result.IsValid)
            {
                log(SiteLogString.UpdateGroupInfo(), group);
                echoRedirect(lang("opok"), Index);
            }
            else
            {
                errors.Join(result);
                run(Index);
            }
        }