コード例 #1
0
        protected void btn_guardar_ServerClick(object sender, EventArgs e)
        {
            try
            {
                if (FormAccion == "Agregar")
                {
                    WSGestion.WSGestion wsgest = new WSGestion.WSGestion();
                    wsgest.Url = ConfigurationManager.AppSettings.Get("dirWs");
                    WSGestion.MOD_Estado obj = new WSGestion.MOD_Estado();

                    obj.EST_estado = txt_nombre.Value;
                    obj.EST_id_centro_atencion = Convert.ToInt32( txt_cea_codigo.Value);
                    obj.EST_id_estado = 0;

                    wsgest.CRE_Estado(obj);
                    Response.Redirect("frm_Grid_Estado.aspx");
                }

                if (FormAccion == "Editar")
                {
                    WSGestion.WSGestion wsgest = new WSGestion.WSGestion();
                    wsgest.Url = ConfigurationManager.AppSettings.Get("dirWs");
                    WSGestion.MOD_Estado obj = new WSGestion.MOD_Estado();

                    obj.EST_estado = txt_nombre.Value;
                    obj.EST_id_estado = Convert.ToInt32(txt_codigo.Value.ToString());

                    wsgest.UPD_Estado(obj);
                    Response.Redirect("frm_Grid_Estado.aspx");
                }
            }

            catch (Exception exc)
            {
                Alert_Mensaje.Attributes["class"] = "alert alert-danger";
                mensaje_alerta = exc.ToString();
                titulo_mensaje_alerta = "Error: ";
                Alert_Mensaje.Visible = true;
            }
        }