//Método Ajax
 public ActionResult Division(string num1, string num2)
 {
     try
     {
         float n1 = float.Parse(num1);
         float n2 = float.Parse(num2);
         ViewBag.Resultado = client.Division(n1, n2);
         return(View("_parcialresultado"));
     }
     catch (FaultException <ExcepcionPersonalizada> ex)
     {
         String msn = "ERROR: " + ex.Detail.DetailError + " Código:" + ex.Detail.InternalCodeError + "" + ex.Detail;
         ViewBag.Resultado = msn;
         ViewBag.Error     = true;
         return(View("_parcialresultado"));
     }
 }
示例#2
0
        private void button3_Click(object sender, EventArgs e)
        {
            //capturamos los numeros de las cajas
            string text1 = textBox1.Text;
            string text2 = textBox2.Text;

            if (text1 == "" || text2 == "")
            {
                MessageBox.Show("Error: Debe introducir un número en ambos campos");
            }
            else
            {
                try
                {
                    float n1 = float.Parse(text1);
                    float n2 = float.Parse(text2);
                    client.Division(n1, n2);
                }
                catch (FaultException <ServiceCalculadora.ExcepcionPersonalizada> ex)
                {
                    MessageBox.Show(ex.Detail.DetailError + "-" + ex.Detail.InternalCodeError + " de " + ex.Detail);
                }
            }
        }