public List <SYS_Catagory> SelectAllSYS_Catagory(string tableName, DbTransaction dbTransaction) { List <SYS_Catagory> SYS_Catagory = new List <SYS_Catagory>(); DbDataReader reader = null; try { List <DbParameter> para = new List <DbParameter>(); para.Add(_DbHelper.CreateParameter(FIELD_TABLENAME, tableName, false)); reader = _DbHelper.ExecuteReader(dbTransaction, Common.DatabaseSchema + "[SYS_Catagory_SelectAll]", (DbParameter[])para.ToArray()); if (reader.HasRows) { SYS_CatagoryDataAccess.SetListSYS_CatagoryInfo(ref reader, ref SYS_Catagory); } } catch (Exception ex) { throw new Exception(String.Format(" SYS_CatagoryDataAccess.SelectAll: {0}", ex.Message)); } finally { if (reader != null) { reader.Close(); } } return(SYS_Catagory); }
public List <SYS_Catagory> SelectListCombo(string tableName, int ID, string Connection) { SYS_ConfigConnectionDataAccess connect = new SYS_ConfigConnectionDataAccess(); DbConnection connection = _DbHelper.CreateConnection(connect.DecryptSYS_ConfigConnection(Connection)); connection.Open(); List <SYS_Catagory> SYS_Catagory = new List <SYS_Catagory>(); DbDataReader reader = null; try { List <DbParameter> para = new List <DbParameter>(); para.Add(_DbHelper.CreateParameter(FIELD_TABLENAME, tableName, false)); para.Add(_DbHelper.CreateParameter(FIELD_ID, ID, false)); reader = _DbHelper.ExecuteReader(connection, Common.DatabaseSchema + "[SYS_Catagory_SelectListCombo]", (DbParameter[])para.ToArray()); if (reader.HasRows) { SYS_CatagoryDataAccess.SetListSYS_CatagoryInfo(ref reader, ref SYS_Catagory); } } catch (Exception ex) { throw new Exception(String.Format(" SYS_CatagoryDataAccess.SelectListCombo: {0}", ex.Message)); } finally { if (reader != null) { reader.Close(); } connection.Close(); } return(SYS_Catagory); }
public List <SYS_Catagory> SelectSYS_CatagoryByIdNhanSuXa(int ID, DbConnection connection) { SYS_ConfigConnectionDataAccess connect = new SYS_ConfigConnectionDataAccess(); List <SYS_Catagory> SYS_Catagory = new List <SYS_Catagory>(); //DbConnection connection = _DbHelper.CreateConnection(Common.ConnectionString); DbDataReader reader = null; try { List <DbParameter> para = new List <DbParameter>(); para.Add(_DbHelper.CreateParameter("IDNhanSu", ID, false)); reader = _DbHelper.ExecuteReader(connection, Common.DatabaseSchema + "[SYS_Catagory_SelectByIdNhanSuXa]", para.ToArray()); if (reader.HasRows) { SYS_CatagoryDataAccess.SetListSYS_CatagoryInfo(ref reader, ref SYS_Catagory); } } catch (Exception ex) { throw new Exception(String.Format("SYS_CatagoryDataAccess.SelectSYS_CatagoryByIdNhanSuXáS: {0}", ex.Message)); } //finally //{ // if (reader != null) // reader.Close(); // connection.Close(); //} return(SYS_Catagory); }
/// <summary> /// Sử dụng cho các bảng về VTHCPD /// </summary> /// <param name="TableNotIn"></param> /// <param name="IDDonVi"></param> /// <param name="Year"></param> /// <param name="ParentID"></param> /// <param name="tableName"></param> /// <param name="Connection"></param> /// <returns></returns> public List <SYS_Catagory> SelectSYS_CatagoryByParentIDNotInTable(string TableNotIn, int IDDonVi, int IDChungLoai, int Year, string ParentID, string tableName, string Connection) { SYS_ConfigConnectionDataAccess connect = new SYS_ConfigConnectionDataAccess(); Connection = connect.DecryptSYS_ConfigConnection(Connection); DbConnection connection = _DbHelper.CreateConnection(Connection); connection.Open(); List <SYS_Catagory> SYS_Catagory = new List <SYS_Catagory>(); DbDataReader reader = null; try { List <DbParameter> para = new List <DbParameter>(); para.Add(_DbHelper.CreateParameter(FIELD_PARENTID, ParentID, false)); para.Add(_DbHelper.CreateParameter(FIELD_TABLENAME, tableName, false)); para.Add(_DbHelper.CreateParameter("TableNotIn", TableNotIn, false)); para.Add(_DbHelper.CreateParameter("IDDonVi", IDDonVi, false)); para.Add(_DbHelper.CreateParameter("DBYear", Year, false)); para.Add(_DbHelper.CreateParameter("IDChungLoai", IDChungLoai, false)); reader = _DbHelper.ExecuteReader(connection, Common.DatabaseSchema + "[SYS_Catagory_SelectByParentIdNotInTable]", para.ToArray()); if (reader.HasRows) { SYS_CatagoryDataAccess.SetListSYS_CatagoryInfo(ref reader, ref SYS_Catagory); } } catch (Exception ex) { throw new Exception(String.Format("SYS_CatagoryDataAccess.SelectByIdNotInTable: {0}", ex.Message)); } finally { if (reader != null) { reader.Close(); } connection.Close(); } return(SYS_Catagory); }