private bool ControleView(Dictionnaire y) { if (y.Nom != null ? y.Nom.Trim().Length < 1 : true) { Messages.Error("Vous devez specifier le mot"); return(false); } if (y.Langue != null ? y.Langue.Id < 1 : true) { Messages.Error("Vous devez specifier la langue"); return(false); } if (!y.Langue.Code.Equals(Constantes.LANGUE_FRANCAIS)) { if (y.Francais != null ? y.Francais.Id < 1 : true) { Messages.Error("Vous devez specifier la traduction en francais"); return(false); } } Dictionnaire d = DictionnaireBLL.One(y.Nom, y.Langue.Id); if (d != null ? (!d.Id.Equals(y.Id)) : false) { Messages.Error("Vous avez deja créer ce mot"); return(false); } return(true); }
public static void Traduction(Control parent) { Dictionnaire y; if (parent.GetType().ToString() == "System.Windows.Forms.Form") { y = DictionnaireBLL.One(parent.Text); if (y != null ? y.id > 0 : false) { parent.Text = y.Nom; } } foreach (Control crtl in parent.Controls) { if ((crtl.GetType().ToString() == "System.Windows.Forms.Label") || (crtl.GetType().ToString() == "System.Windows.Forms.CheckBox") || (crtl.GetType().ToString() == "System.Windows.Forms.RadioButton") || (crtl.GetType().ToString() == "System.Windows.Forms.Button")) { y = DictionnaireBLL.One(crtl.Text); if (y != null ? y.id > 0 : false) { crtl.Text = y.Nom; } } else if ((crtl.GetType().ToString() == "System.Windows.Forms.GroupBox") || (crtl.GetType().ToString() == "System.Windows.Forms.TabPage")) { y = DictionnaireBLL.One(crtl.Text); if (y != null ? y.id > 0 : false) { crtl.Text = y.Nom; } Traduction(crtl); } else if ((crtl.GetType().ToString() == "System.Windows.Forms.Panel") || (crtl.GetType().ToString() == "System.Windows.Forms.TabControl") || (crtl.GetType().ToString() == "System.Windows.Forms.DataGridView")) { Traduction(crtl); } } if (parent.GetType().ToString() == "System.Windows.Forms.DataGridView") { foreach (DataGridViewColumn crtl in ((DataGridView)parent).Columns) { y = DictionnaireBLL.One(crtl.HeaderText); if (y != null ? y.id > 0 : false) { crtl.HeaderText = y.Nom; } } } }
private void LoadTraduction() { List <Dictionnaire> traductions = new DictionnaireBLL().List("select * from " + Dictionnaire.ToTable() + " where francais is null order by nom"); com_traduction.DisplayMember = "Nom"; com_traduction.ValueMember = "Id"; com_traduction.DataSource = new BindingSource(traductions, null); foreach (Dictionnaire l in traductions) { com_traduction.AutoCompleteCustomSource.Add(l.Nom); } com_traduction.AutoCompleteMode = AutoCompleteMode.SuggestAppend; com_traduction.AutoCompleteSource = AutoCompleteSource.CustomSource; }