-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLibrary.aspx.cs
160 lines (129 loc) · 5.58 KB
/
Library.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
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
namespace Student_Management_System
{
public partial class Library : System.Web.UI.Page
{
/**
* SqlConnection sqlconn = new SqlConnection("Myconnection");
SqlCommand cmd;
SqlDataAdapter da;
DataSet ds;
string qr;
**/
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
divBookAdd.Visible = true;
divBookEdit.Visible = false;
divBookDelete.Visible = false;
}
}
protected void btn_Add_Click(object sender, EventArgs e)
{
string mainconn = ConfigurationManager.ConnectionStrings["Myconnection"].ConnectionString;
SqlConnection sqlconn = new SqlConnection(mainconn);
string sqlquery = "Insert into [dbo].[BookRecord] (bookid,bookname,bookpubname,bookpubyear,bookprice,bookquantity,recorddate)" +
"values(@bookid,@bookname,@bookpubname,@bookpubyear,@bookprice,@bookquantity,@recorddate)";
sqlconn.Open();
SqlCommand sqlcomm = new SqlCommand(sqlquery, sqlconn);
sqlcomm.Parameters.AddWithValue("@bookid", txt_bookid.Text);
sqlcomm.Parameters.AddWithValue("@bookname", txt_bookname.Text);
sqlcomm.Parameters.AddWithValue("@bookpubname", txt_bookpupname.Text);
sqlcomm.Parameters.AddWithValue("@bookpubyear", txt_bookpubyear.Text);
sqlcomm.Parameters.AddWithValue("@bookprice", txt_bookprice.Text);
sqlcomm.Parameters.AddWithValue("@bookquantity", txt_bookqty.Text);
sqlcomm.Parameters.AddWithValue("@recorddate", DateTime.Today.Date.ToShortDateString());
/**
sqlcomm.Parameters.AddWithValue("@CourseFees", LabCourseFees.Text);
sqlcomm.Parameters.AddWithValue("@Firstinstallment", TxtCourseInstallment.Text);
sqlcomm.Parameters.AddWithValue("@FeesDus", LabDueFees.Text);
sqlcomm.Parameters.AddWithValue("@Joindate", LitJoindate.Text);
**/
int i= sqlcomm.ExecuteNonQuery();
if (i>0)
{
lblresult.ForeColor = System.Drawing.Color.Green;
lblresult.Text = "record inserted successfully";
}
else
{
lblresult.ForeColor = System.Drawing.Color.Red;
lblresult.Text = "record not inserted successfully";
}
/**
Labmsg.Text = "The Student" + TxtStFname.Text + "Is Saved Successfully....</br> The Fee Recipt has been send to email" + TxtStEmail.Text;
MailMessage mm = new MailMessage("shohalafzal86@gmail.com", TxtStEmail.Text);
mm.Subject = "Recipt Details....";
mm.Body = "The Course name" + DDLCourseName.SelectedItem.Text + "You Have Joined and The Total Course Fee is " + LabCourseFees.Text + " and the instalment is " + TxtCourseInstallment.Text + " <br/> The balance is " + LabDueFees.Text + " <br/><h3 style='color:red'>Note:The Certificat will not be Issued until the balance amount is clear...!</h3>";
mm.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.Port = 587;
smtp.EnableSsl = true;
NetworkCredential nc = new NetworkCredential("shohalafzal86@gmail.com", "Admin@123");
smtp.UseDefaultCredentials = true;
smtp.Credentials = nc;
smtp.Send(mm);
**/
sqlconn.Close();
Response.Write("alert('Exception ocur')");
}
protected void btn_Update_Click(object sender, EventArgs e)
{
}
protected void btn_Delete_Cancel_Click(object sender, EventArgs e)
{
}
protected void btn_Delete_Reset_Click(object sender, EventArgs e)
{
}
protected void btn_Add_Reset_Click(object sender, EventArgs e)
{
}
protected void btn_Add_Cancel_Click(object sender, EventArgs e)
{
}
protected void btn_Update_Cancel_Click(object sender, EventArgs e)
{
}
protected void btn_Delete_Reset_Click1(object sender, EventArgs e)
{
}
protected void btn_Delete_Click(object sender, EventArgs e)
{
}
protected void btn_Delete_Cancel_Click1(object sender, EventArgs e)
{
}
protected void rbi_book_AEUD_SelectedIndexChanged(object sender, EventArgs e)
{
if (rbi_book_AEUD.Items[0].Selected == true)
{
divBookAdd.Visible = true;
divBookEdit.Visible = false;
divBookDelete.Visible = false;
}
else if (rbi_book_AEUD.Items[1].Selected == true)
{
divBookAdd.Visible = false;
divBookEdit.Visible = true;
divBookDelete.Visible = false;
}
else if (rbi_book_AEUD.Items[2].Selected == true)
{
divBookAdd.Visible = false;
divBookEdit.Visible = false;
divBookDelete.Visible = true;
}
}
}
}