public void update(theme untheme) { string ThemeUpdate; ThemeUpdate = ("pays set id ='" + untheme.IdTheme + "' , nom = '" + untheme.Theme.Replace("'", "''") + "'"); _dbal.Update(ThemeUpdate); }
private void button1_Click(object sender, EventArgs e) { theme t = (theme)cbTheme.SelectedItem; ThemeEditor editor = new ThemeEditor(db, t); editor.Show(); }
public ThemeEditor(DbAppContext db, theme theme) { this.db = db; this.theme = theme; InitializeComponent(); }
public MinesweeperSettingsDialog(theme parentTheme, int parentWidth, int parentHeight, int parentMines, bool parentTileSize, bool parentOffline) { confirmed = false; InitializeComponent(); // sets the dialog's theme and map type to match the main window for consistency. customWidthBox.Value = parentWidth; customHeightBox.Value = parentHeight; customMinesBox.Value = parentMines; largeTilesCheckBox.Checked = parentTileSize; offlineModeCheckBox.Checked = parentOffline; switch (parentTheme) { case (theme.cats): setCatTheme(null, null); break; case (theme.classic): setClassicTheme(null, null); break; case (theme.bubble): setBubbleTheme(null, null); break; case (theme.dark): setDarkTheme(null, null); break; } }
public void insert(theme untheme) { string ThemeInsert; ThemeInsert = ("themes (id, theme) values (" + untheme.IdTheme + ",'" + untheme.Theme.Replace("'", "''") + "')"); _dbal.Insert(ThemeInsert); }
public sondage UpdateSondageWithThemeWithThemeParent(int id, string t, string d, string th1, string th, int rem, int nbQ, bool dispo) { theme theme = AddThemeAlone(th1); theme.theme2 = db.themes.Where(them => them.nom == th).FirstOrDefault(); db.themes.Find(db.themes.Where(them => them.nom == th).FirstOrDefault().Id).theme1.Add(theme); questionnaire q = getQuestionnaireById(id); q.Titre = t; q.Description = d; q.theme = db.themes.Where(the => the.nom == th1).FirstOrDefault(); q.Id_Theme = db.themes.Where(the => the.nom == th1).FirstOrDefault().Id; q.questions = new List <question>(nbQ); q.Disponible = dispo; foreach (question question in getAllQuestionOfQuestionnaire(id)) { q.questions.Add(question); } sondage s = getSondageByQuestionnaire(id); s.Remuneration = rem; db.SaveChanges(); return(s); }
public void delete(theme untheme) { string ThemeDelete; ThemeDelete = ("theme where id ='" + untheme.IdTheme + "'"); _dbal.Delete(ThemeDelete); }
public void insert(salles unesalle, theme untheme) { string SalleInsert; SalleInsert = ("salle (idSalle, ville, idTheme) values (" + unesalle.IdSalle + ",'" + unesalle.Ville.Replace("'", "''") + "'," + untheme.IdTheme + ")"); _dbal.Insert(SalleInsert); }
public void update(salles unesalle, theme untheme) { string SalleUpdate; SalleUpdate = ("salles set id ='" + unesalle.IdSalle + "' , nom = '" + unesalle.Ville.Replace("'", "''") + untheme.IdTheme + "'"); _dbal.Update(SalleUpdate); }
/// <summary> /// retourne les sous themes /// </summary> /// <param name="letheme">Le theme parent</param> /// <returns>Retourne une liste de sous themes</returns> public static List <theme> ssTheme(theme letheme) { List <theme> ListessTheme = db.themes.ToList(); var result = db.themes.Include(x => x.themes).Single(x => x.id == letheme.id); return(result.theme1.ToList()); }
private void button_Valider_Click_1(object sender, RoutedEventArgs e) { theme22 = new theme { Intutile = textBox_Nom.Text }; Controller.ThemeDAO.addtheme(theme22); MessageBox.Show("Votre thème à bien été ajouté"); }
public sondage AddSondageWithThemeWithThemeParent(string t, string d, string th1, string th, int rem, int nbQ, bool dispo) { theme theme = AddChildrenTheme(th1, db.themes.Where(the => the.nom == th).FirstOrDefault().Id); questionnaire q = AddQuestionnaire(t, d, th1, nbQ); q.Disponible = dispo; sondage s = new sondage(rem, q); q.sondages.Add(s); db.SaveChanges(); return(s); }
public sondage AddSondageWithTheme(string t, string d, string th, int rem, int nbQ, bool dispo) { theme theme = AddThemeAlone(th); questionnaire q = AddQuestionnaire(t, d, th, nbQ); q.Disponible = dispo; sondage s = new sondage(rem, q); q.sondages.Add(s); db.Entry(q).State = System.Data.Entity.EntityState.Modified; return(s); }
public static Theme ToModel(this theme row) { if (row == null) { return(new Theme()); } return(new Theme() { thumbnail = row.url, title = row.title }); }
public void addThemes(ComboBox cb) { theme all = new theme(); all.themeName = "all"; all.themeId = 0; List <theme> cs = new List <theme>(); cs.Add(all); cs.AddRange(db.themes.ToList()); cb.DataSource = cs; }
private void button_Valider_Click(object sender, RoutedEventArgs e) { theme letheme = combo_theme.SelectedItem as PPE.theme; PPE.enquete newEnquete = new PPE.enquete { Intitule = textBox_Nom.Text, themes = letheme.themes }; foreach (var item in (App.Current as App).listeseq) { newEnquete.sequences.Add(item); } Controller.EnqueteDAO.Add(newEnquete); }
public ActionResult Current(string name) { const string rootdir = GeneralConstants.APP_ROOT_DIR + Themepath; var dir = new DirectoryInfo(rootdir); DirectoryInfo selected = null; foreach (var themedir in dir.GetDirectories()) { if (themedir.Name == name) { selected = themedir; break; } } if (selected == null) { return(RedirectToAction("Index", "error", new { Area = "" })); } try { var handler = new ThemeHandler(MASTERdomain, false); handler.CopyThemeToUserThemeDirectory(selected); } catch (Exception ex) { Syslog.Write(ex); return(RedirectToAction("Index", "error", new { Area = "" })); } // save theme var theme = MASTERdomain.theme; if (theme == null) { theme = new theme(); MASTERdomain.theme = theme; } theme.title = name; theme.url = string.Format("{0}/{1}/thumb.jpg", Themepath, selected.Name); theme.created = DateTime.UtcNow; repository.Save(); // need to invalidate any cached liquid assets CacheHelper.Instance.invalidate_dependency(DependencyType.liquid_assets, MASTERdomain.uniqueid); return(RedirectToAction("Index")); }
private void questions_Click(object sender, RoutedEventArgs e) { try { if (nvTheme) { if (themesParents.SelectedIndex == -1) { theme newTheme = ct.AddThemeAlone(themes.Text); if (enqueteExistante) { newEnquete = ct.UpdateEnquete(enquete.Id, titreChoisi.Text, inputDescription.Text, newTheme.nom, int.Parse(inputNbQ.Text), disponibilite.IsChecked.Value); } else { newEnquete = ct.AddEnquete(titreChoisi.Text, inputDescription.Text, newTheme.nom, int.Parse(inputNbQ.Text), disponibilite.IsChecked.Value); } } else { if (enqueteExistante) { newEnquete = ct.UpdateEnqueteWithThemeWithThemeParent(enquete.Id, titreChoisi.Text, inputDescription.Text, themes.Text, themesParents.Text, int.Parse(inputNbQ.Text), disponibilite.IsChecked.Value); } else { newEnquete = ct.AddEnqueteWithThemeWithThemeParent(titreChoisi.Text, inputDescription.Text, themes.Text, themesParents.Text, int.Parse(inputNbQ.Text), disponibilite.IsChecked.Value); } } } else { newEnquete = ct.AddEnquete(titreChoisi.Text, inputDescription.Text, themes.SelectedItem.ToString(), int.Parse(inputNbQ.Text), disponibilite.IsChecked.Value); } if (enqueteExistante) { detailEnquete page = new detailEnquete(newEnquete); NavigationService.Navigate(page); } else { ajouterSE page = new ajouterSE(newEnquete, int.Parse(inputNbQ.Text), 1); NavigationService.Navigate(page); } } catch (System.FormatException) { erreur.Visibility = Visibility.Visible; } }
/// <summary> /// Handles when an item in the themes menu is clicked. /// Functions like a radio button (only one can be checked), /// then applies the selected theme to the application. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void themeMenuItemClicked(object sender, EventArgs e) { ToolStripMenuItem selectedItem = ((ToolStripMenuItem)sender); foreach (ToolStripMenuItem menuItem in themeToolStripMenuItem.DropDownItems) { if (menuItem.ToString() != selectedItem.ToString()) { menuItem.Checked = false; } selectedItem.Checked = true; this.loadedTheme = this.themes.First(x => x.name == selectedItem.Text); themeAllForms(this.loadedTheme); } }
private void frmMain_Load(object sender, EventArgs e) { this.Icon = Icon.ExtractAssociatedIcon(System.Reflection.Assembly.GetExecutingAssembly().Location); loadThemes(); createThemesToolStripMenu(); /* if we can't read the settings file, use the defaults*/ if (!readUserSettingsFromFile()) { this.loadedTheme = themes[0]; this.loadedFontSize = common.DEFAULT_FONT_SIZE; normalToolStripMenuItem.Checked = true; rememberMeToken = null; } foreach (ToolStripMenuItem menuItem in themeToolStripMenuItem.DropDownItems) { if (menuItem.ToString() == loadedTheme.name) { menuItem.Checked = true; } } if (!string.IsNullOrEmpty(this.rememberMeToken)) { rememberMeToolStripMenuItem.Checked = true; } if (this.loadedFontSize == common.DEFAULT_FONT_SIZE) { normalToolStripMenuItem.Checked = true; } else if (this.loadedFontSize == common.LARGE_FONT_SIZE) { largeToolStripMenuItem.Checked = true; } else if (this.loadedFontSize == common.HUGE_FONT_SIZE) { hugeToolStripMenuItem.Checked = true; } this.loadedTheme.themeForm(this); this.Text = common.APPLICATION_NAME; this.WindowState = FormWindowState.Maximized; tmrTimer.Start(); }
public void InsertFromCSV(string chemin) { using (var reader = new StreamReader(chemin)) using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture)) { csv.Configuration.Delimiter = ";"; csv.Configuration.PrepareHeaderForMatch = (string header, int index) => header.ToLower(); var record = new theme(); IEnumerable <theme> records = csv.EnumerateRecords(record); foreach (theme theme in records) { insert(theme); } } }
/// <summary> /// Constructor for the form /// </summary> public Form1() { log.Log(lq.system_message, "initializing components", new string[] { "constructor" }); InitializeComponent(); folder = new FolderBrowserDialog(); // folder initialization this.FormBorderStyle = FormBorderStyle.FixedSingle; // turn off window resizing matching_files = new List <FileInfo>(); last_opened_directory = get_last_opened_folder(); // restore last folder from file current_theme = theme.light; if (!last_opened_directory.Equals("")) { label_previous_folder_name.Text = last_opened_directory; // assign previous folder name to label for visibility button_open_previous.Enabled = true; // enable the button } }
private void addButton_Click(object sender, EventArgs e) { if (validateData(themeTb.Text)) { theme t = new theme(); t.themeName = themeTb.Text; if (crud.create(t) != null) { MessageBox.Show("Theme was added!"); this.Close(); } else { MessageBox.Show("Theme alredy exists!!!"); } } }
private void themeAllForms(theme themeToApply) { themeToApply.themeForm(this); foreach (Form mdiChild in this.MdiChildren) { themeToApply.themeForm(mdiChild); if (mdiChild.Name == "frmAccountDetails") { ((frmAccountDetails)mdiChild).themeButtons(); } if (mdiChild.Name == "frmWelcome") { ((frmWelcome)mdiChild).themeSideBar(); } } }
private void questions_Click(object sender, RoutedEventArgs e) { try { if (nvTheme) { if (themesParents.SelectedIndex == -1) { theme newTheme = ct.AddThemeAlone(themes.Text); if (sondageExistant) { newSondage = ct.UpdateSondage(questionnaire.Id, titreChoisi.Text, inputDescription.Text, newTheme.nom, int.Parse(inputRemuneration.Text), int.Parse(inputNbQ.Text), disponibilite.IsChecked.Value); } else { newSondage = ct.AddSondage(titreChoisi.Text, inputDescription.Text, newTheme.nom, int.Parse(inputRemuneration.Text), int.Parse(inputNbQ.Text), disponibilite.IsChecked.Value); } } else { if (sondageExistant) { newSondage = ct.UpdateSondageWithThemeWithThemeParent(questionnaire.Id, titreChoisi.Text, inputDescription.Text, themes.Text, themesParents.Text, int.Parse(inputRemuneration.Text), int.Parse(inputNbQ.Text), disponibilite.IsChecked.Value); } else { newSondage = ct.AddSondageWithThemeWithThemeParent(titreChoisi.Text, inputDescription.Text, themes.Text, themesParents.Text, int.Parse(inputRemuneration.Text), int.Parse(inputNbQ.Text), disponibilite.IsChecked.Value); } } } else { newSondage = ct.AddSondage(titreChoisi.Text, inputDescription.Text, themes.SelectedItem.ToString(), int.Parse(inputRemuneration.Text), int.Parse(inputNbQ.Text), disponibilite.IsChecked.Value); } ajouterQS page = new ajouterQS(ct.getQuestionnaireBySondage(newSondage), int.Parse(inputNbQ.Text), 1); NavigationService.Navigate(page); } catch (System.FormatException) { erreur.Visibility = Visibility.Visible; } }
/// <summary> /// attempts to read the user settings from a file, and returns a boolean /// indicating if the settings were successfully read /// </summary> /// <returns></returns> private bool readUserSettingsFromFile() { float[] validFontSizes = { common.DEFAULT_FONT_SIZE, common.LARGE_FONT_SIZE, common.HUGE_FONT_SIZE }; try { XmlDocument settingsFile = new XmlDocument(); XmlNode currentNode; settingsFile.Load(System.IO.Directory.GetCurrentDirectory() + "\\settings.xml"); currentNode = settingsFile.SelectSingleNode("/settings/fontSize"); if (!common.isNumeric(currentNode.InnerText) || !validFontSizes.Contains(float.Parse(currentNode.InnerText))) { this.loadedFontSize = common.DEFAULT_FONT_SIZE; } else { this.loadedFontSize = float.Parse(currentNode.InnerText); } currentNode = settingsFile.SelectSingleNode("/settings/rememberMe"); this.rememberMeToken = currentNode.InnerText; currentNode = settingsFile.SelectSingleNode("/settings/theme"); if (this.themes.FirstOrDefault(x => x.name == currentNode.InnerText) != null) { this.loadedTheme = this.themes.First(x => x.name == currentNode.InnerText); } else { this.loadedTheme = themes[0]; } return(true); } catch (Exception) { return(false); } }
void cl_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { if (e.Result != "") { StringReader str = new StringReader(e.Result); XDocument xml = XDocument.Load(str); foreach (XElement theme in xml.Descendants("theme")) { theme th = new theme(); th.description = theme.Descendants("description").FirstOrDefault().Value; th.title = theme.Descendants("title").FirstOrDefault().Value; th.id = theme.Descendants("id").FirstOrDefault().Value; th.thumb = theme.Descendants("thumb").FirstOrDefault().Value; gallery.Add(th); } updateGallery(); } }
/// <summary> /// sets the theme of the dialog and the main window to the dark theme, and updates elements accordingly. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void setDarkTheme(object sender, EventArgs e) { selectedTheme = theme.dark; this.BackColor = Color.FromArgb(45, 41, 51); easyDifficultyButton.Image = Properties.Resources.dark_easy_button; normalDifficultyButton.Image = Properties.Resources.dark_normal_button; hardDifficultyButton.Image = Properties.Resources.dark_hard_button; confirmButton.Image = Properties.Resources.dark_confirm_button; cancelButton.Image = Properties.Resources.dark_cancel_button; widthLabel.Image = Properties.Resources.dark_width_label; heightLabel.Image = Properties.Resources.dark_height_label; minesLabel.Image = Properties.Resources.dark_mines_label; themesLabel.Image = Properties.Resources.dark_themes_label; largeTilesLabel.Image = Properties.Resources.dark_large_tiles_label; offlineModeLabel.Image = Properties.Resources.dark_offlinie_label; catsThemeButton.Image = Properties.Resources.cat_blank; classicThemeButton.Image = Properties.Resources.classic_blank; bubbleThemeButton.Image = Properties.Resources.bubble_blank; darkThemeButton.Image = Properties.Resources.dark_flagged; setDifficultyButtonsPressed(); }
public enquete UpdateEnqueteWithThemeWithThemeParent(int id, string t, string d, string th, string th1, int nbQ, bool dispo) { theme theme = AddThemeAlone(th1); theme.theme2 = db.themes.Where(them => them.nom == th).FirstOrDefault(); db.themes.Find(db.themes.Where(them => them.nom == th).FirstOrDefault().Id).theme1.Add(theme); enquete UpdatedEnquete = db.enquetes.Find(id); UpdatedEnquete.titre = t; UpdatedEnquete.description = d; UpdatedEnquete.theme = db.themes.Where(the => the.nom == th).FirstOrDefault(); UpdatedEnquete.Id_Theme = db.themes.Where(the => the.nom == th).FirstOrDefault().Id; UpdatedEnquete.disponible = dispo; UpdatedEnquete.questionnaires = new List <questionnaire>(nbQ); foreach (questionnaire questionnaire in getAllQuestionnaireOfEnquete(id)) { UpdatedEnquete.questionnaires.Add(questionnaire); } db.SaveChanges(); return(UpdatedEnquete); }
private void checkNewTheme() { // check on a unique List <theme> all = new List <theme>(); all.AddRange(db.themes); all = all.FindAll ( delegate(theme t) { return(t.themeName.Equals(cbTheme.Text)); } ); if (all.Count == 0) { theme t = new theme(); t.themeName = cbTheme.Text; theme saved = db.themes.Add(t); db.SaveChanges(); participantDTO.theme = saved.themeId; } }