Example #1
0
        public ProfileFieldGroupModel(String Name, String DomainName)
        {
            ProfileFieldGroup FieldGroup = ProfileFieldGroups.GetByName(Name);

            this.FieldGroup = FieldGroup;
            this.DomainName = DomainName;
        }
Example #2
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));
        }
Example #3
0
        public ProfileFieldGroupModel(String Name)
        {
            ProfileFieldGroup FieldGroup = ProfileFieldGroups.GetByName(Name);

            this.FieldGroup = FieldGroup;
        }