コード例 #1
0
ファイル: Leave.cs プロジェクト: agamat/MG-EmbraceEnemyCode
 public Leave()
 {
     InitializeComponent();
     admin = new Admin();
     leave = new Leaves();
     //FillComboInstructor();
 }
コード例 #2
0
 public Leave()
 {
     InitializeComponent();
     admin = new Admin();
     leave = new Leaves();
     //FillComboInstructor();
 }
コード例 #3
0
 public void EditRow(Leaves leave, int index)
 {
     DataRow selectedRow = dataSet.Tables["JoinEmployeeLeave"].Rows[index];
     selectedRow["StartDate"] = leave.StartDate;
     selectedRow["EndDate"] = leave.EndDate;
     selectedRow["Reason"] = leave.Reason;
     selectedRow["NoOfDays"] = leave.NoOfDays;
     EditRecord(leave, index);
 }
コード例 #4
0
        public void DeleteRow(Leaves leave, int index)
        {
            DataRow selectedRow = dataSet.Tables["JoinEmployeeLeave"].Rows[index];
            selectedRow.Delete();

            DeleteRecord(leave, index);
        }
コード例 #5
0
 public void AddRecord(Leaves leave)
 {
     connection.Open();
     //set up command
     SqlCommand command = new SqlCommand("gprocedureInsertEmployeeLeave", connection);
     //set up commandType
     command.CommandType = CommandType.StoredProcedure;
     //set up parameters
     command.Parameters.AddWithValue("@EmployeeID", leave.Employee.EmoloyeeID);
     command.Parameters.AddWithValue("@StartDate", leave.StartDate);
     command.Parameters.AddWithValue("@EndDate", leave.EndDate);
     command.Parameters.AddWithValue("@Reason", leave.Reason);
     command.Parameters.AddWithValue("@NoOfDays", leave.NoOfDays);
     command.ExecuteNonQuery();
     connection.Close();
 }
コード例 #6
0
 private void EditRecord(Leaves leave, int index)
 {
     SqlCommand command = new SqlCommand();
     command.Connection = connection;
     command.CommandType = CommandType.StoredProcedure;
     command.CommandText = "gprocedureUpdateEmployeeLeave";
     dataAdapter.UpdateCommand = command;
     command.Parameters.AddWithValue("@LeaveID", leave.LeaveID);
     command.Parameters.AddWithValue("@StartDate", leave.StartDate);
     command.Parameters.AddWithValue("@EndDate", leave.EndDate);
     command.Parameters.AddWithValue("@Reason", leave.Reason);
     command.Parameters.AddWithValue("@NoOfDays", leave.NoOfDays);
     dataAdapter.Update(dataSet, "JoinEmployeeLeave");
 }
コード例 #7
0
        private void DeleteRecord(Leaves leave, int index)
        {
            SqlCommand command = new SqlCommand();
            command.Connection = connection;
            command.CommandType = CommandType.StoredProcedure;
            command.CommandText = "gprocedureDeleteEmployeeLeave";
            dataAdapter.DeleteCommand = command;

            command.Parameters.AddWithValue("@LeaveID", leave.LeaveID);
            dataAdapter.Update(dataSet, "JoinEmployeeLeave");
        }