Пример #1
0
        private void butSubmit_Click(object sender, EventArgs e)
        {
            if (boxCustomerName.Text == "")
            {
                MessageBox.Show("Customer Name must be filled !");
            }
            else if (boxCustomerName.Text.IndexOf(" ") == -1)
            {
                MessageBox.Show("Customer Name must 2 words minimum !");
            }
            else if (boxPaymentType.SelectedIndex == 0)
            {
                MessageBox.Show("Payment Type must be chosen !");
            }
            else
            {
                HeaderTransaction header = new HeaderTransaction();
                header.TrID             = valueTransactionID.Text;
                header.CustomerName     = boxCustomerName.Text;
                header.DateTransaction  = Convert.ToDateTime(valueDateTime.Text);
                header.TotalTransaction = int.Parse(valueTotal.Text);
                header.PaymentType      = boxPaymentType.Text;
                header.EmployeeID       = valueEmployeeID.Text;
                dtBS.HeaderTransactions.InsertOnSubmit(header);
                dtBS.SubmitChanges();

                for (int i = 0; i < dataGridCart.Rows.Count; i++)
                {
                    DetailTransaction detail = new DetailTransaction();
                    detail.TrID       = valueTransactionID.Text;
                    detail.BookID     = dataGridCart.Rows[i].Cells[0].Value.ToString();
                    detail.Qty        = int.Parse(dataGridCart.Rows[i].Cells[2].Value.ToString());
                    detail.TotalPrice = int.Parse(dataGridCart.Rows[i].Cells[3].Value.ToString());
                    dtBS.DetailTransactions.InsertOnSubmit(detail);
                    dtBS.SubmitChanges();
                }


                MessageBox.Show("Data succesfuly inserted !");
                refreshTable();
                generateID();
                dataGridCart.Rows.Clear();
                clear();
                RSDisabled();
                detailDisabled();
            }
        }
Пример #2
0
 private void detach_DetailTransactions(DetailTransaction entity)
 {
     this.SendPropertyChanging();
     entity.HeaderTransaction = null;
 }
Пример #3
0
 partial void DeleteDetailTransaction(DetailTransaction instance);
Пример #4
0
 partial void UpdateDetailTransaction(DetailTransaction instance);
Пример #5
0
 partial void InsertDetailTransaction(DetailTransaction instance);
Пример #6
0
 private void attach_DetailTransactions(DetailTransaction entity)
 {
     this.SendPropertyChanging();
     entity.MsBook = this;
 }