Esempio n. 1
0
        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();
            }
        }
Esempio n. 2
0
        //Добавление предприятия по нажатию "Действия" - "Добавить"
        private void AddTStrMenu_Click(object sender, EventArgs e)
        {
            AddCompanyForm form = new AddCompanyForm();

            form.ShowDialog();
            bindListToDataGridView(CompanyCollection.companies);
        }
Esempio n. 3
0
        private void btnAddCompany_btnClick(object sender, EventArgs e)
        {
            AddCompanyForm addCompanyFRM = new AddCompanyForm();

            addCompanyFRM.ShowDialog(this);
            RefreshMainForm();
        }
Esempio n. 4
0
        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));
        }
Esempio n. 7
0
 /// <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();
         }
     }
 }
Esempio n. 8
0
        private void btnAddCompany_Click(object sender, EventArgs e)
        {
            AddCompanyForm addCompanyForm = new AddCompanyForm(this);

            addCompanyForm.ShowDialog();
        }
Esempio n. 9
0
 public CompanyTransactions()
 {
     mainForm       = (MainForm)Application.OpenForms["MainForm"];
     addCompanyForm = (AddCompanyForm)Application.OpenForms["AddCompanyForm"];
 }
Esempio n. 10
0
        private void addCompanyButton_Click(object sender, EventArgs e)
        {
            var AddCompanyForm = new AddCompanyForm(service);

            AddCompanyForm.Show();
        }