public List <AdvancedSessionModel> getConsecutiveSessions() { List <AdvancedSessionModel> listStudent = new List <AdvancedSessionModel>(); try { /*Select a.*,b.sub_name from Sessions a left outer join subjects b on b.subject_id = a.subject_id * where session_status = 2;*/ string Query = @"Select a.*,b.sub_name from Sessions a left outer join subjects b on b.subject_id = a.subject_id where session_status = 2"; SqlCommand cmd = new SqlCommand(Query, DBConnection.DatabaseConnection); SqlDataReader myReader; DBConnection.OpenConnection(); myReader = cmd.ExecuteReader(); while (myReader.Read()) { AdvancedSessionModel objStudent = new AdvancedSessionModel(); objStudent.SessionId = myReader["session_id"].ToString(); objStudent.Lecturer = myReader["lecturer_id"].ToString(); objStudent.Group = myReader["group_id"].ToString(); objStudent.SubGroup = myReader["sub_group_id"].ToString(); objStudent.Subject = myReader["subject_id"].ToString(); objStudent.SubjCode = myReader["sub_name"].ToString(); objStudent.Tag = myReader["tag_code"].ToString(); objStudent.Stucount = myReader["student_count"].ToString(); objStudent.Duration = myReader["duration"].ToString(); objStudent.ConsecutiveID = Convert.ToInt32(myReader["consecutive_id"].ToString()); listStudent.Add(objStudent); } DBConnection.CloseConnection(); } catch (Exception ex) { } return(listStudent); }
private void gvLoad_CellClick(object sender, DataGridViewCellEventArgs e) { if (gvLoad.CurrentRow.Index != -1) { AdvancedSessionModel objCurr = new AdvancedSessionModel(); objCurr.SessionId = gvLoad.CurrentRow.Cells[0].Value.ToString(); objCurr.Lecturer = gvLoad.CurrentRow.Cells[1].Value.ToString(); objCurr.Subject = gvLoad.CurrentRow.Cells[2].Value.ToString(); objCurr.Tag = gvLoad.CurrentRow.Cells[3].Value.ToString(); objCurr.Group = gvLoad.CurrentRow.Cells[4].Value.ToString(); objCurr.SubGroup = gvLoad.CurrentRow.Cells[5].Value.ToString(); objCurr.Stucount = gvLoad.CurrentRow.Cells[6].Value.ToString(); objCurr.Duration = gvLoad.CurrentRow.Cells[7].Value.ToString(); //objCurr.SessionStatus = dataGridView1.CurrentRow.Cells[4].Value.ToString(); ParallelList.Add(objCurr); loadListAdd(); gvAdd.Visible = true; btnSave.Visible = true; btnReset.Visible = true; } }
private void btnAddToList_Click(object sender, EventArgs e) { dataGridView1.Visible = true; btnSave.Visible = true; AdvancedSessionModel obj = new AdvancedSessionModel(); obj.Group = ddlGroup.SelectedValue.ToString(); if (ddlGroup.SelectedValue != null) { obj.SubGroup = ddlSubGroup.SelectedValue.ToString(); } obj.Lecturer = ddlLecturer.SelectedValue.ToString(); obj.Subject = ddlSubject.SelectedValue.ToString(); obj.SubjCode = (ddlSubject.SelectedItem as DataRowView)["subject_Code"].ToString(); obj.Tag = ddlTags.SelectedValue.ToString(); obj.Stucount = txtStdCount.Text; obj.Duration = txtDuration.Text; obj.SessionStatus = 2;//consecutive consecutiveList.Add(obj); loadList(); }