-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathInsuranceCompanyRegistration.aspx.cs
More file actions
91 lines (86 loc) · 2.99 KB
/
InsuranceCompanyRegistration.aspx.cs
File metadata and controls
91 lines (86 loc) · 2.99 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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;
public partial class InsuranceCompanyRegistration : System.Web.UI.Page
{
SqlConnection con;
SqlCommand cmd;
SqlDataReader rs;
protected void Page_Load(object sender, EventArgs e)
{
try
{
Label1.Text = "";
Menu m1 = (Menu)Master.FindControl("Menu1");
m1.Visible = true;
con = new SqlConnection(ConfigurationManager.ConnectionStrings["connection"].ConnectionString);
con.Open();
if (!IsPostBack)
autonumber();
}
catch (Exception ex)
{
Label1.Text = ex.Message;
}
}
void autonumber()
{
cmd = new SqlCommand("select isnull(max(iid), 0)+1 from itable", con);
TextBox1.Text = cmd.ExecuteScalar().ToString();
cmd.Dispose();
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
try
{
cmd = new SqlCommand("select iid from itable where iid=@iid", con);
cmd.Parameters.AddWithValue("iid", TextBox1.Text);
rs = cmd.ExecuteReader();
bool b = rs.Read();
rs.Close();
cmd.Dispose();
if (b)
{
Label1.Text = "Insurer ID Already Found.....";
return;
}
cmd = new SqlCommand("insert into itable values(@iid,@iname,@cname,@crno,@caddress,@mno,@emailid,@uname,@pword,@status)", con);
cmd.Parameters .AddWithValue ("iid",TextBox1 .Text );
cmd.Parameters .AddWithValue ("iname",TextBox2 .Text );
cmd.Parameters .AddWithValue ("cname",TextBox3 .Text );
cmd.Parameters .AddWithValue ("crno",TextBox4 .Text );
cmd.Parameters .AddWithValue ("caddress",TextBox5 .Text );
cmd.Parameters .AddWithValue ("mno",TextBox6 .Text );
cmd.Parameters .AddWithValue ("emailid",TextBox7 .Text );
cmd.Parameters .AddWithValue ("uname",TextBox8 .Text );
cmd.Parameters .AddWithValue ("pword",TextBox9 .Text );
cmd.Parameters .AddWithValue ("status","Register");
cmd.ExecuteNonQuery();
cmd.Dispose();
Label1.Text = "Register New Insurance Company Details......";
}
catch (Exception ex)
{
Label1.Text = ex.Message;
}
}
protected void LinkButton2_Click(object sender, EventArgs e)
{
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
TextBox4.Text = "";
TextBox5.Text = "";
TextBox6.Text = "";
TextBox7.Text = "";
TextBox8.Text = "";
TextBox9.Text = "";
autonumber();
TextBox2.Focus();
}
}