private void buttonLogin_Click(object sender, EventArgs e) { BL.CLS_Login log = new BL.CLS_Login(); DataTable dt = new DataTable(); if (txtUsername.Text != "" && txtPassword.Text != "") { dt = log.Login(txtUsername.Text, txtPassword.Text); if (dt.Rows.Count > 0) { MessageBox.Show("تم تسجيل الدخول بنجاح !", "عملية الدخول", MessageBoxButtons.OK, MessageBoxIcon.Information); Frm_Main frm = Frm_Main.getMainForm; frm.accordionControlElementLogin.Enabled = false; frm.accordionControlElementStudents.Enabled = true; frm.accordionControlElementHoliday.Enabled = true; frm.accordionControlElementSanctions.Enabled = true; frm.accordionControlElementHistory.Enabled = true; frm.accordionControlElementUsers.Enabled = true; frm.accordionControlElementMakeBackup.Enabled = true; frm.accordionControlElementGetBackup.Enabled = true; frm.accordionControlElementSettings.Enabled = true; frm.accordionControlElementMakeBackup.Enabled = true; frm.accordionControlElementGetBackup.Enabled = true; frm.accordionControlElement_AddStudent.Enabled = true; frm.accordionControlElement_StudentManage.Enabled = true; frm.accordionControlElementFullStudentReports.Enabled = true; frm.accordionControlElementDegreeCrud.Enabled = true; frm.accordionControlElementSettings.Enabled = true; Form tmp = this.FindForm(); tmp.Close(); tmp.Dispose(); } else { MessageBox.Show("اسم المستخدم او كلمة السر غير صحيحه !", "تنبيه", MessageBoxButtons.OK); } } else { MessageBox.Show("ادخل البيانات من فضلك !", "تنبيه", MessageBoxButtons.OK); } }
public Frm_Main() { InitializeComponent(); if (frm == null) { frm = this; } this.accordionControlElementStudents.Enabled = false; this.accordionControlElementHoliday.Enabled = false; this.accordionControlElementSanctions.Enabled = false; this.accordionControlElementHistory.Enabled = false; this.accordionControlElementUsers.Enabled = false; this.accordionControlElementMakeBackup.Enabled = false; this.accordionControlElementGetBackup.Enabled = false; this.accordionControlElement_AddStudent.Enabled = false; this.accordionControlElement_StudentManage.Enabled = false; this.accordionControlElementFullStudentReports.Enabled = false; this.accordionControlElementDegreeCrud.Enabled = false; this.accordionControlElementSettings.Enabled = false; }
static void frm_FormClosed(object sender, FormClosedEventArgs e) { frm = null; }