Exemplo n.º 1
0
        public void CreateCenaTest()
        {
            bool expected = true;
            Cena cen      = new Cena()
            {
                Number             = "121212120",
                Creation           = DateTime.Now,
                End                = DateTime.Now,
                Client             = "20295782K",
                TipoCena           = TipoCena.CE001,
                EvType             = 30,
                Start              = DateTime.Now,
                Finish             = DateTime.Now,
                Assist             = 10,
                Additional         = 20,
                Realized           = true,
                Total              = 987654321,
                Observation        = "Probanding",
                IdTipoAmbientacion = 10,
                MusicaAmbiental    = true,
                LocalOnBreak       = true,
                OtroLocalOnBreak   = false,
                ValorArriendo      = 150000
            };
            bool result = cen.Create();

            Assert.AreEqual(expected, result);
        }
Exemplo n.º 2
0
        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."));
            }
        }