private void SaveBtn_Click(object sender, EventArgs e)
        {

            #region "  CheckFillTextBox "
            if (employeeNameTextBox.Text == "")
            {

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

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



            if (GenderDropDownList.Text == "")
            {

                GenderDropDownList.DropDownListElement.TextBox.BackColor = Color.OrangeRed;
                errorProvider1.SetError(this.GenderDropDownList, "من فضلك ادخل الجنس");

                GenderDropDownList.Focus();

                return;
            }
            else
            {
                GenderDropDownList.DropDownListElement.TextBox.BackColor = Color.White;
                errorProvider1.Clear();
            }

            if (EmployeejobNumberTextBox.Text == "")
            {

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

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

            string mail = EmailTextBox.Text;

            if (EmailTextBox.Text != "")
            {
                if (mail.IndexOf('@') == -1 || mail.IndexOf('.') == -1)
                {
                    errorProvider1.SetError(this.EmailTextBox, "من فضلك بريد صحيح ");
                    return;

                }

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

            {
                Operation.BeginOperation(this);
               

                Employee db = new Employee()
                {
                    ID = XIDEmployee,
                    EmployeeName = employeeNameTextBox.Text,
                    EmployeeGender = GenderDropDownList.Text.ToString(),
                    EmployeejobNumber = EmployeejobNumberTextBox.Text,
                    EmployeeNationalNumber = EmployeeNationalNumberTextBox4.Text,
                    Email = EmailTextBox.Text,
                    PhoneNumber = PhoneNumberTextBox.Text,
                    Mobilenumber = MobilenumberTextBox.Text,

                };
                EmployeeCmd.EditEmployee(db);
                Operation.EndOperation(this);
                RadMessageBox.Show(OperationX.SaveMessagedone, "نجاح العملية", MessageBoxButtons.OK, RadMessageIcon.Info);
                GC.SuppressFinalize(db);

                GC.Collect();
                GC.WaitForFullGCComplete();
                GC.WaitForPendingFinalizers();
                this.Dispose();

            }
        }
Beispiel #2
0
        private void AddBtn_Click(object sender, EventArgs e)
        {
            #region "  CheckFillTextBox "
            if (employeeNameTextBox.Text == "")
            {

                  employeeNameTextBox.TextBoxElement.Fill.BackColor = Color.OrangeRed;
                  errorProvider1.SetError(this.employeeNameTextBox, "من فضلك ادخل اسم الموظف");
                employeeNameTextBox.Focus();
               
                return;
            }
            else
            {
                employeeNameTextBox.TextBoxElement.Fill.BackColor = Color.White;
                errorProvider1.Clear();
            }



            if (GenderDropDownList.Text == "")
            {
               
                  GenderDropDownList.DropDownListElement.TextBox.BackColor = Color.OrangeRed;
                  errorProvider1.SetError(this.GenderDropDownList, "من فضلك ادخل الجنس");
                 
                 GenderDropDownList.Focus();

                return;
            }
            else
            {
                GenderDropDownList.DropDownListElement.TextBox.BackColor = Color.White;
                errorProvider1.Clear();
            }

            if (EmployeejobNumberTextBox.Text == "")
            {

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

                return;
            }
            else
            {
                EmployeejobNumberTextBox.TextBoxElement.Fill.BackColor = Color.White;
                errorProvider1.Clear();
            }
            
           string mail =EmailTextBox.Text;

           if (EmailTextBox.Text !="")
           {
               if (mail.IndexOf('@') == -1 || mail.IndexOf('.') == -1)
               {
                   errorProvider1.SetError(this.EmailTextBox, "من فضلك بريد صحيح ");
                   return;

               }
               
           }
          
            #endregion

            Operation.BeginOperation(this);
            

            Employee emp = new Employee()
            {
                EmployeeName= employeeNameTextBox.Text,
                EmployeeGender=GenderDropDownList.Text.ToString(),
                EmployeejobNumber=EmployeejobNumberTextBox.Text,
                EmployeeNationalNumber=EmployeeNationalNumberTextBox4.Text,
                Email=EmailTextBox.Text,
                PhoneNumber=PhoneNumberTextBox.Text,
                Mobilenumber=MobilenumberTextBox.Text,



            };
            EmployeeCmd.addEmployee(emp);
           
          
            Operation.EndOperation(this);
            Operation.ShowToustOk(OperationX.AddMessageDone, this);
            // ===============
            AddUser();
            //================
            ClearTxt();
        }