예제 #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();
 }