Ejemplo n.º 1
0
        public JsonResult SaveFieldGroup(int GroupID, string Name, string Description, string Order, bool IsActive, bool AdminUseOnly)
        {
            ProfileFieldGroup fieldGroup = ProfileFieldGroups.GetBy(GroupID);
            String            Message    = "";

            if (fieldGroup.FieldGroupName.Trim().ToLower() != Name.Trim().ToLower())
            {
                if (ProfileFieldGroups.GetByName(Name.Trim()).FieldGroupID > 0)
                {
                    Message = "The group \"" + Name + "\" already exists.";
                }
            }

            if (fieldGroup.FieldGroupName.Trim().ToLower().Length == 0)
            {
                Message = "The group name should not be empty.";
            }


            if (Message != "")
            {
                RequestResultModel _model = new RequestResultModel();
                _model.InfoType = RequestResultInfoType.ErrorOrDanger;
                _model.Message  = Message;
                AuditEvent.AppEventWarning(Profile.Member.Email, Message);

                return(Json(new
                {
                    NotifyType = NotifyType.DialogInline,
                    Html = this.RenderPartialView(@"_RequestResultDialogInLine", _model),
                }, JsonRequestBehavior.AllowGet));
            }


            fieldGroup.FieldGroupName        = Name;
            fieldGroup.FieldGroupDescription = Description;
            fieldGroup.IsActive     = IsActive ? 1 : 0;
            fieldGroup.AdminUseOnly = AdminUseOnly ? 1 : 0;
            fieldGroup.Save();

            if (GroupID > 0)
            {
                AuditEvent.AppEventSuccess(Profile.Member.Email, String.Format("The \"{0}\" profile group has been updated.", Name));
            }
            else
            {
                AuditEvent.AppEventSuccess(Profile.Member.Email, String.Format("The \"{0}\" profile group has been added.", Name));
            }

            if (Order != "")
            {
                ProfileFieldGroups.UpdateOrder(Order);
            }

            return(Json(new
            {
                NotifyType = -1,
                Html = "",
            }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 2
0
        public JsonResult GetAddFieldDialog(int GroupID)
        {
            ProfileFieldGroup      fieldGroup = ProfileFieldGroups.GetBy(GroupID);
            ProfileFieldGroupModel _model     = new ProfileFieldGroupModel(fieldGroup);

            return(Json(new
            {
                Html = this.RenderPartialView(@"_AddField", _model),
            }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 3
0
        public JsonResult RemoveFieldGroup(int GroupID)
        {
            ProfileFieldGroup  fieldGroup = ProfileFieldGroups.GetBy(GroupID);
            RequestResultModel _model     = new RequestResultModel();

            if (fieldGroup.FieldGroupID > 0)
            {
                fieldGroup.Delete();

                _model.InfoType = RequestResultInfoType.Success;
                _model.Message  = "The group \"" + fieldGroup.FieldGroupName + "\" has been removed.";

                if (GroupID > 0)
                {
                    AuditEvent.AppEventSuccess(Profile.Member.Email, _model.Message);
                }

                return(Json(new
                {
                    NotifyType = NotifyType.PageInline,
                    Html = this.RenderPartialView(@"_RequestResultPageInLine", _model),
                }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                _model.InfoType = RequestResultInfoType.Success;
                _model.Message  = "The group doesn't exist.";

                AuditEvent.AppEventWarning(Profile.Member.Email, _model.Message);

                return(Json(new
                {
                    NotifyType = NotifyType.PageInline,
                    Html = this.RenderPartialView(@"_RequestResultPageInLine", _model),
                }, JsonRequestBehavior.AllowGet));
            }
        }