Ejemplo n.º 1
0
        private void getDatos(VISTA.VDialog_Sucursal vdialog, bool edit)
        {
            DataRowView Rows    = vdialog.cmbEmpresa.SelectedItem as DataRowView;
            DataRowView Rowss   = vdialog.cmbDireccion.SelectedItem as DataRowView;
            var         empresa = Rows.Row[0].ToString();
            var         direc   = Rowss.Row[0].ToString();

            vdialog.cmbEmpresa.SelectedValuePath   = empresa;
            vdialog.cmbDireccion.SelectedValuePath = direc;
            if (edit == false)
            {
                this.vosucursal.IDSUCURSAL = 0;
            }
            else
            {
                this.vosucursal.IDSUCURSAL = int.Parse(vdialog.txtIdSucursal.Text);
            }
            this.vosucursal.IDEMPRESA       = int.Parse(vdialog.cmbEmpresa.SelectedValuePath);
            this.vosucursal.NOMBRESUCURSAL  = vdialog.txtNombreSucursal.Text;
            this.vosucursal.CODIGO          = vdialog.txtCodigo.Text;
            this.vosucursal.DIRECCIONFISCAL = int.Parse(vdialog.cmbDireccion.SelectedValuePath);
            //this.vosucursal.CODIGOPOSTAL = vdialog.txtCodigoPostal.Text;
            //this.vosucursal.PAIS = vdialog.txtPais.Text;
            //this.vosucursal.MUNICIPIO = vdialog.txtMunicipio.Text;
            //this.vosucursal.COLONIA = vdialog.txtColonia.Text;
            //this.vosucursal.CALLE = vdialog.txtCalle.Text;
            //this.vosucursal.NEXTERIOR = vdialog.txtNExterior.Text;
            //this.vosucursal.NINTERIOR = vdialog.txtNInterior.Text;
            this.daosucursal = new MODELO.DAO_Sucursal(vosucursal);
        }
Ejemplo n.º 2
0
        private void btnEditar_Click(object sender, RoutedEventArgs e)
        {
            DataRowView Rows = this.vsucursal.DgvPlantilla.SelectedItem as DataRowView;

            VISTA.VDialog_Sucursal vdialog = new VISTA.VDialog_Sucursal();
            C_DialogSucursal       cdialog = new C_DialogSucursal(vdialog);

            vdialog.txtIdSucursal.Text           = Rows.Row[0].ToString();
            vdialog.cmbEmpresa.SelectedValuePath = Rows.Row[1].ToString();
            vdialog.txtNombreSucursal.Text       = Rows.Row[2].ToString();
            vdialog.txtCodigo.Text = Rows.Row[3].ToString();
            vdialog.cmbDireccion.SelectedValuePath = Rows.Row[4].ToString();
            //vdialog.txtCodigoPostal.Text = Rows.Row[4].ToString();
            //vdialog.txtPais.Text = Rows.Row[5].ToString();
            //vdialog.txtMunicipio.Text = Rows.Row[6].ToString();
            //vdialog.txtColonia.Text = Rows.Row[7].ToString();
            //vdialog.txtCalle.Text = Rows.Row[8].ToString();
            //vdialog.txtNExterior.Text = Rows.Row[9].ToString();
            //vdialog.txtNInterior.Text = Rows.Row[10].ToString();

            cdialog.FormLoad();
            if (vdialog.DialogResult == true)
            {
                getDatos(vdialog, true);
                if (daosucursal.Editar().Equals(1))
                {
                    MessageBox.Show(":)");
                    Reload();
                }
                else
                {
                    MessageBox.Show(":(");
                }
            }
        }
Ejemplo n.º 3
0
        public C_DialogSucursal(VISTA.VDialog_Sucursal vdl_sucursal)
        {
            this.vdl_sucursal = vdl_sucursal;
            daosucursal       = new MODELO.DAO_Sucursal();
            daosucursal.abrirConexion();
            this.vdl_sucursal.cmbEmpresa.Items.Clear();
            this.vdl_sucursal.cmbDireccion.Items.Clear();
            var items1 = (daosucursal.consultaEmpresa() as IListSource).GetList();
            var items2 = (daosucursal.consultaTipoDireccionFisccal() as IListSource).GetList();

            this.vdl_sucursal.cmbEmpresa.ItemsSource         = items1;
            this.vdl_sucursal.cmbDireccion.ItemsSource       = items2;
            this.vdl_sucursal.cmbEmpresa.DisplayMemberPath   = "vchNombre";
            this.vdl_sucursal.cmbEmpresa.SelectedValuePath   = "intIdClave";
            this.vdl_sucursal.cmbDireccion.DisplayMemberPath = "vchMunicipo";
            this.vdl_sucursal.cmbDireccion.SelectedValuePath = "intIdDireccion";
        }
Ejemplo n.º 4
0
        private void btnNuevo_Click(object sender, RoutedEventArgs e)
        {
            VISTA.VDialog_Sucursal vdialog = new VISTA.VDialog_Sucursal();
            C_DialogSucursal       cdialog = new C_DialogSucursal(vdialog);

            cdialog.FormLoad();
            if (vdialog.DialogResult == true)
            {
                getDatos(vdialog, false);
                if (daosucursal.Insertar().Equals(1))
                {
                    MessageBox.Show(":)");
                    Reload();
                }
                else
                {
                    MessageBox.Show(":(");
                }
            }
        }