private void button1_Click(object sender, EventArgs e) { IGestionEtatDAO IGEDAO = new GestionEtatDAO(); IGestionProduitDAO IGPDAO = new GestionProduitDAO(); Etat a = new Etat(); IGestionEtat IGE = new GestionEtat(); string D = dateTimePicker1.Text; int i1 = D.IndexOf(" "); var jour = D.Substring(0, i1); var mot1 = D.Substring(i1 + 1); int i2 = mot1.IndexOf(" "); var jour_nbr = mot1.Substring(0, i2); var mot2 = mot1.Substring(i2 + 1); int i3 = mot2.IndexOf(" "); var mois = mot2.Substring(0, i3); var mois_nbr = IGE.GetDate(mois); var anne = mot2.Substring(i3 + 1); var date = jour_nbr + "-" + mois_nbr + "-" + anne; if (comboBox5.Text != "Local") { a = IGEDAO.GetEtat(comboBox5.Text, date, comboBox2.Text, "b"); ICollection <TextBox> TextBoxes = AddTextBoxes(this); int k = 0; for (int i = 33; i > 0; i--) { TextBoxes.ElementAt(k).Text = "" + a.Buses.ElementAt(i - 1).Quantite; k++; } } else { ICollection <Buse> BuseUsine = IGPDAO.ListerTotaleBusesUsine(); ICollection <Buse> BuseinallUF = IGPDAO.ListerTotaleBuseAccueil(date, comboBox2.Text, "b"); int k = 0; for (int i = 33; i > 0; i--) { ICollection <TextBox> TextBoxes = AddTextBoxes(this); TextBoxes.ElementAt(k).Text = "" + (BuseUsine.ElementAt(i - 1).Quantite - BuseinallUF.ElementAt(i - 1).Quantite); k++; } } }
private void button1_Click(object sender, EventArgs e) { IGestionEtatDAO IGEDAO = new GestionEtatDAO(); IGestionProduitDAO IGPDAO = new GestionProduitDAO(); Etat a = new Etat(); IGestionEtat IGE = new GestionEtat(); string D = dateTimePicker1.Text; int i1 = D.IndexOf(" "); var jour = D.Substring(0, i1); var mot1 = D.Substring(i1 + 1); int i2 = mot1.IndexOf(" "); var jour_nbr = mot1.Substring(0, i2); var mot2 = mot1.Substring(i2 + 1); int i3 = mot2.IndexOf(" "); var mois = mot2.Substring(0, i3); var mois_nbr = IGE.GetDate(mois); var anne = mot2.Substring(i3 + 1); var date = jour_nbr + "-" + mois_nbr + "-" + anne; if (comboBox5.Text != "Local") { a = IGEDAO.GetEtat(comboBox5.Text, date, comboBox2.Text, "f"); textBox6.Text = "" + a.Feeders.ElementAt(0).Quantite; textBox5.Text = "" + a.Feeders.ElementAt(1).Quantite; textBox4.Text = "" + a.Feeders.ElementAt(2).Quantite; textBox9.Text = "" + a.Feeders.ElementAt(3).Quantite; textBox8.Text = "" + a.Feeders.ElementAt(4).Quantite; textBox7.Text = "" + a.Feeders.ElementAt(5).Quantite; } else { ICollection <Feeder> FeederdanslesUF = IGPDAO.ListerTotaleFeederAccueil(date, comboBox2.Text, "f"); ICollection <Feeder> FeederDansUsine = IGPDAO.ListerTotaleFeederUsine(); textBox6.Text = "" + (FeederDansUsine.ElementAt(0).Quantite - FeederdanslesUF.ElementAt(0).Quantite); textBox5.Text = "" + (FeederDansUsine.ElementAt(1).Quantite - FeederdanslesUF.ElementAt(1).Quantite); textBox4.Text = "" + (FeederDansUsine.ElementAt(2).Quantite - FeederdanslesUF.ElementAt(2).Quantite); textBox9.Text = "" + (FeederDansUsine.ElementAt(3).Quantite - FeederdanslesUF.ElementAt(3).Quantite); textBox8.Text = "" + (FeederDansUsine.ElementAt(4).Quantite - FeederdanslesUF.ElementAt(4).Quantite); textBox7.Text = "" + (FeederDansUsine.ElementAt(5).Quantite - FeederdanslesUF.ElementAt(5).Quantite); } }
private void button3_Click(object sender, EventArgs e) { if (this.verou1) { MessageBox.Show("Vous devez appuiyer sur le boutton calcul d'abord"); } else { IGestionEtatDAO IGEDAO = new GestionEtatDAO(); IGestionConfigurationDAO IGCDAO = new GestionConfigurationDAO(); IGestionProduitDAO IGPDAO = new GestionProduitDAO(); ICollection <Buse> TotaleBusesDansUF = new List <Buse>(); ICollection <Buse> TotaleBusesInLocale = new List <Buse>(); ICollection <Buse> BusesConfig = new List <Buse>(); Etat etat = IGEDAO.RechercherDernierEtat(UF_Combo_Box.Text, "b"); BusesConfig = IGCDAO.ConfigBuse(UF_Combo_Box.Text); int[] ConfigB = new int[33]; string[] ConfigBusesID = new string[33]; int[] DernierEtatB = new int[33]; int i = 0; foreach (var item in BusesConfig) { ConfigB[i] = item.Quantite; ConfigBusesID[i] = item.coordonnee; i++; } i = 0; foreach (var item in etat.Buses) { DernierEtatB[i] = item.Quantite; i++; } string[] CoordonneBuses = new string[33]; CoordonneBuses[0] = "110S"; CoordonneBuses[1] = "115S"; CoordonneBuses[2] = "120S"; CoordonneBuses[3] = "130S"; CoordonneBuses[4] = "235S"; CoordonneBuses[5] = "110"; CoordonneBuses[6] = "115"; CoordonneBuses[7] = "120"; CoordonneBuses[8] = "130"; CoordonneBuses[9] = "140"; CoordonneBuses[10] = "185"; CoordonneBuses[11] = "235"; CoordonneBuses[12] = "1002"; CoordonneBuses[13] = "1003"; CoordonneBuses[14] = "1004"; CoordonneBuses[15] = "1005"; CoordonneBuses[16] = "1006"; CoordonneBuses[17] = "1159"; CoordonneBuses[18] = "1647"; CoordonneBuses[19] = "5700"; CoordonneBuses[20] = "1403"; CoordonneBuses[21] = "5490"; CoordonneBuses[22] = "1001"; CoordonneBuses[23] = "4498"; CoordonneBuses[24] = "5150"; CoordonneBuses[25] = "240S"; CoordonneBuses[26] = "5739"; CoordonneBuses[27] = "1497"; CoordonneBuses[28] = "2013"; CoordonneBuses[29] = "111"; CoordonneBuses[30] = "112"; CoordonneBuses[31] = "113"; CoordonneBuses[32] = "161"; int[] T = new int[33]; ICollection <TextBox> TextBoxs = new List <TextBox>(); TextBoxs = AddLAbel(this); int w = 0; for (int j = 33; j > 0; j--) { T[w] = DernierEtatB[w] + Convert.ToInt32(TextBoxs.ElementAt(j - 1).Text); w++; } TotaleBusesDansUF = IGPDAO.ListerTotaleBuseAccueil(); TotaleBusesInLocale = IGPDAO.ListerTotaleBusesUsine(); int[] TotaleBusesDansUF1 = new int[33]; int[] TotaleBusesInLocale1 = new int[33]; int[] BusesDisponible = new int[33]; var k = 0; foreach (var item in TotaleBusesDansUF) { TotaleBusesDansUF1[k] = item.Quantite; k++; } k = 0; foreach (var item in TotaleBusesInLocale) { TotaleBusesInLocale1[k] = item.Quantite; k++; } for (int u = 0; u < 33; u++) { BusesDisponible[u] = TotaleBusesInLocale1[u] - TotaleBusesDansUF1[u]; } int tmp = 0; for (int m = 32; m >= 0; m--) { if (Convert.ToInt32(TextBoxs.ElementAt(m).Text) > BusesDisponible[tmp]) { MessageBox.Show(" stock insuffisant du Buses " + CoordonneBuses[tmp] + " vous avez besoin de " + (Convert.ToInt32(TextBoxs.ElementAt(m).Text) - BusesDisponible[tmp])); } tmp++; } ////////////////2eme test //////////// for (int j = 0; j < 6; j++) { if (T[j] > ConfigB[j]) { MessageBox.Show("Vous avez depassé la configuration maximale " + CoordonneBuses[j] + " de " + (T[j] - ConfigB[j])); } } Etat e1 = new Etat(); e1.UF = UF_Combo_Box.Text.ToString(); e1.Technicien = (Technicien)Personne; e1.NumEquipe = Convert.ToInt32(equipe); ICollection <Buse> Buses = new List <Buse>(); for (int j = 0; j < 33; j++) { Buses.Add(new Buse { Quantite = T[j] }); } ////////////////////Date////////////////////////// IGestionEtat IGE = new GestionEtat(); string D = DateTime.Text; int i1 = D.IndexOf(" "); var jour = D.Substring(0, i1); var mot1 = D.Substring(i1 + 1); int i2 = mot1.IndexOf(" "); var jour_nbr = mot1.Substring(0, i2); var mot2 = mot1.Substring(i2 + 1); int i3 = mot2.IndexOf(" "); var mois = mot2.Substring(0, i3); var mois_nbr = IGE.GetDate(mois); var anne = mot2.Substring(i3 + 1); var date = jour_nbr + "-" + mois_nbr + "-" + anne; e1.DateCS = date; ///////////////////////////////////// e1.Buses = Buses; this.etat = e1; this.verou = false; //;/////////////////////// Foued : est se que je fais une separation entre l'ajout d'etat d'un changement de serie de feeeder et de buses wala lé ? //// } }
private void button3_Click(object sender, EventArgs e) { if (this.verou1) { MessageBox.Show("Vous devez appuiyer sur le boutton calcul d'abord"); } else { IGestionEtatDAO IGEDAO = new GestionEtatDAO(); IGestionConfigurationDAO IGCDAO = new GestionConfigurationDAO(); IGestionProduitDAO IGPDAO = new GestionProduitDAO(); ICollection <Feeder> TotaleFeederDansUF = new List <Feeder>(); ICollection <Feeder> TotaleFeederInLocale = new List <Feeder>(); ICollection <Feeder> FeedersConfig = new List <Feeder>(); Etat etat = IGEDAO.RechercherDernierEtat(UF_Combo_Box.Text, "f"); FeedersConfig = IGCDAO.ConfigFeeder(UF_Combo_Box.Text); int[] ConfigF = new int[6]; string[] ConfigFeederID = new string[6]; int[] DernierEtatF = new int[6]; int i = 0; foreach (var item in FeedersConfig) { ConfigF[i] = item.Quantite; ConfigFeederID[i] = item.Coordonnee; i++; } i = 0; foreach (var item in etat.Feeders) { DernierEtatF[i] = item.Quantite; i++; } string [] Coordonnefeeder = new string [6]; Coordonnefeeder[0] = "F2X8"; Coordonnefeeder[1] = "F12X16"; Coordonnefeeder[2] = "F24X32"; Coordonnefeeder[3] = "F44X56"; Coordonnefeeder[4] = "F72"; Coordonnefeeder[5] = "F88"; int[] T = new int[6]; T[0] = DernierEtatF[0] + Convert.ToInt32(textBox1.Text); T[1] = DernierEtatF[1] + Convert.ToInt32(textBox2.Text); T[2] = DernierEtatF[2] + Convert.ToInt32(textBox3.Text); T[3] = DernierEtatF[3] + Convert.ToInt32(textBox4.Text); T[4] = DernierEtatF[4] + Convert.ToInt32(textBox5.Text); T[5] = DernierEtatF[5] + Convert.ToInt32(textBox6.Text); TotaleFeederDansUF = IGPDAO.ListerTotaleFeederAccueil(); TotaleFeederInLocale = IGPDAO.ListerTotaleFeederUsine(); int[] TotaleFeederDansUF1 = new int[6]; int[] TotaleFeederInLocale1 = new int[6]; int[] FeederDisponible = new int[6]; var k = 0; foreach (var item in TotaleFeederDansUF) { TotaleFeederDansUF1[k] = item.Quantite; k++; } k = 0; foreach (var item in TotaleFeederInLocale) { TotaleFeederInLocale1[k] = item.Quantite; k++; } for (int w = 0; w < 6; w++) { FeederDisponible[w] = TotaleFeederInLocale1[w] - TotaleFeederDansUF1[w]; } if (Convert.ToInt32(textBox1.Text) > FeederDisponible[0]) { MessageBox.Show(" stock insuffisant du feeder " + Coordonnefeeder[0] + " vous avez besoin de " + (Convert.ToInt32(textBox1.Text) - FeederDisponible[0])); } if (Convert.ToInt32(textBox2.Text) > FeederDisponible[1]) { MessageBox.Show(" stock insuffisant du feeder " + Coordonnefeeder[1] + " vous avez besoin de " + (Convert.ToInt32(textBox2.Text) - FeederDisponible[1])); } if (Convert.ToInt32(textBox3.Text) > FeederDisponible[2]) { MessageBox.Show(" stock insuffisant du feeder " + Coordonnefeeder[2] + " vous avez besoin de " + (Convert.ToInt32(textBox2.Text) - FeederDisponible[2])); } if (Convert.ToInt32(textBox4.Text) > FeederDisponible[3]) { MessageBox.Show(" stock insuffisant du feeder " + Coordonnefeeder[3] + " vous avez besoin de " + (Convert.ToInt32(textBox3.Text) - FeederDisponible[3])); } if (Convert.ToInt32(textBox5.Text) > FeederDisponible[4]) { MessageBox.Show(" stock insuffisant du feeder " + Coordonnefeeder[4] + "vous avez besoin de " + (Convert.ToInt32(textBox4.Text) - FeederDisponible[4])); } if (Convert.ToInt32(textBox6.Text) > FeederDisponible[5]) { MessageBox.Show(" stock insuffisant du feeder " + Coordonnefeeder[5] + " vous avez besoin de " + (Convert.ToInt32(textBox5.Text) - FeederDisponible[5])); } /////////////////////2eme test //////////////// for (int j = 0; j < 6; j++) { if (T[j] > ConfigF[j]) { MessageBox.Show("Vous avez depassé la configuration maximale " + Coordonnefeeder[j] + " de " + (T[j] - ConfigF[j])); } } Etat e1 = new Etat(); { e1.UF = UF_Combo_Box.Text.ToString(); e1.Technicien = (Technicien)personne; e1.NumEquipe = Convert.ToInt32(equipe); /* int[] T3 = new int[6]; * T3[0] = Convert.ToInt32(textBox1.Text); * T3[1] = Convert.ToInt32(textBox2.Text); * T3[2] = Convert.ToInt32(textBox3.Text); * T3[3] = Convert.ToInt32(textBox4.Text); * T3[4] = Convert.ToInt32(textBox5.Text); * T3[5] =Convert.ToInt32(textBox6.Text); */ ICollection <Feeder> Feeders = new List <Feeder>(); for (int j = 0; j < 6; j++) { Feeders.Add(new Feeder { Quantite = T[j] }); } ////////////////////Date////////////////////////// IGestionEtat IGE = new GestionEtat(); string D = DateTime.Text; int i1 = D.IndexOf(" "); var jour = D.Substring(0, i1); var mot1 = D.Substring(i1 + 1); int i2 = mot1.IndexOf(" "); var jour_nbr = mot1.Substring(0, i2); var mot2 = mot1.Substring(i2 + 1); int i3 = mot2.IndexOf(" "); var mois = mot2.Substring(0, i3); var mois_nbr = IGE.GetDate(mois); var anne = mot2.Substring(i3 + 1); var date = jour_nbr + "-" + mois_nbr + "-" + anne; e1.DateCS = date; ///////////////////////////////////// e1.Feeders = Feeders; this.etat = e1; this.verou = false; // IGEDAO.AjouterEtat(e1); } } }