Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        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);
        }