public DropDownList GetMadahForFasl(int EmpID, int SafID,int FaslID, DropDownList dlist) { OleDbCommand com = new OleDbCommand("SELECT DISTINCT gadwal_alhasas.mawad_no FROM gadwal_alhasas WHERE CODE=@CODE and alsofof_code=@alsofof_code and fasl_code=@fasl_code", MySchool.GadwalConnection); com.Parameters.AddWithValue("@CODE", EmpID); com.Parameters.AddWithValue("@alsofof_code", SafID); com.Parameters.AddWithValue("@fasl_code", FaslID); com.Connection.Open(); OleDbDataReader DR = com.ExecuteReader(); Codes cd = new Codes(); ListItem li; dlist.Items.Clear(); dlist.Items.Add(new ListItem ( "ÇÎÊÑ ÇáãÇÏÉ.............","0")); while (DR.Read()) { string s = cd.SubjectName(Convert.ToInt32(DR["mawad_no"])); li = new ListItem(s, DR["mawad_no"].ToString()); dlist.Items.Add(li); } com.Connection.Close(); return dlist; }
public string GetSubjectName(int ClassNo,int StageNo,int Day,int Lecture) { string sub = string.Empty; Codes cd = new Codes(); OleDbCommand com = new OleDbCommand(" select mawad_no from gadwal_alhasas where alsofof_code = @alsofof_code and fasl_code = @fasl_code and daycode = @daycode and hasa_code = @hasa_code", MySchool.GadwalConnection); com.Parameters.AddWithValue("@alsofof_code", StageNo); com.Parameters.AddWithValue("@fasl_code", ClassNo); com.Parameters.AddWithValue("@daycode", Day); com.Parameters.AddWithValue("@hasa_code", Lecture); com.Connection.Open(); int subno = -1; if (com.ExecuteScalar() != null) { subno =Convert.ToInt32(com.ExecuteScalar()); } com.Connection.Close(); sub = cd.SubjectName(subno); return sub; }