Пример #1
0
        protected void lbtnGrabarDireccionesEstados_Click(object sender, EventArgs e)
        {
            try
            {
                foreach (GridViewRow item in grvDirecciones.Rows)
                {
                    Label _lblIdDireccion = (Label)grvDirecciones.Rows[item.RowIndex].FindControl("lblIdDireccion");
                    RadioButtonList _rbtnEstado = (RadioButtonList)grvDirecciones.Rows[item.RowIndex].FindControl("rbtnEstado");
                    string idDireccion = _lblIdDireccion.Text;
                    string idEstado = _rbtnEstado.SelectedValue;

                    UbicDireccion dir = new UbicDireccion();
                    dir.IdDireccion = Convert.ToInt32(idDireccion);
                    dir.IdEstadoUbic = Convert.ToInt32(idEstado);

                    dal.setUpDireccion(dir);
                }
                verUltimoDireccion();
            }
            catch (Exception ex)
            {
                divAlerta.Visible = true;
                lblInfo.Text = ex.Message;
            }
        }
Пример #2
0
        protected void btnGrabarDireccion_Click(object sender, EventArgs e)
        {
            try
            {
                UbicDireccion dir = new UbicDireccion();
                dir.Calle = txtCalle.Text;
                dir.Comuna = ddlComunaDireccion.SelectedItem.ToString();
                dir.Rut = lblRutDeudor.Text;
                dir.IdProveedorUbic = Convert.ToInt32(ddlOrigen.SelectedValue);
                dir.Numero = txtNumero.Text.Trim();
                dir.Resto = txtResto.Text.Trim();
                dir.IdUsuarioIngreso = Convert.ToInt32(Session["variableIdUsuario"]);
                dir.CargoContacto = txtCargoContactoDireccion.Text;
                dir.NombreContacto = txtNomContactoDireccion.Text;

                string existe = dal.setInUbicDireccion(dir);
                if (existe == "1")
                {
                    divAlerta.Visible = true;
                    lblInfo.Text = "La dirección ingresado ya existe en la BD";
                    return;
                }
                
                verUltimoDireccion();
            }
            catch (Exception ex)
            {
                divAlerta.Visible = true;
                lblInfo.Text = ex.Message;
            }
        }