//CARGA CONTRATOS DE UN EMPLEADO ESPECIFICO public void loadDataContract(string value) { ClearContract(); this.tabItem2.IsEnabled = !string.IsNullOrEmpty(this.tRut.Text.Trim()) == true ? true : false; List <String> estados = new List <String>(); estados.Add("VIGENTE"); estados.Add("NO VIGENTE"); string sql = "SELECT e.fecha_inicio,e.fecha_termino,e.estado," + " (SELECT c.tipo AS tipo_contrato" + " FROM personal_contrato AS pc" + " INNER JOIN personal AS p ON(p.id_personal = pc.id_personal)" + " INNER JOIN contrato AS e ON (e.id_contrato = pc.id_contrato)" + " INNER JOIN tipo_contrato AS c ON(e.tipo_contrato_id_tipo_contrato=c.id_tipo_contrato)" + " WHERE p.rut ='" + value + "') AS tipo_contrato," + " IFNULL((SELECT f.cargo AS nombre_cargo" + " FROM personal_contrato AS pc" + " INNER JOIN personal AS p ON(p.id_personal = pc.id_personal)" + " INNER JOIN contrato AS e ON (e.id_contrato = pc.id_contrato)" + " INNER JOIN cargo AS f ON(f.id_cargo = e.cargo_id_cargo)" + " WHERE p.rut = '" + value + "'),'1')AS cargo" + " FROM personal AS p" + " INNER JOIN personal_contrato AS pc ON(p.id_personal = pc.id_personal)" + " INNER JOIN contrato AS e ON (e.id_contrato = pc.id_contrato)" + " INNER JOIN cargo AS f ON(f.id_cargo = e.cargo_id_cargo)" + " WHERE p.nombre = '" + value + "' OR p.apellido ='" + value + "' OR p.rut = '" + value + "'"; string interfaces = ""; foreach (DataRow dtRow in new Clases.Consultas().QueryDB(sql).Rows) { this.lPuesto.Content = dtRow["cargo"].ToString(); interfaces = dtRow["cargo"].ToString(); this.tDateInit.Text = validacion.DateFormat(dtRow["fecha_inicio"].ToString()); this.tDateEnd.Text = validacion.DateFormat(dtRow["fecha_termino"].ToString()); int i = 0; foreach (String es in estados) { this.tStat.Items.Add(es); if (es.Equals(dtRow["estado"].ToString())) { this.tStat.SelectedIndex = i; //nombre_banco } i++; } i = 0; this.cTypeContract.Items.Add(dtRow["tipo_contrato"].ToString()); this.cTypeContract.SelectedItem = dtRow["tipo_contrato"].ToString(); this.cCargo.Items.Add(dtRow["cargo"].ToString()); this.cCargo.SelectedItem = dtRow["cargo"].ToString(); } Label[] labelVisible = { this.label15, this.label16, this.label17, this.label18, this.label19, this.label20 }; Label[] btnVisible = { this.btnShowContract, this.btnInsertNewContract, this.btnCancelNewContract }; //cambia color en caso de que no existe contrato this.lDescription.Background = interfaces == "1" || interfaces == "" ? new SolidColorBrush((Color)ColorConverter.ConvertFromString("#dd4337")) : new SolidColorBrush((Color)ColorConverter.ConvertFromString("#4185f4")); this.lDescription.Content = interfaces == "1" || interfaces == "" ? "Usuario sin contrato" : this.cCargo.Text; this.tDateInit.Visibility = interfaces == "1" || interfaces == "" ? Visibility.Hidden : Visibility.Visible; this.tDateEnd.Visibility = interfaces == "1" || interfaces == "" ? Visibility.Hidden : Visibility.Visible; this.tStat.Visibility = interfaces == "1" || interfaces == "" ? Visibility.Hidden : Visibility.Visible; this.cTypeContract.Visibility = interfaces == "1" || interfaces == "" ? Visibility.Hidden : Visibility.Visible; this.cCargo.Visibility = interfaces == "1" || interfaces == "" ? Visibility.Hidden : Visibility.Visible; this.cJornada.Visibility = interfaces == "1" || interfaces == "" ? Visibility.Hidden : Visibility.Visible; this.tDateInit.IsEnabled = interfaces == "1" || interfaces == "" ? true : false; this.tDateEnd.IsEnabled = interfaces == "1" || interfaces == "" ? true : false; this.tStat.IsEnabled = interfaces == "1" || interfaces == "" ? true : false; this.cTypeContract.IsEnabled = interfaces == "1" || interfaces == "" ? true : false; this.cCargo.IsEnabled = interfaces == "1" || interfaces == "" ? true : false; this.cJornada.IsEnabled = interfaces == "1" || interfaces == "" ? true : false; this.btnEndContract.Visibility = interfaces == "1" || interfaces == "" ? Visibility.Hidden : Visibility.Visible; this.btnNewContract.Visibility = interfaces == "1" || interfaces == "" ? Visibility.Visible : Visibility.Hidden; foreach (Label x in labelVisible) { x.Visibility = interfaces == "1" || interfaces == "" ? Visibility.Hidden : Visibility.Visible; } foreach (Label x in btnVisible) { x.Visibility = interfaces == "1" || interfaces == "" ? Visibility.Hidden : Visibility.Hidden; } this.btnDateInitCalendar.Visibility = interfaces == "1" || interfaces == "" ? Visibility.Hidden : Visibility.Hidden; this.btnDateEndCalendar.Visibility = interfaces == "1" || interfaces == "" ? Visibility.Hidden : Visibility.Hidden; }