protected void Guardar() { try { CrmCatSolucion soluciones = new CrmCatSolucion(); soluciones.Area = !string.IsNullOrEmpty(ddlAreas.SelectedValue) ? Convert.ToInt32(ddlAreas.SelectedValue) : 0; soluciones.Descripcion = txtPosicion.Text; //Request.Form["txtPosicion"].ToString();//txtPosicion.Text; soluciones.Porcentaje = txtPotencial.Value.Value; // == null) ? Convert.ToDouble(txtPotencial.Value.Value) : 0; if (soluciones.Area == 0) { Alerta("Seleccione una área valida"); return; } if (string.IsNullOrEmpty(soluciones.Descripcion)) { Alerta("Ingrese una descripción de la solución"); return; } if (soluciones.Porcentaje == 0) { Alerta("Ingrese un valor de porcentaje"); return; } soluciones.Id = Convert.ToInt32(MaximoId()); int valido = 0; CN_CrmCatSoluciones cls = new CN_CrmCatSoluciones(); Sesion session2 = new Sesion(); session2 = (Sesion)Session["Sesion" + Session.SessionID]; if (HF_Modificar.Value == "") { if (!_PermisoGuardar) { Alerta("No tiene permisos para grabar"); return; } cls.InsertCatSolucion(session2, soluciones, ref valido); } else { if (!_PermisoModificar) { Alerta("No tiene permisos para modificar"); return; } soluciones.Clave = Convert.ToInt32(HF_Modificar.Value); cls.ModificarSolucion(soluciones, session.Emp_Cnx, session.Id_Emp, ref valido); } if (valido == 1) { FinGuardar(); //Alerta("Registro agregado satisfactoriamente"); } else { Alerta("Ocurrio un error al intentar guardar"); } rgAreas.Rebind(); txtPosicion.Focus(); } catch (Exception ex) { throw ex; } }