public void ReadCenaTest() { // Declarar un string para buscar y una de el valor esperado string expected = "20295782K"; string result = ""; Cena cen = new Cena() { Number = "121212120" }; cen.Read(); result = cen.Client; // Preguntar si variables resultado y esperado son iguales Assert.AreEqual(expected, result); }
private void FillContract(Contract cnt) { txtRutCliente.Text = cnt.Client; dpkStartDte.SelectedDate = cnt.Start; dpkFTerm.SelectedDate = cnt.Finish; txtCAss.Text = cnt.Assist.ToString(); txtPersonalAdicional.Text = cnt.Additional.ToString(); txtObservacion.Text = cnt.Observation; cmbTipoEv.SelectedItem = (TipoEvento)cnt.EvType; lbNumberContract.Content = cnt.Number; dpkCreacionContrato.SelectedDate = cnt.Creation; dpkTerminarContrato.SelectedDate = cnt.End; cbkRealized.IsChecked = cnt.Realized; Cliente cli = new Cliente() { Rut = cnt.Client }; cli.Read(); lbRazon.Content = cli.RazonSocial; switch (cmbTipoEv.SelectedIndex) { case 0: CofeeBreak coff = new CofeeBreak() { Number = cnt.Number }; coff.Read(); cmbCofMod.SelectedItem = coff.Mod; cbkVeg.IsChecked = coff.Veg; break; case 1: Cocktail c**k = new Cocktail() { Number = cnt.Number }; c**k.Read(); cmbCockMod.SelectedItem = c**k.Mod; cbkAmbCk.IsChecked = c**k.HasAmbient; cmbAmbCk.SelectedItem = c**k.Ambient; cbkAmbMusCk.IsChecked = c**k.AmbientMusic; cbkCliMusCk.IsChecked = c**k.ClientMusic; break; case 2: Cena cen = new Cena() { Number = cnt.Number }; cen.Read(); cmbCenaMod.SelectedItem = cen.Mod; cmbAmbCe.SelectedItem = cen.IdTipoAmbientacion; cbkAmbMusCe.IsChecked = cen.MusicaAmbiental; rbtLocalOb.IsChecked = cen.LocalOnBreak; rbtLocalOt.IsChecked = cen.OtroLocalOnBreak; txtUf.Text = cen.ValorArriendo.ToString(); break; } }
private async void BtnAgregarContrato_Click(object sender, RoutedEventArgs e) { if (CliCheck()) { try { switch (cmbTipoEv.SelectedIndex) { case 0: CofeeBreak cb = new CofeeBreak(DateTime.Today, DateTime.Today.AddDays(2), txtRutCliente.Text, (DateTime)dpkStartDte.SelectedDate, (DateTime)dpkFTerm.SelectedDate, int.Parse(txtCAss.Text), int.Parse(txtPersonalAdicional.Text), txtObservacion.Text, (bool)cbkVeg.IsChecked, cmbCofMod.SelectedItem.ToString()); if (cb.Read()) { await this.ShowMessageAsync("Aviso", string.Format( "Contrato ya existe, no se puede agregar.")); } else { if (cb.Create()) { await this.ShowMessageAsync("Aviso", string.Format( "Contrato creado con éxito.")); } else { await this.ShowMessageAsync("Error", string.Format( "No se pudo agregar el contrato.")); } } break; case 1: Cocktail ck = new Cocktail(DateTime.Today, DateTime.Today.AddDays(2), txtRutCliente.Text, (DateTime)dpkStartDte.SelectedDate, (DateTime)dpkFTerm.SelectedDate, int.Parse(txtCAss.Text), int.Parse(txtPersonalAdicional.Text), txtObservacion.Text, (bool)cbkAmbCk.IsChecked, (bool)cbkAmbMusCk.IsChecked, (bool)cbkCliMusCk.IsChecked, cmbCockMod.SelectedItem.ToString(), (int)cmbAmbCk.SelectedItem); if (ck.Read()) { await this.ShowMessageAsync("Aviso", string.Format( "Contrato ya existe, no se puede agregar.")); } else { if (ck.Create()) { await this.ShowMessageAsync("Aviso", string.Format( "Contrato creado con éxito.")); } else { await this.ShowMessageAsync("Error", string.Format( "No se pudo agregar el contrato.")); } } break; case 2: Cena ce = new Cena(DateTime.Today, DateTime.Today.AddDays(2), txtRutCliente.Text, (DateTime)dpkStartDte.SelectedDate, (DateTime)dpkFTerm.SelectedDate, int.Parse(txtCAss.Text), int.Parse(txtPersonalAdicional.Text), txtObservacion.Text, (int)cmbAmbCe.SelectedItem, (bool)cbkAmbMusCe.IsChecked, (bool)rbtLocalOb.IsChecked, (bool)rbtLocalOt.IsChecked, int.Parse(txtUf.Text), cmbCenaMod.SelectedItem.ToString()); if (ce.Read()) { await this.ShowMessageAsync("Aviso", string.Format( "Contrato ya existe, no se puede agregar.")); } else { if (ce.Create()) { await this.ShowMessageAsync("Aviso", string.Format( "Contrato creado con éxito.")); } else { await this.ShowMessageAsync("Error", string.Format( "No se pudo agregar el contrato.")); } } break; } } catch (Exception zz) { MessageBox.Show(zz.Message, "ERROR", MessageBoxButton.OK, MessageBoxImage.Error); } AllInit(); } else { await this.ShowMessageAsync("Error", string.Format( "El cliente no se encuentra registrado.")); } }