Exemplo n.º 1
0
        private void cb_ModalidadServicio_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            int ID = ((ComboTipoEvento)cb_tipoevento.SelectedItem).id;

            if (ID != 0)
            {
                ComboModalidadServicio modd = new ComboModalidadServicio();
                foreach (var item in modd.ModServ(ID))
                {
                    ModalidadServicio modsrv = new ModalidadServicio();
                    BibliotecaClases.ModalidadServicio BMS   = new ModalidadServicio();
                    List <ModalidadServicio>           twice = BMS.ListaMod();
                    foreach (ModalidadServicio item2 in twice)
                    {
                        ComboModalidadServicio CMS = new ComboModalidadServicio();
                        CMS.IdModalidad  = item2.IdModalidad;
                        CMS.IdTipoEvento = item2.IdTipoEvento;
                        CMS.Nombre       = item2.Nombre;
                        CMS.PersonalBase = item2.PersonalBase;
                        CMS.ValorBase    = item2.ValorBase;
                        cb_ModalidadServicio.Items.Add(CMS);
                    }
                }
            }
        }
Exemplo n.º 2
0
        // El combo box con dependencia
        private void cboTipoEvento_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (Inicio)
            {
                ModalidadServicio modalidad = new ModalidadServicio();

                try
                {
                    string valor;

                    valor = cboTipoEvento.SelectedValue.ToString();
                    List <ModalidadServicio> modalidadServicios = new List <ModalidadServicio>();

                    foreach (var x in modalidad.ReadAll())
                    {
                        if (x.IdTipoEvento == int.Parse(valor))
                        {
                            modalidadServicios.Add(x);
                        }
                    }

                    cboModalidad.ItemsSource       = modalidadServicios;
                    cboModalidad.DisplayMemberPath = "Nombre";
                    cboModalidad.SelectedValuePath = "IdModalidad";
                    cboModalidad.SelectedIndex     = 0;
                }
                catch (Exception)
                {
                }
            }
        }
Exemplo n.º 3
0
        public double valorCocktailPersonal()
        {
            ModalidadServicio mod      = new ModalidadServicio();
            double            personal = double.Parse(con.txtPersonalAdicional.Text);

            double cant_uf = 0;


            if (personal == 2)
            {
                cant_uf = 2;
            }
            if (personal == 3)
            {
                cant_uf = 3;
            }
            if (personal == 4)
            {
                cant_uf = 3.5;
            }
            if (personal > mod.PersonalBase)
            {
                double cantidad = personal - mod.PersonalBase;
                cant_uf = 3.5;

                double extra = (cantidad * 0.5);
                cant_uf = cant_uf + extra;
            }

            double v = (double)(cant_uf * uf);

            return(v);
        }
        //MÉTODO BUSCAR CONTRATO botón buscar

        public async void BuscarContrato()
        {
            try
            {
                Contrato c = new Contrato();
                c.Numero = txtNumero.Text;
                bool buscar = c.Buscar();
                if (buscar)
                {
                    txtBuscarCliente.Text = c.RutCliente;

                    dpFechaInicio1.datos(c.FechaHoraInicio);
                    dpFechaTermino.datos(c.FechaHoraTermino);

                    dpFechaInicio1.datos(c.FechaHoraInicio);
                    dpFechaTermino.datos(c.FechaHoraTermino);

                    txtNumeroAsistentes.Text  = c.Asistentes.ToString();
                    txtPersonalAdicional.Text = c.PersonalAdicional.ToString();

                    TipoEvento tip = new TipoEvento();
                    tip.IdTipoEvento = c.IdTipoEvento;
                    tip.Read();
                    cboTipo.Text = tip.Descripcion;

                    ModalidadServicio mod = new ModalidadServicio();
                    mod.IdModalidad = c.IdModalidad;
                    mod.Read();
                    cbModalidad.Text = mod.Nombre;
                    lblTotal.Content = calculo();

                    txtObservaciones.Text   = c.Observaciones;
                    lblNumero.Content       = txtNumero.Text;
                    btnModificar.Visibility = Visibility.Visible;
                    btnTerminar.Visibility  = Visibility.Visible;
                    btnCrear.Visibility     = Visibility.Hidden;

                    Cliente cl = new Cliente();
                    lblNombreCliente.Content = cl.NombreContacto;
                }
                else
                {
                    await this.ShowMessageAsync("Mensaje:",
                                                string.Format("Contrato no encontrado"));
                }
            }
            catch (Exception ex)
            {
                await this.ShowMessageAsync("Mensaje:",
                                            string.Format("Error al Buscar"));

                Logger.Mensaje(ex.Message);
            }
        }
Exemplo n.º 5
0
        // Metodo que filtra cbo de modalidad por el cbo de tipo seleccionado
        private void CboTipoEvento_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ModalidadServicio modalidadServicio = new ModalidadServicio();
            // recuperar id tipo evento a través del SelectedValue
            int tipoId = int.Parse(cboTipoEvento.SelectedValue.ToString());

            cboModalidad.ItemsSource       = modalidadServicio.ReadAll(tipoId);
            cboModalidad.DisplayMemberPath = "Nombre";
            cboModalidad.SelectedValuePath = "IdModalidad";
            cboModalidad.SelectedIndex     = 0;

            AditionalOptions();
        }
Exemplo n.º 6
0
 private void CboTipoEvento_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (cboTipoEvento.SelectedValue != null)
     {
         int id_tipo = 0;
         if (cboTipoEvento.SelectedIndex > -1)
         {
             id_tipo = int.Parse(cboTipoEvento.SelectedValue.ToString());
             ModalidadServicio ms = new ModalidadServicio();
             ms.IdTipoEvento    = id_tipo;
             cboMod.ItemsSource = ms.ListarPorTE();
         }
     }
 }
Exemplo n.º 7
0
 private void cboModalidadServicio_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (cboModalidadServicio.SelectedItem != null)
     {
         ModalidadServicio mo = new ModalidadServicio();
         mo = (ModalidadServicio)cboModalidadServicio.SelectedItem;
         txtPersonal.Text = "" + mo.PersonalBase;
         mostrarCalculosPantalla();
     }
     else
     {
         txtPersonal.Text = "0";
     }
 }
Exemplo n.º 8
0
 private void CboTipoEvento_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (cboTipoEvento.SelectedValue != null)
     {
         Contrato        contrato  = new Contrato();
         int             idTipo    = int.Parse(cboTipoEvento.SelectedValue.ToString());
         List <Contrato> contratos = contrato.ReadAllByTipoEvento(idTipo);
         PopDgFiltered(contratos);
         // ENLAZAR CBO MODALIDAD
         ModalidadServicio modalidadServicio = new ModalidadServicio();
         cboModalidad.ItemsSource       = modalidadServicio.ReadAll(idTipo);
         cboModalidad.DisplayMemberPath = "Nombre";
         cboModalidad.SelectedValuePath = "IdModalidad";
     }
 }
Exemplo n.º 9
0
        public void CargarModalidad(int IdTipoEvento)
        {
            ModalidadServicio mod = new ModalidadServicio()

            {
                IdTipoEvento = IdTipoEvento
            };

            if (mod.Read())
            {
                comboModalidad.ItemsSource = mod.Nombre;
            }
            else
            {
                MessageBox.Show("El Cliente Buscado No Existe");
            }
        }
Exemplo n.º 10
0
        private void cboTipo_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            int contenido = ((comboBoxItem)cboTipo.SelectedItem).id;

            ModalidadServicio mod = new ModalidadServicio();

            cbModalidad.Items.Clear();
            cbModalidad.IsEnabled = true;
            foreach (var item in mod.ReadAll().Where(con => con.IdtipoEvento == contenido).ToList())
            {
                comboBoxItem2 cb = new comboBoxItem2();
                cb.id          = item.Id;
                cb.descripcion = item.Nombre;
                cbModalidad.Items.Add(cb);
            }
            cbModalidad.SelectedIndex = 0;
        }
Exemplo n.º 11
0
        /*TipoEvento evento;
         * double asistentes;
         * double valorbase;
         * double total;*/

        public Wpf_AdminContrato()
        {
            InitializeComponent();

            ServiceReference1.Service1Client ws = new ServiceReference1.Service1Client();
            lbl_uf.Content = ws.Uf().ToString();

            //evento = new TipoEvento();
            txt_contrato.Text = DateTime.Now.ToString("yyyyMMddHHmm");
            txt_creacion.Text = DateTime.Now.ToString("yyyy/MM/dd");
            TipoEvento tpevent = new TipoEvento();

            BibliotecaClases.TipoEvento BTE = new TipoEvento();
            var bts = BTE.listar();

            cb_tipoevento.Items.Add("Seleccione");
            cb_tipoevento.SelectedIndex = 0;
            foreach (var item in bts)
            {
                ComboTipoEvento CTE = new ComboTipoEvento();
                CTE.id    = item.IdTipoEvento;
                CTE.texto = item.Descripcion;
                cb_tipoevento.Items.Add(CTE);
            }
            ModalidadServicio modsrv = new ModalidadServicio();

            BibliotecaClases.ModalidadServicio BMS = new ModalidadServicio();
            var twice = BMS.ListaMod();

            cb_ModalidadServicio.Items.Add("Seleccione");
            cb_ModalidadServicio.SelectedIndex = 0;

            /*foreach (var item in twice)
             * {
             *  ComboModalidadServicio CMS = new ComboModalidadServicio();
             *  CMS.IdModalidad = item.IdModalidad;
             *  CMS.IdTipoEvento = item.IdTipoEvento;
             *  CMS.Nombre = item.Nombre;
             *  CMS.PersonalBase = item.PersonalBase;
             *  CMS.ValorBase = item.ValorBase;
             *  cb_ModalidadServicio.Items.Add(CMS);
             * }
             * ComboTipoEvento TipoEve = new ComboTipoEvento();
             * //String ID = TipoEve.id.ToString().Trim();
             */
        }
Exemplo n.º 12
0
        //valor personal adicional
        private async void txtPersonalAdicional_TextChanged_1(object sender, TextChangedEventArgs e)
        {
            if (txtPersonalAdicional.Text != null)
            {
                ModalidadServicio mod      = new ModalidadServicio();
                double            personal = 0;
                if (double.TryParse(txtPersonalAdicional.Text, out personal))
                {
                }
                else
                {
                    txtPersonalAdicional.Focus();
                    return;
                }
                double cant_uf = 0;


                if (personal == 2)
                {
                    cant_uf = 2;
                }
                if (personal == 3)
                {
                    cant_uf = 3;
                }
                if (personal == 4)
                {
                    cant_uf = 3.5;
                }
                if (personal > mod.PersonalBase)
                {
                    double cantidad = personal - mod.PersonalBase;
                    cant_uf = 3.5;

                    double extra = (cantidad * 0.5);
                    cant_uf = cant_uf + extra;
                }

                double v = (double)(cant_uf * uf);
                lblPersonalAdicional.Content = v.ToString();
            }
            //else
            //{
            //    await this.ShowMessageAsync("Mensaje", "Debe crear un contrato");
            //}
        }
Exemplo n.º 13
0
 private void ComboModalidad_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (comboModalidad.SelectedValue != null)
     {
         string            CodModalidad = comboModalidad.SelectedValue.ToString();
         ModalidadServicio modalidad    = new ModalidadServicio()
         {
             IdModalidad = CodModalidad.ToString()
         };
         if (modalidad.Read())
         {
             txtValorTotal.IsEnabled = false;
             txtValorTotal.Text      = "$0";
             var valorBaseS = (float)modalidad.ValorBase;
             valorBaseModalidad = valorBaseS;
         }
     }
 }
Exemplo n.º 14
0
 private void LlenarContratoCache(ContratoSalvar cont)
 {
     txtNumero.Text = cont.Numero;
     txtRut.Text    = cont.RutCliente;
     if (cont.IdTipoEvento == -1)
     {
         cboTipoEvento.SelectedIndex      = -1;
         cboModalidadServicio.ItemsSource = null;
     }
     else
     {
         TipoEvento te = new TipoEvento()
         {
             IdTipoEvento = cont.IdTipoEvento
         };
         te.Read();
         cboTipoEvento.Text = te.Descripcion;
         if (cont.IdModalidad.Equals("-1"))
         {
             cboModalidadServicio.SelectedIndex = -1;
         }
         else
         {
             ModalidadServicio mo = new ModalidadServicio()
             {
                 IdModalidad = cont.IdModalidad
             };
             mo.Read();
             cboModalidadServicio.Text = mo.Nombre.Trim();
         }
     }
     txtAsistentes.Text        = cont.Asistentes.ToString();
     txtPersonalAdicional.Text = cont.PersonalAdicional.ToString();
     txtObservaciones.Text     = cont.Observaciones.ToString();
     ctrFechaHoraInicio.VerFechaYHora(cont.FechaHoraInicio);
     ctrFechaHoraFin.VerFechaYHora(cont.FechaHoraTermino);
     txtFechaCreacion.Text = cont.Creacion.ToString("dd/MM/yyyy HH:mm");
     txtFechaTermino.Text  = cont.Termino.ToString("dd/MM/yyyy HH:mm");
 }
Exemplo n.º 15
0
        private async void RegistrarContrato()
        {
            try
            {
                if (string.IsNullOrWhiteSpace(txtRutCliente.Text))
                {
                    await this.ShowMessageAsync("Error:", "Debes ingresar un Rut válido");

                    txtRutCliente.Focus();
                    return;
                }
                if (cmbTipoEvento.SelectedIndex == -1)
                {
                    await this.ShowMessageAsync("Error:", "Debes seleccionar un Tipo de Evento");

                    cmbTipoEvento.Focus();
                    return;
                }
                if (cmbModalidad.SelectedIndex == -1)
                {
                    await this.ShowMessageAsync("Error:", "Debes ingresar una Modalidad");

                    cmbModalidad.Focus();
                    return;
                }
                if (string.IsNullOrWhiteSpace(Convert.ToString(dtpFechaInicio.SelectedDate)))
                {
                    await this.ShowMessageAsync("Error:", "Debes ingresar una Fecha de inicio");

                    dtpFechaInicio.Focus();
                    return;
                }
                if (string.IsNullOrWhiteSpace(Convert.ToString(dtpFechaTermino1.SelectedDate)))
                {
                    await this.ShowMessageAsync("Error:", "Debes ingresar una Fecha de Termino");

                    dtpFechaTermino1.Focus();
                    return;
                }
                if (string.IsNullOrWhiteSpace(txtObservaciones.Text))
                {
                    await this.ShowMessageAsync("Error:", "Debes ingresar Observaciones");

                    txtObservaciones.Focus();
                    return;
                }
                if (cmbTipoEvento.SelectedIndex == -1)
                {
                    await this.ShowMessageAsync("Error:", "Debes ingresar un tipo de evento");

                    cmbTipoEvento.Focus();
                    return;
                }

                string txtAs  = txtAsistentes.Text.Trim();
                string txtPer = txtPersonalAdicional.Text.Trim();

                if (string.IsNullOrEmpty(txtAs) && string.IsNullOrEmpty(txtPer))
                {
                    txtAsistentes.Text        = "0";
                    txtPersonalAdicional.Text = "0";
                }
                else if (string.IsNullOrEmpty(txtPer))
                {
                    txtPersonalAdicional.Text = "0";
                }
                else if (string.IsNullOrEmpty(txtAs))
                {
                    txtAsistentes.Text = "0";
                }
                double valorBaseTipoEvento = 0;
                int    personalBase        = 0;
                if (cmbTipoEvento.SelectedIndex > -1)
                {
                    ModalidadServicio m = (ModalidadServicio)cmbModalidad.SelectedItem;
                    valorBaseTipoEvento        = m.ValorBase;
                    personalBase               = m.PersonalBase;
                    cmbModalidad.SelectedValue = m.IdModalidad;
                }
                double recargoAsistentes = double.Parse(txtAsistentes.Text);
                double recargoPersonal   = double.Parse(txtPersonalAdicional.Text);

                DateTime FechaActual    = DateTime.Now;
                string   numeroContrato = FechaActual.ToString("yyyyMMddHHmm");
                DateTime Ftermino       = Convert.ToDateTime("01-01-1900");
                string   rutCliente     = txtRutCliente.Text;
                string   Modalidad      = (string)cmbModalidad.SelectedValue;
                int      TipoEvento     = (int)cmbTipoEvento.SelectedValue;
                DateTime Finicio        = (DateTime)dtpFechaInicio.SelectedDate;
                DateTime Ftermino2      = (DateTime)dtpFechaTermino1.SelectedDate;
                int      asistentes     = int.Parse(txtAsistentes.Text);
                int      personalAd     = int.Parse(txtPersonalAdicional.Text);
                bool     realizado      = false;
                if (cbRealizado.IsChecked == true)
                {
                    realizado = true;
                }
                else
                {
                    realizado = false;
                }
                double   valor         = val.calcularValorEvento(valorBaseTipoEvento, recargoAsistentes, recargoPersonal, personalBase);
                string   observaciones = txtObservaciones.Text;
                Contrato contrato      = new Contrato
                {
                    Numero             = numeroContrato,
                    Creacion           = FechaActual,
                    Termino            = Ftermino,
                    RutCliente         = rutCliente,
                    IdModalidad        = Modalidad,
                    IdTipoEvento       = TipoEvento,
                    FechaHoraInicio    = Finicio,
                    FechaHoraTermino   = Ftermino2,
                    Asistentes         = asistentes,
                    PersonalAdicional  = personalAd,
                    Realizado          = realizado,
                    ValorTotalContrato = valor,
                    Observaciones      = observaciones
                };
                sc.AddEntity(contrato);
                await this.ShowMessageAsync("Correcto:", "Contrato registrado satifactoriamente");

                LimpiarControles();
            }
            catch (FormatException)
            {
                await this.ShowMessageAsync("Error:", "El numero de asistentes y/o personal adicional ingresado no contiene un formato válido");
            }
            catch (Exception ex)
            {
                await this.ShowMessageAsync("Error:", "Se ha producido un error inesperado.\n" + ex.Message);
            }
        }
Exemplo n.º 16
0
        public Evento crearObjetoEvento()
        {
            Evento     ev;
            Contrato   cont = new Contrato();
            TipoEvento te   = (TipoEvento)cboTipoEvento.SelectedItem;

            if (te != null)
            {
                ModalidadServicio mo = new ModalidadServicio();
                if (cboModalidadServicio.SelectedIndex == -1) // En caso de modificar los datos del evento antes de escoger una modalidad
                {
                    mo.IdModalidad = "0";
                }
                else
                {
                    mo = (ModalidadServicio)cboModalidadServicio.SelectedItem;
                }
                cont.IdModalidad       = mo.IdModalidad;
                cont.PersonalAdicional = int.Parse(txtPersonalAdicional.Text);
                cont.Asistentes        = int.Parse(txtAsistentes.Text);
                switch (te.Descripcion)
                {
                case "Cocktail":     //Se instancia un Cocktail con los datos disponibles
                    TipoAmbientacion tipoa = new TipoAmbientacion();
                    if (cboCocktailTipoAmbientacion.SelectedIndex == -1)
                    {
                        tipoa.idTipoAmbientacion = 30;
                    }
                    else
                    {
                        tipoa = (TipoAmbientacion)cboCocktailTipoAmbientacion.SelectedItem;
                    }
                    bool ambientacion = chkCocktailAmbientacion.IsChecked == true ? true : false;
                    bool musica_ambiental_cocktail = chkCocktailMusicaAmbiental.IsChecked == true ? true : false;
                    bool musica_cliente            = chkCocktailMusicaCliente.IsChecked == true ? true : false;
                    ev = new Cocktail()
                    {
                        Numero             = txtNumero.Text,
                        IdTipoAmbientacion = tipoa.idTipoAmbientacion,
                        Ambientacion       = ambientacion,
                        MusicaAmbiental    = musica_ambiental_cocktail,
                        MusicaCliente      = musica_cliente
                    };
                    ev.TipoContrato(cont);
                    break;

                case "Coffee Break":    //Se instancia un CoffeeBreak con los datos disponibles
                    bool vegetariana = rbtVegetariana.IsChecked == true ? true : false;
                    ev = new CoffeeBreak()
                    {
                        Numero      = txtNumero.Text,
                        Vegetariana = vegetariana
                    };
                    ev.TipoContrato(cont);
                    break;

                case "Cenas":    //Se instancia Cenas con los datos disponibles
                    TipoAmbientacion tipoa2 = new TipoAmbientacion();
                    if (cboCenasTipoAmbientacion.SelectedIndex == -1)
                    {
                        tipoa2.idTipoAmbientacion = 30;
                    }
                    else
                    {
                        tipoa2 = (TipoAmbientacion)cboCenasTipoAmbientacion.SelectedItem;
                    }
                    bool musica_ambiental_cenas = chkCenasMusicaAmbiental.IsChecked == true ? true : false;
                    bool localOnbreak           = rbtLocalOnBreak.IsChecked == true ? true : false;
                    bool otroLocalOnbreak       = rbtOtroOnbreak.IsChecked == true ? true : false;
                    int  valoraArriendo         = int.Parse(txtValorArriendoLocal.Text);
                    ev = new Cenas()
                    {
                        Numero             = txtNumero.Text,
                        IdTipoAmbientacion = tipoa2.idTipoAmbientacion,
                        MusicaAmbiental    = musica_ambiental_cenas,
                        LocalOnBreak       = localOnbreak,
                        OtroLocalOnBreak   = otroLocalOnbreak,
                        ValorArriendo      = valoraArriendo
                    };
                    ev.TipoContrato(cont);
                    break;

                default:
                    ev = null;
                    break;
                }

                return(ev);
            }
            return(null);
        }
Exemplo n.º 17
0
        //BUSCAR CONTRATO de traspasar
        private async void btnBuscarContrato_Click_2(object sender, RoutedEventArgs e)
        {
            try
            {
                Contrato c    = new Contrato();
                Cliente  clie = new Cliente();
                c.Numero = txtNumero.Text;
                bool buscar = c.Buscar();
                if (c.Realizado == true)
                {
                    rbSi.IsChecked = false;
                    rbNo.IsChecked = true;
                    //BLOQUEAR EDITAR EL CONTRATO
                    txtNumero.IsEnabled            = false;
                    txtBuscarCliente.IsEnabled     = false;
                    txtNumero.IsEnabled            = false;
                    txtNumero.IsEnabled            = false;
                    txtBuscarCliente.IsEnabled     = false;
                    lblNumero.IsEnabled            = false;
                    cbModalidad.IsEnabled          = false;
                    cboTipo.IsEnabled              = false;
                    txtObservaciones.IsEnabled     = false;
                    txtNumeroAsistentes.IsEnabled  = false;
                    txtPersonalAdicional.IsEnabled = false;
                    dpFechaInicio1.bloquear();
                    dpFechaTermino.bloquear();
                }
                else
                {
                    rbSi.IsChecked = true;
                    rbNo.IsChecked = false;
                    //BLOQUEAR EDITAR EL CONTRATO
                    txtNumero.IsEnabled            = true;
                    txtBuscarCliente.IsEnabled     = true;
                    txtNumero.IsEnabled            = true;
                    txtNumero.IsEnabled            = true;
                    txtBuscarCliente.IsEnabled     = true;
                    lblNumero.IsEnabled            = true;
                    cbModalidad.IsEnabled          = true;
                    cboTipo.IsEnabled              = true;
                    txtObservaciones.IsEnabled     = true;
                    txtNumeroAsistentes.IsEnabled  = true;
                    txtPersonalAdicional.IsEnabled = true;
                }


                if (buscar)
                {
                    txtBuscarCliente.Text = c.RutCliente;

                    dpFechaInicio1.datos(c.FechaHoraInicio);
                    dpFechaTermino.datos(c.FechaHoraTermino);

                    dpFechaInicio1.datos(c.FechaHoraInicio);
                    dpFechaTermino.datos(c.FechaHoraTermino);

                    txtNumeroAsistentes.Text  = c.Asistentes.ToString();
                    txtPersonalAdicional.Text = c.PersonalAdicional.ToString();

                    TipoEvento tip = new TipoEvento();
                    tip.IdTipoEvento = c.IdTipoEvento;
                    tip.Read();
                    cboTipo.Text = tip.Descripcion;

                    ModalidadServicio mod = new ModalidadServicio();
                    mod.IdModalidad = c.IdModalidad;
                    mod.Read();
                    cbModalidad.Text = mod.Nombre;

                    txtObservaciones.Text       = c.Observaciones;
                    lblNumero.Content           = txtNumero.Text;
                    lblNombreCliente.Visibility = Visibility.Visible;
                    lblTotal.Content            = calculo();
                    btnModificar.Visibility     = Visibility.Visible;
                    btnTerminar.Visibility      = Visibility.Visible;

                    btnCrear.Visibility = Visibility.Hidden;

                    lblNombreCliente.Content = clie.NombreContacto;
                }
                else
                {
                    await this.ShowMessageAsync("Mensaje:",
                                                string.Format("Contrato no encontrado"));
                }
            }
            catch (Exception ex)
            {
                await this.ShowMessageAsync("Mensaje:",
                                            string.Format("Error al Buscar"));

                Logger.Mensaje(ex.Message);
            }
        }
Exemplo n.º 18
0
        public void llenar(Contrato cont)
        {
            txtNumero.Text = cont.Numero;
            txtRut.Text    = cont.RutCliente;
            Cliente cli = new Cliente()
            {
                RutCliente = txtRut.Text
            };

            cli.Read();
            txtRazonSocial.Text = cli.RazonSocial;
            if (cont.Realizado)
            {
                txtVigencia.Text = "Si";
            }
            else
            {
                txtVigencia.Text = "No";
            }
            TipoEvento te = new TipoEvento()
            {
                IdTipoEvento = cont.IdTipoEvento
            };

            te.Read();
            cboTipoEvento.Text = te.Descripcion;
            ModalidadServicio ms = new ModalidadServicio()
            {
                IdModalidad = cont.IdModalidad
            };

            ms.Read();
            cboModalidadServicio.Text = ms.Nombre.Trim();
            txtPersonal.Text          = ms.PersonalBase.ToString();
            txtAsistentes.Text        = cont.Asistentes.ToString();
            txtPersonalAdicional.Text = cont.PersonalAdicional.ToString();
            txtObservaciones.Text     = cont.Observaciones;
            txtFechaCreacion.Text     = cont.Creacion.ToString("dd/MM/yyyy HH:mm");
            txtFechaTermino.Text      = cont.Termino.ToString("dd/MM/yyyy HH:mm");
            ctrFechaHoraInicio.VerFechaYHora(cont.FechaHoraInicio);
            ctrFechaHoraFin.VerFechaYHora(cont.FechaHoraTermino);
            Evento evento;

            if (te.IdTipoEvento == 10)
            {
                evento = new CoffeeBreak()
                {
                    Numero = cont.Numero
                };
                ((CoffeeBreak)evento).Read();
                if (((CoffeeBreak)evento).Vegetariana)
                {
                    rbtVegetariana.IsChecked = true;
                }
                else
                {
                    rbtMixta.IsChecked = true;
                }
            }
            else if (te.IdTipoEvento == 20)
            {
                evento = new Cocktail()
                {
                    Numero = cont.Numero
                };
                ((Cocktail)evento).Read();
                chkCocktailAmbientacion.IsChecked    = ((Cocktail)evento).Ambientacion;
                chkCocktailMusicaAmbiental.IsChecked = ((Cocktail)evento).MusicaAmbiental;
                chkCocktailMusicaCliente.IsChecked   = ((Cocktail)evento).MusicaCliente;
                if (((Cocktail)evento).Ambientacion == false)
                {
                    cboCocktailTipoAmbientacion.SelectedIndex = -1;
                }
                else
                {
                    TipoAmbientacion ta = new TipoAmbientacion()
                    {
                        idTipoAmbientacion = ((Cocktail)evento).IdTipoAmbientacion
                    };
                    ta.Read();
                    cboCocktailTipoAmbientacion.Text = ta.Descripcion;
                }
            }
            else if (te.IdTipoEvento == 30)
            {
                evento = new Cenas()
                {
                    Numero = cont.Numero
                };
                ((Cenas)evento).Read();
                TipoAmbientacion ta = new TipoAmbientacion()
                {
                    idTipoAmbientacion = ((Cenas)evento).IdTipoAmbientacion
                };
                ta.Read();
                cboCenasTipoAmbientacion.Text     = ta.Descripcion;
                chkCenasMusicaAmbiental.IsChecked = ((Cenas)evento).MusicaAmbiental;
                if (((Cenas)evento).LocalOnBreak)
                {
                    rbtLocalOnBreak.IsChecked = true;
                }
                else
                {
                    rbtOtroLocal.IsChecked = true;
                    if (((Cenas)evento).OtroLocalOnBreak)
                    {
                        rbtOtroOnbreak.IsChecked   = true;
                        txtValorArriendoLocal.Text = (((Cenas)evento).ValorArriendo).ToString();
                    }
                    else
                    {
                        rbtOtroCliente.IsChecked = true;
                    }
                }
            }
        }
Exemplo n.º 19
0
        private void CheckValorBase(object sender, EventArgs e)
        {
            int personalAdicional;

            try
            {
                personalAdicional = int.Parse(txt_personalAdc.Text);
            }
            catch (Exception)
            {
                personalAdicional    = 0;
                txt_personalAdc.Text = "0";
            }
            int asistentes;

            try
            {
                asistentes = string.IsNullOrEmpty(txt_asistentes.Text) == false?Convert.ToInt32(txt_asistentes.Text) : 0;
            }
            catch (Exception)
            {
                asistentes          = 0;
                txt_asistentes.Text = "0";
            }

            string selectedModalidad = (string)cmb_modalidadEvento.SelectedValue;

            ModalidadServicio modalidad = new ModalidadServicio
            {
                IdModalidad = selectedModalidad
            };

            modalidad.Read();
            double   valorBase = modalidad.ValorBase;
            int      musica;
            Cocktail cocktail = new Cocktail();

            try
            {
                cocktail.IdTipoAmbientacion = (int)cmb_AmbientacionCocktail.SelectedValue;
            }
            catch (Exception)
            {
                cocktail.IdTipoAmbientacion = 10;
            }


            cocktail.Numero = "";

            if (cmb_AmbientacionCocktail.SelectedIndex == -1)
            {
                cocktail.Ambientacion = false;
            }
            else
            {
                cocktail.Ambientacion = true;
            }
            if (MusicaAmbiental.IsChecked == true)
            {
                cocktail.MusicaAmbiental = true;
                musica = 1;
            }
            else
            {
                cocktail.MusicaAmbiental = false;
                musica = 0;
            }
            if (MCliente.IsChecked == true)
            {
                cocktail.MusicaCliente = true;
                musica = 1;
            }
            else
            {
                cocktail.MusicaCliente = false;
                musica = 0;
            }
            int   local;
            Cenas cenas = new Cenas();

            try
            {
                cenas.IdTipoAmbientacion = (int)cmb_AmbientacionCenas.SelectedValue;
            }
            catch (Exception)
            {
                cenas.IdTipoAmbientacion = 10;
            }

            cenas.Numero = "";
            try
            {
                cenas.ValorArriendo = int.Parse(txtValorArriendo.Text);
            }
            catch (Exception)
            {
                cenas.ValorArriendo = 0;
            }


            if (LocalOnbreak.IsChecked == true)
            {
                cenas.LocalOnBreak = true;
                local = 1;
            }
            else
            {
                cenas.LocalOnBreak = false;
                local = 0;
            }
            if (OtroOnbreak.IsChecked == true)
            {
                local = 1;
                cenas.OtroLocalOnbreak = true;
            }
            else
            {
                cenas.OtroLocalOnbreak = false;
                local = 0;
            }
            if (OtroCliente.IsChecked == true)
            {
                local = 1;
                cenas.OtroLocalOnbreak = true;
            }
            else
            {
                cenas.OtroLocalOnbreak = false;
                local = 0;
            }
            if (MAmbientalCenas.IsChecked == true)
            {
                cenas.MusicaAmbiental = true;
                musica = 1;
            }
            else
            {
                cenas.MusicaAmbiental = false;
                musica = 0;
            }
            TipoEvento evento = new TipoEvento();

            switch (cmb_tipo.SelectedValue)
            {
            case 10:
                evento = evento.ReadEvento(10);
                IValorizador valorizador = new ValorizadorCoffeBreak();
                txt_valorTotal.Text = valorizador.Valorizador(personalAdicional, valorBase, asistentes).ToString();
                break;

            case 20:
                evento              = evento.ReadEvento(20);
                valorizador         = new ValorizarCocktaill();
                txt_valorTotal.Text = valorizador.Valorizador2(personalAdicional, valorBase, asistentes, (int)cmb_AmbientacionCocktail.SelectedValue, musica).ToString();
                break;

            case 30:
                evento              = evento.ReadEvento(30);
                valorizador         = new ValorizadorCena();
                txt_valorTotal.Text = valorizador.Valorizador3(personalAdicional, valorBase, asistentes, (int)cmb_AmbientacionCocktail.SelectedValue, musica, local).ToString();
                break;
            }
        }
Exemplo n.º 20
0
        private void Btn_actulizar_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(txt_numeroComtrato.Text))
            {
                MessageBox.Show("El numero de contrato no puede estar vacio", "Error", MessageBoxButton.OK);
                return;
            }
            Contrato contrato = new Contrato();

            contrato.Numero = txt_numeroComtrato.Text;
            if (date_inicio.SelectedDate == null ||
                date_inicio.SelectedDate.Value == null ||
                date_fin.SelectedDate == null ||
                date_fin.SelectedDate.Value == null ||
                string.IsNullOrEmpty(txt_rutMostrado.Text) ||
                string.IsNullOrEmpty(txt_valorTotal.Text) ||
                cmb_tipo.SelectedValue == null ||
                cmb_modalidadEvento.SelectedValue == null ||
                string.IsNullOrEmpty(txt_observaciones.Text))
            {
                MessageBox.Show("Tiene que llenar todos los campos para ingresar un Contrato", "Error", MessageBoxButton.OK);
                return;
            }
            if (date_inicio.SelectedDate.Value < DateTime.Today)
            {
                MessageBox.Show("La Fecha de inicio debe ser posterior a la creacion del Contrato", "Error", MessageBoxButton.OK);
                return;
            }
            if (date_fin.SelectedDate.Value < date_inicio.SelectedDate.Value)
            {
                MessageBox.Show("La Fecha de termino debe ser posterior a la fecha de Inicio del evento", "Error", MessageBoxButton.OK);
                return;
            }
            if (date_fin.SelectedDate > date_inicio.SelectedDate.Value.AddDays(1))
            {
                MessageBox.Show("La Fecha de termino debe ser almenos 24hrs posterior al inicio del evento", "Error", MessageBoxButton.OK);
                return;
            }
            ModalidadServicio mod = new ModalidadServicio()
            {
                IdModalidad = (string)cmb_modalidadEvento.SelectedValue
            };

            mod.Read();


            int asistentes = 0;

            try
            {
                asistentes = string.IsNullOrEmpty(txt_asistentes.Text) == false?Convert.ToInt32(txt_asistentes.Text) : 0;
            }
            catch (Exception)
            {
                asistentes = -1;
            }
            int personal = 0;

            try
            {
                personal = int.Parse(txt_personalAdc.Text);
            }
            catch (Exception)
            {
                personal = -1;
            }
            if (txt_asistentes.Text == string.Empty)
            {
                MessageBox.Show("Debe ingresar asistentes", "Error", MessageBoxButton.OK);
                return;
            }
            else if (int.Parse(txt_asistentes.Text) <= 0)
            {
                MessageBox.Show("Debe ingresar almenos 1 asistente", "Error", MessageBoxButton.OK);
                return;
            }
            else if (int.Parse(txt_asistentes.Text) > 300)
            {
                MessageBox.Show("Los asistentes no pueden ser mayores a 300", "Error", MessageBoxButton.OK);
                return;
            }
            if (int.Parse(txt_personalAdc.Text) < 0)
            {
                MessageBox.Show("El personal adicional debe ser mayor a 1", "Error", MessageBoxButton.OK);
                return;
            }
            else if (int.Parse(txt_personalAdc.Text) == 1)
            {
                MessageBox.Show("El personal adicional debe ser mayor a 1", "Error", MessageBoxButton.OK);
                return;
            }
            else if (int.Parse(txt_personalAdc.Text) > 10)
            {
                MessageBox.Show("El personal adicional maximo puede ser 10", "Error", MessageBoxButton.OK);
                return;
            }

            contrato.Creacion           = System.DateTime.Now;
            contrato.RutCliente         = txt_rutMostrado.Text;
            contrato.IdModalidad        = (string)cmb_modalidadEvento.SelectedValue;
            contrato.IdTipoEvento       = (int)cmb_tipo.SelectedValue;
            contrato.FechaHoraInicio    = date_inicio.SelectedDate.Value;
            contrato.FechaHoraTermino   = date_fin.SelectedDate.Value;
            contrato.Asistentes         = int.Parse(txt_asistentes.Text);
            contrato.PersonalAdicional  = int.Parse(txt_personalAdc.Text);
            contrato.Realizado          = false;
            contrato.ValorTotalContrato = int.Parse(txt_valorTotal.Text);
            contrato.Observaciones      = txt_observaciones.Text;

            if (contrato.Update())
            {
                MessageBox.Show("Contrato actualizado correctamente ", "Info", MessageBoxButton.OK);
                LimpiarControles();
            }
            else
            {
                MessageBox.Show("El contrato no pudo ser actualizado", "Error", MessageBoxButton.OK);
                return;
            }
            if (cmb_modalidadEvento.SelectedIndex == 0 || Vegetariana.IsChecked == true)
            {
                CoffeBreak.Numero      = Contrato.CrearNumeroContrato();
                CoffeBreak.Vegetariana = true;
                CoffeBreak.Create();
            }
            if (cmb_modalidadEvento.SelectedIndex == 0 || Vegetariana.IsChecked == false)
            {
                CoffeBreak.Numero      = Contrato.CrearNumeroContrato();
                CoffeBreak.Vegetariana = false;
                CoffeBreak.Create();
            }
            if (cmb_modalidadEvento.SelectedIndex == 1 || MusicaAmbiental.IsChecked == true)
            {
                Cockctail.Numero             = Contrato.CrearNumeroContrato();
                Cockctail.MusicaAmbiental    = true;
                Cockctail.IdTipoAmbientacion = 10;
                Cockctail.Ambientacion       = true;
                Cockctail.MusicaCliente      = true;
                Cockctail.Create();
            }
            if (cmb_tipo.SelectedIndex == 2)
            {
                Cenas.Numero             = Contrato.CrearNumeroContrato();
                Cenas.IdTipoAmbientacion = int.Parse(cmb_AmbientacionCocktail.SelectedValue.ToString());
                Cenas.MusicaAmbiental    = true;
                if (LocalOnbreak.IsChecked == true)
                {
                    Cenas.LocalOnBreak     = true;
                    Cenas.OtroLocalOnbreak = false;
                }
                if (OtroCliente.IsChecked == true)
                {
                    Cenas.LocalOnBreak     = false;
                    Cenas.OtroLocalOnbreak = true;
                }
                Cenas.ValorArriendo = int.Parse(txtValorArriendo.Text);
                Cenas.Create();;
            }
        }
Exemplo n.º 21
0
        private void btn_guardar_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Cliente           cli    = new Cliente();
                ModalidadServicio modd   = new ModalidadServicio();
                TipoEvento        Tipeve = new TipoEvento();
                Contrato          contr  = new Contrato();
                DateTime          Termino;
                Double            ValorTotalContrato;
                String            Numero   = txt_contrato.Text;
                DateTime          Creacion = DateTime.Now;
                cli.RutCliente = txt_buscarporrut.Text;
                DateTime FechaHoraInicio   = (DateTime)dpkFechaInicio.SelectedDate;
                DateTime FechaHoraTermino  = (DateTime)dpkFechaTermino.SelectedDate;
                int      Asistentes        = int.Parse(txt_cantasis.Text);
                int      PersonalAdicional = int.Parse(txt_personalextra.Text);
                if (rbs_yes.IsChecked == true)
                {
                    contr.Realizado = false;
                    Termino         = dpkFechaTermino.SelectedDate.Value;
                }
                else
                {
                    contr.Realizado = true;
                    Termino         = dpkFechaTermino.SelectedDate.Value;
                }

                int personalAdicional = int.Parse(txt_personalextra.Text);
                try
                {
                    if (lbl_valortotal != null)
                    {
                        ValorTotalContrato = Double.Parse(lbl_valortotal.Content.ToString());
                    }
                    else
                    {
                        ValorTotalContrato = 0;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("No se puede guardar vacio el valor total" + ex);
                    throw new ArgumentException();
                }

                String   Observaciones = txt_observaciones.Text;
                Contrato Contrat       = new Contrato();

                Contrat.Numero             = Numero;
                Contrat.Creacion           = Creacion;
                Contrat.Termino            = Termino;
                Contrat.RutCliente         = cli.RutCliente;
                Contrat.IdModalidad        = ((ComboModalidadServicio)cb_ModalidadServicio.SelectedItem).IdModalidad;
                Contrat.IdTipoEvento       = ((ComboTipoEvento)cb_tipoevento.SelectedItem).id;
                Contrat.FechaHoraInicio    = FechaHoraInicio;
                Contrat.FechaHoraTermino   = FechaHoraTermino;
                Contrat.Asistentes         = Asistentes;
                Contrat.PersonalAdicional  = personalAdicional;
                Contrat.ValorTotalContrato = ValorTotalContrato;
                Contrat.Observaciones      = Observaciones;
                Contrat.Realizado          = false;
                Boolean resp = Contrat.Guardar();
                if (resp == true)
                {
                    MessageBox.Show("Se ha guardado el contrato exitosamente");
                }
                else
                {
                    MessageBox.Show("Operacion cancelada");
                }
            }
            catch (Exception exe)
            {
                MessageBox.Show("¡No Grabo!. Asegurece que esten todos los parametros en orden ");
            }
        }
Exemplo n.º 22
0
        private void popCrearContrato_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Contrato          contrato          = new Contrato();
                ModalidadServicio modalidadServicio = new ModalidadServicio();

                contrato.Numero = DateTime.Now.ToString("ddMMyyyyHHmm");


                //guardamos fecha de creacion de contrato con formato dia/mes/año
                string fechaCreacion = DateTime.Now.ToString("dd/MM/yyyy");
                contrato.Creacion = DateTime.Parse(fechaCreacion);

                //guardamos la fecha de creacion en fecha termino para cuando el usuario termne el contrato esta fecha sea reemplazada
                string fechaTerminoUsuario = DateTime.Now.ToString("dd/MM/yyyy");
                contrato.Termino = DateTime.Parse(fechaTerminoUsuario);

                //Guardamos rut sin puntos ni espacios
                string rut = txtRutClienteContrato.Text.Replace(".", "");
                rut = rut.Replace(" ", "");
                contrato.RutCliente = rut;

                contrato.IdTipoEvento = int.Parse(cboTipoEvento.SelectedValue.ToString());
                contrato.IdModalidad  = cboTipoEventoNombre.SelectedValue.ToString().Trim();

                //guardamos la fecha y hora de inicio del evento
                string fechaInicio = fechaInicioPicker.SelectedDate.Value.ToString("dd/MM/yyyy");
                string horaInicio  = horaInicioPicker.SelectedTime.Value.ToString("HH:mm");
                contrato.FechaHoraInicio = DateTime.Parse(fechaInicio + " " + horaInicio);

                //guardamos la fecha y hora del termino del evento
                string fechaTermino = fechaTerminoPicker.SelectedDate.Value.ToString("dd/MM/yyyy");
                contrato.FechaHoraTermino = horaTerminoPicker.SelectedTime.Value;

                contrato.Asistentes        = int.Parse(txtAsistentes.Text.ToString());
                contrato.PersonalAdicional = int.Parse(txtPersonalAdicional.Text.ToString());

                contrato.Observaciones = txtObservaciones.Text.ToString();
                contrato.Realizado     = true;

                //calculamos valor del contrato para guardarlo
                string e_Calculo          = cboTipoEventoNombre.SelectedValue.ToString();
                int    cantidadAsistentes = int.Parse(txtAsistentes.Text.ToString());
                int    personalAdicional  = int.Parse(txtPersonalAdicional.Text.ToString());
                contrato.ValorTotalContrato = Valorizador.CalculoEvento(e_Calculo, cantidadAsistentes, personalAdicional);

                if (this.ContratoCollection.CrearContrato(contrato))
                {
                    txtNumeroDeContrato.Text = DateTime.Now.ToString("ddMMyyyyHHmm");
                    MessageBox.Show("Contrato creado correctamente");
                    dgListaContratos.ItemsSource = null;
                    dgListaContratos.ItemsSource = ContratoCollection.ReadAll();
                }
                else
                {
                    MessageBox.Show("Contrato no se pudo crear");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Error al crear contrato");
            }
        }
Exemplo n.º 23
0
        private async void TerminarContrato()
        {
            try
            {
                BuscarContrato();
                if (string.IsNullOrWhiteSpace(txtNumeroContrato.Text))
                {
                    txtNumeroContrato.Focus();
                    return;
                }
                else
                {
                    MessageDialogResult result = await this.ShowMessageAsync("Pregunta:", "Estas seguro que deseas eliminar el contrato seleccionado?", MessageDialogStyle.AffirmativeAndNegative);

                    if (result == MessageDialogResult.Affirmative)
                    {
                        if (cmbTipoEvento.SelectedIndex == -1)
                        {
                            await this.ShowMessageAsync("Error:", "Debes ingresar un tipo de evento");

                            cmbTipoEvento.Focus();
                            return;
                        }

                        string txtAs  = txtAsistentes.Text.Trim();
                        string txtPer = txtPersonalAdicional.Text.Trim();

                        if (string.IsNullOrEmpty(txtAs) && string.IsNullOrEmpty(txtPer))
                        {
                            txtAsistentes.Text        = "0";
                            txtPersonalAdicional.Text = "0";
                        }
                        else if (string.IsNullOrEmpty(txtPer))
                        {
                            txtPersonalAdicional.Text = "0";
                        }
                        else if (string.IsNullOrEmpty(txtAs))
                        {
                            txtAsistentes.Text = "0";
                        }
                        double valorBaseTipoEvento = 0;
                        int    personalBase        = 0;
                        if (cmbTipoEvento.SelectedIndex > -1)
                        {
                            ModalidadServicio m = (ModalidadServicio)cmbModalidad.SelectedItem;

                            valorBaseTipoEvento        = m.ValorBase;
                            personalBase               = m.PersonalBase;
                            cmbModalidad.SelectedValue = m.IdModalidad;
                        }

                        double recargoAsistentes = double.Parse(txtAsistentes.Text);
                        double recargoPersonal   = double.Parse(txtPersonalAdicional.Text) + personalBase;

                        DateTime fechaTermino   = DateTime.Now;
                        DateTime fActual        = (DateTime)dtpFechaCreacion.SelectedDate;
                        string   numeroContrato = txtNumeroContrato.Text;
                        string   rutCliente     = txtRutCliente.Text;
                        string   Modalidad      = (string)cmbModalidad.SelectedValue;
                        int      TipoEvento     = (int)cmbTipoEvento.SelectedValue;
                        DateTime Finicio        = (DateTime)dtpFechaInicio.SelectedDate;
                        DateTime Ftermino2      = (DateTime)dtpFechaTermino1.SelectedDate;
                        int      asistentes     = int.Parse(txtAsistentes.Text);
                        int      personalAd     = int.Parse(txtPersonalAdicional.Text);
                        bool     realizado      = false;
                        realizado = true;

                        double   valor         = val.calcularValorEvento(valorBaseTipoEvento, recargoAsistentes, recargoPersonal, personalBase);;
                        string   observaciones = txtObservaciones.Text;
                        Contrato contrato      = new Contrato
                        {
                            Numero             = numeroContrato,
                            Creacion           = fActual,
                            Termino            = fechaTermino,
                            RutCliente         = rutCliente,
                            IdModalidad        = Modalidad,
                            IdTipoEvento       = TipoEvento,
                            FechaHoraInicio    = Finicio,
                            FechaHoraTermino   = Ftermino2,
                            Asistentes         = asistentes,
                            PersonalAdicional  = personalAd,
                            Realizado          = realizado,
                            ValorTotalContrato = valor,
                            Observaciones      = observaciones
                        };
                        sc.UpdateEntity(contrato);
                        await this.ShowMessageAsync("Correcto:", "Contrato terminado satifactoriamente");

                        LimpiarControles();
                    }
                }
            }
            catch (Exception ex)
            {
                await this.ShowMessageAsync("Error:", "Se ha producido un error inesperado.\n" + ex.Message);
            }
        }
Exemplo n.º 24
0
        //BUSCAR CONTRATO de traspasar
        private async void btnBuscarContrato_Click_2(object sender, RoutedEventArgs e)
        {
            try
            {
                Contrato c    = new Contrato();
                Cliente  clie = new Cliente();
                c.Numero = txtNumero.Text;
                bool buscar = c.Buscar();
                if (c.Realizado == true)
                {
                    rbSi.IsChecked = false;
                    rbNo.IsChecked = true;
                    //BLOQUEAR EDITAR EL CONTRATO
                    txtNumero.IsEnabled        = false;
                    txtBuscarCliente.IsEnabled = false;
                    txtNumero.IsEnabled        = false;
                    //Convert.ToDateTime(txtNumero).ToString("dd/MM/yyyy HH:mm")
                    txtNumero.IsEnabled            = false;
                    txtBuscarCliente.IsEnabled     = false;
                    lblNumero.IsEnabled            = false;
                    cbModalidad.IsEnabled          = false;
                    cboTipo.IsEnabled              = false;
                    txtObservaciones.IsEnabled     = false;
                    txtNumeroAsistentes.IsEnabled  = false;
                    txtPersonalAdicional.IsEnabled = false;
                    dpFechaInicio1.bloquear();
                    dpFechaTermino.bloquear();
                }
                else
                {
                    rbSi.IsChecked = true;
                    rbNo.IsChecked = false;
                    //BLOQUEAR EDITAR EL CONTRATO
                    txtNumero.IsEnabled        = true;
                    txtBuscarCliente.IsEnabled = true;
                    txtNumero.IsEnabled        = true;
                    //Convert.ToDateTime(txtNumero).ToString("dd/MM/yyyy HH:mm")
                    txtNumero.IsEnabled            = true;
                    txtBuscarCliente.IsEnabled     = true;
                    lblNumero.IsEnabled            = true;
                    cbModalidad.IsEnabled          = true;
                    cboTipo.IsEnabled              = true;
                    txtObservaciones.IsEnabled     = true;
                    txtNumeroAsistentes.IsEnabled  = true;
                    txtPersonalAdicional.IsEnabled = true;
                }


                if (buscar)
                {
                    txtBuscarCliente.Text = c.RutCliente;
                    //dpFechaInicio.Text = c.FechaHoraInicio.ToString();
                    //dpFechaFinEvento.Text = c.FechaHoraTermino.ToString();
                    //txtHoraInicio.Text = c.HoraInicio.ToString();
                    //txtMinutoInicio.Text = c.MinutoInicio.ToString();
                    //txtHoraTermino.Text = c.HoraTermino.ToString();
                    //txtMinutoTermino.Text = c.MinutoTermino.ToString();

                    dpFechaInicio1.datos(c.FechaHoraInicio);
                    dpFechaTermino.datos(c.FechaHoraTermino);

                    dpFechaInicio1.datos(c.FechaHoraInicio);
                    dpFechaTermino.datos(c.FechaHoraTermino);

                    txtNumeroAsistentes.Text  = c.Asistentes.ToString();
                    txtPersonalAdicional.Text = c.PersonalAdicional.ToString();

                    TipoEvento tip = new TipoEvento();
                    tip.Id = c.IdTipoEvento;
                    tip.Read();
                    cboTipo.Text = tip.Descripcion;//Cambiar a descripción

                    //PASAR nombre modalidad no id
                    ModalidadServicio mod = new ModalidadServicio();
                    mod.Id = c.IdModalidad;
                    mod.Read();
                    cbModalidad.Text = mod.Nombre;//Cambiar a descripción

                    /*cboTipo.Text = c.IdTipoEvento.ToString();
                     * cbModalidad.Text = c.IdModalidad.ToString();*/

                    // cbModalidad.Text = c.IdModalidad;
                    txtObservaciones.Text       = c.Observaciones;
                    lblNumero.Content           = txtNumero.Text;     //IGUALAR CAMPOS
                    lblNombreCliente.Visibility = Visibility.Visible; //aparecer label
                    lblTotal.Content            = calculo();
                    btnModificar.Visibility     = Visibility.Visible;
                    btnTerminar.Visibility      = Visibility.Visible;

                    btnCrear.Visibility = Visibility.Hidden;//Desaparece el btn crear


                    lblNombreCliente.Content = clie.NombreContacto;
                }
                else
                {
                    await this.ShowMessageAsync("Mensaje:",
                                                string.Format("Contrato no encontrado"));

                    /*MessageBox.Show("Contrato no Encontrado");*/
                }
            }
            catch (Exception ex)
            {
                await this.ShowMessageAsync("Mensaje:",
                                            string.Format("Error al Buscar"));

                /*MessageBox.Show("Error al buscar");*/
                Logger.Mensaje(ex.Message);
            }
        }