Exemplo n.º 1
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         if (txtID.Text == string.Empty || txtName.Text == string.Empty || txtPWD.Text == string.Empty || txtCPWD.Text == string.Empty || txtType.Text == string.Empty)
         {
             MessageBox.Show("حدث خطأ ما", "خطأ", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return;
         }
         if (txtPWD.Text != txtCPWD.Text)
         {
             MessageBox.Show("كلمات المرور غير متطابقة", "خطأ", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return;
         }
         if (button1.Text == "إضافة")
         {
             BL.CLS_Login User = new BL.CLS_Login();
             User.Add_User(txtID.Text, txtName.Text, txtPWD.Text, txtType.Text);
             MessageBox.Show("تمت الإضافة بنجاح", "عملية الإضافة", MessageBoxButtons.OK, MessageBoxIcon.Information);
             this.Close();
         }
         else if (button1.Text == "تحديث")
         {
             BL.CLS_Login User = new BL.CLS_Login();
             User.Edit_User(txtID.Text, txtName.Text, txtPWD.Text, txtType.Text);
             MessageBox.Show("تم التعديل بنجاح", "عملية التعديل", MessageBoxButtons.OK, MessageBoxIcon.Information);
             this.Close();
         }
     }
     catch
     {
         MessageBox.Show("حدث خطأ ما", "خطأ", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
 public FRM_Users_List()
 {
     BL.CLS_Login clsL = new BL.CLS_Login();
     InitializeComponent();
     DG_Users.DataSource = clsL.Search_User("");
     //DG_Users.Columns["pwd"].Visible = false; // the index of pwd =1
 }
 private void btnDelUser_Click(object sender, EventArgs e)
 {
     BL.CLS_Login clsL = new BL.CLS_Login();
     if (MessageBox.Show("هل تريد حذف المستخدم المحدد؟", "الحذف", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         clsL.Delete_User(DG_Users.CurrentRow.Cells[0].Value.ToString());
         DG_Users.DataSource = clsL.Search_User("");
     }
 }
        private void btnAddUser_Click(object sender, EventArgs e)
        {
            FRM_Add_User frmS = new FRM_Add_User();

            BL.CLS_Login clsL = new BL.CLS_Login();
            frmS.btnAddUser.Text = "حفظ المستخدم";
            frmS.Text            = "إضافة مستخدم جديد";
            frmS.ShowDialog();
            DG_Users.DataSource = clsL.Search_User("");
        }
        private void btnEditUser_Click(object sender, EventArgs e)
        {
            FRM_Add_User frmS = new FRM_Add_User();

            frmS.btnAddUser.Text     = "تعديل المستخدم";
            frmS.Text                = "تعديل مستخدم ";
            frmS.txtUserID.Text      = DG_Users.CurrentRow.Cells[0].Value.ToString();
            frmS.txtPWD.Text         = DG_Users.CurrentRow.Cells[1].Value.ToString();
            frmS.txtPWD_Confirm.Text = DG_Users.CurrentRow.Cells[1].Value.ToString();
            frmS.txtFullName.Text    = DG_Users.CurrentRow.Cells[2].Value.ToString();
            frmS.CmbUsers.Text       = DG_Users.CurrentRow.Cells[3].Value.ToString();

            BL.CLS_Login clsL = new BL.CLS_Login();
            frmS.ShowDialog();
            DG_Users.DataSource = clsL.Search_User("");
        }
Exemplo n.º 6
0
        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);
            }
        }
Exemplo n.º 7
0
        private void btnAddUser_Click(object sender, EventArgs e)
        {
            if (txtUserID.Text == string.Empty || txtPWD.Text == string.Empty || txtPWD_Confirm.Text == string.Empty || txtFullName.Text == string.Empty)
            {
                MessageBox.Show("جميع الحقول مطلوبة", "تنبيه", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                return;
            }
            if (txtPWD.Text != txtPWD_Confirm.Text)
            {
                MessageBox.Show("حقلي كلمة السر غير متطابقين", "خطأ", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }


            FRM_Users_List frmList = new FRM_Users_List();

            BL.CLS_Login clsLG = new BL.CLS_Login();

            if (btnAddUser.Text == "حفظ المستخدم")
            {
                clsLG.Add_User(txtUserID.Text, txtFullName.Text, txtPWD.Text, CmbUsers.Text);
                MessageBox.Show("تمت اضافة المستخدم", "اضافة", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            else if (btnAddUser.Text == "تعديل المستخدم")
            {
                clsLG.Edit_User(txtUserID.Text, txtFullName.Text, txtPWD.Text, CmbUsers.Text);
                MessageBox.Show("تم نعديل المستخدم", "تعديل", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            //clear texts
            txtUserID.Clear();
            txtFullName.Clear();
            txtPWD.Clear();
            txtPWD_Confirm.Clear();
            CmbUsers.Text = null;
            txtUserID.Focus();
        }
 private void txtSearchUser_TextChanged(object sender, EventArgs e)
 {
     BL.CLS_Login clsL = new BL.CLS_Login();
     DG_Users.DataSource = clsL.Search_User(txtSearchUser.Text);
 }