Ejemplo n.º 1
0
        public void EditRow(Position positions, int index)
        {
            DataRow selectedRow = dataSet.Tables["JoinPosition"].Rows[index];
            selectedRow["PositionID"] = positions.PositionID;
            selectedRow["PositionName"] = positions.PositionName;
            selectedRow["Salary"] = positions.Salary;

            EditRecord(positions, index);
        }
Ejemplo n.º 2
0
        public void DeleteRow(Position positions, int index)
        {
            DataRow selectedRow = dataSet.Tables["JoinPosition"].Rows[index];
            selectedRow.Delete();

            DeleteRecord(positions, index);
        }
Ejemplo n.º 3
0
        public void AddRecord(Position positions)
        {
            connection.Open();
            //set up command
            SqlCommand command = new SqlCommand("cprocedureInsertPosition", connection);
            //set up commandType
            command.CommandType = CommandType.StoredProcedure;
            //set up parameters

            //command.Parameters.AddWithValue("@PositionID", positions.PositionID);
            command.Parameters.AddWithValue("@PositionName", positions.PositionName);
            command.Parameters.AddWithValue("@Salary", positions.Salary);
            command.ExecuteNonQuery();
            connection.Close();
        }
Ejemplo n.º 4
0
        private void EditRecord(Position positions, int index)
        {
            SqlCommand command = new SqlCommand();
            command.Connection = connection;
            command.CommandType = CommandType.StoredProcedure;
            command.CommandText = "cprocedureUpdatePosition";
            dataAdapter.UpdateCommand = command;

            command.Parameters.AddWithValue("@PositionID", positions.PositionID);
            command.Parameters.AddWithValue("@PositionName", positions.PositionName);
            command.Parameters.AddWithValue("@Salary", positions.Salary);
            dataAdapter.Update(dataSet, "JoinPosition");
        }
Ejemplo n.º 5
0
        private void DeleteRecord(Position position, int index)
        {
            SqlCommand command = new SqlCommand();
            command.Connection = connection;
            command.CommandType = CommandType.StoredProcedure;
            command.CommandText = "cprocedureDeletePosition";
            dataAdapter.DeleteCommand = command;

            command.Parameters.AddWithValue("@PositionID", position.PositionID);
            dataAdapter.Update(dataSet, "JoinPosition");
        }
 public FormPosition()
 {
     InitializeComponent();
     admin = new Admin();
     positions = new Position();
 }