/* * Button (Save) - Save Button code behind */ private void btnSave_Click(object sender, EventArgs e) { AddData updateStudentRecord = new AddData(); int studentId = ucUpdateRecordControl1.UpdateStudent.StudentNumber; string firstName = ucUpdateRecordControl1.UpdateStudent.FirstName; string surname = ucUpdateRecordControl1.UpdateStudent.Surname; string email = ucUpdateRecordControl1.UpdateStudent.Email; string phone = ucUpdateRecordControl1.UpdateStudent.Phone; string addressLine1 = ucUpdateRecordControl1.UpdateStudent.AddressLine1; string addressLine2 = ucUpdateRecordControl1.UpdateStudent.AddressLine2; string city = ucUpdateRecordControl1.UpdateStudent.City; string county = ucUpdateRecordControl1.UpdateStudent.County; string studentLevel = ucUpdateRecordControl1.UpdateStudent.Level; //send updated record to DB if (updateStudentRecord.EditStudentRecord(studentId, email, phone, addressLine1, addressLine2, city, county, studentLevel)) { MessageBox.Show("Record Update - Student Record Successfully Saved", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Ref Student Record Update For: " + firstName + " " + surname + "\nRecord Update Save Failed - Please Revise and Try Again", "Failed Save", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void Add() { if (string.IsNullOrEmpty(AddData)) { return; } var parts = AddData.Split(','); if (parts.Length != 2) { return; } var nameResult = NameConverter.ValidateName(parts[0]); var ageResult = AgeConverter.ValidateAge(parts[1]); if (!nameResult || !ageResult) { MessageBox.Show("Error input"); return; } var sytudent = new Student(parts[0], Convert.ToInt32(parts[1])); Students.Add(sytudent); OnPropertyChanged("Students"); }
public CreateIssueRequest(string username, string repo, string title, string body) { addData = new AddData { Title = title, Body = body.Replace('\r', '\n') }; Uri = String.Format("/repos/{0}/{1}/issues", username, repo); }
public CreatePullRequestCommentsRequest(string username, string repo, string number, string body) { addData = new AddData { Body = body.Replace('\r', '\n') }; Uri = String.Format("/repos/{0}/{1}/pulls/{2}/comments", username, repo, number); }
private void btnSubmit_Click(object sender, EventArgs e) { AddData addingNewUser = new AddData(); //call DAL Add Data class for DB access //add variables passing in form values for the new registration int employeeId = 0; string username = ucSystemUserRegistration1.NewUser.EmployeeUsername; string password = ucSystemUserRegistration1.NewUser.Password; string firstName = ucSystemUserRegistration1.NewUser.EmployeeFirstName; string lastName = ucSystemUserRegistration1.NewUser.EmployeeLastName; string jobTitle = ucSystemUserRegistration1.NewUser.JobTitle; string userType = ucSystemUserRegistration1.NewUser.UserType; string userStatus = ucSystemUserRegistration1.NewUser.UserStatus; string managerAuthId = ucSystemUserRegistration1.NewUser.ManagerId; string managerFirstName = ucSystemUserRegistration1.NewUser.ManagerFirstName; string managerLastName = ucSystemUserRegistration1.NewUser.ManagerLastName; string managerEmail = ucSystemUserRegistration1.NewUser.ManagerEmail; if (addingNewUser.AddNewUser(employeeId, username, password, firstName, lastName, jobTitle, userType, userStatus, managerAuthId, managerFirstName, managerLastName, managerEmail)) { MessageBox.Show("Successfully Added " + lastName + " as " + username, "Success", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk); } else { MessageBox.Show("Failed to Add " + lastName + " as " + username + ". Please review entry", "Failed Save", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); } }
private void RecurseDrive(DirectoryInfo root, TreeNode node) { try { foreach (DirectoryInfo dirInfo in root.GetDirectories()) { try { TreeNode subNode = new TreeNode(dirInfo.Name) { ImageIndex = 1, SelectedImageIndex = 2 }; if (TreeViewFolder.InvokeRequired) { AddData invoker = new AddData(AddDataToTreeNode); TreeViewFolder.Invoke(invoker, node, subNode); } else { node.Nodes.Add(subNode); } RecurseDrive(dirInfo, subNode); } catch (Exception ex) { Console.WriteLine(ex); } } } catch (Exception ex) { Console.WriteLine(ex); } }
private void Init(DbContextOptions <OpcUaDataDbContext> sqlDbOptions) { addData = new AddData(sqlDbOptions); //Server in Datenbanlk ablegen SaveServerDataInSql().Wait(); }
public CommentCommitRequest(string username, string repo, string sha, string body) { addData = new AddData { Body = body.Replace('\r', '\n') }; Uri = String.Format("/repos/{0}/{1}/commits/{2}/comments", username, repo, sha); }
private void btnWithdraw_Click(object sender, EventArgs e) { //variables decimal minusAmount = decimal.Parse(txtMinusAmount.Text); decimal currentBalance = decimal.Parse(txtBal.Text); decimal overdraft = decimal.Parse(txtOverdraft.Text); decimal limit = currentBalance + overdraft; if (minusAmount > limit) { MessageBox.Show("Transaction not allowed, Overdraft exceeded"); this.DialogResult = DialogResult.None; txtMinusAmount.Clear(); txtMinusAmount.Focus(); } else { txtBal.Text = (currentBalance - minusAmount).ToString(); //record transaction AddData ad = new AddData();//to make transaction //gather withdrawal variables string type = "Withdrawal"; decimal amount = decimal.Parse(txtMinusAmount.Text); int accNum = int.Parse(txtAccountNumber.Text); decimal balance = decimal.Parse(txtBal.Text); DateTime date = DateTime.Now; ad.AddWithdrawTransaction(type, amount, accNum, balance, date); MessageBox.Show("Success, Make Another Withdrawal or Update Database"); } }
private static AddData InstantiateDataAccessObject() { AddData ad = new AddData();//instantiate the AddData class //var details = AddAccountDetails return(ad); }
private void btnSave_Click(object sender, EventArgs e) { AddData addNewStudent = new AddData(); //DAL Layer class call - no business validation for now int studentId = 0; int courseId = 0; string firstName = ucNewStudentDetails.UpdateStudent.FirstName; string surname = ucNewStudentDetails.UpdateStudent.Surname; string email = ucNewStudentDetails.UpdateStudent.Email; string phone = ucNewStudentDetails.UpdateStudent.Phone; string addressLine1 = ucNewStudentDetails.UpdateStudent.AddressLine1; string addressLine2 = ucNewStudentDetails.UpdateStudent.AddressLine2; string city = ucNewStudentDetails.UpdateStudent.City; string county = ucNewStudentDetails.UpdateStudent.County; string studentLevel = ucNewStudentDetails.UpdateStudent.Level; //from here down is for Course Table string courseCode = ucCourseDetailControl1.UpdateCourse.CourseCode; string courseName = ucCourseDetailControl1.UpdateCourse.CourseName; string courseLevel = ucCourseDetailControl1.UpdateCourse.CourseLevel; //use harvested object values in variables to call the add data class and save the information to Student and Course tables if (addNewStudent.AddNewStudent(studentId, firstName, surname, email, phone, addressLine1, addressLine2, city, county, studentLevel, courseId, courseCode, courseName, courseLevel)) { MessageBox.Show("New Record Successfully Saved", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Ref: " + surname + " Course Ref: " + courseCode + "\nNew Record Save Failed - Please Revise and Try Again", "Failed Save", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void ParseFormDataAndAddNewSavingsAccount(AddData ad) { AddAccountDetails addNewSavingAccount = new AddAccountDetails(); txtOverdraftLimit.Text = "0"; addNewSavingAccount.FirstName = txtFName.Text; addNewSavingAccount.Surname = txtFName.Text; addNewSavingAccount.Email = new Email(txtEmail.Text); addNewSavingAccount.Phone = new Phone(txtPhone.Text); addNewSavingAccount.AddressLine1 = txtAddress1.Text; addNewSavingAccount.AddressLine2 = txtAddress2.Text; addNewSavingAccount.City = txtCity.Text; addNewSavingAccount.County = cbxCounty.Items[cbxCounty.SelectedIndex].ToString(); addNewSavingAccount.AccountType = cbxAccountType.Items[cbxAccountType.SelectedIndex].ToString(); addNewSavingAccount.AccountNumber = new AccountNumber(txtAccountNumber.Text); addNewSavingAccount.SortCode = txtSortCode.Text; addNewSavingAccount.OpeningBalance = decimal.Parse(txtOpeningBalance.Text); addNewSavingAccount.Overdraft = decimal.Parse(txtOverdraftLimit.Text); //check account number is 8 digits if (txtAccountNumber.Text.Length == 8) { ad.AddSavingsAccount(addNewSavingAccount); CloseCon(); } else { AccountNumberLengthErrorMessage(); } }
private void AddMovieNxtBTN_Click(object sender, EventArgs e) { AddData AD = new AddData(); string Name = MovieNameInput.Text; int Year = Int32.Parse(ReleaseInput.Text); int MinimumAge = Int32.Parse(AgeResInput.Text); string Summary = SumInput.Text; string Actors = ActorsInput.Text; int Duration = Int32.Parse(DurationInput.Text); string Genre = GenreInput.Text; if (Year <= 1800 || Year > Convert.ToInt32((DateTime.Now.ToString("yyyy")))) { ReleaseInput.Clear(); MessageBox.Show("The year of release was not valid. Please try again", "Invalid year of release", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (MinimumAge < 0 || MinimumAge > 99) { AgeResInput.Clear(); MessageBox.Show("The minimum age was not valid. Please try again", "Invalid minimum age", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { AD.InsertMovie(Name, Year, MinimumAge, Summary, Actors, Duration, Genre); this.Hide(); AddTime form = new AddTime(Name, Duration); form.ShowDialog(); this.Close(); } }
static void Main(string[] args) { var exampleToRun = ExamplesEnumeration.GetCharactersFromDb; switch (exampleToRun) { case ExamplesEnumeration.AddCharactersToDb: AddData.AddCharactersToDb(); break; case ExamplesEnumeration.GetCharactersFromDb: GetData.GetCharactersFromDb(); break; case ExamplesEnumeration.UpdateCharacter: Update.UpdateCharacter(); break; case ExamplesEnumeration.DeleteCharacter: Delete.DeleteCharacter(); break; } Console.Read(); }
public static void Main(string[] args) { //CreateWebHostBuilder(args).Build().Run(); var host = CreateWebHostBuilder(args).Build(); using (var scope = host.Services.CreateScope()) { var services = scope.ServiceProvider; try { var context = services.GetRequiredService <ProgrammingTestContext>(); context.Database.Migrate(); AddData.Initialize(services); } catch (Exception ex) { var logger = services.GetRequiredService <ILogger <Program> >(); logger.LogError(ex, "An error occurred seeding the DB."); } } host.Run(); }
public AddForm(PhoneBook.Objects.Language language, string up_text, Form1 parentForm, AddData deleg) { InitializeComponent(); this.language = language; InitStrings(); this.Text = language.Add + " " + up_text; this.parentForm = parentForm; this.addData = deleg; }
/// <summary> /// Добавление истории /// </summary> /// <param name="history"></param> public void AddHistory(OperationHistory history) { if (history != null) { history.OperationDate = DateTime.Now; OperationHistories.Add(history); AddData.AddHistory(history); } }
public static async Task SeedAsync(SoccerFieldServerContext dbContext, UserManager <ApplicationUser> userManager, RoleManager <IdentityRole> roleManager, ILoggerFactory loggerFactory, int?retry = 0) { int retryForAvailability = retry.Value; try { dbContext.Database.Migrate(); await AddData.SeedRolesAndClaims(userManager, roleManager); await AddData.SeedAdmin(userManager); await AddData.SeedOwner(userManager); await AddData.SeedStaff(userManager); await AddData.SeedCustomer(userManager); if (!dbContext.GroupSoccerFields.Any()) { dbContext.GroupSoccerFields.AddRange(DataValues.GroupSoccerFieldData()); await dbContext.SaveChangesAsync(); } if (!dbContext.SoccerFields.Any()) { dbContext.SoccerFields.AddRange(DataValues.SoccerFieldData()); await dbContext.SaveChangesAsync(); } if (!dbContext.Products.Any()) { dbContext.Products.AddRange(DataValues.ProductData()); await dbContext.SaveChangesAsync(); } if (!dbContext.User_GroupSoccerFields.Any()) { dbContext.User_GroupSoccerFields.AddRange(DataValues.User_GroupSoccerFieldData()); await dbContext.SaveChangesAsync(); } if (!dbContext.WorkScheduleStaffs.Any()) { dbContext.WorkScheduleStaffs.AddRange(DataValues.WorkScheduleStaffData()); await dbContext.SaveChangesAsync(); } } catch (Exception ex) { if (retryForAvailability < 10) { retryForAvailability++; var log = loggerFactory.CreateLogger <SoccerFieldServerContext>(); log.LogError(ex.Message); await SeedAsync(dbContext, userManager, roleManager, loggerFactory, retryForAvailability); } } }
public AddPersonForm(PhoneBook.Objects.Language language, Form1 parentForm, AddData deleg) { InitializeComponent(); this.language = language; InitStrings(); this.parentForm = parentForm; this.addData = deleg; this.Text = language.AddPerson; }
private void btnRegister_Click(object sender, EventArgs e) { string regUser = txtRegUser.Text; string regPass = txtRegPass.Text; string regFullName = txtRegFullName.Text; AddData ad = new AddData(); ad.AddUser(regUser, regPass, regFullName); MessageBox.Show("User Registered"); }
static void Main(string[] args) { AddData.InsertClub(); AddData.InsertMultipleClubs(); AddData.InsertCoach(); AddData.InsertClubWithFootballers(); AddData.InsertClubWithStadium(); AddData.AddFootballerToExistingClubTracked(); AddData.AddFootballerToExistingClubNotTracked(4); AddData.InsertMultipleTournament(); }
private void btnRegisterNewUser_Click(object sender, EventArgs e) { Subscriber subscriber = new Subscriber(txtUser.Text, txtPass.Text, txtFullName.Text); AddData ad = new AddData(); //instantiate the AddData class ad.AddUser(subscriber); //call AddUser Method passing in values from 3 textboxes MessageBox.Show("Registration Successful"); this.Close(); }
public AddTime(string name, int duration) { InitializeComponent(); Title = name; Duration = duration; AD = new AddData(); GD = new GetData(); DateTime CurrentDate = DateTime.Now; DTP.MinDate = CurrentDate; DTP.MaxDate = CurrentDate.AddYears(2); }
public AddPersonForm(PhoneBook.Objects.Language language, Form1 parentForm, AddData deleg, string name, string phone, string address) { InitializeComponent(); this.language = language; InitStrings(); this.Text = language.EditPerson; this.parentForm = parentForm; this.addData = deleg; nameBox.Text = name; phoneBox.Text = phone; addressBox.Text = address; }
private void buttonAdd_Click(object sender, EventArgs e) { AdminAddForm addform = new AdminAddForm(QlistView); addform.Text = "Ввод новых вопросов"; if (addform.ShowDialog(this) == DialogResult.OK) { Group = addform.button; TextFieldsData = addform.textdata; // QlistView.Items.Clear(); AddData?.Invoke(this, EventArgs.Empty); } }
private void btnAddAccount_Click(object sender, EventArgs e) { AddData ad = InstantiateDataAccessObject(); if (cbxAccountType.SelectedIndex == 1)//savings account - no o/draft { ParseFormDataAndAddNewSavingsAccount(ad); } else { ParseFormDataAndAddNewCurrentAccount(ad); } }
private void Pb_PNC_Click(object sender, EventArgs e) { if ((sender as Button).Text == "Add PNC") { Form AddData = new AddData("Proszę podać listę PNC", "PNC"); AddData.ShowDialog(); } else if ((sender as Button).Text == "Add PNC Spec") { Form AddData = new AddData("Proszę podać liste PNC", "PNCSpec"); AddData.ShowDialog(); } }
private void btnRegForm_Click(object sender, EventArgs e) { string regFirstname = txtRegFirstname.Text; string regSurname = txtRegSurname.Text; string regUser = txtRegUsername.Text; string regPass = hash.HashPassword(txtRegPassword.Text); AddData ad = new AddData(); ad.AddStaff(regFirstname, regSurname, regUser, regPass); MessageBox.Show("Registration Successful. Please Login"); this.Close(); }
private void btnAddData_Click(object sender, RoutedEventArgs e) { if (_mapDocument == null) { return; } HideBackstageMenu(); AddData tool = new AddData(); tool.OnCreate(_mapDocument); tool.OnEvent(new MapEvent(_mapDocument.FocusMap)); }
static async System.Threading.Tasks.Task Main(string[] args) { UsersService user = new UsersService(); user.RemoveAll(); CirclesService circle = new CirclesService(); circle.RemoveAll(); AddData addData = new AddData(); addData.DoTheThing(); Console.WriteLine("Data er nu seedet"); }