Ejemplo n.º 1
0
        public static bool GuardarInfraestructuraApartamento(Model.Infraestructura_Apartamento infraestructuraApartamento)
        {
            string response = ServicesManager.Instance.ServiceClient.GuardarInfraestructuraApartamento(infraestructuraApartamento);

            if (response != "")
            {
                infraestructuraApartamento.Id = response;
                ListInfraestructuraApartament.Add(infraestructuraApartamento);
                return(true);
            }
            return(false);
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Button      b_ok            = sender as Button;
            ListBox     lbxInfraDetalle = currentExpander.FindName("lbx_childExpander") as ListBox;
            List <Grid> temp            = new List <Grid>();

            HelpContentVisual.GetListChild <Grid>(lbxInfraDetalle, temp, "grid");
            Grid     gridfound     = temp.Find(G => G.Tag.ToString() == b_ok.Tag.ToString());
            CheckBox checkSelected = gridfound.FindName("chbx_DetalleInfra") as CheckBox;

            if (!(bool)checkSelected.IsChecked)
            {
                MessageBox.Show("Selecione un opcion");
                return;
            }

            ComboBox     combo = gridfound.FindName("cbx_Numbers") as ComboBox;
            ComboBoxItem elem  = combo.SelectedValue as ComboBoxItem;

            if (elem == null)
            {
                MessageBox.Show("Selecione una cantidad", "", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return;
            }

            var containerItem = lbxInfraDetalle.FindName("Grid_ContainerItem");

            foreach (Model.Infraestructura_Detalle infra in lbxInfraDetalle.Items)
            {
                if (b_ok.Tag.ToString() == infra.Id)
                {
                    _infraDetalleSelected = infra;
                    break;
                }
            }


            Model.Infraestructura_Apartamento nuevoInfraApartamento = new Model.Infraestructura_Apartamento();
            nuevoInfraApartamento.Id_Apartamento    = _id_Apartamento;
            nuevoInfraApartamento.Cantidad          = Convert.ToInt16(elem.Content);
            nuevoInfraApartamento.Id_Infrac_Detalle = _infraDetalleSelected.Id;
            if (LocalDataStore.GuardarInfraestructuraApartamento(nuevoInfraApartamento))
            {
                MessageBox.Show("Se guardo exitosamente", "Registro de Infraestructura", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            else
            {
                MessageBox.Show("No se guardo", "Registro de Infraestructura", MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }
        }