private void CalcSum() { if (comboBoxProduct.SelectedValue != null && !string.IsNullOrEmpty(textBoxCount.Text)) { try { int id = Convert.ToInt32(comboBoxProduct.SelectedValue); ProductViewModel product = APIClient.GetRequest <ProductViewModel>($"api/main/getproduct?productId={id}"); int count = Convert.ToInt32(textBoxCount.Text); textBoxSum.Text = (count * product.Price).ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void LoadList() { try { dataGridView.DataSource = APIClient.GetRequest <List <MessageInfoViewModel> >( $"api/client/GetMessages?clientId={Program.Client.Id}"); dataGridView.Columns[0].Visible = false; dataGridView.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; dataGridView.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; dataGridView.Columns[3].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; dataGridView.Columns[4].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView.Columns[5].Visible = false; } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void LoadList() { try { dataGridView.DataSource = APIClient.GetRequest <List <OrderViewModel> >( $"api/main/getorders?clientId={Program.Client.Id}"); dataGridView.Columns[0].Visible = false; dataGridView.Columns[1].Visible = false; dataGridView.Columns[2].Visible = false; dataGridView.Columns[3].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView.Columns[4].Visible = false; dataGridView.Columns[5].Visible = false; dataGridView.Columns[6].Width = 100; dataGridView.Columns[7].Width = 100; dataGridView.Columns[8].Width = 100; dataGridView.Columns[9].Visible = false; dataGridView.Columns[10].Visible = false; dataGridView.Columns[11].Visible = false; } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void buttonLogin_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(textBoxEmail.Text) && !string.IsNullOrEmpty(textBoxPassword.Text)) { try { Program.Client = APIClient.GetRequest <ClientViewModel>($"api/client/login?login={textBoxEmail.Text}&password={textBoxPassword.Text}"); if (Program.Client == null) { MessageBox.Show("Неверный логин/пароль", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } Close(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Введите логин и пароль", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } }