protected void btnregistrar_Click(object sender, EventArgs e)
        {
            try
            {
                //string Nombre;
                //string Direccion;
                //int Telefono;

                //Nombre = tbnombre.Text;
                //Direccion = tbdireccion.Text;
                //Telefono = Convert.ToInt16(tbtelefono.Text);

                TheGym k = new TheGym
                {
                    NombreSucursal      = tbnombre.Text,
                    CalleSucursal       = tbcalle.Text,
                    BarrioSucursal      = tbbarrio.Text,
                    NumeroSucursal      = tbnumerocasa.Text,
                    FKLocalidadSucursal = ddllocalidad.SelectedValue,
                    TelefonoSucursal    = Convert.ToInt64(tbtelefono.Text)
                };

                k.AddNewSucursal();

                ddllocalidad.ClearSelection();
                tbcalle.Text      = string.Empty;
                tbbarrio.Text     = string.Empty;
                tbnumerocasa.Text = string.Empty;
                tbnombre.Text     = string.Empty;
                tbtelefono.Text   = string.Empty;
                lblerror.Text     = "Sucursal registrada con exito!.";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "$('#modal-default').modal('show');", true);
            }
            catch (Exception ex)
            {
                lblerror.Text = ex.Message.ToString();
            }
        }
Example #2
0
        protected void btnregistrar_Click(object sender, EventArgs e)
        {
            //string Nombre;
            //string Direccion;
            //int Telefono;

            //Nombre = tbnombre.Text;
            //Direccion = tbdireccion.Text;
            //Telefono = Convert.ToInt16(tbtelefono.Text);

            TheGym k = new TheGym
            {
                NombreSucursal    = tbnombre.Text,
                DireccionSucursal = tbdireccion.Text,
                TelefonoSucursal  = Convert.ToInt64(tbtelefono.Text)
            };

            k.AddNewSucursal();


            tbnombre.Text    = string.Empty;
            tbdireccion.Text = string.Empty;
            tbtelefono.Text  = string.Empty;
        }