public DepartmentList GetAll() { Database database = new Database("Alumnus"); database.Command.Parameters.Clear(); database.Command.CommandType = System.Data.CommandType.StoredProcedure; database.Command.CommandText = "tblDepartmentGetAll"; DataTable dt = database.ExectueQuery(); Department select = new Department(); select.Id = Guid.Empty; select.Name = "--Please Select a Department--"; _List.Add(select); foreach (DataRow dr in dt.Rows) { Department department = new Department(); department.Initailize(dr); department.InitializeBusinessData(dr); department.IsNew = false; department.IsDirty = false; _List.Add(department); } return(this); }
public DepartmentList GetAll() { Database database = new Database("Employer"); database.Command.Parameters.Clear(); database.Command.CommandType = System.Data.CommandType.StoredProcedure; database.Command.CommandText = "tblDepartmentGetAll"; DataTable dt = database.ExecuteQuery(); Department blank = new Department(); blank.Name = "Select a Department"; _List.Add(blank); foreach (DataRow dr in dt.Rows) { Department d = new Department(); d.Initialize(dr); d.InitializeBusinessData(dr); d.IsNew = false; d.IsDirty = false; d.Savable += Department_Savable; _List.Add(d); } return(this); }
public DepartmentList GetById(Guid Id) { Database database = new Database("DB_109645_projectfinal"); DataTable dt = new DataTable(); database.Command.CommandType = CommandType.StoredProcedure; database.Command.CommandText = "tblDepartmentGetById"; database.Command.Parameters.Add("@Id", SqlDbType.UniqueIdentifier).Value = Id; dt = database.ExecuteQuery(); foreach (DataRow dr in dt.Rows) { Department department = new Department(); department.Initialize(dr); department.InitializeBusinessData(dr); _List.Add(department); } return(this); }
public DepartmentList DepartmentGetIdByDepartmentName(string departmentName) { Database database = new Database("DB_109645_projectfinal"); database.Command.Parameters.Clear(); database.Command.CommandType = CommandType.StoredProcedure; database.Command.CommandText = "tblDepartmentGetIdByDepartmentName"; database.Command.Parameters.Add("@Name", SqlDbType.VarChar).Value = departmentName; DataTable dt = database.ExecuteQuery(); dt = database.ExecuteQuery(); foreach (DataRow dr in dt.Rows) { Department department = new Department(); department.Initialize(dr); department.InitializeBusinessData(dr); _List.Add(department); } return(this); }
public DepartmentList GetAll() { Database database = new Database("DB_109645_projectfinal"); database.Command.Parameters.Clear(); database.Command.CommandType = CommandType.StoredProcedure; database.Command.CommandText = "tblDepartmentGetAll"; DataTable dt = database.ExecuteQuery(); foreach (DataRow dr in dt.Rows) { Department department = new Department(); department.Initialize(dr); department.InitializeBusinessData(dr); department.IsNew = false; department.IsDirty = false; department.Savable += Department_Savable; _List.Add(department); } return(this); }