public void GetProgram(DropDownList dp) { try { MyUtilities.DBUtils db = new MyUtilities.DBUtils(); SqlDataReader sdb = db.readOperation(@"select program_name as PN from App_Program"); while (sdb.Read()) { ListItem li = new ListItem(); li.Text = sdb["PN"].ToString(); li.Value = sdb["PN"].ToString(); dp.Items.Add(li); } } catch (Exception ex) { MyUtilities.LogUtils.myLog.Error("Error", ex); } }
public void SelectionData() { try { MyUtilities.DBUtils db = new MyUtilities.DBUtils(); SqlDataReader res = db.readOperation(@"select t1.STUDENT_ID as STDID,t1.STUDENT_NAME as STDN,t2.ACDEMIC_YEAR as ACAD,t3.course_name as CN,t4.CODE_VALUE as SM, t5.program_name as PN from APP_STUDENT t1 inner join APP_COURSE_ENROLMENT t2 on t1.COURSE_ENR_ID = t2.COURSE_ENROL_ID inner join App_Course t3 on t2.APP_COURSE_ID = t3.course_id inner join App_CODE t4 on t2.SEMESTER = t4.CODE_ID inner join App_Program t5 on t3.App_Program_program_id = t5.program_id where t1.STUDENT_ID_PK = " + IDs + ""); while (res.Read()) { AdSPro.Items.Add(new ListItem() { Text = res["PN"].ToString(), Value = res["PN"].ToString() }); AdSCour.Items.Add(new ListItem() { Text = res["CN"].ToString(), Value = res["CN"].ToString() }); AdSAYear.Items.Add(new ListItem() { Value = res["ACAD"].ToString(), Text = res["ACAD"].ToString() }); AdSSem.Items.Add(new ListItem() { Text = res["SM"].ToString(), Value = res["SM"].ToString() }); StudentNameTxt.Text = res["STDN"].ToString(); StudentrollTxt.Text = res["STDID"].ToString(); } AdSPro.SelectedIndex = AdSPro.Items.Count - 1; AdSCour.SelectedIndex = AdSCour.Items.Count - 1; AdSSem.SelectedIndex = AdSSem.Items.Count - 1; AdSAYear.SelectedIndex = AdSAYear.Items.Count - 1; } catch (Exception ex) { MyUtilities.LogUtils.myLog.Error("Error:", ex); } }
public void SelectPrograms() { try { DropDownList1.Items.Clear(); MyUtilities.DBUtils db = new MyUtilities.DBUtils(); SqlDataReader res = db.readOperation(@"declare @a int select @a = program_id from App_Program where program_name = '" + program.SelectedValue + "'; select (course_name) as Course from App_Course where App_Program_program_id = @a;"); while (res.Read()) { ListItem listItem = new ListItem(); listItem.Text = res["Course"].ToString(); listItem.Value = res["Course"].ToString(); DropDownList1.Items.Add(listItem); } } catch (Exception ex) { MyUtilities.LogUtils.myLog.Error("Exception :", ex); } }
public void SelectionData() { try { MyUtilities.DBUtils db = new MyUtilities.DBUtils(); SqlDataReader res = db.readOperation(@"Declare @b int; Declare @bb varchar(50); select @b = App_Instructor.UNI_ID from App_Instructor where instructor_id =" + IDs + "; Select @bb = UNI_NAME from APP_UNIVERSITY where APP_UNIVERSITY.UNI_ID = @b; select *,@bb as Uni from App_Instructor where instructor_id =" + IDs + ";"); while (res.Read()) { TextBox1.Text = res["FIRST_NAME"].ToString(); TextBox2.Text = res["MIDDLE_NAME"].ToString(); TextBox3.Text = res["LAST_NAME"].ToString(); TextBox4.Text = res["OFFICE_ROOM_NO"].ToString(); TextBox5.Text = res["BUILDING"].ToString(); TextBox6.Text = res["OFFICE_PHONE_EXT"].ToString(); TextBox7.Text = res["EMAIL"].ToString(); TextBox8.Text = res["CELL_PHONE_NUM"].ToString(); TextBox9.Text = res["WEB_ADDRESS"].ToString(); if (!Update) { uniss.Text = res["Uni"].ToString(); uniss.Visible = true; unis.Visible = false; } else { unis.Items.Add(res["Uni"].ToString()); } } Button1.Text = "Submit"; } catch (Exception ex) { MyUtilities.LogUtils.myLog.Error("Error", ex); } }
public void ViewStudentBySemester() { try { if (ViewSemester.SelectedIndex != -1) { string a = @"select t1.COURSE_ENROL_ID as CEID from APP_COURSE_ENROLMENT t1 inner join App_Course t2 on t1.APP_COURSE_ID = t2.course_id inner join App_CODE t3 on t1.SEMESTER = t3.CODE_ID where t1.ACDEMIC_YEAR = " + AcadmicYears.SelectedValue + " and t2.course_name = '" + Course.SelectedValue + "' and t3.CODE_VALUE = '" + ViewSemester.SelectedValue + "'"; MyUtilities.DBUtils db = new MyUtilities.DBUtils(); SqlDataReader sdr = db.readOperation(a); string enrollId = ""; while (sdr.Read()) { enrollId = sdr["CEID"].ToString(); } GetAllStd("Select STUDENT_ID_PK as 'Student ID PK',STUDENT_ID as 'Student ID', STUDENT_NAME as 'Student Name',COURSE_ENR_ID as 'Course Enroll ID' from APP_STUDENT where COURSE_ENR_ID = " + enrollId + ""); } } catch (Exception ex) { MyUtilities.LogUtils.myLog.Error("Error:", ex); } }
public void SelectionData() { try { MyUtilities.DBUtils db = new MyUtilities.DBUtils(); SqlDataReader res = db.readOperation(@"select * from APP_COURSE_ENROLMENT where COURSE_ENROL_ID = " + IDs + ";"); string insid = ""; string couid = ""; string sems = ""; while (res.Read()) { acadmicyear.Items.Add(res["ACDEMIC_YEAR"].ToString()); acadmicyear.SelectedIndex = acadmicyear.Items.Count - 1; insid = res["INSTRUCTOR_ID"].ToString(); couid = res["APP_COURSE_ID"].ToString(); sems = res["SEMESTER"].ToString(); } MyUtilities.DBUtils dbs = new MyUtilities.DBUtils(); SqlDataReader ress = dbs.readOperation(@"Declare @a varchar(50); Declare @aa varchar(50); Declare @b varchar(50); declare @c varchar(50); select @a = course_name, @aa = App_Program_program_id from App_Course where course_id = " + couid + "; select @b = CODE_VALUE from App_CODE where CODE_ID = " + sems + "; select @c =instructor_name from App_Instructor where instructor_id = " + insid + "; select @aa = program_name from App_Program where program_id = @aa; select @a as 'CourseName',@b as 'Semester', @c as 'InsName', @aa as PID"); while (ress.Read()) { //TextBox1.Text = ress["InsName"].ToString(); program.SelectedValue = ress["PID"].ToString(); ListItem li = new ListItem(); li.Text = ress["CourseName"].ToString(); li.Value = ress["CourseName"].ToString(); DropDownList1.Items.Add(li); DropDownList1.SelectedIndex = DropDownList1.Items.Count - 1; li = new ListItem(); li.Text = ress["Semester"].ToString(); li.Value = ress["Semester"].ToString(); Semester.Items.Add(li); Semester.SelectedIndex = Semester.Items.Count - 1; } SqlDataReader sd = db.readOperation("select UNI_NAME as N from APP_UNIVERSITY where UNI_ID = (select UNI_ID from App_Instructor where instructor_id = " + Session["LoginID"] + ");"); while (sd.Read()) { unis.Items.Add(sd["N"].ToString()); } } catch (Exception ex) { MyUtilities.LogUtils.myLog.Error("Error:", ex); } }
protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack == false) { new Connections().GetProgram(program); SelectPrograms(); new Connections().GetSemester(Semester); } if (Session["Instrutor"] != null) { TextBox1.Text = Session["Instrutor"].ToString(); } Update = Request.QueryString["Update"] == null ? false : bool.Parse(Request.QueryString["Update"]); bool Delete = Request.QueryString["Delete"] == null ? false : bool.Parse(Request.QueryString["Delete"]); IDs = Request.QueryString["ID"] == null ? 0 : int.Parse(Request.QueryString["ID"]); bool View = Request.QueryString["View"] == null ? false : bool.Parse(Request.QueryString["View"]); if (Delete) { DeleteData(); Response.Redirect("~/AppPages/Course.aspx"); } else if (Update) { Button1.Text = "Submit"; if (Values == 1) { SelectionData(); Values = 2; Button1.Text = "Update"; } else { Values = 1; } } else if (View) { program.Enabled = false; DropDownList1.Enabled = false; acadmicyear.Enabled = false; Semester.Enabled = false; Button1.Visible = false; SelectionData(); unis.Enabled = false; Cancel.Text = "Close"; } else { Button1.Text = "Submit"; } MyUtilities.DBUtils db = new MyUtilities.DBUtils(); SqlDataReader sd = db.readOperation("select UNI_NAME as N from APP_UNIVERSITY where UNI_ID = (select UNI_ID from App_Instructor where instructor_id = " + Session["LoginID"] + ");"); while (sd.Read()) { unis.Items.Add(sd["N"].ToString()); } }
protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack == false) { new Connections().GetProgram(programs); new Students().SelectCourse(Course, programs); new Students().GetAcadmicYear(programs, Course, Year); new Students().GetSamester(Sem, Year, Course); GetSOs(SO, programs); GETCLOs(CLO, Course); } try { Table tb = new Table(); TableRow tbr = new TableRow(); TableCell tbc1 = new TableCell(); tbc1.Width = 50; tbc1.Text = "CLOSO ID"; tbc1.BackColor = Color.Black; tbc1.ForeColor = Color.White; TableCell tbc2 = new TableCell(); tbc2.Width = 20; tbc2.Text = "a"; tbc2.BackColor = Color.Black; tbc2.ForeColor = Color.White; TableCell tbc3 = new TableCell(); tbc3.Width = 20; tbc3.Text = "b"; tbc3.BackColor = Color.Black; tbc3.ForeColor = Color.White; TableCell tbc4 = new TableCell(); tbc4.Width = 20; tbc4.Text = "c"; tbc4.BackColor = Color.Black; tbc4.ForeColor = Color.White; TableCell tbc5 = new TableCell(); tbc5.Width = 20; tbc5.Text = "d"; tbc5.BackColor = Color.Black; tbc5.ForeColor = Color.White; TableCell tbc6 = new TableCell(); tbc6.Width = 20; tbc6.Text = "e"; tbc6.BackColor = Color.Black; tbc6.ForeColor = Color.White; TableCell tbc7 = new TableCell(); tbc7.Width = 20; tbc7.Text = "f"; tbc7.BackColor = Color.Black; tbc7.ForeColor = Color.White; TableCell tbc8 = new TableCell(); tbc8.Width = 20; tbc8.Text = "g"; tbc8.BackColor = Color.Black; tbc8.ForeColor = Color.White; TableCell tbc9 = new TableCell(); tbc9.Width = 20; tbc9.Text = "h"; tbc9.BackColor = Color.Black; tbc9.ForeColor = Color.White; TableCell tbc10 = new TableCell(); tbc10.Width = 20; tbc10.Text = "i"; tbc10.BackColor = Color.Black; tbc10.ForeColor = Color.White; TableCell tbc11 = new TableCell(); tbc11.Width = 20; tbc11.Text = "j"; tbc11.BackColor = Color.Black; tbc11.ForeColor = Color.White; TableCell tbc12 = new TableCell(); tbc12.Width = 20; tbc12.Text = "k"; tbc12.BackColor = Color.Black; tbc12.ForeColor = Color.White; tbr.Cells.Add(tbc1); tbr.Cells.Add(tbc2); tbr.Cells.Add(tbc3); tbr.Cells.Add(tbc4); tbr.Cells.Add(tbc5); tbr.Cells.Add(tbc6); tbr.Cells.Add(tbc7); tbr.Cells.Add(tbc8); tbr.Cells.Add(tbc9); tbr.Cells.Add(tbc10); tbr.Cells.Add(tbc11); tbr.Cells.Add(tbc12); tb.Rows.Add(tbr); //dynamic Code Start Hear FOR CLOSO MyUtilities.DBUtils db = new MyUtilities.DBUtils(); SqlDataReader sdr = db.readOperation("Select distinct CLO_ID from APP_CLO_SO_MAP"); while (sdr.Read()) { TableRow tbr1 = new TableRow(); // Get CLO ID string CLOID = sdr["CLO_ID"].ToString(); TableCell tc1 = new TableCell(); tc1.Width = 20; tc1.Text = CLOID.ToString(); // Get SO_ID MyUtilities.DBUtils db1 = new MyUtilities.DBUtils(); SqlDataReader sdr1 = db1.readOperation("select * from APP_CLO_SO_MAP where CLO_ID = " + Int32.Parse(CLOID) + " order by SO_ID ASC"); TableCell[] tcarr = new TableCell[12]; int a = 1; while (sdr1.Read()) { // Response.Write(sdr1["SO_ID"]); string SO_ID = sdr1["SEQUENCE_ID"].ToString(); TableCell tbcs = new TableCell(); tbcs.Width = 20; tbcs.Text = "1"; tcarr[Int32.Parse(SO_ID)] = tbcs; a++; } tcarr[0] = tc1; for (int i = 1; i < 12; i++) { if (tcarr[i] == null) { TableCell tbcs = new TableCell(); tbcs.Width = 20; tbcs.Text = "0"; tcarr[i] = tbcs; } } tbr1.Cells.AddRange(tcarr); tb.Rows.Add(tbr1); } div.Controls.Add(tb); MyUtilities.DBUtils dbs = new MyUtilities.DBUtils(); SqlDataReader sdrs = dbs.readOperation("select max(CLOSO_ID) as CLOSO_ID from APP_CLO_SO_MAP"); while (sdrs.Read()) { string closoid = sdrs["CLOSO_ID"].ToString(); CLOSOID.Text = (Int32.Parse(closoid) + 1).ToString(); } } catch (Exception ex) { MyUtilities.LogUtils.myLog.Error("Error While CLOSO MAPING", ex); } }