1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
| public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void tbxVMS_TextChanged(object sender, EventArgs e)
{
if ((tbxVMS.Text.Length != 0) && (tbxVMG.Text.Length != 0) && (tbxVSS.Text.Length != 0) && (tbxVSG.Text.Length != 0) && (tbxNPS.Text.Length != 0) && (tbxNPG.Text.Length != 0) && (tbxSmin.Text.Length != 0))
{
OK.Enabled = true;
}
else
{
OK.Enabled = false;
}
}
private void tbxVMG_TextChanged(object sender, EventArgs e)
{
if ((tbxVMS.Text.Length != 0) && (tbxVMG.Text.Length != 0) && (tbxVSS.Text.Length != 0) && (tbxVSG.Text.Length != 0) && (tbxNPS.Text.Length != 0) && (tbxNPG.Text.Length != 0) && (tbxSmin.Text.Length != 0))
{
OK.Enabled = true;
}
else
{
OK.Enabled = false;
}
}
private void tbxVSS_TextChanged(object sender, EventArgs e)
{
if ((tbxVMS.Text.Length != 0) && (tbxVMG.Text.Length != 0) && (tbxVSS.Text.Length != 0) && (tbxVSG.Text.Length != 0) && (tbxNPS.Text.Length != 0) && (tbxNPG.Text.Length != 0) && (tbxSmin.Text.Length != 0))
{
OK.Enabled = true;
}
else
{
OK.Enabled = false;
}
}
private void tbxVSG_TextChanged(object sender, EventArgs e)
{
if ((tbxVMS.Text.Length != 0) && (tbxVMG.Text.Length != 0) && (tbxVSS.Text.Length != 0) && (tbxVSG.Text.Length != 0) && (tbxNPS.Text.Length != 0) && (tbxNPG.Text.Length != 0) && (tbxSmin.Text.Length != 0))
{
OK.Enabled = true;
}
else
{
OK.Enabled = false;
}
}
private void tbxNPS_TextChanged(object sender, EventArgs e)
{
if ((tbxVMS.Text.Length != 0) && (tbxVMG.Text.Length != 0) && (tbxVSS.Text.Length != 0) && (tbxVSG.Text.Length != 0) && (tbxNPS.Text.Length != 0) && (tbxNPG.Text.Length != 0) && (tbxSmin.Text.Length != 0))
{
OK.Enabled = true;
}
else
{
OK.Enabled = false;
}
}
private void tbxNPG_TextChanged(object sender, EventArgs e)
{
if ((tbxVMS.Text.Length != 0) && (tbxVMG.Text.Length != 0) && (tbxVSS.Text.Length != 0) && (tbxVSG.Text.Length != 0) && (tbxNPS.Text.Length != 0) && (tbxNPG.Text.Length != 0) && (tbxSmin.Text.Length != 0))
{
OK.Enabled = true;
}
else
{
OK.Enabled = false;
}
}
private void tbxSmin_TextChanged(object sender, EventArgs e)
{
if ((tbxVMS.Text.Length != 0) && (tbxVMG.Text.Length != 0) && (tbxVSS.Text.Length != 0) && (tbxVSG.Text.Length != 0) && (tbxNPS.Text.Length != 0) && (tbxNPG.Text.Length != 0) && (tbxSmin.Text.Length != 0))
{
OK.Enabled = true;
}
else
{
OK.Enabled = false;
}
}
private void OK_Click(object sender, EventArgs e)
{
// Déclaration des variables principales //
float VMS, VMG, VSS, VSG;
int Smin, NPG, NPS;
// Conversion des caratères en nombre //
VMS = float.Parse (tbxVMS.Text);
VSS = float.Parse (tbxVSS.Text);
NPS = int.Parse (tbxNPS.Text);
VMG = float.Parse (tbxVMG.Text);
VSG = float.Parse (tbxVSG.Text);
NPG = int.Parse (tbxNPG.Text);
Smin = int.Parse (tbxSmin.Text);
// Calcul des sommes //
float VM = VMS + VMG;
float VS = VSS + VSG;
int NP = NPS + NPG;
// Calcul des Indices de Volumes //
float IC = 1 / Smin;
float IVS = VMS /(30 * VSS);
float IVG = VMG /(30 * VSG);
// Solutions Volumes //
float VSSnew = (VSS * IVS) / IC;
float VSGnew = (VSG * IVG) / IC;
if (IVS>IC)
{
label9.Text = "Le volume de stockage optimal de Super est : " + VSSnew.ToString ();
}
else
{
label9.Text = "Le volume actuel de Super est acceptable. Vous pouvez l'augmenter mais pas le diminuer si vous le voulez.";
}
if (IVG > IC)
{
label18.Text = "Le volume de stockage optimal de Super est : " + VSGnew.ToString ();
}
else
{
label18.Text = "Le volume actuel de Super est acceptable. Vous pouvez l'augmenter mais pas le diminuer si vous le voulez.";
}
}
} |
Partager