Esempio n. 1
0
        public object SaveCustomNamingSettings(string usrCaption, string usrsCaption, string grpCaption, string grpsCaption,
                                               string usrStatusCaption, string regDateCaption,
                                               string grpHeadCaption,
                                               string guestCaption, string guestsCaption)
        {
            try
            {
                SecurityContext.DemandPermissions(SecutiryConstants.EditPortalSettings);

                usrCaption       = (usrCaption ?? "").Trim();
                usrsCaption      = (usrsCaption ?? "").Trim();
                grpCaption       = (grpCaption ?? "").Trim();
                grpsCaption      = (grpsCaption ?? "").Trim();
                usrStatusCaption = (usrStatusCaption ?? "").Trim();
                regDateCaption   = (regDateCaption ?? "").Trim();
                grpHeadCaption   = (grpHeadCaption ?? "").Trim();
                guestCaption     = (guestCaption ?? "").Trim();
                guestsCaption    = (guestsCaption ?? "").Trim();

                if (String.IsNullOrEmpty(usrCaption) ||
                    String.IsNullOrEmpty(usrsCaption) ||
                    String.IsNullOrEmpty(grpCaption) ||
                    String.IsNullOrEmpty(grpsCaption) ||
                    String.IsNullOrEmpty(usrStatusCaption) ||
                    String.IsNullOrEmpty(regDateCaption) ||
                    String.IsNullOrEmpty(grpHeadCaption) ||
                    String.IsNullOrEmpty(guestCaption) ||
                    String.IsNullOrEmpty(guestsCaption))
                {
                    throw new Exception(Resource.ErrorEmptyFields);
                }

                var names = new PeopleNamesItem
                {
                    Id               = PeopleNamesItem.CustomID,
                    UserCaption      = usrCaption.Substring(0, Math.Min(30, usrCaption.Length)),
                    UsersCaption     = usrsCaption.Substring(0, Math.Min(30, usrsCaption.Length)),
                    GroupCaption     = grpCaption.Substring(0, Math.Min(30, grpCaption.Length)),
                    GroupsCaption    = grpsCaption.Substring(0, Math.Min(30, grpsCaption.Length)),
                    UserPostCaption  = usrStatusCaption.Substring(0, Math.Min(30, usrStatusCaption.Length)),
                    RegDateCaption   = regDateCaption.Substring(0, Math.Min(30, regDateCaption.Length)),
                    GroupHeadCaption = grpHeadCaption.Substring(0, Math.Min(30, grpHeadCaption.Length)),
                    GuestCaption     = guestCaption.Substring(0, Math.Min(30, guestCaption.Length)),
                    GuestsCaption    = guestsCaption.Substring(0, Math.Min(30, guestsCaption.Length)),
                };

                CustomNamingPeople.SetPeopleNames(names);

                CoreContext.TenantManager.SaveTenant(CoreContext.TenantManager.GetCurrentTenant());

                AdminLog.PostAction("Settings: saved team template settings to {0:Json}", names);
                MessageService.Send(HttpContext.Current.Request, MessageAction.TeamTemplateChanged);

                return(new { Status = 1, Message = Resource.SuccessfullySaveSettingsMessage });
            }
            catch (Exception e)
            {
                return(new { Status = 0, e.Message });
            }
        }
        public object SaveCustomNamingSettings(string usrCaption, string usrsCaption, string addUsersCaption, string grpCaption, string grpsCaption,
                                               string usrStatusCaption, string regDateCaption,
                                               string grpHeadCaption, string globalHeadCaption)
        {
            try
            {
                SecurityContext.DemandPermissions(SecutiryConstants.EditPortalSettings);

                usrCaption        = (usrCaption ?? "").Trim();
                usrsCaption       = (usrsCaption ?? "").Trim();
                grpCaption        = (grpCaption ?? "").Trim();
                grpsCaption       = (grpsCaption ?? "").Trim();
                usrStatusCaption  = (usrStatusCaption ?? "").Trim();
                regDateCaption    = (regDateCaption ?? "").Trim();
                grpHeadCaption    = (grpHeadCaption ?? "").Trim();
                globalHeadCaption = (globalHeadCaption ?? "").Trim();
                addUsersCaption   = (addUsersCaption ?? "").Trim();

                if (String.IsNullOrEmpty(usrCaption) ||
                    String.IsNullOrEmpty(usrsCaption) ||
                    String.IsNullOrEmpty(addUsersCaption) ||
                    String.IsNullOrEmpty(grpCaption) ||
                    String.IsNullOrEmpty(grpsCaption) ||
                    String.IsNullOrEmpty(usrStatusCaption) ||
                    String.IsNullOrEmpty(regDateCaption) ||
                    String.IsNullOrEmpty(grpHeadCaption) ||
                    String.IsNullOrEmpty(globalHeadCaption))
                {
                    throw new Exception(Resources.Resource.ErrorEmptyFields);
                }

                var names = new PeopleNamesItem
                {
                    UserCaption       = usrCaption.Substring(0, Math.Min(30, usrCaption.Length)),
                    UsersCaption      = usrsCaption.Substring(0, Math.Min(30, usrsCaption.Length)),
                    GroupCaption      = grpCaption.Substring(0, Math.Min(30, grpCaption.Length)),
                    GroupsCaption     = grpsCaption.Substring(0, Math.Min(30, grpsCaption.Length)),
                    UserPostCaption   = usrStatusCaption.Substring(0, Math.Min(30, usrStatusCaption.Length)),
                    RegDateCaption    = regDateCaption.Substring(0, Math.Min(30, regDateCaption.Length)),
                    GroupHeadCaption  = grpHeadCaption.Substring(0, Math.Min(30, grpHeadCaption.Length)),
                    GlobalHeadCaption = globalHeadCaption.Substring(0, Math.Min(30, globalHeadCaption.Length)),
                    AddUsersCaption   = addUsersCaption.Substring(0, Math.Min(30, addUsersCaption.Length))
                };

                CustomNamingPeople.SetPeopleNames(names);

                return(new { Status = 1, Message = Resources.Resource.SuccessfullySaveSettingsMessage });
            }
            catch (Exception e)
            {
                return(new { Status = 0, Message = e.Message });
            }
        }
        public object SaveNamingSettings(string schemaId)
        {
            try
            {
                SecurityContext.DemandPermissions(SecutiryConstants.EditPortalSettings);

                CustomNamingPeople.SetPeopleNames(schemaId);
                return(new { Status = 1, Message = Resources.Resource.SuccessfullySaveSettingsMessage });
            }
            catch (Exception e)
            {
                return(new { Status = 0, Message = e.Message });
            }
        }
Esempio n. 4
0
        public object SaveNamingSettings(string schemaId)
        {
            try
            {
                SecurityContext.DemandPermissions(SecutiryConstants.EditPortalSettings);

                CustomNamingPeople.SetPeopleNames(schemaId);

                CoreContext.TenantManager.SaveTenant(CoreContext.TenantManager.GetCurrentTenant());

                MessageService.Send(HttpContext.Current.Request, MessageAction.TeamTemplateChanged);

                return(new { Status = 1, Message = Resource.SuccessfullySaveSettingsMessage });
            }
            catch (Exception e)
            {
                return(new { Status = 0, e.Message });
            }
        }