Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            c.bill_no        = Int32.Parse(tbBillNo.Text);
            c.buyer_reg_no   = Int32.Parse(tbBregNo.Text);
            c.buyer_name     = tbBuyerName.Text;
            c.buyer_contact  = tbbuyercontact.Text;
            c.buyer_address  = tbbuyeraddress.Text;
            c.seller_reg_no  = Int32.Parse(tbSRegNo.Text);
            c.seller_name    = tbSellerName.Text;
            c.seller_contact = tbSellerContact.Text;
            c.seller_address = tbSellerAddress.Text;
            c.goods_details  = tbGoodsDetails.Text;
            c.weight         = Int32.Parse(tbWeight.Text);
            c.cost           = Int32.Parse(tbCost.Text);

            bool success = dal.Insert(c);

            if (success == true)
            {
                MessageBox.Show("Data Succesfully Added");
                try
                {
                    Report report = new Report(tbBillNo.Text);
                    report.ShowDialog();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            else
            {
                MessageBox.Show("Failed to add new Customer");
            }

            //printPreviewDialog1.Document = printDocument1;
            //printPreviewDialog1.ShowDialog();

            //beforePrint bp = new beforePrint();
            //bp.Show();
        }