private void LoadCourseFee_dataGridView() { courseFee_dataGridView.DataSource = Course_Methods.LoadDataGridView("course"); courseFee_dataGridView.DefaultCellStyle = new DataGridViewCellStyle() { Font = new Font("Times New Roman", 10, FontStyle.Regular), }; }
private void CreateCourseFolder() { string CourseName = Course_Methods.getCourseAlias(); string path = Properties.Settings.Default.AttendancePath; if (!Directory.Exists(path + CourseName)) { Directory.CreateDirectory(path + CourseName); } }
private void select_course_comboBox_SelectedIndexChanged(object sender, EventArgs e) { DataTable dt = Course_Methods.feeCout(select_course_comboBox.Text.ToString()); instruction_label2.Text = dt.Rows[0]["feeDescription"].ToString(); instruction_label.Text = dt.Rows[0]["durationDesc"].ToString(); multiply = int.Parse(dt.Rows[0]["yearCount"].ToString()); set_fee_textBox.Text = "0"; total_fee_textBox.Text = "0"; }
private void add_new_course_tabControl_Selected(object sender, TabControlEventArgs e) { if (add_new_course_tabControl.SelectedIndex == 0) { changeBackColor(course_nm_textBox, course_nm_alias_textBox, total_sem_numericUpDown); CourseDetails_dataGridView.DataSource = Course_Methods.LoadDataGridView("course"); } else if (add_new_course_tabControl.SelectedIndex == 1) { changeBackColor(subject_code_textBox, subject_nm_textBox, select_sem_numericUpDown); //fuction to load data in datagridview refresh_SubjectDataGridView(); subjectDetails_dataGridView.DefaultCellStyle = new DataGridViewCellStyle() { Font = new Font("Times New Roman", 10, FontStyle.Regular), }; #region Code to load Course name & it's according semester in "Subject detail tabpage" this.course_nm_comboBox.TextChanged -= new EventHandler(this.subject_controls_textChanged); dt_loadDetails = Course_Methods.Load_CourseDetails("subject"); if (dt_loadDetails.Rows.Count > 0) { select_sem_numericUpDown.Enabled = true; course_nm_comboBox.DisplayMember = "Alias"; course_nm_comboBox.ValueMember = "TotalSem"; course_nm_comboBox.DataSource = dt_loadDetails; } else { select_sem_numericUpDown.Enabled = false; course_nm_comboBox.Items.Add("Select Course"); course_nm_comboBox.SelectedIndex = 0; } this.course_nm_comboBox.TextChanged += new EventHandler(this.subject_controls_textChanged); #endregion } else if (add_new_course_tabControl.SelectedIndex == 2) { changeBackColor(select_course_comboBox, set_fee_textBox); #region code to load Course Alias in "Course fee tabpage" this.select_course_comboBox.TextChanged -= new EventHandler(this.subject_controls_textChanged); loadingCourseDetails(); LoadCourseFee_dataGridView(); this.select_course_comboBox.TextChanged += new EventHandler(this.subject_controls_textChanged); #endregion } }
private void SearchStudent_Load(object sender, EventArgs e) { loadDataGridView(); this.select_course_comboBox.SelectedIndexChanged -= new System.EventHandler(this.select_course_comboBox_SelectedIndexChanged); dt_course = Course_Methods.Load_CourseDetails("subject"); DataRow dr = dt_course.NewRow(); dr["Alias"] = "All"; dr["TotalSem"] = 0; dt_course.Rows.InsertAt(dr, 0); select_course_comboBox.DisplayMember = "Alias"; select_course_comboBox.DataSource = dt_course; this.select_course_comboBox.SelectedIndexChanged += new System.EventHandler(this.select_course_comboBox_SelectedIndexChanged); }
private void loadingCourseDetails() { dt_loadDetails = Course_Methods.Load_CourseDetails("fee"); if (dt_loadDetails.Rows.Count > 0) { select_course_comboBox.DisplayMember = "Alias"; select_course_comboBox.ValueMember = "duration_desc"; select_course_comboBox.DataSource = dt_loadDetails; } else { select_course_comboBox.DataSource = null; select_course_comboBox.Items.Add("Select Course"); select_course_comboBox.SelectedIndex = 0; } }
private void Course_dataGridView_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex != -1) { DataGridView dgv = sender as DataGridView; string alias = ""; if (dgv.Rows.Count > 0) { alias = dgv.Rows[e.RowIndex].Cells[1].Value.ToString(); if (e.ColumnIndex == dgv.Columns.Count - 1) { DialogResult result1 = MessageBox.Show("Do u sure U want to delete this course?\n(If any subject is attached with this course, will be deleted also.)", "Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (result1 == DialogResult.OK) { DialogResult result = MessageBox.Show("It will also remove your attendance if exists.\r\nDo u want to remove course?"); if (result == DialogResult.OK) { int affectedRows = Course_Methods.deleteCourses(alias); if (affectedRows > 0) { AlertBox.ShowDialog("Course Deleted Successfully", AlertBox.AlertType.success, true); Course_dataGridView.Columns.RemoveAt(Course_dataGridView.Columns.Count - 1); isModified = true; loadCourse(); string path = Properties.Settings.Default.AttendancePath; System.GC.Collect(); System.GC.WaitForPendingFinalizers(); Directory.Delete(path + alias, true); } else { AlertBox.ShowDialog("You can't delete this course,\r\nbcz Some of the students have this course.", AlertBox.AlertType.error, false); } } } } else { isModified = false; } } } }
//validate and update details for course fee and save it into database private void update_button3_Click(object sender, EventArgs e) { if (course_fee_valid()) { //write code to update course fee details in database CourseEntity ce = new CourseEntity() { course_alias = select_course_comboBox3.Text, fee_per_year = int.Parse(set_fee_TextBox.Text) }; if (Course_Methods.update_fees(ce) > 0) { AlertBox.ShowDialog("successfully updated course fee details", AlertBox.AlertType.success, true); clear_button_Click(sender, e); LoadCourseFee_dataGridView(); } } }
//validate fee details & clear details & add it into database private void save_button_Click(object sender, EventArgs e) { if (course_fee_valid()) { CourseEntity ce = new CourseEntity() { course_alias = select_course_comboBox.Text, fee_per_year = int.Parse(set_fee_textBox.Text) }; if (Course_Methods.update_fees(ce) > 0) { AlertBox.ShowDialog("Fees r set for selected Course", AlertBox.AlertType.success, true); clear_button_Click(sender, e); loadingCourseDetails(); LoadCourseFee_dataGridView(); } } }
//validate details & clear it & add it into database private void add_button2_Click(object sender, EventArgs e) { if (subject_detils_validation()) { CourseEntity ce = new CourseEntity() { course_alias = course_nm_comboBox.Text, subject_nm = subject_nm_textBox.Text.Trim(), subject_code = int.Parse(subject_code_textBox.Text.Trim()), subject_sem = int.Parse(select_sem_numericUpDown.Value.ToString()), }; string msg = Course_Methods.insert_subject(ce); if (displayMessage(msg)) { clear_subject_details(); refresh_SubjectDataGridView(); } } }
private void loadCourse() { dt_course = Course_Methods.LoadDataGridView("course"); Course_dataGridView.DataSource = dt_course; Course_dataGridView.AutoGenerateColumns = false; if (!Course_dataGridView.Columns.Contains("remove")) { DataGridViewLinkColumn dc = new DataGridViewLinkColumn() { Text = "Remove", HeaderText = "Edit", Name = "remove", UseColumnTextForLinkValue = true, LinkColor = Color.Crimson, LinkBehavior = LinkBehavior.HoverUnderline }; Course_dataGridView.Columns.Insert(Course_dataGridView.Columns.Count, dc); } }
private void coursefee_textChanged(object sender, EventArgs e) { if (set_fee_TextBox.BackColor == Color.Pink) { ClassCall.textChangeFun(sender as Control); } if (set_fee_TextBox.Text.Trim() != string.Empty) { DataTable dt = Course_Methods.feeCout(select_course_comboBox3.Text); instruction_label.Text = dt.Rows[0]["durationDesc"].ToString(); instruction_label2.Text = dt.Rows[0]["feeDescription"].ToString(); int year = Convert.ToInt32(dt.Rows[0]["yearCount"]); int fees = Convert.ToInt32(set_fee_TextBox.Text); total_fee_textBox.Text = (fees * year).ToString(); } else { total_fee_textBox.Text = "0"; } }
private void LoadCourseFee_dataGridView() { DataTable dt = Course_Methods.LoadDataGridView("course"); fee_dataGridView.DataSource = dt; if (dt.Rows.Count > 0) { select_course_comboBox3.DataSource = dt; select_course_comboBox3.DisplayMember = "CourseAlias"; } else { select_course_comboBox3.SelectedIndex = 0; } set_fee_TextBox.DataBindings.Clear(); set_fee_TextBox.DataBindings.Add("TEXT", dt, "Fees"); fee_dataGridView.DefaultCellStyle = new DataGridViewCellStyle() { Font = new Font("Times New Roman", 10, FontStyle.Regular), }; }
private void refresh_SubjectDataGridView() { dt_loadDGV = Course_Methods.LoadDataGridView("subject"); subjectDetails_dataGridView.DataSource = dt_loadDGV; dt_loadDGV.DefaultView.RowFilter = "CourseAlias = '" + course_nm_comboBox.Text + "'"; }
private bool InsertDataInCourse() { string msg = Course_Methods.insert_course(setProperties()); return(displayMessage(msg)); }