Пример #1
0
        private void EditEmployeeButton_Click(object sender, EventArgs e)
        {
            if (EmployeesDataGrid.SelectedRows.Count == 0)
            {
                MessageBox.Show("Error! You didnt select an employee to edit!");
            }

            else
            {
                EditEmployeeForm frm = new EditEmployeeForm(Convert.ToInt32(EmployeesDataGrid.SelectedRows[0].Cells[0].Value));

                if (frm.ShowDialog() == DialogResult.OK)
                {
                    BindGrid();
                }
            }
            BindGrid();
        }
Пример #2
0
        private void EditProfileButton_Click(object sender, EventArgs e)
        {
            EditEmployeeForm frm = new EditEmployeeForm(employee.EmployeeID);

            if (frm.ShowDialog() == DialogResult.OK)
            {
                HttpResponseMessage responseMessage = employeesServices.GetResponse(employee.EmployeeID.ToString());
                if (responseMessage.IsSuccessStatusCode)
                {
                    employee          = responseMessage.Content.ReadAsAsync <Employee>().Result;
                    Global.LoggedUser = employee;
                }
                else
                {
                    MessageBox.Show("Error: " + responseMessage.ReasonPhrase);
                }
            }
        }