private void Add_Click(object sender, RoutedEventArgs e)
        {
            float mon;
            int num;

            if (Title.Text.Trim() == "")
                MessageBox.Show("Missing title");
            else
            {
                Transaction transaction = new Transaction();
                transaction.Title = Title.Text.Trim();
                float.TryParse(Amount.Text, out mon);
                transaction.Amount = (decimal)mon;
                transaction.ValueDate = DateTime.Now;

                num = Convert.ToInt32(comboBox1.SelectedValue);
                transaction.CreditClient = num;
                num = Convert.ToInt32(comboBox2.SelectedValue);
                transaction.DebitClient = num;

                Admin.AddTransaction(transaction);
                MessageBox.Show("Transaction was added");
                DialogResult = true;

            }
        }
Exemplo n.º 2
0
 public static void AddTransaction(Transaction transaction)
 {
     using (RealEstateDataDataContext conn = new RealEstateDataDataContext())
     {
         conn.Transactions.InsertOnSubmit(transaction);
         conn.SubmitChanges();
     }
 }
 partial void DeleteTransaction(Transaction instance);
 partial void UpdateTransaction(Transaction instance);
 partial void InsertTransaction(Transaction instance);
		private void detach_Transactions1(Transaction entity)
		{
			this.SendPropertyChanging();
			entity.Client1 = null;
		}
		private void attach_Transactions(Transaction entity)
		{
			this.SendPropertyChanging();
			entity.Client = this;
		}