示例#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_Perfil obj = new WSGestion.MOD_Perfil();

                    obj.PER_nombre = txt_nombre.Value;
                    obj.PER_id_perfil = 0;

                    wsgest.CRE_Perfil(obj);
                    Response.Redirect("frm_Grid_Perfil.aspx");
                }

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

                    obj.PER_nombre = txt_nombre.Value;
                    obj.PER_id_perfil = Convert.ToInt32(txt_codigo.Value.ToString());

                    wsgest.UPD_Perfil(obj);
                    Response.Redirect("frm_Grid_Perfil.aspx");
                }
            }

            catch (Exception exc)
            {
                Alert_Mensaje.Attributes["class"] = "alert alert-danger";
                mensaje_alerta = exc.ToString();
                titulo_mensaje_alerta = "Error: ";
                Alert_Mensaje.Visible = true;
            }
        }
示例#2
0
        private void Carga_Editar()
        {
            try
            {
                WSGestion.WSGestion wsgest = new WSGestion.WSGestion();
                wsgest.Url = ConfigurationManager.AppSettings.Get("dirWs");
                WSGestion.MOD_Perfil obj = new WSGestion.MOD_Perfil();
                obj = wsgest.SEL_GRID_BY_ID_Perfil(codigo_seleccionado);
                txt_nombre.Value = obj.PER_nombre;
                txt_codigo.Value = obj.PER_id_perfil.ToString();

            }
            catch (Exception exc)
            {
                WSGestion.WSGestion wsgest = new WSGestion.WSGestion();
                wsgest.Url = ConfigurationManager.AppSettings.Get("dirWs");
                Session[wsgest.Get_usu_id_session(Session.SessionID.ToString())+"Codigo_Select"] = "0";
                Alert_Mensaje.Attributes["class"] = "alert alert-danger";
                mensaje_alerta = exc.ToString();
                titulo_mensaje_alerta = "Error: ";
                Alert_Mensaje.Visible = true;
            }
        }