public static void AddCompany(AddCompanyForm rent) { using (var _context = new DiemServiceDB()) { User found = _context.UserDbSet.Where(user => user.Username == rent.OwnerUsername).FirstOrDefault(); switch (found.Role) { case Role.AdminAvio: AvioCompany toAdd = rent.getAvio(); string imgName = "avioCompany" + toAdd.Id; File.WriteAllBytes(AppDomain.CurrentDomain.BaseDirectory + "/" + imgName, Convert.FromBase64String(toAdd.Logo)); toAdd.Logo = imgName; toAdd.Owner = found; _context.AdminAvioDbSet.Include(x => x.OwnedAvioCompanies) .Where(x => x.Id == found.UlogaID) .FirstOrDefault().OwnedAvioCompanies .Add(_context.AvioCompanyDbSet.Add(toAdd)); break; case Role.AdminRentACar: RentACar toAdd2 = rent.getRent(); toAdd2.Owner = found; _context.AdminRentDbSet.Include(x => x.OwnedRentServices) .Where(x => x.Id == found.UlogaID) .FirstOrDefault().OwnedRentServices .Add(_context.RentACarDbSet.Add(toAdd2)); break; default: break; } _context.SaveChanges(); } }
//Добавление предприятия по нажатию "Действия" - "Добавить" private void AddTStrMenu_Click(object sender, EventArgs e) { AddCompanyForm form = new AddCompanyForm(); form.ShowDialog(); bindListToDataGridView(CompanyCollection.companies); }
private void btnAddCompany_btnClick(object sender, EventArgs e) { AddCompanyForm addCompanyFRM = new AddCompanyForm(); addCompanyFRM.ShowDialog(this); RefreshMainForm(); }
public HttpResponseMessage AddCompany(AddCompanyForm promote) { ClaimsPrincipal loggedUser = (ClaimsPrincipal)HttpContext.Current.User; //check if admin AdminDbManager.AddCompany(promote); return(Request.CreateResponse(HttpStatusCode.OK)); }
private void btnAddCompany_Click(object sender, EventArgs e) { var dialog = new AddCompanyForm(); if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.Yes) { this.companyTableAdapter.Fill(farmManageDataSet.Company); } }
public IActionResult Create(AddCompanyForm addCompanyForm) { var company = Mediator.Send <AddCompany, CompanyDto>(new AddCompany() { AddCompanyForm = addCompanyForm }); return(Ok(company)); }
/// <summary> /// Add a company to the list /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cmdAdd_Click(object sender, EventArgs e) { using (var form = new AddCompanyForm()) { var result = form.ShowDialog(); if (result == DialogResult.OK) { List <CompanyObject> newCompanies = form.ReturnCompanies; foreach (var company in newCompanies) { _bindingList.Add(company); } _companiesManager.SaveChangesToFile(); ReloadContent(); } } }
private void btnAddCompany_Click(object sender, EventArgs e) { AddCompanyForm addCompanyForm = new AddCompanyForm(this); addCompanyForm.ShowDialog(); }
public CompanyTransactions() { mainForm = (MainForm)Application.OpenForms["MainForm"]; addCompanyForm = (AddCompanyForm)Application.OpenForms["AddCompanyForm"]; }
private void addCompanyButton_Click(object sender, EventArgs e) { var AddCompanyForm = new AddCompanyForm(service); AddCompanyForm.Show(); }