コード例 #1
0
 public void EditRow(Bonus bonus, int index)
 {
     DataRow selectedRow = dataSet.Tables["JoinEmployeeBonus"].Rows[index];
     selectedRow["Date"] = bonus.Date;
     selectedRow["Amount"] = bonus.Amount;
     selectedRow["Type"] = bonus.Type;
     EditRecord(bonus, index);
 }
コード例 #2
0
        public void DeleteRow(Bonus bonus, int index)
        {
            DataRow selectedRow = dataSet.Tables["JoinEmployeeBonus"].Rows[index];
            selectedRow.Delete();

            DeleteRecord(bonus, index);
        }
コード例 #3
0
 private void EditRecord(Bonus bonus, int index)
 {
     SqlCommand command = new SqlCommand();
     command.Connection = connection;
     command.CommandType = CommandType.StoredProcedure;
     command.CommandText = "jprocedureUpdateEmployeeBonus";
     dataAdapter.UpdateCommand = command;
     command.Parameters.AddWithValue("@EmployeeID", bonus.Employee.EmoloyeeID);
     command.Parameters.AddWithValue("@Date", bonus.Date);
     command.Parameters.AddWithValue("@Amount", bonus.Amount);
     command.Parameters.AddWithValue("@BonusID", bonus.BonusID);
     command.Parameters.AddWithValue("@Type", bonus.Type);
     dataAdapter.Update(dataSet, "JoinEmployeeBonus");
 }
コード例 #4
0
 public void AddRecord(Bonus bonus)
 {
     connection.Open();
     //set up command
     SqlCommand command = new SqlCommand("jprocedureInsertEmployeeBonus", connection);
     //set up commandType
     command.CommandType = CommandType.StoredProcedure;
     //set up parameters
     command.Parameters.AddWithValue("@Date", bonus.Date);
     command.Parameters.AddWithValue("@Amount", bonus.Amount);
     command.Parameters.AddWithValue("@EmployeeID", bonus.Employee.EmoloyeeID);
     command.Parameters.AddWithValue("@Type", bonus.Type);
     command.ExecuteNonQuery();
     connection.Close();
 }
コード例 #5
0
        private void DeleteRecord(Bonus bonus, int index)
        {
            SqlCommand command = new SqlCommand();
            command.Connection = connection;
            command.CommandType = CommandType.StoredProcedure;
            command.CommandText = "jprocedureDeleteEmployeeBonus";
            dataAdapter.DeleteCommand = command;

            command.Parameters.AddWithValue("@BonusID",bonus.BonusID );
            dataAdapter.Update(dataSet, "JoinEmployeeBonus");
        }