bool Insert()
    {
        objPaymentsForSupplier = new PaymentsForSupplier();
        objPaymentsForSupplier.BeginTransaction();
        objPaymentsForSupplier.SupplierID   = int.Parse(ddlSupplier.SelectedValue);
        objPaymentsForSupplier.Payment      = Convert.ToDouble(txtPayment.Text.Trim());
        objPaymentsForSupplier.PaymentDateM = Convert.ToDateTime(txtPaymentDateM.Text.Trim(), culture);
        objPaymentsForSupplier.PaymentDateH = txtPaymentDateH.Text.Trim();
        objPaymentsForSupplier.Insert();

        objSupplier          = objSupplier.Single(p => p.SupplierID == int.Parse(ddlSupplier.SelectedValue));
        objSupplier.Balance -= Convert.ToDouble(txtPayment.Text.Trim());
        objSupplier.Update(p => p.SupplierID == objSupplier.SupplierID);
        objSupplier.EndTransaction();
        return(true);
    }
    bool Delete(int SupplierPaymentID)
    {
        try
        {
            objPaymentsForSupplier.BeginTransaction();
            objPaymentsForSupplier = objPaymentsForSupplier.Single(z => z.SupplierPaymentID == SupplierPaymentID);


            objSupplier          = objSupplier.Single(p => p.SupplierID == objPaymentsForSupplier.SupplierID);
            objSupplier.Balance += objPaymentsForSupplier.Payment;
            objSupplier.Update(p => p.SupplierID == objSupplier.SupplierID);

            objPaymentsForSupplier.Delete(p => p.SupplierPaymentID == objPaymentsForSupplier.SupplierPaymentID);
            objPaymentsForSupplier.EndTransaction();
        }
        catch (Exception ex)
        {
            return(false);
        }
        return(true);
    }