public List <DonVi> SelectDonViChuQuanLogin() { List <DonVi> donvi = new List <DonVi>(); DbDataReader reader = null; DbConnection conn = _DbHelper.CreateConnection(Common.ConnectionString); conn.Open(); try { reader = _DbHelper.ExecuteReader(conn, Common.DatabaseSchema + "[SelectDonViChuQuanLogin]", null); if (reader.HasRows) { DonViDataAccess.SetListDonViInfo(ref reader, ref donvi); } return(donvi); } catch (Exception ex) { throw new Exception(String.Format(" DonVi_SelectAllDVbyPhanLoai.SelectAll: {0}", ex.Message)); } finally { if (reader != null) { reader.Close(); } conn.Close(); } }
public List <DonVi> SelectAllDonViByRegionIDAndPhanLoai(int ID, int PhanLoai, int ParentID) { List <DonVi> donvi = new List <DonVi>(); DbDataReader reader = null; DbConnection conn = _DbHelper.CreateConnection(Common.ConnectionString); conn.Open(); try { List <DbParameter> para = new List <DbParameter>(); para.Add(_DbHelper.CreateParameter("ID", ID, false)); para.Add(_DbHelper.CreateParameter("PhanLoai", PhanLoai, false)); para.Add(_DbHelper.CreateParameter("ParentID", ParentID, false)); reader = _DbHelper.ExecuteReader(conn, Common.DatabaseSchema + "[DonVi_SelectByRegionIDAndPhanLoai]", para.ToArray()); if (reader.HasRows) { DonViDataAccess.SetListDonViInfo(ref reader, ref donvi); } return(donvi); } catch (Exception ex) { throw new Exception(String.Format(" DonViDataAccess.SelectAll: {0}", ex.Message)); } finally { if (reader != null) { reader.Close(); } conn.Close(); } }
public List <DonVi> SYS_Region_Organization_SelectByIDIDRegion(int IDIDRegion) { List <DonVi> donvi = new List <DonVi>(); DbDataReader reader = null; DbConnection conn = _DbHelper.CreateConnection(Common.ConnectionString); conn.Open(); try { List <DbParameter> para = new List <DbParameter>(); para.Add(_DbHelper.CreateParameter("IDRegion", IDIDRegion, false)); reader = _DbHelper.ExecuteReader(conn, Common.DatabaseSchema + "[SYS_Region_Organization_SelectByIDIDRegion]", para.ToArray()); if (reader.HasRows) { DonViDataAccess.SetListDonViInfo(ref reader, ref donvi); } return(donvi); } catch (Exception ex) { throw new Exception(String.Format(" SYS_Region_Organization_SelectByIDIDRegion.SelectAll: {0}", ex.Message)); } finally { if (reader != null) { reader.Close(); } conn.Close(); } }