private void BTN_Editar_Click(object sender, RoutedEventArgs e) { string RPT = ""; try { if (TXT_ID.Text == "" || TXT_numero.Text == "" || CBX_Estado.SelectedItem.ToString() == "" || TXT_ID_Cliente.Text == "") { Point relativePoint = IMG_Info.PointToScreen(new Point(0d, 0d)); TXT_ID.Focus(); System.Windows.Forms.Cursor.Position = new System.Drawing.Point(Convert.ToInt32(relativePoint.X), Convert.ToInt32(relativePoint.Y)); } else { RPT = N_Habitaciones.Editar(Convert.ToInt32(TXT_ID.Text), 0, Convert.ToInt32(CBX_Costo.Text), Convert.ToInt32(TXT_numero.Text), CBX_Estado.Text); if (RPT.Equals("OK")) { System.Windows.MessageBox.Show("Se edito la habitacion", "Hotel Royal S.V", MessageBoxButton.OK, MessageBoxImage.Information); } else { System.Windows.MessageBox.Show(RPT, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } Limpiar(); TXT_numero.Focus(); } catch (Exception err) { System.Windows.MessageBox.Show(err.Message, err.Source, MessageBoxButton.OK, MessageBoxImage.Error); } }
private void BTN_Eliminar_Click(object sender, RoutedEventArgs e) { if (TXT_ID.Text == "") { Point relativePoint = IMG_Info.PointToScreen(new Point(0d, 0d)); TXT_ID.Focus(); System.Windows.Forms.Cursor.Position = new System.Drawing.Point(Convert.ToInt32(relativePoint.X), Convert.ToInt32(relativePoint.Y)); } else { try { DialogResult resul = System.Windows.Forms.MessageBox.Show("Dese eliminar este empleado?\nLos cambios no se podran deshacer", "Hotel Royal S.V", (MessageBoxButtons)MessageBoxButton.YesNo, (MessageBoxIcon)MessageBoxImage.Warning); if (resul == DialogResult.Yes) { string RPT = N_Empleado.Eliminar(Convert.ToInt32(TXT_ID.Text)); if (RPT.Equals("OK")) { System.Windows.MessageBox.Show("Se elimino el empleado", "Hotel Royal S.V", MessageBoxButton.OK, MessageBoxImage.Information); } else { System.Windows.MessageBox.Show(RPT, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } Limpiar(); ActualizarTabla = true; } } catch (Exception err) { System.Windows.MessageBox.Show(err.Message); } } }
private void BTN_Editar_Click(object sender, RoutedEventArgs e) { if (TXT_ID.Text == "") { Point relativePoint = IMG_Info.PointToScreen(new Point(0d, 0d)); TXT_ID.Focus(); System.Windows.Forms.Cursor.Position = new System.Drawing.Point(Convert.ToInt32(relativePoint.X), Convert.ToInt32(relativePoint.Y)); } else { try { string RPT = N_Empleado.Editar(Convert.ToInt32(TXT_ID.Text), TXT_Nombre.Text, TXT_Apellido.Text, Convert.ToInt32(TXT_Edad.Text), TXT_Correo.Text, TXT_Telefono.Text, TXT_Celular.Text, TXT_Dui.Text, TXT_Nit.Text, TXT_Isss.Text, TXT_Usuario.Text, TXT_Contraseña.Text, TXT_Puesto.Text, TXT_Departamento.Text); if (RPT.Equals("OK")) { System.Windows.MessageBox.Show("Se actualiz el registro.", "Hotel Royal S.V", MessageBoxButton.OK, MessageBoxImage.Information); } else { System.Windows.MessageBox.Show(RPT, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } Limpiar(); ActualizarTabla = true; } catch (Exception err) { System.Windows.MessageBox.Show(err.Message); } } }
private void BTN_Anular_Click(object sender, RoutedEventArgs e) { if (TXT_ID.Text == "") { Point relativePoint = IMG_Info.PointToScreen(new Point(0d, 0d)); TXT_ID.Focus(); System.Windows.Forms.Cursor.Position = new System.Drawing.Point(Convert.ToInt32(relativePoint.X), Convert.ToInt32(relativePoint.Y)); } else { try { if (TXT_Puesto.Text == "") { BTN_Buscar_Click(null, e); } else { if (TXT_Puesto.Text == "Anulado") { TXT_Puesto.Focus(); TXT_Puesto.Select(0, 7); } else { string RPT = N_Empleado.Anular(Convert.ToInt32(TXT_ID.Text), "Anulado"); if (RPT.Equals("OK")) { System.Windows.MessageBox.Show("Se anulo el empleado", "Hotel Royal S.V", MessageBoxButton.OK, MessageBoxImage.Information); } else { System.Windows.MessageBox.Show(RPT, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } Limpiar(); ActualizarTabla = true; } } } catch (Exception err) { System.Windows.MessageBox.Show(err.Message); } } }
private void BTN_Buscar_Click(object sender, RoutedEventArgs e) { try { if (TXT_ID.Text == "") { Point relativePoint = IMG_Info.PointToScreen(new Point(0d, 0d)); TXT_ID.Focus(); System.Windows.Forms.Cursor.Position = new System.Drawing.Point(Convert.ToInt32(relativePoint.X), Convert.ToInt32(relativePoint.Y)); } else { DataTable DAT = N_Habitaciones.Buscar_ID(Convert.ToInt32(TXT_ID.Text)); TXT_numero.Text = DAT.Rows[0][3].ToString(); CBX_Estado.Text = DAT.Rows[0][4].ToString(); CBX_Costo.Text = DAT.Rows[0][2].ToString(); TXT_ID_Cliente.Text = DAT.Rows[0][1].ToString(); } } catch (Exception err) { System.Windows.MessageBox.Show(err.Message, err.Source, MessageBoxButton.OK, MessageBoxImage.Error); } }
private void BTN_Eliminar_Click(object sender, RoutedEventArgs e) { DialogResult resul = System.Windows.Forms.MessageBox.Show("Desea anular esta habitacion?\nEsta accion se puede editar luego" , "Hotel Royal S.V", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (resul == DialogResult.Yes) { string RPT = ""; try { if (TXT_ID.Text == "") { Point relativePoint = IMG_Info.PointToScreen(new Point(0d, 0d)); TXT_ID.Focus(); System.Windows.Forms.Cursor.Position = new System.Drawing.Point(Convert.ToInt32(relativePoint.X), Convert.ToInt32(relativePoint.Y)); } else { RPT = N_Habitaciones.Anular(Convert.ToInt32(TXT_ID.Text), "Inactivo"); if (RPT.Equals("OK")) { System.Windows.MessageBox.Show("Se deshabilito la habitacion", "Hotel Royal S.V", MessageBoxButton.OK, MessageBoxImage.Information); } else { System.Windows.MessageBox.Show(RPT); } } } catch (Exception err) { System.Windows.MessageBox.Show(err.Message, err.Source, MessageBoxButton.OK, MessageBoxImage.Error); } } }