-
Notifications
You must be signed in to change notification settings - Fork 2
/
AddPayeInputFile_N.aspx.cs
123 lines (113 loc) · 5.12 KB
/
AddPayeInputFile_N.aspx.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
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Text.RegularExpressions;
using System.Data.SqlTypes;
using System.Text;
using Newtonsoft.Json;
using System.IO;
public partial class AddPayeInputFile_N : System.Web.UI.Page
{
SqlConnection con = new SqlConnection(PAYEClass.connection);
protected void Page_Load(object sender, EventArgs e)
{
if (Session["user_id"] == null)
{
Response.Redirect("Login.aspx");
}
if (!IsPostBack)
{
binddropdowns();
}
}
public void binddropdowns()
{
string qry = "Select distinct TaxPayerRIN as CompanyRIN, TaxPayerName as CompanyName from CompanyList_API where TaxPayerRIN is not null ORDER BY TaxPayerName";
//string qry = "Select distinct CompanyRIN,CompanyName from vw_InputFile where CompanyRIN is not null and (CompanyRIN+Tax_Year) not in (select EmployerRIN+Assessment_Year from PayeOuputFile)";
DataTable dt = new DataTable();
dt = PAYEClass.fetchdata(qry);
dpd_employer_RIN.DataSource = dt;
dpd_employer_RIN.DataTextField = "CompanyName";
dpd_employer_RIN.DataValueField = "CompanyRIN";
dpd_employer_RIN.DataBind();
dpd_Business_RIN.Items.Insert(0, "---Select---");
// qry = "select distinct BusinessRIN,BusinessName from vw_Rules_Check where CompanyRIN='" + dpd_employer_RIN.SelectedValue + "'";
// dt = new DataTable();
// dt = PAYEClass.fetchdata(qry);
// dpd_Business_RIN.DataSource = dt;
// dpd_Business_RIN.DataTextField = "BusinessName";
// dpd_Business_RIN.DataValueField = "BusinessRIN";
// dpd_Business_RIN.DataBind();
//// dpd_Business_RIN.DataBind();
// dpd_Business_RIN.Items.Insert(0, "---Select---");
dt = new DataTable();
dt.Columns.Add("tax_year", typeof(int));
for (int i = 2014; i <= DateTime.Now.Year; i++)
{
dt.Rows.Add(i);
}
dpd_Tax_Year.DataSource = dt;
dpd_Tax_Year.DataTextField = "tax_year";
dpd_Tax_Year.DataValueField = "tax_year";
dpd_Tax_Year.DataBind();
}
protected void btn_Add_Click(object sender, EventArgs e)
{
try
{
if (dpd_Business_RIN.SelectedValue == "---Select---")
{
ScriptManager.RegisterStartupScript(Page, this.GetType(), "AlertMessage", "<script language=\"javascript\" type=\"text/javascript\">;alert('Please Select Business!');</script>", false);
return;
}
string qry = "Insert into AddPayeInputFile(CompanyRIN,BusinessRIN,TaxYear) values('" + dpd_employer_RIN.SelectedValue.Trim() + "','" + dpd_Business_RIN.SelectedValue.Trim() + "'," + dpd_Tax_Year.SelectedValue.Trim() + ")";
int status = PAYEClass.insertupdateordelete(qry);
if (status > 0)
{
// Response.Write("<script>alert('Selected Employer Added Successfully!');</script>");
ScriptManager.RegisterStartupScript(Page, this.GetType(), "AlertMessage", "<script language=\"javascript\" type=\"text/javascript\">;alert('Selected Employer Added Successfully for the Selected Year!');</script>", false);
// Response.Redirect("PayeInputFile_N.aspx");
}
else
{
ScriptManager.RegisterStartupScript(Page, this.GetType(), "AlertMessage", "<script language=\"javascript\" type=\"text/javascript\">;alert('Error Occured!');</script>", false);
}
}
catch (Exception e11)
{
ScriptManager.RegisterStartupScript(Page, this.GetType(), "AlertMessage", "<script language=\"javascript\" type=\"text/javascript\">;alert('Error Occured!');</script>", false);
}
}
protected void btn_back_Click(object sender, EventArgs e)
{
Response.Redirect("PayeInputFile_N.aspx");
}
protected void dpd_employer_RIN_SelectedIndexChanged(object sender, EventArgs e)
{
string qry = "select distinct BusinessRIN,BusinessName from vw_Rules_Check where CompanyRIN='" + dpd_employer_RIN.SelectedValue + "'";
DataTable dt = new DataTable();
dt = PAYEClass.fetchdata(qry);
dpd_Business_RIN.DataSource = dt;
dpd_Business_RIN.DataTextField = "BusinessName";
dpd_Business_RIN.DataValueField = "BusinessRIN";
dpd_Business_RIN.DataBind();
// dpd_Business_RIN.DataBind();
dpd_Business_RIN.Items.Insert(0, "---Select---");
}
protected void dpd_Business_RIN_SelectedIndexChanged(object sender, EventArgs e)
{
// string qry = "Select distinct tax_year from vw_ShowBusiness_PayeInputFile_All where BusinessRIN='" + dpd_Business_RIN.SelectedValue + "'";
//DataTable dt = new DataTable();
// dt = PAYEClass.fetchdata(qry);
// dpd_Tax_Year.DataSource = dt;
// dpd_Tax_Year.DataTextField = "tax_year";
// dpd_Tax_Year.DataValueField = "tax_year";
// dpd_Tax_Year.DataBind();
}
}