private void SaveBtn_Click(object sender, EventArgs e)
        {
            #region "  CheckFillTextBox "
            if (OldPasswordTextBox.Text == "")
            {

                OldPasswordTextBox.TextBoxElement.Fill.BackColor = Color.OrangeRed;
                errorProvider1.SetError(this.OldPasswordTextBox, "من فضلك ادخل كلمة المرور القديمة");
                OldPasswordTextBox.Focus();

                return;
            }
            else
            {
                OldPasswordTextBox.TextBoxElement.Fill.BackColor = Color.White;
                errorProvider1.Clear();
            }


            ///         

            if (NewuserNameTextBox.Text == "")
            {

                NewuserNameTextBox.TextBoxElement.Fill.BackColor = Color.OrangeRed;
                errorProvider1.SetError(this.NewuserNameTextBox, "من فضلك ادخل اسم المستخدم الجديد");
                NewuserNameTextBox.Focus();

                return;
            }
            else
            {
                NewuserNameTextBox.TextBoxElement.Fill.BackColor = Color.White;
                errorProvider1.Clear();
            }


            if (NewpasswordTextBox.Text == "")
            {

                NewpasswordTextBox.TextBoxElement.Fill.BackColor = Color.OrangeRed;
                errorProvider1.SetError(this.NewpasswordTextBox, "من فضلك ادخل اسم كلمة المرور الجديدة");
                NewuserNameTextBox.Focus();

                return;
            }
            else
            {
                NewpasswordTextBox.TextBoxElement.Fill.BackColor = Color.White;
                errorProvider1.Clear();
            }
            #endregion
            if (OldPasswordTextBox.Text != InformationsClass.xCurrentUserPass)
            {

                RadMessageBox.Show("كلمة المرور القديمة خاطئة", "خطأ", MessageBoxButtons.OK, RadMessageIcon.Error);
                OldPasswordTextBox.Focus();

                return;

            }
             if (RadMessageBox.Show(this, OperationX.SaveMessage, "حفظ التعديلات", MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes)
             {
                 try { 
            UserTb tb = new UserTb
            {
                ID=InformationsClass.xCurrentUserID,
                UserName=NewuserNameTextBox.Text,
                Password=NewpasswordTextBox.Text,
                TypeUser=InformationsClass.XUserType,

            };

            UsersCmd.EditUser(tb);
            RadMessageBox.Show("سيتم اعادة تشغيل البرنامج ", "نجاح العملية", MessageBoxButtons.OK, RadMessageIcon.Info);


            Application.Restart();
                 }
                 catch (Xprema.XpremaException ex)
                 {
                     Operation.EndOperation(this);
                     RadMessageBox.Show(ex.UserDescriptionArabic, "خطأ", MessageBoxButtons.OK, RadMessageIcon.Error);

                 }

        }
        }
Esempio n. 2
0
        void AddUser()
        {
            UserTb tb = new UserTb() {
                Employee_ID = EmployeeCmd.GetLastId(),
                UserName = employeeNameTextBox.Text,
                Password= GetRandomNumber (0123456789).ToString(),
                TypeUser="******",
            };

            UsersCmd.NewUser(tb);
            GC.SuppressFinalize(tb);

            GC.Collect();
            GC.WaitForFullGCComplete();
            GC.WaitForPendingFinalizers();
        }
Esempio n. 3
0
        private void btnOky_Click(object sender, EventArgs e)
        {
            #region "  CheckFillTextBox "
            if (UserNameTextBox.Text == "")
            {

                UserNameTextBox.TextBoxElement.Fill.BackColor = Color.OrangeRed;
                errorProvider1.SetError(this.UserNameTextBox, "من فضلك ادخل اسم المستخدم");
                UserNameTextBox.Focus();

                return;
            }
            else
            {
                UserNameTextBox.TextBoxElement.Fill.BackColor = Color.White;
                errorProvider1.Clear();
            }


            if (PasswordTextBox.Text == "")
            {

                PasswordTextBox.TextBoxElement.Fill.BackColor = Color.OrangeRed;
                errorProvider1.SetError(this.PasswordTextBox, "من فضلك ادخل كلمة المرور");
                PasswordTextBox.Focus();

                return;
            }
            else
            {
                PasswordTextBox.TextBoxElement.Fill.BackColor = Color.White;
                errorProvider1.Clear();
            }


            #endregion
                if (RadMessageBox.Show(this, OperationX.SaveMessage, "حفظ التعديلات", MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes)
                {
                    try
                    {
                    Operation.BeginOperation(this);


                    UserTb tb = new UserTb
                    {
                        ID = XUserId,
                        UserName = UserNameTextBox.Text,
                        Password = PasswordTextBox.Text,
                        TypeUser = TypeDropDownList.Text

                    };
                    UsersCmd.EditUser(tb);
                    Operation.EndOperation(this);
                    RadMessageBox.Show(OperationX.SaveMessagedone, "نجاح العملية", MessageBoxButtons.OK, RadMessageIcon.Info);
                    GC.SuppressFinalize(tb);
                    GC.Collect();
                    GC.WaitForFullGCComplete();
                    GC.WaitForPendingFinalizers();
                    this.Dispose();

                }
                catch (Xprema.XpremaException ex)
            {
                Operation.EndOperation(this);
                RadMessageBox.Show(ex.UserDescriptionArabic, "خطأ", MessageBoxButtons.OK, RadMessageIcon.Error);

            }
               
            
            //string xValue = "";


            //==========================================
            //UsersCmd.ClearAllUserPermessions(XUserId);
            //===========================================
            //for (int i = 0; i < dataGridView1.Rows.Count; i++)
            //{

            //    DataGridViewCheckBoxCell chkchecking = dataGridView1.Rows[i].Cells[3] as DataGridViewCheckBoxCell;
            //    if (Convert.ToBoolean(chkchecking.Value) == true)
            //    { xValue = "True"; }
            //    else { xValue = "False"; }

            //    px.PermessioID = int.Parse(dataGridView1.Rows[i].Cells[0].Value.ToString());
            //    px.PermessionValue = xValue;
            //    px.UserID = XUserId;
            //    PeremissionsSystemCmd.AddPeremission(px);
            //}


            //MessageBox.Show(" Changes Was Saved ..");
            //frmUserEdit_Load(sender, e);
          
           
              
        }

        }