Пример #1
0
        protected void btnguardanuevo_Click(object sender, EventArgs e)
        {
            String bd = Session["BD"].ToString();

            string[] palabras = SelectTipopersona.Value.Split('/');
            string   id       = palabras[0];

            try
            {
                var valida = sb.Ccrearpersona(txtcc.Value, txtname1.Value.ToUpper(), txtname2.Value.ToUpper(), txtapellido1.Value.ToUpper(), txtapellido2.Value.ToUpper(),
                                              txttel.Value, txtdir.Value.ToUpper(), Select.Value, id, Session["USUARIO"].ToString(), bd);
                if (valida.Rows.Count > 0)
                {
                    btncancelanuevo.Visible = false;

                    btnguardanuevo.Visible = false;
                    txtcc.Value            = "";
                    txtname1.Value         = "";
                    txtname2.Value         = "";
                    txtapellido1.Value     = "";
                    txtapellido2.Value     = "";
                    txtdir.Value           = "";
                    txttel.Value           = "";
                    Select.Value           = "";


                    string script = @"<script type='text/javascript'>
                            alert('Registro Guardado exitosamente');
                            
                        </script>";

                    ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, false);
                    bloqueaitems();
                }
                else
                {
                    txtname1.Value = "Error al Guardar";
                }
            }
            catch (Exception ex)
            {
                notificacion.Visible = true;
                alertant.InnerText   = ex.Message;
            }
        }