private void RefuseButton_Click(object sender, EventArgs e) { try { ConvertData(); if (Trades.FirstManager(SqlConnection, Id)) { EstateObjects.UpdateStatus(SqlConnection, Id, 1); int linkid = Trades.FindLinkId(SqlConnection, Id); Trades.DeleteLink(SqlConnection, linkid); MessageBox.Show("Заявка отклонена"); } this.Close(); } catch (Exception t) { MessageBox.Show(t.ToString()); } }
private void BuyButton_Click(object sender, EventArgs e) { try { ConvertData(); EstateObjects.UpdateStatus(SqlConnection, Id, 2); try { Trades.CreateClientObjectLink(SqlConnection, CurrentUser.ClientId, Id); MessageBox.Show("Заявка подана на рассмотрение"); this.Close(); } catch (Exception tt) { MessageBox.Show("К сожалению, кто-то только что оформил заявку на этот объект. Попробуйте выбрать другой объект в нашем каталоге."); } } catch (Exception u) { MessageBox.Show(u.ToString()); } }
private void paymentButton_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count > 0) { int index = dataGridView1.SelectedRows[0].Index; int id = 0; bool converted = Int32.TryParse(dataGridView1[0, index].Value.ToString(), out id); if (converted == false) { return; } int itemid = 0; bool converted2 = Int32.TryParse(dataGridView1[1, 0].Value.ToString(), out itemid); if (converted2 == false) { return; } MessageBox.Show(itemid.ToString()); PaymentForm pf = new PaymentForm(SqlConnection); string[] res = Trades.Contacts(SqlConnection, CurrentUser.ClientId, itemid); pf.PhoneTextBox.Text = res[0]; pf.EmailTextBox.Text = res[1]; pf.ItemId = itemid; pf.LinkId = id; try { pf.ShowDialog(); RefreshData(); } catch (Exception) { MessageBox.Show("запускай через отладчик"); } } }
private void RefuseButton_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count > 0) { int index = dataGridView1.SelectedRows[0].Index; int id = 0; bool converted = Int32.TryParse(dataGridView1[0, index].Value.ToString(), out id); if (converted == false) { return; } try { Trades.DeleteTrade(SqlConnection, id); Trades.DeleteLink(SqlConnection, id); MessageBox.Show("Заявка удалена."); } catch (Exception r) { MessageBox.Show(r.ToString()); } } }