private void CargaCombos() { ServicioGeneralClient servicioGeneral = new ServicioGeneralClient(); var withBlock = cboEstadoNoPasaPedido; withBlock.DataSource = servicioGeneral.getEstadoActividad(1, 0); withBlock.ValueMember = "CODIGO"; withBlock.DisplayMember = "NOMBRE"; withBlock.SelectedIndex = 0; var withBlockSupera = cboEstadoSuperaCampana; withBlockSupera.DataSource = servicioGeneral.getEstadoActividad(1, 0); withBlockSupera.ValueMember = "CODIGO"; withBlockSupera.DisplayMember = "NOMBRE"; withBlockSupera.SelectedIndex = 0; var withBlockSuperaPedido = cboEstadoSuperaPedido; withBlockSuperaPedido.DataSource = servicioGeneral.getEstadoActividad(1, 0); withBlockSuperaPedido.ValueMember = "CODIGO"; withBlockSuperaPedido.DisplayMember = "NOMBRE"; withBlockSuperaPedido.SelectedIndex = 0; var withBlockPasaPedido = cboEstadoPasaPedido; withBlockPasaPedido.DataSource = servicioGeneral.getEstadoActividad(1, 0); withBlockPasaPedido.ValueMember = "CODIGO"; withBlockPasaPedido.DisplayMember = "NOMBRE"; withBlockPasaPedido.SelectedIndex = 0; var withBlockDtg = dtgEstadosActividad; withBlockDtg.DataSource = servicioGeneral.getEstadoActividad(3, 0); }
private void btnGrabarcliente_Click(object sender, EventArgs e) { if (validaCamposCliente()) { int intCodigoEstadoActividad = 0; ServicioGeneralClient servicioGeneral = new ServicioGeneralClient(); string strResultado; Cliente cliente = new Cliente(); if (rbnEsLider.Checked) { cliente.LIDER = true; } else { cliente.LIDER = false; } if (rbnSiCabezaGrupo.Checked) { cliente.CABEZA_GRUPO = true; } else { cliente.CABEZA_GRUPO = false; } if (rbnSiCobraflete.Checked) { cliente.COBRA_FLETE = true; } else { cliente.COBRA_FLETE = false; } if (rdbEsIngreso.Checked) { cliente.ESINGRESO = true; } else { cliente.ESINGRESO = false; } var estadoActividad = servicioGeneral.getEstadoActividad(5, 0); intCodigoEstadoActividad = estadoActividad.FirstOrDefault().CODIGO; cliente.CODIGO = intCodigoCliente; cliente.CAM_NID_INGRESO = Convert.ToInt32(cboCampanavinculacion.SelectedValue); cliente.CIU_NID = Convert.ToInt32(cboCiudad.SelectedValue); cliente.CUPO_CREDITO = Convert.ToInt32(txtCupoAsignado.Text); cliente.DEP_NID = Convert.ToInt32(cboDepto.SelectedValue); cliente.DIRECCION_DOMICILIO = txtDireccionDomicilio.Text.ToUpper(); cliente.DIRECCION_ENTREGA = txtDireccionEntrega.Text.ToUpper(); cliente.ECV_NID = Convert.ToInt32(cboEstadoCivil.SelectedValue); cliente.EMAIL = txtEmailcliente.Text.ToLower(); cliente.ESA_NID = intCodigoEstadoActividad; cliente.ESTRATO = txtEstrato.Text; cliente.FECHA_NACIMIENTO = Convert.ToDateTime(dtpFechaNacimiento.Value); cliente.FECHA_VINCULACION = Convert.ToDateTime(dtpFechaVinculacion.Value); cliente.FIN_NID = Convert.ToInt32(cboFormaIngreso.SelectedValue); cliente.FORMA_PAGO = Convert.ToString(cboFormaPago.SelectedText).ToUpper(); cliente.FPG_NID = Convert.ToInt32(cboFormaPago.SelectedValue); cliente.GEN_NID = Convert.ToInt32(cboGenero.SelectedValue); cliente.ID_REFERIDO_POR = intCodigoReferente; cliente.NUMERO_IDENTIFICACION = txtIdentificacion.Text; cliente.PAI_NID = Convert.ToInt32(cboPais.SelectedValue); cliente.PRIMER_APELLIDO = txtPrimerApellido.Text.ToUpper(); cliente.PRIMER_NOMBRE = txtPrimerNombreCliente.Text.ToUpper(); cliente.PROFESION = txtProfesion.Text.ToUpper(); cliente.REG_CID = Convert.ToString(cboRegional.SelectedValue); cliente.SEC_CID = Convert.ToString(cboSeccion.SelectedValue); cliente.SEGUNDO_APELLIDO = txtSegundoApellido.Text.ToUpper(); cliente.SEGUNDO_NOMBRE = txtSegundoNombre.Text.ToUpper(); cliente.TDO_NID = Convert.ToInt32(cboTipoDocumento.SelectedValue); cliente.TELEFONO_CELULAR = txtTelefonoCelular.Text; cliente.TELEFONO_FIJO = txtTelefonoFijo.Text; cliente.TELEFONO_OFICINA = txtTelefonoOficina.Text; cliente.ZON_CID = Convert.ToString(cboZona.SelectedValue); cliente.RAZON_BLOQUEO = string.Empty; cliente.TER_CID = "0"; cliente.TIC_NID = Convert.ToInt32(cboTipoCliente.SelectedValue); strResultado = Convert.ToString(servicioGeneral.insCliente(cliente)); if (Information.IsNumeric(strResultado)) { foreach (ReferenciaCliente referencia in ListreferenciaClienteTablas) { referencia.CODIGO_CLIENTE = Convert.ToInt32(strResultado); servicioGeneral.insReferenciasCliente(referencia); } limpiacampos(); if (Convert.ToInt32(strResultado) > 0) { MessageBox.Show("Registro creado exitosamente", "Registro", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); } else if (Convert.ToInt32(strResultado) == -1) { MessageBox.Show("Registro Actualizado exitosamente", "Actualización", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); } } else { MessageBox.Show("Error al grabar en la Base de Datos, contacte al Administrador del Sistema", "Error BD", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } } }