public DepartmentCollection GetAllDepartments() { DepartmentCollection returnCollection = new DepartmentCollection(); Department d1 = new Department() { DepartmentUUID = Guid.NewGuid(), DepartmentName = "MockDept1", CreateDate = DateTime.Now, TheVersionProperty = new byte[8] { 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 } }; Department d2 = new Department() { DepartmentUUID = Guid.NewGuid(), DepartmentName = "MockDept2", CreateDate = DateTime.Now, TheVersionProperty = new byte[8] { 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 } }; Department d3 = new Department() { DepartmentUUID = Guid.NewGuid(), DepartmentName = "MockDept3", CreateDate = DateTime.Now, TheVersionProperty = new byte[8] { 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 } }; returnCollection.Add(d1); returnCollection.Add(d2); returnCollection.Add(d3); return(returnCollection); }
public static DepartmentCollection GetAll() { DataTable dt = DBLayer.ExecuteQuery("Select * from Department"); DepartmentCollection result = new DepartmentCollection(); for (int i = 0; i < dt.Rows.Count; i++) { int departmentID = Convert.ToInt32(dt.Rows[i]["id"]); string deptName = dt.Rows[i]["dept_Name"].ToString(); Department d = new Department(departmentID, deptName); result.Add(d); } return(result); }
public ShellViewModel() { DepartmentCollection.Add(new DeparmentModel() { DepartmentName = "Finance", Supervisor = "John Tommothy" }); DepartmentCollection.Add(new DeparmentModel() { DepartmentName = "Development", Supervisor = "Alex Brown" }); DepartmentCollection.Add(new DeparmentModel() { DepartmentName = "Human Resource", Supervisor = "Dennis Burton" }); }
protected void bind_formview(string mode) { //have to use a collection as formview needs to bind to enumerable DepartmentCollection _tbl = new DepartmentCollection(); if (mode != "Insert") { int _pid = wwi_func.vint(wwi_security.DecryptString(get_token("pid").ToString(), "publiship")); Department _ct = new Department(_pid); _tbl.Add(_ct); //store original value for company type name so we can check against database when saving if (this.dxhfOrder.Contains("oldvalue")) { this.dxhfOrder.Remove("oldvalue"); } this.dxhfOrder.Add("oldvalue", _ct.DepartmentX.Trim()); } else { Department _ct = new Department(); _tbl.Add(_ct); } this.fmvDepartment.DataSource = _tbl; this.fmvDepartment.DataBind(); }