private void TensionExportFromControl(UneTension tension, ctlUneTension control) { control.export(); string[] exp = control.strValues.Split(';'); tension.sys = int.Parse("0" + exp[0]); tension.dia = int.Parse("1" + exp[0]); tension.pul = int.Parse("2" + exp[0]); }
public UnJour() { matin1 = new UneTension(); matin2 = new UneTension(); matin3 = new UneTension(); soir1 = new UneTension(); soir2 = new UneTension(); soir3 = new UneTension(); jour = DateTime.Now.Day; mois = DateTime.Now.Month; annee = DateTime.Now.Year; }
private void Form1_Load(object sender, EventArgs e) { UnJourTransfert ujt = new UnJourTransfert(); using (ChoCSVReader <UnJourTransfert> reader = new ChoCSVReader <UnJourTransfert>("Tension.csv")) { while ((ujt = reader.Read()) != null) { UneTension tension1 = new UneTension(ujt.sys1.ToString() + ";" + ujt.dia1.ToString() + ";" + ujt.pul1.ToString()); UneTension tension2 = new UneTension(ujt.sys2.ToString() + ";" + ujt.dia2.ToString() + ";" + ujt.pul2.ToString()); UneTension tension3 = new UneTension(ujt.sys3.ToString() + ";" + ujt.dia3.ToString() + ";" + ujt.pul3.ToString()); UneTension tension4 = new UneTension(ujt.sys4.ToString() + ";" + ujt.dia4.ToString() + ";" + ujt.pul4.ToString()); UneTension tension5 = new UneTension(ujt.sys5.ToString() + ";" + ujt.dia5.ToString() + ";" + ujt.pul5.ToString()); UneTension tension6 = new UneTension(ujt.sys6.ToString() + ";" + ujt.dia6.ToString() + ";" + ujt.pul6.ToString()); UnJour uj = new UnJour(); uj.matin1 = tension1; uj.matin2 = tension2; uj.matin3 = tension3; uj.soir1 = tension4; uj.soir2 = tension5; uj.soir3 = tension6; this.dateTimePicker1.Value = DateTime.Parse(ujt.LaDate); uj.annee = dateTimePicker1.Value.Year; uj.mois = dateTimePicker1.Value.Month; uj.jour = dateTimePicker1.Value.Day; LJ.Add(uj); ctlUneTension1.import(tension1.sys.ToString() + ";" + tension1.dia.ToString() + ";" + tension1.pul.ToString()); ctlUneTension2.import(tension2.sys.ToString() + ";" + tension2.dia.ToString() + ";" + tension2.pul.ToString()); ctlUneTension3.import(tension3.sys.ToString() + ";" + tension3.dia.ToString() + ";" + tension3.pul.ToString()); ctlUneTension4.import(tension4.sys.ToString() + ";" + tension4.dia.ToString() + ";" + tension4.pul.ToString()); ctlUneTension5.import(tension5.sys.ToString() + ";" + tension5.dia.ToString() + ";" + tension5.pul.ToString()); ctlUneTension6.import(tension6.sys.ToString() + ";" + tension6.dia.ToString() + ";" + tension6.pul.ToString()); } UpdateScrollbar(); UnJour uj1 = (UnJour)LJ[hScrollBar1.Value - 1]; } }
private void hScrollBar1_Scroll(object sender, ScrollEventArgs e) { if (e.OldValue != e.NewValue) { MessageBox.Show(((UnJour)LJ[e.OldValue - 1]).jour.ToString(), ((UnJour)LJ[e.NewValue - 1]).jour.ToString()); txbRec.Text = hScrollBar1.Value.ToString(); this.uj1 = (UnJour)this.LJ[e.OldValue - 1]; TensionExportFromControl(uj1.matin1, ctlUneTension1); TensionExportFromControl(uj1.matin2, ctlUneTension2); TensionExportFromControl(uj1.matin3, ctlUneTension3); TensionExportFromControl(uj1.soir1, ctlUneTension4); TensionExportFromControl(uj1.soir2, ctlUneTension5); TensionExportFromControl(uj1.soir3, ctlUneTension6); this.uj1 = (UnJour)this.LJ[e.NewValue - 1]; dateTimePicker1.Value = new DateTime(uj1.annee, uj1.mois, uj1.jour); if (false) { UneTension tension1 = uj1.matin1; UneTension tension2 = uj1.matin2; UneTension tension3 = uj1.matin3; UneTension tension4 = uj1.soir1; UneTension tension5 = uj1.soir2; UneTension tension6 = uj1.soir3; dateTimePicker1.Value = new DateTime(uj1.annee, uj1.mois, uj1.jour); ctlUneTension1.import(tension1.sys.ToString() + ";" + tension1.dia.ToString() + ";" + tension1.pul.ToString()); ctlUneTension2.import(tension2.sys.ToString() + ";" + tension2.dia.ToString() + ";" + tension2.pul.ToString()); ctlUneTension3.import(tension3.sys.ToString() + ";" + tension3.dia.ToString() + ";" + tension3.pul.ToString()); ctlUneTension4.import(tension4.sys.ToString() + ";" + tension4.dia.ToString() + ";" + tension4.pul.ToString()); ctlUneTension5.import(tension5.sys.ToString() + ";" + tension5.dia.ToString() + ";" + tension5.pul.ToString()); ctlUneTension6.import(tension6.sys.ToString() + ";" + tension6.dia.ToString() + ";" + tension6.pul.ToString()); } } else { MessageBox.Show(ctlUneTension1.sys.ToString()); } }