private void btn_Eliminar_Click(object sender, EventArgs e) { cls_TiposClientes_BLL objBLL = new cls_TiposClientes_BLL(); string sMsjError = string.Empty; if (Dgv_View.Rows.Count > 0) { if (MessageBox.Show("Realmente desea eliminar?", "Advertencia", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { objBLL.Eliminar_TipoCliente(ref sMsjError, Dgv_View.SelectedRows[0].Cells[0].Value.ToString()); if (sMsjError != string.Empty) { MessageBox.Show("Se presento un error a la hora de listar : [ " + sMsjError + " ]", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Registro eliminado correctamente", "Listo", MessageBoxButtons.OK, MessageBoxIcon.Information); CargarDatos(); } txtFiltro.Text = string.Empty; } } else { MessageBox.Show("No hay registros para eliminar"); } }
private void CargarDatos() { cls_TiposClientes_BLL Obj_Tipos_Clientes_BLL = new cls_TiposClientes_BLL(); string sMsjError = string.Empty; DataTable dtEstados = new DataTable(); if (txtFiltro.Text == string.Empty) { dtEstados = Obj_Tipos_Clientes_BLL.ListarTiposClientes(ref sMsjError); } else { dtEstados = Obj_Tipos_Clientes_BLL.FiltrarTiposClientes(ref sMsjError, txtFiltro.Text.Trim()); } if (sMsjError == string.Empty) { Dgv_View.DataSource = null; Dgv_View.DataSource = dtEstados; } else { Dgv_View.DataSource = null; MessageBox.Show("Se Presentó un error : [ " + sMsjError + " ].", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnGuardar_Click(object sender, EventArgs e) { if (txt_IDTipoCliente.Text != string.Empty || txt_descripcion.Text != string.Empty || txt_TipoCliente.Text != string.Empty || cmb_IDEstado.SelectedValue.ToString() != "0") { cls_TiposClientes_BLL obj_TiposClientes_BLL = new cls_TiposClientes_BLL(); string sMsjError = string.Empty; Obj_DAL_TiposClientes.CIdEstado = Convert.ToChar(cmb_IDEstado.SelectedValue.ToString().Trim()); Obj_DAL_TiposClientes.STipoCliente = txt_TipoCliente.Text.Trim(); Obj_DAL_TiposClientes.SDescripcion = txt_descripcion.Text.Trim(); if (Obj_DAL_TiposClientes.CBandAX == 'I') { obj_TiposClientes_BLL.Insertar_TipoCliente(ref sMsjError, ref Obj_DAL_TiposClientes); if (sMsjError == string.Empty) { MessageBox.Show("Se han ingresado los datos correctamente"); Obj_DAL_TiposClientes.CBandAX = 'U'; toolStripLabel3.Text = "Modificar"; } else { MessageBox.Show("Se presentó un error" + "[ " + sMsjError + " ]"); } } else { obj_TiposClientes_BLL.Modificar_TipoCliente(ref sMsjError, ref Obj_DAL_TiposClientes); if (sMsjError == string.Empty) { MessageBox.Show("Se han ingresado los datos correctamente"); } else { MessageBox.Show("Se presentó un error"); } } } else { MessageBox.Show("Todos los cambios son obligatorios", "Informacion", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void CargarDatos() { #region Combo ID Estados cls_Estados_BLL ObjBLLEstados = new cls_Estados_BLL(); string sMsjError = string.Empty; DataTable DTE = new DataTable(); DTE = ObjBLLEstados.Listar_Estados(ref sMsjError); DTE.Rows.Add("0", "SELECCIONE UN ESTADO"); cmb_ID_Estado.DataSource = DTE; cmb_ID_Estado.DisplayMember = DTE.Columns[1].ToString(); cmb_ID_Estado.ValueMember = DTE.Columns[0].ToString(); cmb_ID_Estado.SelectedValue = "0"; #endregion #region Combo ID Clientes cls_TiposClientes_BLL ObjBLLTipoC = new cls_TiposClientes_BLL(); string sMsjError1 = string.Empty; DataTable DTTC = new DataTable(); DTTC = ObjBLLTipoC.ListarTiposClientes(ref sMsjError1); DTTC.Rows.Add("0", "SELECCIONE UN ID CLIENTE"); cmb_ID_Tipo_Cliente.DataSource = DTTC; cmb_ID_Tipo_Cliente.DisplayMember = DTTC.Columns[1].ToString(); cmb_ID_Tipo_Cliente.ValueMember = DTTC.Columns[0].ToString(); cmb_ID_Tipo_Cliente.SelectedValue = "0"; #endregion if (ObjClientes_DAL != null) { if (ObjClientes_DAL.cBandAxn == 'I') { txt_ID_Cliente.Text = string.Empty; txt_ID_Cliente.Enabled = true; txt_Cedula.Text = string.Empty; txt_Nombre.Text = string.Empty; txt_Apellidos.Text = string.Empty; txt_Telefono.Text = string.Empty; } else { lb_Guardar.Text = "Modificar"; txt_ID_Cliente.Text = ObjClientes_DAL.sIdCliente.ToString().Trim(); txt_ID_Cliente.Enabled = false; txt_Cedula.Text = ObjClientes_DAL.sCedula.ToString().Trim(); txt_Nombre.Text = ObjClientes_DAL.sNombre.ToString().Trim(); txt_Apellidos.Text = ObjClientes_DAL.sApellido.ToString().Trim(); txt_Telefono.Text = ObjClientes_DAL.sTelefono.ToString().Trim(); } } else { MessageBox.Show("Se presentó un error de capa 8 de programador. \n\nFavor Contactar a soporte técnico", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); } }