public async Task <long> Handle(CreateExtraClassCommand request, CancellationToken cancellationToken) { var subject = await _context.Subjects.FindAsync(request.SubjectId); if (subject == null) { throw new NotFoundException(nameof(Subject), request.SubjectId); } var entity = new ExtraClass { Name = request.Name, Date = request.Date, Duration = request.Duration, IsClassFull = false, Size = request.Size, SubjectId = request.SubjectId, TeacherId = _currentUserService.UserId, Price = request.Price, }; _context.ExtraClasses.Add(entity); await _context.SaveChangesAsync(cancellationToken); return(entity.Id); }
private void btnEditRecipient_Click(object sender, RoutedEventArgs e) { bool resultEmail = ExtraClass.IsValidString(tbEditEmail.Text, @"^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$"); bool resultPhoneNumber = ExtraClass.IsValidString(tbEditPhoneNumber.Text, @"^\+\d{1}\(\d{3}\)\d{3}-\d{2}-\d{2}$"); if (dgRecipient.SelectedItem is null) { sB.Info("Выберете строку для редактирования"); } else if (string.IsNullOrEmpty(tbEditFirstName.Text)) { sB.Info("Введите имя"); } else if (string.IsNullOrEmpty(tbEditLastName.Text)) { sB.Info("Введите фамилию"); } else if (string.IsNullOrEmpty(tbEditAddress.Text)) { sB.Info("Введите адрес"); } else if (string.IsNullOrEmpty(tbEditPhoneNumber.Text)) { sB.Info("Введите номер телефона"); } else if (string.IsNullOrEmpty(tbEditEmail.Text)) { sB.Info("Введите email"); } else if (resultEmail == false) { sB.Info("Email введен не корректно"); } else if (resultPhoneNumber == false) { sB.Info("Телефон введен не корректно"); } else { dataBaseQuery.SqlQuery("UPDATE dbo.[Recipient] " + $"SET [FirstName] = '{tbEditFirstName.Text}', " + $"[LastName] = '{tbEditLastName.Text}'," + $"[Address] = '{tbEditAddress.Text}'," + $"[Email] = '{tbEditEmail.Text}'," + $"[PhoneNumber] = '{tbEditPhoneNumber.Text}'" + $"WHERE [Id] = '{id}'", "Данные успешно изменены", "Ошибка"); dG.Loader("SELECT Id, FirstName + N' ' + LastName as Recipient," + " Address, PhoneNumber, Email FROM dbo.Recipient"); tbEditAddress.Clear(); tbEditFirstName.Clear(); tbEditLastName.Clear(); tbEditEmail.Clear(); tbEditPhoneNumber.Clear(); } }
private void btnEditEmployee_Click(object sender, RoutedEventArgs e) { bool resultEmail = ExtraClass.IsValidString(tbEditEmail.Text, @"^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$"); bool resultPhoneNumber = ExtraClass.IsValidString(tbEditPhoneNumber.Text, @"^\+\d{1}\(\d{3}\)\d{3}-\d{2}-\d{2}$"); if (dgEmployee.SelectedItem is null) { sB.Info("Выберете строку для редактирования"); } else if (string.IsNullOrEmpty(cbEditLogin.Text)) { sB.Info("Введите логин"); } else if (string.IsNullOrEmpty(tbEditFirstName.Text)) { sB.Info("Введите имя"); } else if (string.IsNullOrEmpty(tbEditLastName.Text)) { sB.Info("Введите фамилию"); } else if (string.IsNullOrEmpty(tbEditPhoneNumber.Text)) { sB.Info("Введите номер телефона"); } else if (string.IsNullOrEmpty(tbEditEmail.Text)) { sB.Info("Введите email"); } else if (resultEmail == false) { sB.Info("Email введен не корректно"); } else if (resultPhoneNumber == false) { sB.Info("Телефон введен не корректно"); } else { dataBaseQuery.SqlQuery("UPDATE dbo.[Employee] " + "SET [IdUser] = (SELECT Id FROM dbo.[User] " + $"WHERE [Login] = '{cbEditLogin.Text}')," + $"[FirstName] = '{tbEditFirstName.Text}'," + $"[LastName] = '{tbEditLastName.Text}'," + $"[PhoneNumber] = '{tbEditPhoneNumber.Text}'," + $"Email = '{tbEditEmail.Text}' " + $"WHERE Id = {id}", "Данные успешно обновлены", "Ошибка"); dG.Loader("SELECT * FROM dbo.[EmployeeUser]"); tbEditEmail.Clear(); tbEditPhoneNumber.Clear(); tbEditFirstName.Clear(); tbEditLastName.Clear(); cbEditLogin.Text = null; } }
private void btnEditSupplier_Click(object sender, RoutedEventArgs e) { bool resultEmail = ExtraClass.IsValidString(tbEditEmail.Text, @"^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$"); bool resultPhoneNumber = ExtraClass.IsValidString(tbEditPhoneNumber.Text, @"^\+\d{1}\(\d{3}\)\d{3}-\d{2}-\d{2}$"); if (dgSupplier.SelectedItem is null) { sB.Info("Выберете строку для редактирования"); } else if (string.IsNullOrEmpty(tbEditName.Text)) { sB.Info("Введите наименование"); } else if (string.IsNullOrEmpty(tbEditAddress.Text)) { sB.Info("Введите адрес"); } else if (string.IsNullOrEmpty(tbEditPhoneNumber.Text)) { sB.Info("Введите номер телефона"); } else if (string.IsNullOrEmpty(tbEditEmail.Text)) { sB.Info("Введите почту"); } else if (string.IsNullOrEmpty(tbEditFieldOfActivity.Text)) { sB.Info("Введите область деятельности"); } else if (resultEmail == false) { sB.Info("Email введен не корректно"); } else if (resultPhoneNumber == false) { sB.Info("Телефон введен не корректно"); } else { dataBaseQuery.SqlQuery("UPDATE dbo.[Supplier] " + $"SET [Name] = '{tbEditName.Text}', " + $"[Address] = '{tbEditAddress.Text}'," + $"[PhoneNumber] = '{tbEditPhoneNumber.Text}'," + $"[Email] = '{tbEditEmail.Text}'," + $"[FieldOfActivity] = '{tbEditFieldOfActivity.Text}'" + $"WHERE [Id] = '{id}'", "Данные успешно изменены", "Ошибка"); dG.Loader("SELECT * FROM dbo.[Supplier]"); tbEditName.Clear(); tbEditAddress.Clear(); tbEditPhoneNumber.Clear(); tbEditEmail.Clear(); tbEditFieldOfActivity.Clear(); } }
static void Main() { ExtraClass extra = new ExtraClass(); extra.x = 10; Func <int, int> foo = extra.DelegateMethod; Console.WriteLine(foo(x)); }
public WinDirector() { InitializeComponent(); tbDragger.MouseDown += delegate { this.DragMove(); }; btnReference.Click += delegate { ExtraClass.Reference(); }; btnBack.Click += delegate { ExtraClass.OpenWinAutorization(this); }; btnHidde.Click += delegate { ExtraClass.MinimizedWindow(this); }; btnClose.Click += delegate { ExtraClass.Shutdown(); }; }
private void btnAddSupplier_Click(object sender, RoutedEventArgs e) { bool resultEmail = ExtraClass.IsValidString(tbEmail.Text, @"^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$"); bool resultPhoneNumber = ExtraClass.IsValidString(tbPhoneNumber.Text, @"^\+\d{1}\(\d{3}\)\d{3}-\d{2}-\d{2}$"); if (string.IsNullOrEmpty(tbName.Text)) { sB.Info("Введите наименование"); } else if (string.IsNullOrEmpty(tbAddress.Text)) { sB.Info("Введите адрес"); } else if (string.IsNullOrEmpty(tbPhoneNumber.Text)) { sB.Info("Введите номер телефона"); } else if (string.IsNullOrEmpty(tbEmail.Text)) { sB.Info("Введите почту"); } else if (string.IsNullOrEmpty(tbFieldOfActivity.Text)) { sB.Info("Введите область деятельности"); } else if (resultEmail == false) { sB.Info("Email введен не корректно"); } else if (resultPhoneNumber == false) { sB.Info("Телефон введен не корректно"); } else { dataBaseQuery.SqlQuery("INSERT INTO dbo.[Supplier] " + $"VALUES ('{tbName.Text}', '{tbAddress.Text}', " + $"'{tbPhoneNumber.Text}', '{tbEmail.Text}', " + $"'{tbFieldOfActivity.Text}')", "Данные успешно добавлены", "Ошибка"); dG.Loader("SELECT * FROM dbo.[Supplier]"); tbName.Clear(); tbAddress.Clear(); tbPhoneNumber.Clear(); tbEmail.Clear(); tbFieldOfActivity.Clear(); } }
private void btnAddRecipient_Click(object sender, RoutedEventArgs e) { bool resultEmail = ExtraClass.IsValidString(tbEmail.Text, @"^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$"); bool resultPhoneNumber = ExtraClass.IsValidString(tbPhoneNumber.Text, @"^\+\d{1}\(\d{3}\)\d{3}-\d{2}-\d{2}$"); if (string.IsNullOrEmpty(tbFirstName.Text)) { sB.Info("Введите имя"); } else if (string.IsNullOrEmpty(tbLastName.Text)) { sB.Info("Введите фамилию"); } else if (string.IsNullOrEmpty(tbAddress.Text)) { sB.Info("Введите адрес"); } else if (string.IsNullOrEmpty(tbPhoneNumber.Text)) { sB.Info("Введите номер телефона"); } else if (string.IsNullOrEmpty(tbEmail.Text)) { sB.Info("Введите email"); } else if (resultEmail == false) { sB.Info("Email введен не корректно"); } else if (resultPhoneNumber == false) { sB.Info("Телефон введен не корректно"); } else { dataBaseQuery.SqlQuery("INSERT INTO dbo.[Recipient] " + $"VALUES ('{tbFirstName.Text}', '{tbLastName.Text}', " + $"'{tbAddress.Text}', '{tbPhoneNumber.Text}', '{tbEmail.Text}')", "Данные успешно добавлены", "Ошибка"); tbAddress.Clear(); tbFirstName.Clear(); tbLastName.Clear(); tbEmail.Clear(); tbPhoneNumber.Clear(); dG.Loader("SELECT Id, FirstName + N' ' + LastName as Recipient," + " Address, PhoneNumber, Email FROM dbo.Recipient"); } }
// Start is called before the first frame update void Awake() { this.customClass = new CustomClass(); //normalClass = GetComponentInChildren<NormalClass>(); //extraClass = GetComponentInChildren<ExtraClass>(); this.normalClass = new NormalClass(); //this.extraClass = new ExtraClass(); this.extraClass = new List <ExtraClass>(); for (int i = 0; i < 5; i++) { ExtraClass e = new ExtraClass(); e.int1 = 100 + i; e.int2 = 100 - i; this.extraClass.Add(e); } }
public WinAutorization() { InitializeComponent(); autorization = new Autorization(this, tbLogin, pbPassword, snack, snackMessage); tbDragger.MouseDown += delegate { this.DragMove(); }; btnEnter.Click += delegate { autorization.Enter(tbLogin.Text); }; snackMessage.ActionClick += delegate { autorization.CloseSnack(); }; btnHidde.Click += delegate { ExtraClass.MinimizedWindow(this); }; btnClose.Click += delegate { ExtraClass.Shutdown(); }; }