Esempio n. 1
0
 private Boolean CreateSchool(School school)
 {
     try
     {
         using (var context = new UzoneEntities())
         {
             context.Schools.Add(school);
             context.SaveChanges();
         }
         return true;
     }
     catch (Exception ex)
     { return false; }
 }
Esempio n. 2
0
 private Boolean UpdateSchool(School school)
 {
     try
     {
         using (var context = new UzoneEntities())
         {
             context.Schools.Attach(school);
             context.Entry(school).State = EntityState.Modified;
             context.SaveChanges();
         }
         return true;
     }
     catch (Exception ex)
     { return false; }
 }
Esempio n. 3
0
        protected void schoolWizard_FinishButtonClick(object sender, WizardEventArgs e)
        {
            School _school = new School();
            _school.Name = txtFullName.Text;
            _school.Alias = txtAlias.Text;
            _school.Mascot = txtMascot.Text;
            _school.Address = txtAddress.Text;
            _school.City = txtCity.Text;
            _school.Zip = txtZip.Text;
            _school.State = comboState.SelectedValue;
            _school.Email = txtContactEmail.Text;
            _school.Phone = txtContactPhone.Text;
            _school.ButtonColor = ColorTranslator.ToHtml(rdColorPrimary.SelectedColor) == string.Empty ? "NULL" : ColorTranslator.ToHtml(rdColorPrimary.SelectedColor);
            _school.BannerColor = ColorTranslator.ToHtml(rdColorBackground.SelectedColor) == string.Empty ? "NULL" : ColorTranslator.ToHtml(rdColorBackground.SelectedColor);

            if (isUpdate)
            {
                _school.SchoolID = Convert.ToInt64(Request.QueryString["schoolid"]);
                if (UpdateSchool(_school))
                    Response.Redirect("Modules");
                else
                    CreateErrorMsg("There was an issue saving your data.  Please try again.");
            }
            else
            {
                if (CreateSchool(_school))
                    Response.Redirect("Modules");
                else
                    CreateErrorMsg("There was an issue saving your data.  Please try again.");
            }
        }