public Holiday()
 {
     InitializeComponent();
     holiday = new Holidays();
     counts = new Counts();
     admin = new Admin();
 }
Пример #2
0
        public void EditRow(Holidays holiday, int index)
        {
            //get selectedRow from the dataTable, tableCourse
            DataRow selectedRow = dataSet.Tables["Holiday"].Rows[index];

            //replace values from course object
            selectedRow["HolidayName"] = holiday.HolidayName;
            selectedRow["HolidayDate"] = holiday.HolidayDate;
            selectedRow["HolidayReason"] = holiday.HolidayReason;
            selectedRow["Status"] = holiday.Status;
            EditRecord(holiday, index);
        }
Пример #3
0
        public void DeleteRow(Holidays holiday, int index)
        {
            //get selectedRow from the dataTable, tableCourse
            DataRow selectedRow = dataSet.Tables["Holiday"].Rows[index];

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

            DeleteRecord(holiday, index);
        }
Пример #4
0
        public void AddRow(Holidays holiday)
        {
            //get dataTable tableCourse
            DataTable dataTable = dataSet.Tables["Holiday"];

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

            //assign values from course object
            dataRow["HolidayID"] = holiday.HolidayNo;
            dataRow["HolidayName"] = holiday.HolidayName;
            dataRow["HolidayDate"] = holiday.HolidayDate;
            dataRow["HolidayReason"] = holiday.HolidayReason;
            dataRow["Status"] = holiday.Status;
            //add the new dataRow to dataTable
            dataTable.Rows.Add(dataRow);

            AddRecord(holiday);
        }
Пример #5
0
        private void EditRecord(Holidays holiday, 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 = "hprocedureUpdateHoliday";
            dataAdapter.UpdateCommand = command;

            //set up parameters
            command.Parameters.AddWithValue("@HolidayNo", holiday.HolidayNo);
            command.Parameters.AddWithValue("@HolidayName", holiday.HolidayName);
            command.Parameters.AddWithValue("@HolidayDate", holiday.HolidayDate);
            command.Parameters.AddWithValue("@HolidayReason", holiday.HolidayReason);
            command.Parameters.AddWithValue("@Status", holiday.Status);
            //update tableCourse from the dataSet
            dataAdapter.Update(dataSet, "Holiday");
        }