private void PointBook_Load(object sender, EventArgs e) { var dc = new ClassSRMDataContext(Config.connection); GC.Collect(); GC.WaitForPendingFinalizers(); var tosifi = Config.ReadSetting("Tosifi System"); if (tosifi == "true") { cmbScore2Visibility.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; cmbScoreVisibility.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; } else { cmbScore2Visibility.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; cmbScoreVisibility.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; } tblSchoolBindingSource.DataSource = dc.SelectSchool(); cmbClass.ItemIndex = 0; if (isQuastion) { cmbBook.SelectedIndex = bookIndex; cmbClass.EditValue = SchoolId; tblStudentBindingSource.DataSource = dc.SelectStudentByClassIdNoIMG((int)cmbClass.EditValue); cmbStudent.EditValue = StudentId; } }
private void cmbClass_EditValueChanged(object sender, EventArgs e) { var dc = new ClassSRMDataContext(Config.connection); tblStudentBindingSource.DataSource = dc.SelectStudentByClassIdNoIMG((int)cmbClass.EditValue); cmbStudent.ItemIndex = 0; }
private void cmbClass_EditValueChanged(object sender, EventArgs e) { var dc = new ClassSRMDataContext(Config.connection); int count = (cmbClass.Properties.DataSource as IList).Count; if (count > 0) { tblStudentBindingSource.DataSource = dc.SelectStudentByClassIdNoIMG((int)cmbClass.EditValue); cmbStudent.ItemIndex = 0; } }
private void cmbClass_EditValueChanged(object sender, EventArgs e) { try { var dc = new ClassSRMDataContext(Config.connection); tblStudentBindingSource.DataSource = dc.SelectStudentByClassIdNoIMG((int)cmbClass.EditValue); } catch (Exception) { XtraMessageBox.Show("برنامه با مشکل مواجه شد", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error); } }