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
|
protected void BTN_envoiecalib_Click(object sender, EventArgs e)
{
GC.Formok(valeurs); //Vérifie si les Champs sont bien remplis, sinon met en surbrillance les champs oubliés
bool formok;
formok = GC.Formok(valeurs); //return True si les Champs sont bien remplis
if (formok)
{
bool BoolHN = true;
float V1 = Convert.ToSingle(TXTB_Val_indiq.Text.Replace('.', ','));
float V2 = Convert.ToSingle(TXTB_Val_mes.Text.Replace('.', ','));
float V3 = Convert.ToSingle(LBL_Tol_Min.Text); //Valeur de la tolerance
if (LBL_Unit_Max.Text == "%") //ceci inclus LBL_Unit_Mini aussi || Effectue un calcul par rapport au %
{
float result = ((V1 - V2) / ((V1 + V2) / 2) * 100);
if (Math.Abs(result) <= V3)
{
BoolHN = false;
}
}
else //Effectue un calcul par rapport à une tolérance d'un entier
{
float result = V1 - V2;
if (Math.Abs(result) <= V3)
{
BoolHN = false;
}
}
if (BoolHN) //Si les valeurs submit sont Hors normes.
{
ClientScript.RegisterStartupScript(typeof(Page), "exampleScript", "if(confirm('Confirmez vous que la valeur à envoyer est belle et bien Hors Normes ?'))", true);
}
}
} |
Partager