public DataTable Get_Interface_Datareader(BE_ReqInterface Request) { DataTable dt; DA_Interface Obj = new DA_Interface(); dt = Obj.Get_Interface_DataTable(Request); return dt; }
//----------------------------------------------- // Select: Interface por (nIntClase and nIntTipo) //----------------------------------------------- public DataTable Get_Interface(BE_ReqInterface Request) { DataTable dt = new DataTable(); try { clsConection Obj = new clsConection(); string Cadena = Obj.GetConexionString("Naylamp"); using (SqlConnection cn = new SqlConnection(Cadena)) { cn.Open(); using (SqlCommand cm = new SqlCommand()) { cm.CommandText = "[usp_Get_Interface]"; cm.CommandType = CommandType.StoredProcedure; cm.Parameters.AddWithValue("nIntClase", Request.nIntClase); cm.Parameters.AddWithValue("nIntTipo", Request.nIntTipo); cm.Parameters.AddWithValue("cFlag", Request.cFlag); cm.Connection = cn; using (SqlDataReader dr = cm.ExecuteReader()) dt.Load(dr); } } } catch (Exception) { throw; } return dt; }
//para Insert Interface public BE_ResGenerico InsInterface(BE_ReqInterface Request) { BE_ResGenerico Item = new BE_ResGenerico(); DA_Interface Obj = new DA_Interface(); Item = Obj.InsInterface(Request); return Item; }
//---------------- // Get_Interface //---------------- //para buscar Interface public DataTable Get_Interface(long nIntClase, long nIntTipo, string cFlag) { BE_ReqInterface Request = new BE_ReqInterface(); DA_Interface da = new DA_Interface(); Request.nIntClase = nIntClase; Request.nIntTipo = nIntTipo; Request.cFlag = cFlag; return da.Get_Interface(Request); }
public IList<BE_Res_Interface> Get_InterfaceDR(BE_ReqInterface Request) { BE_Res_Interface Item = new BE_Res_Interface(); var lista = new List<BE_Res_Interface>(); try { clsConection Obj = new clsConection(); string Cadena = Obj.GetConexionString("Naylamp"); using (SqlConnection cn = new SqlConnection(Cadena)) { cn.Open(); using (SqlCommand cm = new SqlCommand()) { cm.CommandText = "usp_Get_Interface"; cm.CommandType = CommandType.StoredProcedure; cm.Parameters.AddWithValue("nIntClase", Request.nIntClase); cm.Parameters.AddWithValue("nIntTipo", Request.nIntTipo); cm.Connection = cn; using (SqlDataReader dr = cm.ExecuteReader()) { lista.Clear(); while (dr.Read()) { Item = new BE_Res_Interface(); Item.nIntClase = dr.GetInt32(dr.GetOrdinal("nIntClase")); Item.nIntCodigo = dr.GetInt32(dr.GetOrdinal("nIntCodigo")); Item.nIntTipo = dr.GetInt32(dr.GetOrdinal("nIntTipo")); Item.cIntDescripcion = dr.GetString(dr.GetOrdinal("cIntDescripcion")).Trim(); Item.cIntJerarquia = dr.GetString(dr.GetOrdinal("cIntJerarquia")).Trim(); Item.cIntNombre = dr.GetString(dr.GetOrdinal("cIntNombre")).Trim(); lista.Add(Item); } dr.Close(); } } } } catch (Exception) { throw; } return lista; }
//BE_ReqSolCorrelativo Request) public string Get_NewIdcIntJerarquia(BE_ReqInterface Request) { DA_Interface Obj = new DA_Interface(); return Obj.Get_NewIdcIntJerarquia(Request); }
//--------------------------------- // Get_Interface and cIntJerarquia //--------------------------------- //para buscar Interface public DataTable Get_Interface_and_cIntJerarquia(BE_ReqInterface Request) { DA_Interface Obj = new DA_Interface(); return Obj.Get_Interface_and_cIntJerarquia(Request); }
//----------------------------------------------- // en SqlDataReader: Interface por (nIntClase and nIntTipo) //----------------------------------------------- public IList<BE_Res_Interface> Get_InterfaceDR(BE_ReqInterface Request) { DA_Interface Obj = new DA_Interface(); return Obj.Get_InterfaceDR(Request); }
//------------------- // Update: Interface //------------------- public BE_ResGenerico UpdInterface(BE_ReqInterface Request) { BE_ResGenerico Item = new BE_ResGenerico(); long Resultado = 0; try { clsConection Obj = new clsConection(); string Cadena = Obj.GetConexionString("Naylamp"); using (SqlConnection cn = new SqlConnection(Cadena)) { cn.Open(); using (SqlCommand cm = new SqlCommand()) { cm.CommandText = "[usp_Upd_Interface]"; cm.CommandType = CommandType.StoredProcedure; cm.Parameters.AddWithValue("nIntCodigo", Request.nIntCodigo); cm.Parameters.AddWithValue("nIntClase", Request.nIntClase); cm.Parameters.AddWithValue("cIntJerarquia", Request.cIntJerarquia); cm.Parameters.AddWithValue("cIntNombre", Request.cIntNombre); cm.Parameters.AddWithValue("cIntDescripcion", Request.cIntDescripcion); cm.Parameters.AddWithValue("nIntTipo", Request.nIntTipo); cm.Connection = cn; Resultado = cm.ExecuteNonQuery(); Item.Resultado = Resultado; } } } catch (Exception) { throw; } return Item; }
//BE_ReqSolCorrelativo Request) //Obtener correlativo cIntJerarquia para la Tabla [Interface] public string Get_NewIdcIntJerarquia(BE_ReqInterface Request) { string nNewId = ""; try { clsConection Obj = new clsConection(); string Cadena = Obj.GetConexionString("Naylamp"); using (SqlConnection cn = new SqlConnection(Cadena)) { cn.Open(); using (SqlCommand cm = new SqlCommand()) { cm.CommandText = "usp_Get_NewIdcIntJerarquia"; cm.CommandType = CommandType.StoredProcedure; cm.Parameters.AddWithValue("nIntClase", Request.nIntClase); cm.Parameters.AddWithValue("nIntTipo", Request.nIntTipo); cm.Connection = cn; SqlParameter pCod = new SqlParameter(); pCod.ParameterName = "nNewId"; pCod.DbType = DbType.String; pCod.Size = 25; pCod.Direction = ParameterDirection.Output; cm.Parameters.Add(pCod); cm.ExecuteNonQuery(); nNewId = cm.Parameters["nNewId"].Value.ToString(); } } } catch (Exception) { throw; } return nNewId; }