コード例 #1
0
 public void setId(int SupplierInvoiceId, APCEntities APCContext1)
 {
     APCContext = APCContext1;
     DataTable dtSupplierInvoice = BLSupplierInvoice.GetSupplierInvoiceById(SupplierInvoiceId);
     if (dtSupplierInvoice.Rows.Count > 0)
     {
         DataRow supplierInvoiceRow = dtSupplierInvoice.Rows[0];
         int supplierInvoiceId = int.Parse(supplierInvoiceRow["Id"].ToString());
         tbSupplierInvoiceId.Text = supplierInvoiceRow["Id"].ToString();
         tbSupplierInvoiceOriginalNo.Text = supplierInvoiceRow["SupplierOriNo"].ToString();
         tbPONo.Text = supplierInvoiceRow["POId"].ToString();
         tbPaymentDue.Text = ((decimal.Parse(supplierInvoiceRow["PaymentDue"].ToString())) - TotalPaid(supplierInvoiceId)).ToString("N");
     }
 }
コード例 #2
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            int id = 0;

            int.TryParse(tbId.Text, out id);
            if (id != 0)
            {
                SupplierInvoice currentSupplierInvoice = BLSupplierInvoice.GetSupplierInvoiceById(APCContext, id);
                if (currentSupplierInvoice != null)
                {
                    decimal paymentDue = 0;
                    if (decimal.TryParse(tbPaymentDue.Text, out paymentDue))
                    {
                        if (calDueDate.Value != null)
                        {
                            if (ddlPO.SelectedValue != null)
                            {
                                currentSupplierInvoice.SupplierOriNo = tbSupplierOriInvoiceNo.Text;
                                currentSupplierInvoice.PaymentDue    = paymentDue;
                                currentSupplierInvoice.DueDate       = calDueDate.Value;
                                currentSupplierInvoice.PO            = BLPO.GetPOById(APCContext, int.Parse(ddlPO.SelectedValue.ToString()));
                                APCContext.SaveChanges();
                                MessageBox.Show("SupplierInvoice Details Successfully Updated");
                            }
                            else
                            {
                                MessageBox.Show("Please select the associated PO Number");
                            }
                        }
                        else
                        {
                            MessageBox.Show("Please specify a correct due date");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Please specify correct amount of Payment Due");
                    }
                }
                else
                {
                    MessageBox.Show("SupplierInvoice Id not found");
                }
            }
            else
            {
                MessageBox.Show("SupplierInvoice Id not found");
            }
        }
コード例 #3
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            int id = 0;

            int.TryParse(tbId.Text, out id);
            if (id != 0)
            {
                SupplierInvoice currentSupplierInvoice = BLSupplierInvoice.GetSupplierInvoiceById(APCContext, id);
                if (currentSupplierInvoice != null)
                {
                    APCContext.DeleteObject(currentSupplierInvoice);
                    APCContext.SaveChanges();
                    MessageBox.Show("Delete Successfully");
                }
                else
                {
                    MessageBox.Show("SupplierInvoice Id not found");
                }
            }
            else
            {
                MessageBox.Show("SupplierInvoice Id not found");
            }
        }