private void SaveBtn_Click(object sender, EventArgs e) { #region " CheckFillTextBox " if (EmployeeComboBox.Text == "") { EmployeeComboBox.MultiColumnComboBoxElement.BackColor = Color.OrangeRed; errorProvider1.SetError(this.EmployeeComboBox, "من فضلك ادخل الموظف"); EmployeeComboBox.Focus(); return; } else { EmployeeComboBox.MultiColumnComboBoxElement.BackColor = Color.White; errorProvider1.Clear(); } if (EmployeeComboBox.SelectedValue == null) { EmployeeComboBox.MultiColumnComboBoxElement.BackColor = Color.OrangeRed; errorProvider1.SetError(this.EmployeeComboBox, "من فضلك ادخل الموظف"); EmployeeComboBox.Focus(); return; } else { EmployeeComboBox.MultiColumnComboBoxElement.BackColor = Color.White; errorProvider1.Clear(); } /// if (SalaryTextBox.Text == "") { SalaryTextBox.TextBoxElement.Fill.BackColor = Color.OrangeRed; errorProvider1.SetError(this.SalaryTextBox, "من فضلك ادخل قيمة الراتب"); SalaryTextBox.Focus(); return; } else { SalaryTextBox.TextBoxElement.Fill.BackColor = Color.White; errorProvider1.Clear(); } #endregion if (RadMessageBox.Show(this, OperationX.SaveMessage, "حفظ التعديلات", MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes) { try { Operation.BeginOperation(this); Monthlysalary tb = new Monthlysalary() { ID = XSalaryID, ContractID = int.Parse(EmployeeComboBox.SelectedValue.ToString()), Amount = Convert.ToDouble(SalaryTextBox.Text), Formonth = FromonthDateTimePicker.Value.Date, IssueDate = ReleaseDateTimePicker.Value.Date, }; SalariesCmd.EditSalary(tb); Operation.EndOperation(this); RadMessageBox.Show(OperationX.SaveMessagedone, "نجاح العملية", MessageBoxButtons.OK, RadMessageIcon.Info); GC.SuppressFinalize(th); GC.SuppressFinalize(tb); GC.Collect(); GC.WaitForFullGCComplete(); GC.WaitForPendingFinalizers(); this.Dispose(); } catch (Xprema.XpremaException ex) { Operation.EndOperation(this); RadMessageBox.Show(ex.OtherDescription, "خطأ", MessageBoxButtons.OK, RadMessageIcon.Error); } } }
private void AddBtn1_Click(object sender, EventArgs e) { #region " CheckFillTextBox " if (EmployeeComboBox.Text == "") { EmployeeComboBox.MultiColumnComboBoxElement.BackColor = Color.OrangeRed; errorProvider1.SetError(this.EmployeeComboBox, "من فضلك ادخل الموظف"); EmployeeComboBox.Focus(); return; } else { EmployeeComboBox.MultiColumnComboBoxElement.BackColor = Color.White; errorProvider1.Clear(); } if (EmployeeComboBox.SelectedValue == null) { EmployeeComboBox.MultiColumnComboBoxElement.BackColor = Color.OrangeRed; errorProvider1.SetError(this.EmployeeComboBox, "من فضلك ادخل الموظف"); EmployeeComboBox.Focus(); return; } else { EmployeeComboBox.MultiColumnComboBoxElement.BackColor = Color.White; errorProvider1.Clear(); } /// if (SalaryTextBox.Text == "") { SalaryTextBox.TextBoxElement.Fill.BackColor = Color.OrangeRed; errorProvider1.SetError(this.SalaryTextBox, "من فضلك ادخل قيمة الراتب"); SalaryTextBox.Focus(); return; } else { SalaryTextBox.TextBoxElement.Fill.BackColor = Color.White; errorProvider1.Clear(); } #endregion try { Operation.BeginOperation(this); Monthlysalary tb = new Monthlysalary { ProjectProfile_ID = InformationsClass.ProjID, ContractID = int.Parse(EmployeeComboBox.SelectedValue.ToString()), Formonth = FormonthDateTimePicker.Value.Date, IssueDate = ReleaseDateTimePicker.Value.Date, Amount = Convert.ToDouble(SalaryTextBox.Text) }; SalariesCmd.NewSalary(tb); Operation.EndOperation(this); Operation.ShowToustOk(OperationX.AddMessageDone, this); GC.SuppressFinalize(tb); GC.Collect(); GC.WaitForFullGCComplete(); GC.WaitForPendingFinalizers(); ClearText(); } catch (Xprema.XpremaException ex) { Operation.EndOperation(this); RadMessageBox.Show(ex.OtherDescription, "خطأ", MessageBoxButtons.OK, RadMessageIcon.Error); } }