private void Frm_UpdateTipoCambio_Load(object sender, EventArgs e) { DataTable DTVALOR = new DataTable(); DTVALOR = NFunciones.TABLADATOS("SELECT VALOR FROM P_PARAMETROS where IDVARIABLE='001'"); try { txt_tipocambio.Text = DTVALOR.Rows[0]["VALOR"].ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message); } ListarPresupuestos(); if (chk_presupuesto.Checked) { cbo_presupuesto.Enabled = true; } else { cbo_presupuesto.Enabled = false; } if (chk_TC.Checked) { txt_tipocambio.ReadOnly = false; } else { txt_tipocambio.ReadOnly = true; } }
private void monoFlat_Button1_Click(object sender, EventArgs e) { //removeCombinedFlags(cbo_select_fundo.Properties); valores = ""; for (int i = 0; i < cbo_select_fundo.Properties.Items.Count; i++) { if (cbo_select_fundo.Properties.Items[i].CheckState == CheckState.Checked) { valores = valores + cbo_select_fundo.Properties.Items[i].Value.ToString() + "."; } } valores = valores.TrimEnd('.'); //MessageBox.Show(valores); idpresupuesto = Convert.ToString(cbo_presu.EditValue); idmoneda = Convert.ToString(cbo_mon.EditValue); idcultivo = Convert.ToString(cbo_cult.EditValue); dtresultado = NFunciones.TABLADATOS(" EXEC SP_REPORTE_PYG'" + idpresupuesto + "','" + idmoneda + "','" + valores + "','" + idcultivo + "'"); pvt_datos2.DataSource = dtresultado; }
private void edit_mostrarDatos_lote() { try { string errores = ""; string rpta = ""; ConsultaSql = ConsultaSql + " EXEC MONEDAEQUIVALENTE '" + idpresupuesto + "'"; ConsultaSql = ConsultaSql + " EXEC ACTUALIZA_MONEDA_PRTLOTE '" + idpresupuesto + "'"; rpta = NFunciones.ExecuteSQL(ConsultaSql); if (!rpta.Equals("Ok")) { errores = "Se produjo un error consulte con soporte"; Console.Write(errores); } ConsultaSql = ""; tbgeneral = NFunciones.TABLADATOS("EXEC sp_FiltroPresupuesto_Lote '" + idpresupuesto + "','" + Convert.ToString(cbo_cultivo.EditValue).Trim() + "','" + Convert.ToString(cbo_variedad.EditValue).Trim() + "','" + Convert.ToString(cbo_estructura.EditValue).Trim() + "','" + Convert.ToString(cbo_item.EditValue).Trim() + "','" + Convert.ToString(cbo_fundo.EditValue).Trim() + "','" + Convert.ToString(cbo_actisub.EditValue).Trim() + "','" + Convert.ToString(cbo_labor.EditValue).Trim() + "','" + Convert.ToString(cbo_moneda.EditValue).Trim() + "','" + Convert.ToString(cbo_lote.EditValue).Trim() + "'"); modo = "S"; } catch (Exception ex) { MensajeError("Ocurrio un error, Consulte con Soporte" + "\n" + ex.Message); modo = "S"; } }
private void btn_guardar_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { string rpta = ""; if (this.txt_codigo.Text == string.Empty) { MensajeError("Falta Ingresar Codigo"); return; } if (this.txt_descripcion.Text == string.Empty) { MensajeError("Falta Ingresar Nombre de Responsable"); return; } string codigo; DataTable dtid = new DataTable(); if (this.IsNuevo) { dtid = NFunciones.TABLADATOS("EXEC SP_IDRESPONSABLE''"); codigo = dtid.Rows[0]["ID"].ToString(); txt_codigo.Text = codigo; rpta = NFunciones.ExecuteSQL("INSERT INTO P_RESPONSABLES(IdResponsable,Nombre,ESTADO) values('" + codigo + "','" + txt_descripcion.Text + "','AC')"); } else { rpta = NFunciones.ExecuteSQL("UPDATE P_RESPONSABLES set NOMBRE='" + txt_descripcion.Text + "' WHERE IDRESPONSABLE='" + txt_codigo.Text + "'"); } if (rpta.Equals("Ok")) { if (this.IsNuevo) { this.MensajeOk("Se Inserto los Datos Correctamente"); } else { this.MensajeOk("Se Actualizo los Datos Correctamente"); } } else { this.MensajeError(rpta); } this.IsNuevo = false; this.IsEditar = false; this.Botones(); this.HabilitarTexbox(false); this.LlenarGrilla(); } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
private void Listarmoneda() { Invoke((Action) delegate { cbo_moneda.Properties.DataSource = NFunciones.TABLADATOS("SELECT IDMONEDA,RTRIM(LTRIM(NOMBRE_CORTO))+ '- '+DESCRIPCION MONEDA FROM P_MONEDAS ORDER BY IDMONEDA ASC"); cbo_moneda.Properties.ValueMember = "IDMONEDA"; cbo_moneda.Properties.DisplayMember = "MONEDA"; }); }
private void btn_guardar_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (txt_codigo.Text.Equals("")) { MessageBox.Show("Debe Ingresar Codigo !"); return; } if (txt_descripcion.Text.Equals("")) { MessageBox.Show("Debe Ingresar Descripcion !"); return; } //if (txt_valor.Text.Equals("")) //{ // MessageBox.Show("Debe Ingresar Valor !"); // return; //} //if (txt_sp.Text.Equals("")) //{ // MessageBox.Show("Debe Ingresar SP Asignado !"); // return; //} if (_modo.Equals("N")) { DataTable tb_table = new DataTable(); tb_table = NFunciones.TABLADATOS("SELECT * FROM P_PARAMETROS WHERE IDVARIABLE='" + txt_codigo.Text + "'"); if (tb_table.Rows.Count > 0) { MessageBox.Show("Ya existe el codigo ingresado debe colocar uno que nuevo !"); return; } string rpta = NFunciones.ExecuteSQL("INSERT INTO P_PARAMETROS (IDEMPRESA,IDVARIABLE,DESCRIPCION,VALOR,SP_ASIGNADO)VALUES('001','" + txt_codigo.Text + "','" + txt_descripcion.Text + "','" + txt_valor.Text + "','" + txt_sp.Text + "')"); if (rpta.Equals("Ok")) { LlegarGrilla(); botones(true); activartxt(false); MessageBox.Show("Guardado Correctamente"); } } if (_modo.Equals("E")) { string rpta = NFunciones.ExecuteSQL("UPDATE P_PARAMETROS SET DESCRIPCION='" + txt_descripcion.Text + "',VALOR='" + txt_valor.Text + "', SP_ASIGNADO='" + txt_sp.Text + "' WHERE IDVARIABLE='" + txt_codigo.Text + "'"); if (rpta.Equals("Ok")) { LlegarGrilla(); botones(true); activartxt(false); MessageBox.Show("Actualizado Correctamente"); } } _modo = ""; }
void procesar() { DataTable _dtresultado; _dtresultado = NFunciones.TABLADATOS("EXEC SP_PROCESAR_PXQ '" + _idpresupuesto + "'"); string rpta = NFunciones.ExecuteSQL("EXEC SP_CALCULAR_PYG'" + _idpresupuesto + "'"); estado = "S"; }
private void ProcesarConsultar() { string rpta = NFunciones.ExecuteSQL("EXEC SP_CALCULAR_PYG_DOL'" + idpresupuesto + "','" + idmoneda + "'"); dtresultado = NFunciones.TABLADATOS(" EXEC SP_REPORTE_PYG'" + idpresupuesto + "','" + idmoneda + "','" + idfundo + "','" + idcultivo + "'"); mostrar = "S"; }
private void ListarCultivo() { cbo_cult.Properties.DataSource = NFunciones.TABLADATOS("SELECT IDCULTIVO ID,RTRIM(LTRIM(DESCRIPCION)) DESCRIPCION FROM P_CULTIVOS ORDER BY IDCULTIVO ASC"); cbo_cult.Properties.ValueMember = "ID"; cbo_cult.Properties.DisplayMember = "DESCRIPCION"; cbo_select_cult.Properties.DataSource = NFunciones.TABLADATOS("SELECT IDCULTIVO ID,RTRIM(LTRIM(DESCRIPCION)) DESCRIPCION FROM P_CULTIVOS ORDER BY IDCULTIVO ASC"); cbo_select_cult.Properties.ValueMember = "ID"; cbo_select_cult.Properties.DisplayMember = "DESCRIPCION"; }
private void ListarFundo() { cbo_fun.Properties.DataSource = NFunciones.TABLADATOS("SELECT IDFUNDO ID ,RTRIM(LTRIM(DESCRIPCION)) DESCRIPCION FROM P_FUNDO ORDER BY IDFUNDO ASC "); cbo_fun.Properties.ValueMember = "ID"; cbo_fun.Properties.DisplayMember = "DESCRIPCION"; cbo_select_fundo.Properties.DataSource = NFunciones.TABLADATOS("SELECT IDFUNDO ID ,RTRIM(LTRIM(DESCRIPCION)) DESCRIPCION FROM P_FUNDO ORDER BY IDFUNDO ASC "); cbo_select_fundo.Properties.ValueMember = "ID"; cbo_select_fundo.Properties.DisplayMember = "DESCRIPCION"; }
void cargarpresupuesto() { cbo_presupuesto.Properties.DataSource = NFunciones.TABLADATOS("SELECT IDPRESUPUESTO ID,DESCRIPCION PRESUPUESTO FROM P_PRESUPUESTO ORDER BY IDPRESUPUESTO ASC"); cbo_presupuesto.Properties.ValueMember = "ID"; cbo_presupuesto.Properties.DisplayMember = "PRESUPUESTO"; cbo_presupuesto_gf.Properties.DataSource = NFunciones.TABLADATOS("SELECT IDPRESUPUESTO ID,DESCRIPCION PRESUPUESTO FROM P_PRESUPUESTO ORDER BY IDPRESUPUESTO ASC"); cbo_presupuesto_gf.Properties.ValueMember = "ID"; cbo_presupuesto_gf.Properties.DisplayMember = "PRESUPUESTO"; }
void data() { if (tipo.Equals("V")) { tbresult = NFunciones.TABLADATOS("SELECT * FROM P_DPRESUPUESTO_RG WHERE IDPRESUPUESTO='" + idpresupuesto + "'"); } if (tipo.Equals("L")) { tbresult = NFunciones.TABLADATOS("SELECT * FROM P_DPRESUPUESTO_LOTE WHERE IDPRESUPUESTO='" + idpresupuesto + "'"); } dtg_datos.DataSource = tbresult; }
public static string AutorizarIngreso(string usuario, string password) { string autorizarIngresoReturn = string.Empty; DataTable TB_USER = NFunciones.TABLADATOS("select * from tb_usuario where usuario='" + usuario + "' and clave='" + password + "'"); if (TB_USER.Rows.Count == 1) { autorizarIngresoReturn = "Ok"; } return(autorizarIngresoReturn); }
private void MostrarPorFundo() { _dtresultado = NFunciones.TABLADATOS("EXEC SP_PROCESAR_PXQ_TOTALES'" + _idpresupuesto + "','" + _moneda + "'"); Invoke((Action) delegate { pvt_datos2.DataSource = _dtresultado; }); _mostrar = "S"; }
private void mostrarDatos_lote() { try { tbgeneral = NFunciones.TABLADATOS("EXEC sp_FiltroPresupuesto_Lote '" + idpresupuesto + "','" + Convert.ToString(cbo_cultivo.EditValue).Trim() + "','" + Convert.ToString(cbo_variedad.EditValue).Trim() + "','" + Convert.ToString(cbo_estructura.EditValue).Trim() + "','" + Convert.ToString(cbo_item.EditValue).Trim() + "','" + Convert.ToString(cbo_fundo.EditValue).Trim() + "','" + Convert.ToString(cbo_actisub.EditValue).Trim() + "','" + Convert.ToString(cbo_labor.EditValue).Trim() + "','" + Convert.ToString(cbo_moneda.EditValue).Trim() + "','" + Convert.ToString(cbo_lote.EditValue).Trim() + "','" + Convert.ToString(cbo_subitemcosto.EditValue).Trim() + "','" + Convert.ToString(cbo_tipocosto.EditValue).Trim() + "'"); modo = "S"; } catch (Exception ex) { MensajeError("Ocurrio un error, Consulte con Soporte" + "\n" + ex.Message); modo = "S"; } }
void CargarDatos() { if (_idmonedad.Equals("02")) { dtresultado = NFunciones.TABLADATOS("EXEC SP_MOSTRARDETALLEPXQ_DOL '" + _idpresupuestod + "','" + _iditemd + "','" + _idmonedad + "'"); _estado = "S"; } if (_idmonedad.Equals("01")) { dtresultado = NFunciones.TABLADATOS("EXEC SP_MOSTRARDETALLEPXQ_SOL '" + _idpresupuestod + "','" + _iditemd + "','" + _idmonedad + "'"); _estado = "S"; } }
void procesando() { try { tbresumen = NFunciones.TABLADATOS("EXEC SP_GENERAR_RPTXLOTE'" + Convert.ToString(cbo_presupuesto.EditValue) + "'"); PROCESADO = "S"; } catch (Exception ex) { errores = ex.Message; PROCESADO = "S"; } }
private void MostrarDatos() { //_dtresultado = NFunciones.TABLADATOS("SELECT COUNT(*)AS NREGISTROS FROM P_RPT_PXQ WHERE IDPRESUPUESTO='"+_idpresupuesto+"'"); _dtresultado = NFunciones.TABLADATOS("EXEC SP_PROCESAR_PXQ '" + _idpresupuesto + "','" + _moneda + "'"); //MessageBox.Show(Convert.ToString(cbo_moneda.EditValue)); Invoke((Action) delegate { pvt_datos2.DataSource = _dtresultado; }); _mostrar = "S"; }
private void Consultar() { DataTable tbregistros = new DataTable(); tbregistros = NFunciones.TABLADATOS("SELECT COUNT(*)NREGISTROS FROM P_RPT_PYG WHERE IDPRESUPUESTO='" + idpresupuesto + "'"); if (Convert.ToInt32(tbregistros.Rows[0]["NREGISTROS"]) == 0) { string rpta = NFunciones.ExecuteSQL("EXEC SP_CALCULAR_PYG_DOL'" + idpresupuesto + "','" + idmoneda + "'"); } dtresultado = NFunciones.TABLADATOS(" EXEC SP_REPORTE_PYG'" + idpresupuesto + "','" + idmoneda + "','" + valores + "','" + cultivos + "'"); mostrar = "S"; }
void actualizardatos() { if (TC > 0) { string rptat2 = NFunciones.ExecuteSQL("UPDATE P_PARAMETROS SET VALOR='" + Convert.ToDecimal(txt_tipocambio.Text) + "' WHERE IDVARIABLE='001' "); if (rptat2.Equals("Ok")) { toastNotificationsManager1.ShowNotification(toastNotificationsManager1.Notifications[0]); } else { toastNotificationsManager1.ShowNotification(toastNotificationsManager1.Notifications[1]); } } if (!idpresupuesto.Equals("")) { try { DataTable tbractualiza, tbractualiza1, tbractualiza2 = new DataTable(); string rpta, rpta1, rpta2; tbractualiza = NFunciones.TABLADATOS("EXEC ACTUALIZA_MONEDA_PRTLOTE'" + idpresupuesto + "'"); rpta = tbractualiza.Rows[0]["RESULTADO"].ToString(); tbractualiza1 = NFunciones.TABLADATOS("EXEC SP_PROCESAR_PXQ_DOL'" + idpresupuesto + "','02'"); tbractualiza2 = NFunciones.TABLADATOS("EXEC SP_PROCESAR_PXQ_SOL'" + idpresupuesto + "','01'"); MessageBox.Show(rpta + " " + Convert.ToString(tbractualiza1.Rows.Count) + " " + Convert.ToString(tbractualiza2.Rows.Count)); if (rpta.Equals("Ok") /*&& tbractualiza1.Rows.Count>0 && tbractualiza2.Rows.Count > 0*/) { //MessageBox.Show("Correctamente actualizado"); toastNotificationsManager1.ShowNotification(toastNotificationsManager1.Notifications[2]); } else { toastNotificationsManager1.ShowNotification(toastNotificationsManager1.Notifications[3]); } // MessageBox.Show(rpta); } catch (Exception ex) { MessageBox.Show(ex.Message); // toastNotificationsManager1.Notifications[4].Body2 = EX.Message; toastNotificationsManager1.ShowNotification(toastNotificationsManager1.Notifications[3]); } } actualizar = "S"; }
private void btn_activar_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { string estado; if (vista_registros.GetFocusedRowCellValue(COL_IDESTADO).ToString().Equals("1")) { estado = "ANULAR"; } else { estado = "ACTIVAR"; } DialogResult resultado; resultado = MessageBox.Show("Desea " + estado + " el registro ?", "Advertencia", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (resultado == DialogResult.Yes) { string respuesta; if (vista_registros.GetFocusedRowCellValue(COL_IDESTADO).ToString().Equals("1")) { respuesta = NFunciones.ExecuteSQL("UPDATE P_PARAMETROS_ESPECIFICOS SET IDESTADO='0' WHERE ID='" + vista_registros.GetFocusedRowCellValue(COL_ID).ToString() + "' "); } else { DataTable TB_VERIFICACION = NFunciones.TABLADATOS("SELECT * FROM P_PARAMETROS_ESPECIFICOS WHERE IDVARIEABLE='" + vista_registros.GetFocusedRowCellValue(COL_IDVARIABLE).ToString() + "' AND IDPRESUPUESTO='" + vista_registros.GetFocusedRowCellValue(COL_IDPRESUPUESTO).ToString() + "' AND IDESTADO='1'"); if (TB_VERIFICACION.Rows.Count > 0) { MessageBox.Show("NO se Puede Activar , Ya existe un registro para esta Variable y Presupuesto", "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { respuesta = NFunciones.ExecuteSQL("UPDATE P_PARAMETROS_ESPECIFICOS SET IDESTADO='1' WHERE ID='" + vista_registros.GetFocusedRowCellValue(COL_ID).ToString() + "' "); } } if (respuesta.Equals("Ok")) { MessageBox.Show("Se Actualizo Correctamente ", "ConfirmaciĆ³n", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("No se Pudo Actualizar!! ", "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Warning); } LlegarGrilla(); } }
private static string Validarxvariedad(string idempresa, string idpresupuesto, string idcultivo, string IdVariedad, string idetapa, string idestructura, string idtipocosto, string iditemcosto, string idactividadsubgru, string idlaborproducto, string idunidad, int con_igv, string periodo, string semana, decimal cantidad, decimal costo, string idmoneda, int dias_pago, string idobjetivo, string idsubitemcosto, string idfundo, string IDITEMCOSTO_USER, string IDCULTIVO_USER) { string valor; valor = ""; DataTable dtvalidar = new DataTable(); dtvalidar = NFunciones.TABLADATOS("EXEC SP_VALIDAR_DPRESUPUESTO_VARIEDAD'" + idempresa + "','" + idpresupuesto + "','" + idcultivo + "','" + IdVariedad + "','" + idetapa + "','" + idestructura + "','" + idtipocosto + "','" + iditemcosto + "','" + idactividadsubgru + "','" + idlaborproducto + "','" + idunidad + "','" + con_igv + "','" + periodo + "','" + semana + "','" + cantidad + "','" + costo + "','" + idmoneda + "','" + dias_pago + "','" + idobjetivo + "','" + idsubitemcosto + "','" + idfundo + "','" + IDITEMCOSTO_USER + "','" + IDCULTIVO_USER + "'"); if (dtvalidar.Rows.Count > 0) { valor = dtvalidar.Rows[0]["ERRORES"].ToString(); } else { valor = "ERROR DE CONEXION"; } return(valor); }
void descargardata() { try { DTRESULT = NFunciones.TABLADATOS("SELECT * FROM P_PROCESADO_DPRESUPUESTO_RG WHERE IDPRESUPUESTO='" + IDPRESUPUESTO + "'"); DataSet ds = new DataSet(); //ds.Tables.Add(DTRESULT); //Console.WriteLine("dataset completo"); //string RUTA = "c:\\DATA\\xxxxx.xlsx"; //Console.WriteLine("funcion excel"); //FuncionesExtras obj = new FuncionesExtras(); //obj.ExportDataSetToExcel(ds, RUTA); } catch (Exception EX) { MessageBox.Show("Se produjo un error : " + EX, "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Warning); } ESTADO = "S"; }
private void vista_datos_ShownEditor(object sender, EventArgs e) { ColumnView view = (ColumnView)sender; if (view.FocusedColumn.FieldName == "idsubitemcosto") { LookUpEdit editor = (LookUpEdit)view.ActiveEditor; string tipocosto = Convert.ToString(view.GetFocusedRowCellValue("IdItemCosto")); editor.Properties.DataSource = NFunciones.TABLADATOS("SELECT IdSubItemCosto ID,RTRIM(LTRIM(DESCRIPCION)) DESCRIPCION FROM P_SUB_ICOSTO WHERE IdItemCosto='" + tipocosto + "'"); editor.Properties.ValueMember = "ID"; editor.Properties.DisplayMember = "DESCRIPCION"; } if (view.FocusedColumn.FieldName == "IdLaborProducto") { LookUpEdit editor = (LookUpEdit)view.ActiveEditor; string actividad = Convert.ToString(view.GetFocusedRowCellValue("IdActividadSubGru")); editor.Properties.DataSource = NFunciones.TABLADATOS("SELECT IDLABORPROD ID,RTRIM(LTRIM(DESCRIPCION)) DESCRIPCION FROM P_LABORPRODUCT WHERE IDACTIVIDAD='" + actividad + "' ORDER BY IDLABORPROD ASC"); editor.Properties.ValueMember = "ID"; editor.Properties.DisplayMember = "DESCRIPCION"; } }
private void btn_nuevo_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { this.Limpiar(); DataTable dtid = new DataTable(); try { dtid = NFunciones.TABLADATOS("EXEC SP_IDFUNDO''"); this.IsNuevo = true; this.IsEditar = false; this.Botones(); this.HabilitarTexbox(true); this.txt_descripcion.Focus(); txt_codigo.Text = dtid.Rows[0]["ID"].ToString(); } catch (Exception ex) { MensajeError("Ocurrio un error " + "\n" + ex.Message); return; } }
void LlegarGrilla() { dtg_datos.DataSource = NFunciones.TABLADATOS("SELECT IDVARIABLE,DESCRIPCION,VALOR,SP_ASIGNADO FROM P_PARAMETROS ORDER BY IDVARIABLE ASC"); }
private void ListarPresupuestos() { cbo_presupuesto.Properties.DataSource = NFunciones.TABLADATOS("SELECT IDPRESUPUESTO,DESCRIPCION PRESUPUESTO FROM P_PRESUPUESTO WHERE ES_GF='0'"); cbo_presupuesto.Properties.ValueMember = "IDPRESUPUESTO"; cbo_presupuesto.Properties.DisplayMember = "PRESUPUESTO"; }
void LlenarCombo() { cbo_empresa.Properties.DataSource = NFunciones.TABLADATOS("SELECT IDEMPRESA ID , DESCRIPCION FROM P_EMPRESA"); cbo_empresa.Properties.ValueMember = "ID"; cbo_empresa.Properties.DisplayMember = "DESCRIPCION"; }
void llenargrilla() { dtg_datos.DataSource = NFunciones.TABLADATOS("SELECT F.IDFUNDO ID, F.DESCRIPCION,E.IDEMPRESA,E.DESCRIPCION EMPRESA FROM P_FUNDO F INNER JOIN P_EMPRESA E ON E.IDEMPRESA=F.IDEMPRESA ORDER BY F.IDFUNDO ASC"); }
private void btn_guardar_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { if (this.cbo_empresa.Text == "[Seleccionar..]") { MensajeError("Falta Seleccionar Empresa"); return; } string rpta = ""; if (this.txt_codigo.Text == string.Empty) { MensajeError("Falta Ingresar Codigo"); return; } if (this.txt_descripcion.Text == string.Empty) { MensajeError("Falta Ingresar DescripciĆ³n"); return; } string codigo; DataTable dtid = new DataTable(); if (this.IsNuevo) { dtid = NFunciones.TABLADATOS("EXEC SP_IDFUNDO''"); codigo = dtid.Rows[0]["ID"].ToString(); txt_codigo.Text = codigo; rpta = NFunciones.ExecuteSQL("INSERT INTO P_FUNDO(IDEMPRESA,IDFUNDO,DESCRIPCION)VALUES('" + Convert.ToString(cbo_empresa.EditValue) + "','" + txt_codigo.Text + "','" + txt_descripcion.Text + "')"); } else { rpta = NFunciones.ExecuteSQL("UPDATE P_FUNDO SET IDEMPRESA='" + Convert.ToString(cbo_empresa.EditValue) + "',DESCRIPCION='" + txt_descripcion.Text + "' WHERE IDFUNDO='" + txt_codigo.Text + "'"); } if (rpta.Equals("Ok")) { if (this.IsNuevo) { this.MensajeOk("Se Inserto los Datos Correctamente"); } else { this.MensajeOk("Se Actualizo los Datos Correctamente"); } } else { this.MensajeError(rpta); } this.IsNuevo = false; this.IsEditar = false; this.Botones(); this.HabilitarTexbox(false); this.llenargrilla(); } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }