public List<Branch> GetAllBranch() { List<Branch> list = new List<Branch>(); using (SqlCommand cmd = GetCommand("getAllBranch", CommandType.StoredProcedure)) { Branch branch = new Branch(); using (SqlDataReader dr = ExeDataReader(cmd)) { if (dr.HasRows) { while (dr.Read()) { list.Add(branch.BranchIDatareader(dr)); } } } branch = null; } return list; }
public List<Branch> GetBranchByID(string id) { List<Branch> list = new List<Branch>(); using (SqlCommand cmd = GetCommand("getBranchByID", CommandType.StoredProcedure)) { AddParameter(cmd, "@ID", Convert.ToInt32(id)); Branch branch = new Branch(); using (SqlDataReader dr = ExeDataReader(cmd)) { if (dr.HasRows) { while (dr.Read()) { list.Add(branch.BranchIDatareader(dr)); } } } branch = null; } return list; }
public List<Branch> SearchBranchByName(string name) { List<Branch> list = new List<Branch>(); using (SqlCommand cmd = GetCommand("searchBranchByName", CommandType.StoredProcedure)) { AddParameter(cmd, "@Name", name); Branch branch = new Branch(); using (SqlDataReader dr = ExeDataReader(cmd)) { if (dr.HasRows) { while (dr.Read()) { list.Add(branch.BranchIDatareader(dr)); } } } branch = null; } return list; }