private void btnSave_Click(object sender, EventArgs e) { try { if (txtOld.Text.Equals("") || txtNew.Text.Equals("") || txtConfirm.Text.Equals("")) { MessageBox.Show("الرجاء ملىء جميع الحقول"); } else { if (txtOld.Text == FRM_Main.U_Password && txtNew.Text == txtConfirm.Text) { int i = ClassSign.ChangePassword(FRM_Main.Emp_id, txtNew.Text); FRM_Main.U_Password = txtNew.Text; MessageBox.Show("تم تغيير كلمة المرور بنجاح"); txtNew.Text = txtOld.Text = txtConfirm.Text = ""; Close(); } else { MessageBox.Show("المعلومات غير متطابقة"); } } } catch (Exception ex) { MessageBox.Show("هناك خطأ في البيانات المدخلة"); } }
private void btnSignIn_Click(object sender, EventArgs e) { DataTable dt = ClassSign.selectAllEmp(); if (txtUserName.Text.Equals("") || txtPassword.Text.Equals("")) { MessageBox.Show("الرجاء تعبئة كل الحقول"); } else { for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i][1].Equals(txtUserName.Text)) { if (dt.Rows[i][2].Equals(txtPassword.Text)) { Close(); stateEnter = "1"; FRM_Main.Emp_id = int.Parse(dt.Rows[i][0].ToString()); FRM_Main.user_name = dt.Rows[i][1].ToString(); FRM_Main.U_Password = dt.Rows[i][2].ToString(); FRM_Main.PerMission = dt.Rows[i][3].ToString(); FRM_Main.Full_Name = dt.Rows[i][4].ToString(); FRM_Main.Department = dt.Rows[i][5].ToString(); } } } if (!stateEnter.Equals("1")) { MessageBox.Show("اسم المستخدم أو كلمة السر غير صحيحة"); txtUserName.Text = txtPassword.Text = ""; } } }