-
Notifications
You must be signed in to change notification settings - Fork 0
/
AddStudent.cs
247 lines (203 loc) · 8.82 KB
/
AddStudent.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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using System.Data.SqlClient;
namespace FighyGym2
{
public partial class AddStudent : DevExpress.XtraEditors.XtraUserControl
{
private static AddStudent _instance;
int IDnumber;
Boolean healthisgood, sport;
public string colfirstname, colsecondname, colthname, collastname, fullname, classcourse;
public static SqlConnection connction;
public static SqlCommand SelectAccountnumb;
public string countNUMB, resultNUMBSTu;
public int phonestu;
string deptname, datecurrent;
string nametypeservice;
public static AddStudent Instance
{
get
{
if (_instance == null)
_instance = new AddStudent();
return _instance;
}
}
public AddStudent()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
frmEditStudenr frm = new frmEditStudenr();
frm.Show();
}
private void groupBox2_Enter(object sender, EventArgs e)
{
}
private void phonNm_TextChanged(object sender, EventArgs e)
{
}
private void simpleButton2_Click(object sender, EventArgs e)
{
}
private void groupBox1_Enter(object sender, EventArgs e)
{
}
private void labelControl1_Click(object sender, EventArgs e)
{
}
private void pictureBox1_Click(object sender, EventArgs e)
{
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
//private void yes_CheckedChanged(object sender, EventArgs e)
//{
// yes.Checked.
//}
private void fatherNm_TextChanged(object sender, EventArgs e)
{
}
private void firstName_TextChanged(object sender, EventArgs e)
{
}
private void label13_Click(object sender, EventArgs e)
{
}
private void label12_Click(object sender, EventArgs e)
{
}
private void label18_Click(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{ }
// Boolean healthisgood, sport;
// if (yes.Checked == true)
// {
// healthisgood = true;
// }
// else
// {
// healthisgood = false;
// }
// if (Yeshealth.Checked == true)
// {
// sport = true;
// }
// else
// {
// sport = false;
// }
// //try
// //{
//// string ConString = System.Configuration.ConfigurationManager.ConnectionStrings["Database1ConnectionString"].ConnectionString;
//// SqlConnection cnn = new SqlConnection(ConString);
//// SqlCommand sc, insertStudent, scd, cscd3;
//// cnn.Open();
//// string datecurrent = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
//// string datecreatinAccount = DateTime.Now.ToString("yyyy-MM-dd HH:mm");
//// string sql = "Insert into Student_Deitls(First_name,Father_Name,GrandFather_Name,Last_Name,Birth_Day,Nationalty,Adress,Longth,Evalute,Health,Sport,type_student,Date,Classroom_id,Wieght,phone_number) values('" + firstName.Text + "','','', '" + lastname.Text + "','','" + nationalty.Text + "','" + adress.Text + "','" + longth.Text + "','" + cbxEvalute.Text + "','" + healthisgood + "','" + sport + "','" + cbxtype.Text + "','" + datecurrent + "','" + typecourse.Text + "','" + whigt.Text + "','" + phonNm.Text + "');";
//// try
//// {
//// //cnn.Open();
//// // MessageBox.Show("Data Saved..");
//// sc = new SqlCommand(sql, cnn);
//// sc.ExecuteNonQuery();
//// sc.Dispose();
//// MessageBox.Show("تم تعبئة الاستمارة بنجاح");
//// SqlDataReader reader = null;
//// SqlDataReader reader1 = null;
//// SqlDataReader reader2 = null;
//// SqlDataReader reader3 = null;
//// SqlDataReader reader4 = null;
//// SqlDataReader reader5 = null;
//// string selectCmd = "SELECT First_name,Father_Name,GrandFather_Name ,Last_Name ,phone_number,Classroom_id FROM Student_Deitls ";
//// scd = new SqlCommand(selectCmd, cnn);
//// reader = scd.ExecuteReader();
//// while (reader.Read())
//// {
//// colfirstname = (string)(reader["First_name"]);
//// }
//// reader.Close();
//// reader1 = scd.ExecuteReader();
//// while (reader1.Read())
//// {
//// colsecondname = (string)(reader1["Father_Name"]);
//// }
//// reader1.Close();
//// reader2 = scd.ExecuteReader();
//// while (reader2.Read())
//// {
//// colthname = (string)(reader2["GrandFather_Name"]);
//// }
//// reader2.Close();
//// reader3 = scd.ExecuteReader();
//// while (reader3.Read())
//// {
//// collastname = (string)(reader3["Last_Name"]);
//// }
//// reader3.Close();
//// reader4 = scd.ExecuteReader();
//// while (reader4.Read())
//// {
//// phonestu = (int)(reader4["phone_number"]);
//// }
//// reader4.Close();
//// reader5 = scd.ExecuteReader();
//// while (reader5.Read())
//// {
//// classcourse = (string)(reader5["Classroom_id"]);
//// }
//// reader5.Close();
//// fullname = colfirstname + " " + colsecondname + " " + colthname + " " + collastname;
//// try
//// {
//// SqlConnection connInsert = new SqlConnection(ConString);
//// connInsert.Open();
//// string sqltostudent = "Insert into Students(Student_Name,Phone_Number,Classroom_id,Account_numb) values('" + fullname + "','" + phonestu + "','" + classcourse + "','');";
//// // MessageBox.Show("Data Saved..");
//// SqlCommand insertt = new SqlCommand(sqltostudent, connInsert);
//// insertt.ExecuteNonQuery();
//// insertt.Dispose();
//// // MessageBox.Show("رقم حساب الطالب " + "هو " + "" + acc.resultNUMBSTu);
//// }
//// catch (Exception ex)
//// {
//// MessageBox.Show(ex.ToString());
//// }
//// }
//// catch (Exception ex)
//// {
//// MessageBox.Show(ex.ToString());
//// }
//////}
//catch (Exception ex)
//{
//}
private void r(object sender, EventArgs e)
{
}
private void AddStudent_Load(object sender, EventArgs e)
{
// string ConString = System.Configuration.ConfigurationManager.ConnectionStrings["Database1ConnectionString"].ConnectionString;
// SqlConnection conn = new SqlConnection(ConString);
// SqlDataAdapter da = new SqlDataAdapter("Select Classrooms_Name FROM Classrooms", conn);
// DataSet ds = new DataSet();
// da.Fill(ds, "Classrooms");
//typecourse.DisplayMember = Convert.ToString(ds.Tables[0].DefaultView);
// //typecourse.DisplayMember = ds.Tables[0].Columns["Classrooms_Name"].ToString();
}
}
}