public CResult InsertOrderVoucher(COrderVoucher inOrderVoucher) { CResult oResult = new CResult(); try { this.OpenConnection(); string sSql = string.Format(SqlQueries.GetQuery(Query.OrderVoucherInsert), inOrderVoucher.VoucherID,inOrderVoucher.OrderID,inOrderVoucher.VoucherAmount); this.ExecuteNonQuery(sSql); oResult.IsSuccess = true; } catch (Exception ex) { Logger.Write("Exception : " + ex + " in InsertOrderDiscount()", LogLevel.Error, "Database"); // throw new Exception("Exception occure at InsertOrderSeatTime()", ex); oResult.IsException = true; } finally { this.CloseConnection(); } return oResult; }
public CResult InsertOrderVoucher(COrderVoucher inOrderVoucher) { try { m_oResult = Database.Instance.OrderInfo.InsertOrderVoucher(inOrderVoucher); m_oResult.Message = "Data Inserted Successfully"; } catch (Exception ex) { System.Console.WriteLine("Exception occuer at InsertOrderVoucher() : " + ex.Message); m_oResult.IsException = true; m_oResult.Action = EERRORNAME.EXCEPTION_OCCURE; //m_oResult.SetParams(ex.Message); m_oResult.Message = ex.Message; Logger.Write("Exception : " + ex + " in InsertOrderVoucher()", LogLevel.Error, "COrderManager"); } return m_oResult; }
private void g_VoucherButton_Click(object sender, EventArgs e) { if (g_InputTextBox.Text.Substring(Program.currency.Length).Equals("0.00")) { CConfirmDialogBox tempConfirmDialog = new CConfirmDialogBox("Confirm", "Are you sure you want to enter zero value?"); tempConfirmDialog.ShowDialog(); if (CConfirmDialogBox.DialogResult.Equals("No")) return; } //CCalculatorForm tempCalculatorForm = new CCalculatorForm("Voucher Number", "Enter Voucher Number"); //tempCalculatorForm.ShowDialog(); //if (CCalculatorForm.inputResult.Equals("Cancel")) // return; Double voucherAmount = 0; Double.TryParse(g_InputTextBox.Text.Substring(Program.currency.Length), out voucherAmount); if (voucherAmount > m_dBalance) { m_dTotalAmount = m_dTotalAmount - m_dBalance; g_VoucherLabel.Text = Program.currency + m_dBalance.ToString("F02"); } else { m_dTotalAmount = m_dTotalAmount - voucherAmount; g_VoucherLabel.Text = g_InputTextBox.Text; } g_BillTotalLabel.Text = Program.currency + m_dTotalAmount.ToString("F02"); //insert order voucher m_oOrderVoucher = new COrderVoucher(); // m_oOrderVoucher.VoucherID = Int64.Parse(CCalculatorForm.inputResult); m_oOrderVoucher.OrderID = m_iOrderID; m_oOrderVoucher.VoucherAmount = Double.Parse(g_VoucherLabel.Text.Substring(Program.currency.Length)); CurrentPaymentMethod = "Voucher"; #region "Service charge payment section" //New added at 16.02.2009 if (this.IsFinishedActualAmount() == true) { Double tempTotalPaid = 0.0; tempTotalPaid = Double.Parse(g_CashLabel.Text.Substring(Program.currency.Length)) + Double.Parse(g_EFTLabel.Text.Substring(Program.currency.Length)) + Double.Parse(g_ChequeLabel.Text.Substring(Program.currency.Length)) + Double.Parse(g_AccountLabel.Text.Substring(Program.currency.Length)) + Double.Parse(g_VoucherLabel.Text.Substring(Program.currency.Length)); double serviceCharge = Convert.ToDouble(g_ServiceChargeLabel.Text.Substring(Program.currency.Length)); double tobePaid = Convert.ToDouble(g_BillTotalLabel.Text.Substring(Program.currency.Length));//Total payment without service charge double dblAssignedServiceCharge = (m_serviceCharge_cash + m_serviceCharge_eft + m_serviceCharge_cheque + m_serviceCharge_voucher + m_serviceCharge_accounts); if (serviceCharge > dblAssignedServiceCharge)//If service charge is rest to pay { double extraPayBack = 0.0; if (g_BalaceLabel.Text.Contains("Pay Back")) { extraPayBack = Convert.ToDouble("0" + g_BalaceLabel.Text.Substring(9 + Program.currency.Length));//For deducting the payback amount } m_serviceCharge_voucher = tempTotalPaid - (m_tobePaid + dblAssignedServiceCharge) - extraPayBack; if (m_serviceCharge_voucher < 0) { m_serviceCharge_voucher = 0; } } } if (g_BalaceLabel.Text.Contains("Pay Back")) { double payBackAmount = Convert.ToDouble(g_BalaceLabel.Text.Substring(9+Program.currency.Length)); if (Convert.ToDouble("0" + payBackAmount) > 0) { PayBackComfirmForm objPayBack = new PayBackComfirmForm(); objPayBack.ShowDialog(); if (PayBackComfirmForm.m_cancelStatus.Replace(" ", "").ToUpper() == "Cancel".Replace(" ", "").ToUpper()) { return; } if (PayBackComfirmForm.m_PaybackStatus.Replace(" ", "").ToUpper() == "Add to Service Charge".Replace(" ", "").ToUpper()) { m_serviceCharge_voucher = m_serviceCharge_voucher + Convert.ToDouble("0" + g_BalaceLabel.Text.Substring(9 + Program.currency.Length)); g_BalaceLabel.Text = "Pay Back " + Program.currency + "0.00"; m_isAddServiceCharge = true; } } } #endregion if (m_serviceCharge_voucher < 0) { m_serviceCharge_voucher = 0; } UpdateCalculation(4); g_InputTextBox.Text = Program.currency + "0.00"; g_VoucherButton.Enabled = false; }