Пример #1
0
        public ActionResult EditSchema(string id, string settingGroupData)
        {
            try
            {
                SettingGroup SettingGroup = new SettingGroup();

                if (!string.IsNullOrWhiteSpace(id))
                {
                    SettingGroup = SettingGroupDAO.LoadSettingGroupById(id);
                }
                else if (string.IsNullOrWhiteSpace(settingGroupData))
                {
                    //add an empty setting for new setting groups
                    SettingGroup.SettingsList.Add(new Setting());
                }
                else
                {
                    SettingGroup = JsonConvert.DeserializeObject <SettingGroup>(settingGroupData);
                }

                ViewBag.SettingGroup          = SettingGroup;
                ViewBag.StaticPropertyKeyList = StaticPropertyDAO.LoadAllKeyNames();
            }
            catch (Exception e)
            {
                CompanyCommons.Logging.WriteLog("ChimeraWebsite.Areas.Admin.Controllers.SettingsController.EditSchema() " + e.Message);
            }

            return(View());
        }
Пример #2
0
        public ActionResult EditValues(string id)
        {
            try
            {
                SettingGroup SettingGroup = SettingGroupDAO.LoadSettingGroupById(id);

                List <string> StaticPropertyKeys = (from e in SettingGroup.SettingsList.AsQueryable() where DataEntryTypeProperty.DataTypesRequireProperties.Contains(e.EntryType) && !string.IsNullOrWhiteSpace(e.DataEntryStaticPropertyKey) select e.DataEntryStaticPropertyKey).ToList();

                ViewBag.SettingGroup = SettingGroup;

                ViewBag.StaticPropertyList = StaticPropertyKeys != null && StaticPropertyKeys.Count > 0 ?StaticPropertyDAO.LoadByMultipleKeyNames(StaticPropertyKeys) : new List <StaticProperty>();

                ViewBag.ImageList = ImageDAO.LoadAll();
            }
            catch (Exception e)
            {
                CompanyCommons.Logging.WriteLog("ChimeraWebsite.Areas.Admin.Controllers.SettingsController.EditValues() " + e.Message);
            }

            return(View());
        }
Пример #3
0
        public ActionResult EditValues_Post(string id)
        {
            try
            {
                SettingGroup SettingGroup = SettingGroupDAO.LoadSettingGroupById(id);

                foreach (var Sett in SettingGroup.SettingsList)
                {
                    if (!string.IsNullOrWhiteSpace(Request["setting_" + Sett.Key]))
                    {
                        Sett.Value = Request["setting_" + Sett.Key];
                    }
                    else
                    {
                        Sett.Value = string.Empty;
                    }
                }

                if (SettingGroupDAO.Save(SettingGroup))
                {
                    AddWebUserMessageToSession(Request, String.Format("Successfully saved/updated setting group \"{0}\"", SettingGroup.GroupKey), SUCCESS_MESSAGE_TYPE);
                }
                else
                {
                    AddWebUserMessageToSession(Request, String.Format("Unable to saved/update setting group \"{0}\" at this time", SettingGroup.GroupKey), FAILED_MESSAGE_TYPE);
                }

                return(RedirectToAction("Index", "Dashboard"));
            }
            catch (Exception e)
            {
                CompanyCommons.Logging.WriteLog("ChimeraWebsite.Areas.Admin.Controllers.SettingsController.EditValues_Post() " + e.Message);
            }

            AddWebUserMessageToSession(Request, String.Format("Unable to save/update setting values at this time."), FAILED_MESSAGE_TYPE);

            return(RedirectToAction("Index", "Dashboard"));
        }