-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmployeePayment.cs
More file actions
107 lines (95 loc) · 3.88 KB
/
EmployeePayment.cs
File metadata and controls
107 lines (95 loc) · 3.88 KB
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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace StudentHousing
{
public partial class EmployeePayment : Form
{
function fn = new function();
String query;
public EmployeePayment()
{
InitializeComponent();
}
private void btn_search_Click(object sender, EventArgs e)
{
if (txtmblno.Text != "")
{
query = "select enamee,email,edesignation,paid from newEmployee where emobile =" + txtmblno.Text + "";
DataSet ds = fn.getData(query);
if (ds.Tables[0].Rows.Count != 0)
{
txtname.Text = ds.Tables[0].Rows[0][0].ToString();
txtemail.Text = ds.Tables[0].Rows[0][1].ToString();
txtdesig.Text = ds.Tables[0].Rows[0][2].ToString();
comboBox1.Text=ds.Tables[0].Rows[0][3].ToString();
//if student paid previous month rent after pressing the search button data shown on datagridview
query = "select * from employeeSalary where mobileNo = " + txtmblno.Text + "";
DataSet ds2 = fn.getData(query);
dataGridView1.DataSource = ds2.Tables[0];
}
else
{
MessageBox.Show("No Record Exist", "Information", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
else
{
MessageBox.Show("Enter Some Data", "Information", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
private void EmployeePayment_Load(object sender, EventArgs e)
{
//code set customize date fordatetimeoicker
dateTimePicker1.Format = DateTimePickerFormat.Custom;
dateTimePicker1.CustomFormat = " MMMM yyyy";
}
private void btn_pay_Click(object sender, EventArgs e)
{
if (txtmblno.Text != "" && txtdues.Text != "")
{
//Fetch the data from database
query = "select * from employeeSalary where mobileNo =" + Int64.Parse(txtmblno.Text) + " and fmonth ='" + dateTimePicker1.Text + "'";
DataSet ds = fn.getData(query);
if (ds.Tables[0].Rows.Count == 0)
{
//Fetch the data from database
Int64 mobile = Int64.Parse(txtmblno.Text);
String month = dateTimePicker1.Text;
Int64 amount = Int64.Parse(txtdues.Text);
//Insert into fees table
query = "insert into employeeSalary values(" + mobile + ",'" + month + "'," + amount + ")";
//Finally set the data from this method.
fn.setData(query, "Payment Paid");
}
//If fees already paid for that month
else
{
MessageBox.Show("No dues of" + dateTimePicker1.Text + " Left", "Information", MessageBoxButtons.OK, MessageBoxIcon.Hand);
}
}
}
private void btn_clr_Click(object sender, EventArgs e)
{
txtmblno.Clear();
txtname.Clear();
txtdues.Clear();
txtdesig.Clear();
txtemail.Clear();
dataGridView1.DataSource = 0;
}
private void guna2Button2_Click(object sender, EventArgs e)
{
Int64 mobile = Int64.Parse(txtmblno.Text);
String livingStatus = comboBox1.Text;
query = " update newEmployee set paid = '" + livingStatus + "' where emobile = " + mobile + " ";
fn.setData(query, "Fee Status Updated");
}
}
}