Esempio n. 1
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            if (ModeField.Value == "New")
            {
                Data2.Class.Struct_Supplier t_Supplier = new Data2.Class.Struct_Supplier(
                    Conversion.ObtenerLocal(UserId), txtNombre.Text,
                    txtNombreFantasia.Text,
                    int.Parse(cmbPais.SelectedValue),
                    int.Parse(cmbProvincia.SelectedValue),
                    txtLocalidad.Text,
                    txtDomicilio.Text,
                    txtTelefono1.Text,
                    txtTelefono2.Text,
                    txtMailContacto.Text,
                    txtMailPedidos.Text,
                    int.Parse(cmbCategoríaAFIP.SelectedValue),
                    txtIngresosBrutos.Text,
                    int.Parse(cmbTipoDocumento.SelectedValue),
                    txtNumeroDocumento.Text,
                    txtDetalle.Text);
                t_Supplier.Guardar();

                RedirectToBase();
            }

            if (ModeField.Value == "Edit")
            {
                Data2.Class.Struct_Supplier t_SP = new Data2.Class.Struct_Supplier(Conversion.ObtenerLocal(UserId), int.Parse(SupplierIdField.Value));
                t_SP.Nombre          = txtNombre.Text;
                t_SP.NombreFantasia  = txtNombreFantasia.Text;
                t_SP.Pais            = int.Parse(cmbPais.SelectedValue);
                t_SP.Provincia       = int.Parse(cmbProvincia.SelectedValue);
                t_SP.Localidad       = txtLocalidad.Text;
                t_SP.Domicilio       = txtDomicilio.Text;
                t_SP.Telefono1       = txtTelefono1.Text;
                t_SP.Telefono2       = txtTelefono2.Text;
                t_SP.MailContacto    = txtMailContacto.Text;
                t_SP.MailPedidos     = txtMailPedidos.Text;
                t_SP.IdCategoriaAfip = int.Parse(cmbCategoríaAFIP.SelectedValue);
                t_SP.IngresosBrutos  = txtIngresosBrutos.Text;
                t_SP.IdTipoDocumento = int.Parse(cmbTipoDocumento.SelectedValue);
                t_SP.NroDocumento    = txtNumeroDocumento.Text;
                t_SP.Detalle         = txtDetalle.Text;
                t_SP.Actualizar(Conversion.ObtenerLocal(UserId));
                ModeField.Value       = "None";
                SupplierIdField.Value = "0";
                RedirectToBase();
            }
        }