public int GetSerialNo() { int SerialNo = 0; DataSet ds = new DataSet(); _oDealSlipFXMaster = new DealSlipFXMaster(); ds = _oDealSlipFXMaster.GetSerialNo(); if (ds.Tables[0].Rows.Count > 0) { SerialNo = Convert.ToInt32(ds.Tables[0].Rows[0]["SerialNo"].ToString()) + 1; } return(SerialNo); }
private void btnSavePrint_Click(object sender, EventArgs e) { try { //bool Result = false; _oDealSlipFXMaster = new DealSlipFXMaster(); _oDealSlipFXMaster.ClientName = txtClientName.Text.ToString().Length > 0 ? txtClientName.Text : null; if (txtSerialNo.Text.Length > 0) { _oDealSlipFXMaster.SerialNo = Convert.ToInt32(txtSerialNo.Text); } _oDealSlipFXMaster.CreatedDate = Convert.ToDateTime(txtDate.Text.ToString()); _oDealSlipFXMaster.Bought = chkBought.Checked; _oDealSlipFXMaster.Sold = chkSold.Checked; _oDealSlipFXMaster.Swap = chkSwap.Checked; _oDealSlipFXMaster.Tod = chkTod.Checked; _oDealSlipFXMaster.Tom = chkTom.Checked; _oDealSlipFXMaster.Spot = chkSpot.Checked; _oDealSlipFXMaster.Forward = chkForward.Checked; _oDealSlipFXMaster.Time = txtTime.Text.ToString().Length > 0 ? txtTime.Text : null; _oDealSlipFXMaster.CCYBought = txtccyBought.Text.ToString().Length > 0 ? txtccyBought.Text : null; if (txtBoughtAmount.Text.Length > 0) { _oDealSlipFXMaster.BoughtAmount = Convert.ToDecimal(txtBoughtAmount.Text); } if (txtExchangeRate.Text.Length > 0) { _oDealSlipFXMaster.ExchangeRate = Convert.ToDecimal(txtExchangeRate.Text); } _oDealSlipFXMaster.CCYSold = txtccySold.Text.ToString().Length > 0 ? txtccySold.Text : null; if (txtSoldAmount.Text.Length > 0) { _oDealSlipFXMaster.SoldAmount = Convert.ToDecimal(txtSoldAmount.Text); } _oDealSlipFXMaster.ValueDate = Convert.ToDateTime(dateTimePicker1.Text); _oDealSlipFXMaster.ReceiveThrough = txtReceivedThrough.Text.Length > 0 ? txtReceivedThrough.Text : null; _oDealSlipFXMaster.DeliverTo = txtDeliverTo.Text.Length > 0 ? txtDeliverTo.Text : null; _oDealSlipFXMaster.PurposePurchaseSale = txtPurpose.Text.Length > 0 ? txtPurpose.Text : null; if (txtDepositRate.Text.Length > 0) { _oDealSlipFXMaster.DepositRate = Convert.ToDecimal(txtDepositRate.Text); } if (txtDepositInterest.Text.Length > 0) { _oDealSlipFXMaster.DepositInterest = Convert.ToDecimal(txtDepositInterest.Text); } if (txtDepositTenor.Text.Length > 0) { _oDealSlipFXMaster.DepositTenor = Convert.ToDecimal(txtDepositTenor.Text); } if (txtDepositMaturity.Text.Length > 0) { _oDealSlipFXMaster.DepositMaturity = Convert.ToDecimal(txtDepositMaturity.Text); } if (txtPlacementRate.Text.Length > 0) { _oDealSlipFXMaster.PlacementRate = Convert.ToDecimal(txtPlacementRate.Text); } if (txtPlacementInterest.Text.Length > 0) { _oDealSlipFXMaster.PlacementInterest = Convert.ToDecimal(txtPlacementInterest.Text); } if (txtPlacementTenor.Text.Length > 0) { _oDealSlipFXMaster.PlacementTenor = Convert.ToDecimal(txtPlacementTenor.Text); } if (txtPlacementMaturity.Text.Length > 0) { _oDealSlipFXMaster.PlacementMaturity = Convert.ToDecimal(txtPlacementMaturity.Text); } int Result = _oDealSlipFXMaster.AddDealSlipFXDetails(); if (Result > 0) { MessageBox.Show("Receipt added successfully.", "Electronic Receipt ", MessageBoxButtons.OK, MessageBoxIcon.Information); _oDealSlipFXMaster.UpdateSerialNo(); dsFormCaptions = new DataSet(); _oDealSlipFXMaster.DealSlipFXId = Result; dsFormCaptions = _oDealSlipFXMaster.GetReceiptByID(); PrintRecipt(); ClearText(); BindData(); } else { MessageBox.Show("Receipt not added successfully.", "Electronic Receipt ", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show("There was some issue,Please kindly contact IT Administrator", "Electronic Receipt ", MessageBoxButtons.OK, MessageBoxIcon.Error); throw new FPException("DealSlipFX.btnSavePrint_Click()" + ex.Message.ToString(), FPException.ErrorType.Error); } }