示例#1
0
 public Department()
 {
     InitializeComponent();
     admin = new Admin();
     department = new Departments();
     counts = new Counts();
 }
示例#2
0
 public Positions()
 {
     departments = new Departments();
 }
示例#3
0
        private void DeleteRecord(Departments department, int index)
        {
            //set up command
            SqlCommand command = new SqlCommand();
            command.Connection = connection;

            //set up commandType
            command.CommandType = CommandType.StoredProcedure;

            //set up procedure name
            command.CommandText = "bprocedureDeleteDepartment";
            dataAdapter.DeleteCommand = command;

            //set up parameters
            command.Parameters.AddWithValue("@DepartmentID", department.DepartmentID);

            //update tableCourse from the dataSet
            dataAdapter.Update(dataSet, "Department");
        }
示例#4
0
        public void DeleteRow(Departments department, int index)
        {
            //get selectedRow from the dataTable, tableCourse
            DataRow selectedRow = dataSet.Tables["Department"].Rows[index];

            //delete selected row from the dataSet
            selectedRow.Delete();

            DeleteRecord(department, index);
        }
示例#5
0
        public void EditRow(Departments department, int index)
        {
            //get selectedRow from the dataTable, tableCourse
            DataRow selectedRow = dataSet.Tables["Department"].Rows[index];

            //replace values from course object
            selectedRow["DepartmentName"] = department.DepartmentName;

            EditRecord(department, index);
        }
示例#6
0
        public void AddRow(Departments department)
        {
            //get dataTable tableCourse
            DataTable dataTable = dataSet.Tables["Department"];

            //create a new dataRow
            DataRow dataRow = dataTable.NewRow();

            //assign values from course object
            dataRow["DepartmentID"] = department.DepartmentID;
            dataRow["DepartmentName"] = department.DepartmentName;

            //add the new dataRow to dataTable
            dataTable.Rows.Add(dataRow);

            AddRecord(department);
        }
 public Positions()
 {
     departments = new Departments();
 }