Exemplo n.º 1
0
        public void UpdateCenaTest()
        {
            string expected = "Funco";
            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        = "Funco",
                IdTipoAmbientacion = 10,
                MusicaAmbiental    = true,
                LocalOnBreak       = false,
                OtroLocalOnBreak   = true,
                ValorArriendo      = 120000
            };

            cen.Update();
            string result = cen.Observation;

            //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);
            }
        }