Пример #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (Program.CheckString(new string[] { textBox1.Text }) && comboBox1.SelectedIndex != 0)
     {
         try
         {
             var     result = ((Main)Owner).db.payment.SingleOrDefault(n => n.id_p == item.id_p);
             PayForm pay    = new PayForm();
             pay.EditPayment(item, result, dateTimePicker1.Value
                             , Convert.ToInt32(comboBox1.SelectedItem.ToString().Substring(0, comboBox1.SelectedItem.ToString().IndexOf('.'))),
                             (float)Convert.ToDouble(textBox1.Text));
             ((Main)Owner).paySheet = ((Main)Owner).db.payment.OrderBy(n => n.id_p).ToList();
             ((Main)Owner).db.SaveChanges();
             ((Main)Owner).платежиStripMenuItem_Click(sender, e);
             this.Close();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
     else
     {
         MessageBox.Show("Не все поля заполнены!");
     }
 }
Пример #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (Program.CheckString(new string[] { textBox1.Text }) && comboBox1.SelectedIndex != 0)
     {
         try
         {
             PayForm pay = new PayForm((float)Convert.ToDouble(textBox1.Text));
             pay.AddPayment(dateTimePicker1, comboBox1);
             ((Main)Owner).платежиStripMenuItem_Click(sender, e);
             this.Close();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, "Ошибка");
         }
     }
     else
     {
         MessageBox.Show("Не все поля заполнены!");
     }
 }