예제 #1
0
        private void BtnAgregar_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                #region validaciones

                if (CBCampa.SelectedIndex < 0)
                {
                    NotificationOn("seleccione un campamento");
                    return;
                }
                if (CBpunto.SelectedIndex < 0)
                {
                    NotificationOn("seleccione un punto de venta");
                    return;
                }

                #endregion

                CtaMaeAdd ventana = new CtaMaeAdd();
                ventana.punto_v       = CBpunto.SelectedValue.ToString();
                ventana.ShowInTaskbar = false;
                ventana.Owner         = Application.Current.MainWindow;
                ventana.ShowDialog();
                if (ventana.act_int == true)
                {
                    Cargar();
                }
            }
            catch (Exception w)
            {
                MessageBox.Show("errro al agregar:" + w);
            }
        }
예제 #2
0
        private void BtnEditar_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (dataGrid.SelectedIndex >= 0)
                {
                    DataRowView row = (DataRowView)dataGrid.SelectedItems[0];

                    CtaMaeAdd ventana = new CtaMaeAdd();
                    ventana.punto_v       = CBpunto.SelectedValue.ToString();
                    ventana.flag          = true;
                    ventana.codeVivi      = row["ViviendaCodigo"].ToString().Trim();
                    ventana.codeEmpre     = row["EmpresaCodigo"].ToString().Trim();
                    ventana.ShowInTaskbar = false;
                    ventana.Owner         = Application.Current.MainWindow;
                    ventana.ShowDialog();
                    if (ventana.act_int == true)
                    {
                        Cargar();
                    }
                }
                else
                {
                    if (CBCampa.SelectedIndex < 0 || CBpunto.SelectedIndex < 0)
                    {
                        NotificationOn("debe de seleccionar el campamento o el punto de ventas");
                    }
                    else
                    {
                        NotificationOn("debe de seleccionar una habitacion");
                    }
                }
            }
            catch (Exception w)
            {
                MessageBox.Show("errro al editar:" + w);
            }
        }