Exemplo n.º 1
0
        public void UpdateCoffeeTest()
        {
            bool       expected = true;
            CofeeBreak coff     = new CofeeBreak()
            {
                Number      = "897654321",
                Creation    = DateTime.Now,
                End         = DateTime.Now,
                Client      = "20295782K",
                Mode        = TipoCoff.CB001,
                EvType      = 10,
                Start       = DateTime.Now,
                Finish      = DateTime.Now,
                Assist      = 100,
                Additional  = 20,
                Realized    = true,
                Total       = 987654321,
                Observation = "Tengo mucho sueño",
                Veg         = true
            };

            coff.Update();
            bool result = coff.Veg;

            //Preguntamos si son iguales
            Assert.AreEqual(expected, result);
        }
Exemplo n.º 2
0
        private bool UpdateContratoh()
        {
            try
            {
                switch (cmbTipoEv.SelectedIndex)
                {
                case 0:
                    CofeeBreak cof = new CofeeBreak()
                    {
                        Number      = lbNumberContract.Content.ToString(),
                        Creation    = (DateTime)dpkCreacionContrato.SelectedDate,
                        End         = (DateTime)dpkTerminarContrato.SelectedDate,
                        Client      = txtRutCliente.Text,
                        Mode        = (TipoCoff)cmbCofMod.SelectedItem,
                        EvType      = (int)((TipoEvento)cmbTipoEv.SelectedItem),
                        Start       = (DateTime)dpkStartDte.SelectedDate,
                        Finish      = (DateTime)dpkFTerm.SelectedDate,
                        Assist      = int.Parse(txtCAss.Text),
                        Additional  = int.Parse(txtPersonalAdicional.Text),
                        Realized    = (bool)cbkRealized.IsChecked,
                        Observation = txtObservacion.Text,
                        Veg         = (bool)cbkVeg.IsChecked
                    };

                    if (cof.Update())
                    {
                        return(true);
                    }

                    else
                    {
                        return(false);
                    }
                    break;

                case 1:
                    Cocktail c**k = new Cocktail()
                    {
                        Number       = lbNumberContract.Content.ToString(),
                        Creation     = (DateTime)dpkCreacionContrato.SelectedDate,
                        End          = (DateTime)dpkTerminarContrato.SelectedDate,
                        Client       = txtRutCliente.Text,
                        Mode         = (TipoCock)cmbCockMod.SelectedItem,
                        EvType       = (int)((TipoEvento)cmbTipoEv.SelectedItem),
                        Start        = (DateTime)dpkStartDte.SelectedDate,
                        Finish       = (DateTime)dpkFTerm.SelectedDate,
                        Assist       = int.Parse(txtCAss.Text),
                        Additional   = int.Parse(txtPersonalAdicional.Text),
                        Realized     = (bool)cbkRealized.IsChecked,
                        Observation  = txtObservacion.Text,
                        Ambient      = (Ambientacion)cmbAmbCk.SelectedItem,
                        HasAmbient   = (bool)cbkAmbCk.IsChecked,
                        AmbientMusic = (bool)cbkAmbMusCk.IsChecked,
                        ClientMusic  = (bool)cbkCliMusCk.IsChecked
                    };

                    if (c**k.Update())
                    {
                        return(true);
                    }

                    else
                    {
                        return(false);
                    }

                    break;

                case 2:
                    Cena ce = new Cena()
                    {
                        Number             = lbNumberContract.Content.ToString(),
                        Creation           = (DateTime)dpkCreacionContrato.SelectedDate,
                        End                = (DateTime)dpkTerminarContrato.SelectedDate,
                        Client             = txtRutCliente.Text,
                        TipoCena           = (TipoCena)cmbCenaMod.SelectedItem,
                        EvType             = (int)((TipoEvento)cmbTipoEv.SelectedItem),
                        Start              = (DateTime)dpkStartDte.SelectedDate,
                        Finish             = (DateTime)dpkFTerm.SelectedDate,
                        Assist             = int.Parse(txtCAss.Text),
                        Additional         = int.Parse(txtPersonalAdicional.Text),
                        Realized           = (bool)cbkRealized.IsChecked,
                        Observation        = txtObservacion.Text,
                        IdTipoAmbientacion = (int)((Ambientacion)cmbAmbCe.SelectedItem),
                        MusicaAmbiental    = (bool)cbkAmbMusCe.IsChecked,
                        LocalOnBreak       = (bool)rbtLocalOb.IsChecked,
                        OtroLocalOnBreak   = (bool)rbtLocalOt.IsChecked,
                        ValorArriendo      = double.Parse(txtUf.Text)
                    };

                    if (ce.Update())
                    {
                        return(true);
                    }

                    else
                    {
                        return(false);
                    }

                    break;

                default:
                    return(false);

                    break;
                }
            }
            catch (Exception zz)
            {
                MessageBox.Show(zz.Message, "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                AllInit();

                return(false);
            }
        }