Example #1
0
 public ActionResult ConvertFromMdy(int id)
 {
     var cul = "en-US";
     Thread.CurrentThread.CurrentUICulture = new CultureInfo(cul);
     Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(cul);
     var org = DbUtil.Db.LoadOrganizationById(id);
     var m = new Settings(org.RegSetting, DbUtil.Db, id);
     var os = new Settings(m.ToString(), DbUtil.Db, id);
     m.org.RegSetting = os.ToString();
     DbUtil.Db.SubmitChanges();
     return Redirect("/RegSetting/Index/" + id);
 }
Example #2
0
 public ActionResult OnlineRegQuestionsUpdate(int id)
 {
     var m = GetRegSettings(id);
     DbUtil.LogActivity("Update OnlineRegQuestions {0}".Fmt(m.org.OrganizationName));
     m.AskItems.Clear();
     m.TimeSlots.list.Clear();
     try
     {
         if (!TryUpdateModel(m))
         {
             var q = from e in ModelState.Values
                     where e.Errors.Count > 0
                     select e.Errors[0].ErrorMessage;
             throw new Exception(q.First());
         }
         string s = m.ToString();
         m = new Settings(s, DbUtil.Db, id);
         m.org.RegSetting = m.ToString();
         DbUtil.Db.SubmitChanges();
         if (!m.org.NotifyIds.HasValue())
             ModelState.AddModelError("Form", needNotify);
         return View("OnlineRegQuestions", m);
     }
     catch (Exception ex)
     {
         ModelState.AddModelError("Form", ex.Message);
         return Content("error:" + ex.Message);
         //return View("OnlineRegQuestionsEdit", m);
     }
 }
Example #3
0
 public ActionResult OnlineRegMessagesUpdate(int id)
 {
     var m = GetRegSettings(id);
     DbUtil.LogActivity("Update OnlineRegMessages {0}".Fmt(m.org.OrganizationName));
     //m.VoteTags.Clear();
     try
     {
         UpdateModel(m);
         var os = new Settings(m.ToString(), DbUtil.Db, id);
         m.org.RegSetting = os.ToString();
         DbUtil.Db.SubmitChanges();
         if (!m.org.NotifyIds.HasValue())
             ModelState.AddModelError("Form", needNotify);
         return View("OnlineRegMessages", m);
     }
     catch (Exception ex)
     {
         ModelState.AddModelError("Form", ex.Message);
         return View("OnlineRegMessagesEdit", m);
     }
 }
Example #4
0
        public ActionResult OnlineRegAdminUpdate(int id)
        {
            var m = GetRegSettings(id);
            m.AgeGroups.Clear();
            DbUtil.LogActivity("Update OnlineRegAdmin {0}".Fmt(m.org.OrganizationName));
            try
            {
                UpdateModel(m);
                if (m.org.OrgPickList.HasValue() && m.org.RegistrationTypeId == RegistrationTypeCode.JoinOrganization)
                    m.org.OrgPickList = null;

                var os = new Settings(m.ToString(), DbUtil.Db, id);
                m.org.RegSetting = os.ToString();
                DbUtil.Db.SubmitChanges();
                if (!m.org.NotifyIds.HasValue())
                    ModelState.AddModelError("Form", needNotify);
                return View("OnlineRegAdmin", m);
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("Form", ex.Message);
                return View("OnlineRegAdminEdit", m);
            }
        }