Ejemplo n.º 1
0
        public Department[] GetDepartments()
        {
            DataSet returnDataSet = null;
            Department[] departments = null;

            using (SqlCommand command = NewCommand())
            {
                List<Department> DepartmentList = new List<Department>();
                Department department = null;

                command.CommandText = "[dbo].[GetDepartments]";
                returnDataSet = ExecuteQuery(command);
                if (returnDataSet != null && returnDataSet.Tables != null && returnDataSet.Tables.Count > 0 && returnDataSet.Tables[0].Rows != null && returnDataSet.Tables[0].Rows.Count > 0)
                {
                    department = new Department();

                    DataRow UserRow = returnDataSet.Tables[0].Rows[0];

                    if (UserRow["DepartmentId"] != DBNull.Value)
                        department.DepartmentId = Convert.ToInt32(UserRow["DepartmentId"].ToString(), CultureInfo.InvariantCulture);
                    if (UserRow["Name"] != DBNull.Value)
                        department.Name = UserRow["Name"].ToString();
                    if (UserRow["GroupName"] != DBNull.Value)
                        department.GroupName = UserRow["GroupName"].ToString();
                    if (UserRow["ModifiedDate"] != DBNull.Value)
                        department.ModifiedDate = Convert.ToDateTime(UserRow["ModifiedDate"].ToString(), CultureInfo.InvariantCulture);
                }
                if (DepartmentList.Count > 0)
                    departments = DepartmentList.ToArray();
            }
            return departments;
        }
Ejemplo n.º 2
0
 public Developer(int id, string firstName, string lastName, decimal salary, Department department)
     : base(id, firstName, lastName, salary, department)
 {
 }