@Transactional
public void saveCompositeUser(UserCompositeDTO userCompositeDTO) {
var userInfo = new UserInfo();
userInfo.setFirstName(userCompositeDTO.getFirstName())
.setMiddleName(userCompositeDTO.getMiddleName())
.setLastName(userCompositeDTO.getLastName())
.setBirthDate(userCompositeDTO.getBirthDate())
.setPhoneNumber(userCompositeDTO.getPhoneNumber());
UserInfo currentUserInfo = userInfoRepository.save(userInfo);
User user = new User();
user.setAuthorities(userCompositeDTO.getAuthorities())
.setEmail(userCompositeDTO.getEmail())
.setPassword(userCompositeDTO.getPassword())
.setUsername(userCompositeDTO.getUsername())
.setEnabled(true)
.setOrganization(userCompositeDTO.getOrganization())
.setUserInfo(currentUserInfo);
User currentUser = userRepository.save(user);
userInfoRepository.addUserId(currentUserInfo.getId(), currentUser);
}
<form method="post" th:action="@{'/users/'}" th:object="${users.users}">
<table class="table table-bordered">
<thead>
<tr>
<th>Id</th>
<th>Название</th>
<th>Порядковый номер</th>
</tr>
</thead>
<tbody>
<tr class="Authors-item" th:each="user, item : *{users.users}">
<td th:text="*{user.id}">Id</td>
<td th:text="*{user.name}">End</td>
<td class="dragElement" draggable="true">
<input type="text" th:field="*{user.sequence}" style="border: none; outline: none;">
</td>
</tr>
</tbody>
</table>
<input type="submit" class="btn btn-block btn-primary btn-lg font-weight-medium auth-form-btn" value="СОХРАНИТЬ">
</form>
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
int main()
{
int n, i;
float c = 0;
int count = 0;
printf_s("enter elements: ");
scanf_s("%d", &n);
int* a = (int*)malloc(n * sizeof(int));
for (i = 0; i < n; i++)
{
printf("a[%d] = ", i);
scanf_s("%d", &a[i]);
}
for (i = 0; i < n; i++) {
if (a[i] < c) {
count++;
}
}
free(a);
return count;
}
static public DataTable ColumnsCreating()
{
DataTable dataTable = new DataTable("student");
// инициализация массива названий столбцов
string[] columnHeaders = { "ФИО", "№ зачетной книжки",
"Специальность", "1 зачет", "2 зачет", "3 зачет",
"4 зачет", "5 зачет", "1 экзамен", "2 экзамен",
"3 экзамен", "4 экзамен", "5 экзамен"};
// автоматическое создание столбцов
for (int i = 0; i < columnHeaders.Length; i++)
dataTable.Columns.Add(columnHeaders[i]);
return dataTable;
}
static public DataTable FileToTable()
{
try
{
DataTable dt = new DataTable();
string[] list;
string name = "database.txt";
string buffer = "";
dt = CreatingForm.ColumnsCreating();
FileStream file = new FileStream(name, FileMode.OpenOrCreate);
using (StreamReader streamReader = new StreamReader(file))
{
while (!streamReader.EndOfStream)
{
buffer = streamReader.ReadLine();
list = buffer.Split(';');
DataRow row = dt.NewRow();
for (int i = 0; i < list.Length; i++)
row[i] = list[i];
dt.Rows.Add(row);
}
return dt;
}
}
catch
{
MessageBox.Show("Произошла ошибка при чтении файла");
return null;
}
}
#include <stdio.h>
#include <Windows.h>
int n;
DWORD WINAPI Add(int Num) {
printf("Thread is started\n");
n += Num;
printf("Thread is finished\n");
}
int main() {
int inc = 10;
HANDLE hThread;
DWORD IDThread;
printf("n = %d\n", n);
hThread = CreateThread(
NULL,
0,
Add,
(void*)inc,
0,
&IDThread);
if (hThread == NULL)
return GetLastError();
WaitForSingleObject(hThread, INFINITE);
CloseHandle(hThread);
printf("n = %d\n", n);
return 0;
}