public void DeleteTheme(ThemeModel theme) { if (theme == null) { throw new ArgumentNullException(); } using (AppTourEntities data = new AppTourEntities()) { THEME current = data.THEME.Where(p => p.ID == theme.Id).SingleOrDefault(); if (current != null) { try { current.IS_ACTIVE = false; data.SaveChanges(); } catch (Exception e) { if (e.InnerException != null) { throw new Exception(e.InnerException.Message); } throw; } } } }
public void UpdateTheme(ThemeModel theme) { using (AppTourEntities data = new AppTourEntities()) { THEME current = data.THEME.Where(x => theme.Id == x.ID).SingleOrDefault(); if (current != null) { try { current.NAME = theme.Name; current.DESCRIPTION = theme.Description; current.IMAGE = theme.Image; current.IS_ACTIVE = theme.IsActive; current.CREATION_DATE = theme.CreationDate; current.UPDATE_DATE = DateTime.Now; data.SaveChanges(); } catch (Exception e) { if (e.InnerException != null) { throw new Exception(e.InnerException.Message); } throw; } } } }
public Guid InsertTheme(ThemeModel theme) { Guid id = Guid.NewGuid(); if (theme == null) { throw new NullReferenceException("theme"); } using (AppTourEntities data = new AppTourEntities()) { THEME _new = new THEME { ID = id, NAME = theme.Name, DESCRIPTION = theme.Description, IMAGE = theme.Image, IS_ACTIVE = theme.IsActive, CREATION_DATE = DateTime.Now, UPDATE_DATE = DateTime.Now }; data.THEME.AddObject(_new); data.SaveChanges(); } return(id); }
//sets theme to GCC crimson private void themeToGCC(object sender, EventArgs e) { currentTheme = THEME.GCC; adjustCheckstates(); updateCalendarTheme(); scheduleTitle.ForeColor = Color.Black; menuBar.BackColor = Color.White; searchBox.BackColor = Color.White; searchTab.BackColor = Calendar.GCCCrimsonRenderer.TrueCrimsonLight; scheduleTab.BackColor = Calendar.GCCCrimsonRenderer.TrueCrimsonLight; searchResult_UI.BackColor = Color.White; scheduleView.BackColor = Color.White; searchResult_UI.ForeColor = Color.Black; appMenu.BackColor = Color.White; // Adv Filter filter_UI.BackColor = Color.White; filter_UI.ForeColor = Color.Black; // Buttons searchBtn.BackColor = Color.Gainsboro; advSearchBtn.BackColor = Color.Gainsboro; searchBtn.BackColor = Color.Gainsboro; // Button font color searchBtn.ForeColor = Color.Black; advSearchBtn.ForeColor = Color.Black; clickHelp1.ForeColor = Color.White; removeHelp.ForeColor = Color.White; // This is the "Double click to remove courses" text autocorrect_label.ForeColor = Color.White; credits_notify_label.ForeColor = Color.White; calendar_info_label.ForeColor = Color.White; updateScheduleUI(); refreshSearchItemColors(search.lastSearchResults.getCourses()); calendar_UI.Invalidate(); // Updates the Calendar }
//sets theme to night private void themeToNight(object sender, EventArgs e) { currentTheme = THEME.NIGHT; adjustCheckstates(); updateCalendarTheme(); var veryDarkGray = Color.FromArgb(51, 51, 51); // Base color scheduleTitle.ForeColor = Color.White; menuBar.BackColor = Color.White; searchBox.BackColor = Color.White; searchTab.BackColor = veryDarkGray; searchResult_UI.BackColor = Color.LightGray; searchResult_UI.ForeColor = Color.Black; scheduleView.BackColor = Color.LightGray; scheduleTab.BackColor = veryDarkGray; appMenu.BackColor = Color.White; // Adv Filter elements filter_UI.BackColor = veryDarkGray; filter_UI.ForeColor = Color.White; // Button backgrounds searchBtn.BackColor = Color.Gainsboro; advSearchBtn.BackColor = Color.Gainsboro; searchBtn.BackColor = Color.Gainsboro; // Button fonts searchBtn.ForeColor = Color.Black; advSearchBtn.ForeColor = Color.Black; autocorrect_label.ForeColor = Color.White; removeHelp.ForeColor = Color.White; credits_notify_label.ForeColor = Color.White; calendar_info_label.ForeColor = Color.White; clickHelp1.ForeColor = Color.White; updateScheduleUI(); refreshSearchItemColors(search.lastSearchResults.getCourses()); calendar_UI.Invalidate(); // Updates the Calendar }
public static THEME currentTheme; // enum for keeping track of current theme //constructor public AppWindow() { InitializeComponent(); initializeProfessorComboBox(); currentTheme = THEME.CLASSIC; // Start using the Classing theme calendar_UI.StartDate = new DateTime(2010, 2, 1, 0, 0, 0); // I chose this date so that the calendar starts on Monday the 1st calendar_UI.ResolveAppointments += new Calendar.ResolveAppointmentsEventHandler(this.dayView1_ResolveAppointments); calendar_UI.DoubleClick += new EventHandler(this.dayView1_MouseDoubleClick); // For double-clicking on calendar items calendar_UI.Renderer = new Calendar.Office11Renderer(calendar_UI); // Begin using the Classic theme calendar_UI.HalfHourHeight = 11; // Spacing between half hours in the calendar calendar_UI.StartHour = 8; calendar_UI.WorkingHourStart = 8; clearAdvBtn_Click(this, new EventArgs()); // Reset all the advanced options clickHelp1.Text = "Double click to add a course!"; updateScheduleUI(); }
public ActionResult SaveTemplate(TEMPLATEViewModel model, FormCollection collection) { int res = 0; var selectedProjetId = model.listprojetId; var selectedThemeId = model.listThemeId; string ftpdir = ""; if (!string.IsNullOrEmpty(collection["ftpdirs"])) { ftpdir = collection["ftpdirs"]; } if (!string.IsNullOrEmpty(Request.QueryString["currentid"])) { _userId = Guid.Parse(Request.QueryString["currentid"]); Session["currentid"] = Request.QueryString["currentid"]; } else if (!string.IsNullOrEmpty(HttpContext.User.Identity.Name)) { _userId = Guid.Parse(HttpContext.User.Identity.Name); } MODELEViewModel modelVm = new MODELEViewModel(); modelVm = new Modeles().GetDetailsModele((Guid)Session["modeleId"]); Session["Menu"] = "1"; var html = RenderViewAsString("Home", modelVm); TEMPLATE newtemplate = new TEMPLATE(); newtemplate.dateCreation = DateTime.Now; newtemplate.url = model.url; newtemplate.ftpUser = model.ftpUser; newtemplate.ftpPassword = model.ftpPassword; newtemplate.modeleId = (Guid)Session["modeleId"]; newtemplate.ip = model.ip; newtemplate.userId = _userId; newtemplate.PROJET = db.PROJETS.Find(selectedProjetId); newtemplate.projetId = selectedProjetId; var selectedTheme = model.THEME.theme_name; THEME currentTheme = db.THEMES.FirstOrDefault(x => x.theme_name.Contains(selectedTheme.TrimEnd())); if (currentTheme == null) { currentTheme = new THEME { themeId = Guid.NewGuid(), theme_name = selectedTheme }; db.THEMES.Add(currentTheme); db.SaveChanges(); } newtemplate.THEME = currentTheme; newtemplate.themeId = currentTheme.themeId; newtemplate.html = html; var results = newtemplate.templateId = Guid.NewGuid(); db.TEMPLATEs.Add(newtemplate); try { res = db.SaveChanges(); if (res > 0) { var templateName = Session["TemplateName"].ToString(); int nb_menu = (Session["nbmenu"] == null) ? 1 : int.Parse(Session["nbmenu"].ToString()); CreateFiles(nb_menu, html); //Send Ftp string pathParent = Server.MapPath("~/Themes/" + templateName); string pathCss = pathParent + "/css/"; string pathImg = pathParent + "/img"; string pathJs = pathParent + "/js"; int result = SendToFtp(ftpdir, model.url, model.ftpUser, model.ftpPassword, pathCss, pathParent, pathImg, pathJs); //return new FilePathResult(path, "text/html"); if (result == 0) { return(View("CreateTemplateConfirmation")); } else { return(View("ErrorException")); } } else { return(View("ErrorException")); } } catch (Exception ex) { return(View("ErrorException")); } }