Esempio n. 1
0
        private void btnAddBranch_Click(object sender, EventArgs e)
        {
            BranchForm form = new BranchForm();

            if (DialogResult.OK == form.ShowDialog(this))
            {
                CreateBranch createBranch = new CreateBranch();
                createBranch.Name = form.textName.Text;
                createBranch.Uri  = form.textAdres.Text;
                var branch = managementService.CreateBranch(createBranch);
                UpdateGridBranches();
            }
        }
Esempio n. 2
0
        private void btnBranchEdit_Click(object sender, EventArgs e)
        {
            BranchForm form     = new BranchForm();
            var        selected = gridBranch.SelectedRows[0];
            int        branchId = int.Parse(selected.Cells[0].Value.ToString());
            var        toEdit   = managementService.GetBranch(branchId.ToString());

            form.textId.Text    = toEdit.Id.ToString();
            form.textName.Text  = toEdit.Name;
            form.textAdres.Text = toEdit.Uri;
            if (DialogResult.OK == form.ShowDialog(this))
            {
                Branch updateBranch = new Branch();
                updateBranch.Name = form.textName.Text;
                updateBranch.Uri  = form.textAdres.Text;
                var branch = managementService.UpdateBranch(form.textId.Text, updateBranch);
                UpdateGridBranches();
            }
        }