public static List <Dept> GetDepts() { List <Dept> list = new List <Dept>(); foreach (DataRow row in ((DeptCache) new DeptCache().GetData()).dtDept.Rows) { Dept dept = new Dept(); Dept @object = DeptUtils.GetObject(row); list.Add(@object); } return(list); }
public static List <Dept> GetDeptByName(string deptName) { List <Dept> list = new List <Dept>(); DataRowView[] array = ((DeptCache) new DeptCache().GetData()).dvDeptBy_DeptName.FindRows(deptName); for (int i = 0; i < array.Length; i++) { DataRowView dataRowView = array[i]; Dept dept = new Dept(); Dept @object = DeptUtils.GetObject(dataRowView.Row); list.Add(@object); } return(list); }
public static Dept GetDept(string deptId) { Dept dept = null; DeptCache deptCache = (DeptCache) new DeptCache().GetData(); int index = deptCache.dvDeptBy_DeptId.Find(deptId); bool flag = index >= 0; if (flag) { Dept dept2 = new Dept(); dept = DeptUtils.GetObject(deptCache.dvDeptBy_DeptId[index].Row); } return(dept); }