Ejemplo n.º 1
0
 private void FormMessages_Load(object sender, EventArgs e)
 {
     try
     {
         List <MessageInfoViewModel> dataSourse = ClientApi.GetRequest <List <MessageInfoViewModel> >($"api/client/getmessages?clientId={Program.Client.Id}");
         dataGridView.DataSource              = dataSourse;
         dataGridView.Columns[0].Visible      = false;
         dataGridView.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
 private void FormCreateOrder_Load(object sender, EventArgs e)
 {
     try
     {
         comboBoxKomlect.DisplayMember = "KomlectName";
         comboBoxKomlect.ValueMember   = "Id";
         comboBoxKomlect.DataSource    = ClientApi.GetRequest <List <KomlectViewModel> >("api/main/getproductlist");
         comboBoxKomlect.SelectedItem  = null;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
 private void CalcSum()
 {
     if (comboBoxKomlect.SelectedValue != null && !string.IsNullOrEmpty(textBoxCount.Text))
     {
         try
         {
             int id = Convert.ToInt32(comboBoxKomlect.SelectedValue);
             KomlectViewModel product = ClientApi.GetRequest <KomlectViewModel>($"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);
         }
     }
 }
Ejemplo n.º 4
0
 private void LoadList()
 {
     try
     {
         dataGridView.DataSource              = ClientApi.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].Visible      = false;
         dataGridView.Columns[4].Visible      = false;
         dataGridView.Columns[5].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
                         MessageBoxIcon.Error);
     }
 }
Ejemplo n.º 5
0
 private void ButtonLogin_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(textBoxEmail.Text) && !string.IsNullOrEmpty(textBoxPassword.Text))
     {
         try
         {
             Program.Client = ClientApi.GetRequest <ClientViewModel>($"api/client/login?login={textBoxEmail.Text}&password={textBoxPassword.Text}");
             Close();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     else
     {
         MessageBox.Show("Введите логин и пароль", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }