-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfrmIntraBankTransfer.cs
164 lines (146 loc) · 5.6 KB
/
frmIntraBankTransfer.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ATMApp.BL;
namespace ATMApp
{
public partial class frmIntraBankTransfer : Form
{
clCommonBL objBL = new clCommonBL();
CommunicationRef.CommunicationService objService = new CommunicationRef.CommunicationService();
public frmIntraBankTransfer()
{
InitializeComponent();
}
private void frmIntraBankTransfer_Load(object sender, EventArgs e)
{
try
{
DataSet dsBankWithBranch = objService.GetBankWithBranch(ATMApp.frmCustomLogin.ClassValue.BankID, ATMApp.frmCustomLogin.ClassValue.CustomerId, ATMApp.frmCustomLogin.ClassValue.AtmPin);
if (dsBankWithBranch.Tables[0].Rows.Count > 0)
{
DataRow dr = dsBankWithBranch.Tables[0].NewRow();
dr[0] = 0;
dr[1] = "---Select Bank---";
dsBankWithBranch.Tables[0].Rows.InsertAt(dr, 0);
ddlFromBank.DataSource = dsBankWithBranch.Tables[0];
ddlFromBank.ValueMember = "BankID";
ddlFromBank.DisplayMember = "name";
}
}
catch (Exception ex)
{
}
finally
{
}
}
private void lblTransfer_Click(object sender, EventArgs e)
{
if (txtAmount.Text == String.Empty)
{
MessageBox.Show("Please Enter the amount");
return;
}
if (ddlFromBank.SelectedIndex == 0)
{
MessageBox.Show("From Bank Field is required");
return;
}
if (txtBenificiaryName.Text == String.Empty)
{
MessageBox.Show("Benificiary Name is required");
return;
}
if (txtToAccountNumber.Text == String.Empty)
{
MessageBox.Show("Destination Account number is required");
return;
}
if (Convert.ToInt32(txtAmount.Text) > 100000)
{
MessageBox.Show("Day wise transfer limit : 100000. Unable to complete this transaction");
return;
}
if (Convert.ToInt32(txtAmount.Text) == 0)
{
MessageBox.Show("Invalid Amount");
return;
}
int Customerid = ATMApp.frmCustomLogin.ClassValue.CustomerId;
string BankID = ddlFromBank.SelectedValue.ToString();
Random rn = new Random();
string ReferenceNumber = rn.Next(111111111, 999999999).ToString();
string Narration = string.Format("Deposit Transaction from Account Number {0} ", txtFromAccountNumber.Text);
int Returncode =objService.InsertDepositTransactions(Customerid, BankID, ReferenceNumber, Convert.ToDecimal(txtAmount.Text), Narration, "Completed",txtToAccountNumber.Text);
if (ATMApp.frmCustomLogin.ClassValue.BankID != ddlFromBank.SelectedValue.ToString())
{
ATMApp.frmCustomLogin.ClassValue.OtherBankTransactionInd++;
}
if (Returncode == 1)
{
MessageBox.Show("Funds has been transferred successfully");
//lblProceed.Visible = true;
}
else if (Returncode == 2)
{
MessageBox.Show("Account number is incorrect");
}
else if (Returncode == 3)
{
MessageBox.Show("You do not have sufficient amount to complete this transaction");
}
else
{
MessageBox.Show("Fund transfer has failed. Double check your account number");
}
}
private void lblGoBack_Click(object sender, EventArgs e)
{
GoBack();
}
private void GoBack()
{
this.Hide();
frmSelectBankFund options = new frmSelectBankFund();
options.ShowDialog();
this.Close();
}
private void ddlFromBank_SelectedIndexChanged(object sender, EventArgs e)
{
DataSet dsAccountNumberWithBranch = null;
dsAccountNumberWithBranch = objService.GetAccountNumberForBank(ddlFromBank.SelectedValue.ToString(), Convert.ToInt32(ATMApp.frmCustomLogin.ClassValue.CustomerId));
if (dsAccountNumberWithBranch.Tables[0] != null)
{
if (dsAccountNumberWithBranch.Tables[0].Rows.Count > 0)
{
txtFromAccountNumber.Text = dsAccountNumberWithBranch.Tables[0].Rows[0]["AccNO"].ToString();
lblBalance.Text = dsAccountNumberWithBranch.Tables[0].Rows[0]["totalavailablebalance"].ToString();
}
}
}
//private void lblProceed_Click(object sender, EventArgs e)
//{
// this.Hide();
// frmCompleted updatepin = new frmCompleted();
// updatepin.ShowDialog();
// this.Close();
//}
private void txtAmount_KeyPress(object sender, KeyPressEventArgs e)
{
if (!char.IsDigit(e.KeyChar) && !char.IsControl(e.KeyChar))
{
e.Handled = true;
}
}
private void frmIntraBankTransfer_FormClosing(object sender, FormClosingEventArgs e)
{
e.Cancel = true;
}
}
}