Пример #1
0
 public FormPositions()
 {
     InitializeComponent();
     admin = new Admin();
     positions = new Positions();
     counts = new Counts();
 }
Пример #2
0
        private void DeleteRecord(Positions 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, "JoinPositionDepartment");
        }
Пример #3
0
        public void DeleteRow(Positions positions, int index)
        {
            DataRow selectedRow = dataSet.Tables["JoinPositionDepartment"].Rows[index];
            selectedRow.Delete();

            DeleteRecord(positions, index);
        }
Пример #4
0
        private void EditRecord(Positions 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);
            command.Parameters.AddWithValue("@DepartmentID", positions.Department.DepartmentID);
            dataAdapter.Update(dataSet, "JoinPositionDepartment");
        }
Пример #5
0
        public void EditRow(Positions positions, int index)
        {
            DataRow selectedRow = dataSet.Tables["JoinPositionDepartment"].Rows[index];
            selectedRow["PositionID"] = positions.PositionID;
            selectedRow["PositionName"] = positions.PositionName;
            selectedRow["Salary"] = positions.Salary;
            selectedRow["DepartmentName"] = positions.Department.DepartmentName;

            EditRecord(positions, index);
        }
Пример #6
0
 public void AddRow(Positions positions)
 {
     DataTable dataTable = dataSet.Tables["JoinPositionDepartment"];
     DataRow dataRow = dataTable.NewRow();
     dataRow["PositionID"] = positions.PositionID;
     dataRow["PositionName"] = positions.PositionName;
     dataRow["Salary"] = positions.Salary;
     dataRow["DepartmentName"] = positions.Department.DepartmentName;
     dataTable.Rows.Add(dataRow);
     AddRecord(positions);
 }