void Metodo_obtener_servicios_por_tipo(ET_M41 entidad) { cbx_servicio.Items.Clear(); var resultado = _nt_m41.get_001(entidad); if (resultado != null) { _lista_R19 = new List <ET_R19>(); _lista_R19 = resultado._lista_et_r19; if (_lista_R19.Count > 0) { cbx_servicio.Enabled = true; num_frecuencia.Enabled = true; _lista_R19.ForEach(x => { cbx_servicio.Items.Add(x._TR19_TM41_DESCRIP); }); cbx_servicio.SelectedIndex = 0; } else { cbx_servicio.Text = string.Empty; cbx_servicio.Enabled = false; num_frecuencia.Enabled = false; } } }
public void Agregar_Et_m41(ET_M41 dato) { if (dato != null) { _Et_m41 = dato; } }
void Metodo_obtener_tipo_servicio() { cbx_tipo_servicio.Items.Clear(); ET_M41 _et_41 = new ET_M41(); _et_41._TM41_TM42_ID = ID_TIPO_SERVICIO; _nt_m41.Agregar_Et_m41(_et_41); _nt_m41.Iniciar(Tarea.BUSCAR); }
private void cb_tipo_SelectedIndexChanged(object sender, EventArgs e) { nombre_tipo_servicio = cb_tipo.Text; ET_M42 entidad_m42 = _lista_m42.FirstOrDefault(x => x._TM42_DESCRIP == nombre_tipo_servicio); ET_M41 entidad_m41 = new ET_M41(); entidad_m41._TM41_TM42_ID = entidad_m42._TM42_ID; //Listar los servicios de acuerdo al tipo seleccionado Metodo_obtener_servicios_por_tipo(entidad_m41); }
//OBTENER LISTA DE SERVICIOS POR TIPO public ET_entidad get_001(ET_M41 objEntity) { string Mensaje_error = ""; DataTable dt = new DataTable(); using (SqlConnection cn = new SqlConnection(conexion)) { cn.Open(); SqlTransaction sqlTran = cn.BeginTransaction(); SqlCommand cmd = new SqlCommand("pa_tr19_sel001", cn, sqlTran); cmd.CommandType = CommandType.StoredProcedure; try { cmd.Parameters.Add("@p_TR19_TM2_ID", SqlDbType.VarChar, 10).Value = _global._TM2_ID; cmd.Parameters.Add("@p_TR19_TM42_ID", SqlDbType.VarChar, 10).Value = objEntity._TM41_TM42_ID; SqlDataAdapter da = new SqlDataAdapter(); da.SelectCommand = cmd; da.Fill(dt); _LISTA_ET_R19.Clear(); foreach (DataRow fila in dt.Rows) { _et_r19 = new ET_R19(); _et_r19._T_R19_TM2_ID = fila["T_R19_TM2_ID"].ToString(); _et_r19._TR19_TM41_ID = Convert.ToInt32(fila["TR19_TM41_ID"].ToString()); _et_r19._TR19_TM42_ID = Convert.ToInt32(fila["TR19_TM42_ID"].ToString()); _et_r19._TR19_TM41_DESCRIP = fila["TR19_TM41_DESCRIP"].ToString(); //_et_r19._TR19_VALOR = Convert.ToInt32(fila["TR19_VALOR"].ToString()); _et_r19._TR19_UCREA = fila["TR19_UCREA"].ToString(); _et_r19._TR19_FCREA = Convert.ToDateTime(fila["TR19_FCREA"].ToString()); _et_r19._TR19_UACTUALIZA = fila["TR19_UACTUALIZA"].ToString(); _et_r19._TR19_FACTUALIZA = Convert.ToDateTime(fila["TR19_FACTUALIZA"].ToString()); _LISTA_ET_R19.Add(_et_r19); } _Entidad._lista_et_r19 = _LISTA_ET_R19; _Entidad._hubo_error = false; } catch (SqlException exsql) { try { sqlTran.Rollback(); } catch (Exception exRollback) { } } catch (Exception ex) { Mensaje_error = string.Format("{1}{0}", Environment.NewLine, (Mensaje_error + ex.Message.ToString())); if (ex.InnerException != null) { Mensaje_error = string.Format("{1}{0}", Environment.NewLine, (Mensaje_error + "Inner exception: " + ex.InnerException.Message)); } Mensaje_error = string.Format("{1}{0}", Environment.NewLine, (Mensaje_error + "Stack trace: " + ex.StackTrace)); _Entidad._hubo_error = true; _Entidad._contenido_mensaje = Mensaje_error; _Entidad._titulo_mensaje = "Error!"; } finally { cn.Close(); } return(_Entidad); } }
public ET_entidad get_001(ET_M41 objEntity) { return(_dt_m41.get_001(objEntity)); }