Example #1
0
        private void btnInsert_Click(object sender, EventArgs e)
        {
            decimal paymentDue = 0;

            if (decimal.TryParse(tbPaymentDue.Text, out paymentDue))
            {
                if (calDueDate.Value != null)
                {
                    //if (ddlPO.SelectedValue != null)
                    //{
                    if (ddlProject.SelectedValue != null)
                    {
                        Project selectedProject = BLProject.GetProjectById(APCContext, int.Parse(ddlProject.SelectedValue.ToString()));
                        bool    success         = false;
                        Invoice selectedInvoice = BLInvoice.insertInvoice(APCContext, DateTime.Today, paymentDue, calDueDate.Value, tbScannedDoc.Text, selectedProject);

                        if (InsertInvoicePO(selectedInvoice))
                        {
                            insertInvoice_Product(selectedInvoice);
                            success = true;
                        }

                        if (success == true)
                        {
                            MessageBox.Show("Invoice Successfully Added");
                            ClearContent();
                        }
                        else
                        {
                            MessageBox.Show("Please check your input");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Please select the associated Project Number");
                    }
                    //}
                    //else
                    //    MessageBox.Show("Please select the associated PO Number");
                }
                else
                {
                    MessageBox.Show("Please specify Due Date");
                }
            }
            else
            {
                MessageBox.Show("Please specify correct amount of Payment Due");
            }
        }