private void CmbxEstado_SelectedValueChanged(object sender, EventArgs e) { if (CmbxEstado.SelectedValue != null) { int Estado = Convert.ToInt32(CmbxEstado.SelectedValue); DtRegistros = Consulta.MunicipioListCombo(Estado); if (DtRegistros.Rows.Count > 0) { if (Estado == 0) { if (CmbxMunicipio.DataSource != null) { CmbxMunicipio.SelectedIndex = 0; } CmbxMunicipio.Enabled = false; } else { CmbxMunicipio.Enabled = true; CmbxMunicipio.DisplayMember = "Nombre"; CmbxMunicipio.ValueMember = "IdMunicipio"; CmbxMunicipio.DataSource = DtRegistros; } } CmbColonias.SelectedValue = 0; CmbColonias.Enabled = false; TxtCodigoPostal.Clear(); } }
private void LimpiaCajasTextoBox() { //CmbPuesto.SelectedIndex=0; //CmbEstatus.SelectedIndex = 0; TxtNomina.Clear(); TxtId_Usuario.Clear(); TxtNombres.Clear(); TxtApMaterno.Clear(); TxtApPaterno.Clear(); TxtRFC.Clear(); TxtCURP.Clear(); TxtTelefono.Clear(); TxtCelular.Clear(); TxtEmail.Clear(); TxtCalle.Clear(); TxtNumInterno.Clear(); TxtNumExterno.Clear(); TxtEntreCalles.Clear(); TxtColonia.Clear(); TxtCodigoPostal.Clear(); TxtEstado.Clear(); TxtMunicipio.Clear(); TxtPais.Clear(); DtpFechaNacimiento.MaxDate = DateTime.Now.AddYears(-18); PtbxFotoPerfil.Image = Properties.Resources.LgoEsferaBlancTrasp; CmbxPais.SelectedValue = 0; CmbAreas.SelectedValue = 0; CmbEstatus.SelectedValue = 0; CmbEmpresa.SelectedValue = 0; }
private void Limpiar() { CmbxPais.SelectedValue = 0; CmbxEstado.DataSource = null; CmbxMunicipio.DataSource = null; TxtCodigoPostal.Clear(); TxtColonia.Clear(); TxtDescripcion.Clear(); }
void guardarInmueble() { try { string Tipo = string.Empty; if (RadiotipoE.Checked) { Tipo = "1"; } else if (RadiotipoP.Checked) { Tipo = "2"; } else if (RadiotipoL.Checked) { Tipo = "3"; } else if (RadiotipoO.Checked) { Tipo = "4"; } else if (RadiotipoF.Checked) { Tipo = "5"; } using (SqlConnection sqlCon = new SqlConnection(connectionString)) { sqlCon.Open(); string query = "INSERT INTO inmueble (nombre,codigo_postal,direccion,precio,tipo_inmueble_id) VALUES (@nombre,@codigo_postal,@direccion,@precio,@tipo_inmueble_id)"; SqlCommand sqlCmd = new SqlCommand(query, sqlCon); sqlCmd.Parameters.AddWithValue("@nombre", (TxtNombreInmueble.FindControl("TxtNombreInmueble") as TextBox).Text.Trim()); sqlCmd.Parameters.AddWithValue("@codigo_postal", (TxtCodigoPostal.FindControl("TxtCodigoPostal") as TextBox).Text.Trim()); sqlCmd.Parameters.AddWithValue("@direccion", (TxtDireccionInmueble.FindControl("TxtDireccionInmueble") as TextBox).Text.Trim()); sqlCmd.Parameters.AddWithValue("@precio", (TxTPrecio.FindControl("TxTPrecio") as TextBox).Text.Trim()); sqlCmd.Parameters.AddWithValue("@tipo_inmueble_id", Tipo); sqlCmd.ExecuteNonQuery(); lblSuccessMessage.Text = "Registro Con Exito"; lblSuccessMessage.Visible = true; lblErrorMessage.Text = ""; lblErrorMessage.Visible = true; sqlCmd.Parameters.Clear(); } } catch (Exception ex) { lblSuccessMessage.Text = ""; lblErrorMessage.Text = ex.Message; } }
private void LimpiarRegistros() { NombreEmpresa = null; TxtNombreEmpresa.Clear(); RazonSocial = null; TxtRazonSocial.Clear(); Direccion = null; TxtDireccion.Clear(); Id_Impuesto = 0; CmbImpuesto.SelectedValue = 0; Id_Moneda = 0; CmbMoneda.SelectedValue = 0; RdbSI.Checked = false; RdbNO.Checked = false; Trabaja_Impuesto = null; ChkCodigoBarras.Checked = false; Modo_Busqueda = null; ChkTeclado.Checked = false; Carpeta_Copia_Seguridad = null; TxtRutaCopiaSeguridad.Clear(); Correo_EnvioReportes = null; TxtCorreoEmpresa.Clear(); Ultima_Fecha_Copia_Seguridad = null; Ultima_Fecha_Copia_Date = DateTime.Now; Frecuencia_Copias = 0; Id_Estatus = 0; Tipo_Empresa = null; Redondeo_Total = null; PctbxLogo.Image = Properties.Resources.LgoEsferaBlancTrasp; Calle = null; TxtCalle.Clear(); Numero_Interno = null; TxtNumInterno.Clear(); Numero_Externo = null; TxtNumExterno.Clear(); Entre_Calles = null; TxtEntreCalles.Clear(); Id_Colonia = 0; //CmbColonias.SelectedValue=0; Codigo_Postal = 0; TxtCodigoPostal.Clear(); Id_Municipio = 0; //CmbxMunicipio.SelectedValue=0; Id_Estado = 0; //Convert.ToInt32(CmbxEstado.SelectedValue); Id_Pais = 0; CmbPais.SelectedValue = 0; Direccion = null; }
public bool ValidarGuardar() { if (TxtNumeroIdentificacion.Text == "") { TxtNumeroIdentificacion.Focus(); return(false); } else { if (TxtNombreCorto.Text == "") { TxtNombreCorto.Focus(); return(false); } else { if (TxtNombreExtendido.Text == "") { TxtNombreExtendido.Focus(); return(false); } else { if (TxtDireccion.Text == "") { TxtDireccion.Focus(); return(false); } else { if (TxtTelefono.Text == "") { TxtTelefono.Focus(); return(false); } else { if (CboIdentificacion.SelectedIndex < 0) { CboIdentificacion.Focus(); return(false); } else { if (CboIdentificacion.SelectedIndex < 0) { CboIdentificacion.Focus(); return(false); } else { if (TxtTelefono.Text == "") { TxtTelefono.Focus(); return(false); } else { if (TxtCorreo.Text == "") { TxtCorreo.Focus(); return(false); } else { if (TxtCodigoPostal.Text == "") { TxtCodigoPostal.Focus(); return(false); } else { return(true); } } } } } } } } } } }
private bool ValidarCampos() { if (Editar) { if (IdSucursal == 0) { Soporte.MsgError("Seleccione un registro al que desea Actualizar."); TxtNombre.Focus(); return(false); } } if (string.IsNullOrEmpty(TxtNombre.Text) || TxtNombre.Text == "0") { Soporte.MsgError("Ingrese Nombre de la Sucursal"); TxtNombre.Focus(); return(false); } if (string.IsNullOrEmpty(TxtTelefono.Text) || TxtTelefono.Text == "0") { Telefono = "Registro Pendiente"; } if (string.IsNullOrEmpty(TxtCorreo.Text) || TxtCorreo.Text == "0") { Correo = "*****@*****.**"; } else { if (Soporte.ValidarMail(TxtCorreo.Text) == false) { Soporte.MsgError("El correo no cuenta con el Formato correcto"); TxtCorreo.Focus(); TxtCorreo.SelectAll(); return(false); } } if (CmbEmpresa.SelectedIndex == 0) { Soporte.MsgError("Seleccione una empresa al que pertenecera la Sucursal"); CmbEmpresa.Focus(); CmbEmpresa.SelectAll(); return(false); } if (CmbxPais.SelectedIndex == 0) { Soporte.MsgError("Seleccione un Pais"); CmbxPais.Focus(); CmbxPais.SelectAll(); return(false); } if (CmbxEstado.SelectedIndex == 0) { Soporte.MsgError("Seleccione un Estado"); CmbxEstado.Focus(); CmbxEstado.SelectAll(); return(false); } if (CmbxMunicipio.SelectedIndex == 0) { Soporte.MsgError("Seleccione un Municipio"); CmbxMunicipio.Focus(); CmbxMunicipio.SelectAll(); return(false); } if (CmbColonias.SelectedIndex == 0) { Soporte.MsgError("Seleccione una Colonia"); CmbColonias.Focus(); CmbColonias.SelectAll(); return(false); } if (TxtCodigoPostal.TextLength < 4) { Soporte.MsgError("Ingrse un Codigo Postal Valido."); TxtCodigoPostal.Focus(); return(false); } if (TxtCalle.TextLength < 5) { Soporte.MsgError("Ingrse una calle valido"); TxtCalle.Focus(); return(false); } if (string.IsNullOrEmpty(TxtEntreCalles.Text) || TxtEntreCalles.Text == "0") { Entre_Calles = "Sin Registro"; } if (string.IsNullOrEmpty(TxtNumExterno.Text) || TxtNumExterno.Text == "0") { Numero_Externo = "SIN NUMERO"; } if (string.IsNullOrEmpty(TxtNumInterno.Text) || TxtNumInterno.Text == "0") { Numero_Interno = "SIN NUMERO"; } return(true); }