private void AddBtn_Click(object sender, EventArgs e) { #region " CheckFillTextBox " if (UserListComboBox.Text == "") { UserListComboBox.MultiColumnComboBoxElement.BackColor = Color.OrangeRed; errorProvider1.SetError(this.UserListComboBox, "من فضلك اختر الموظف"); UserListComboBox.Focus(); return; } else { UserListComboBox.MultiColumnComboBoxElement.BackColor = Color.White; errorProvider1.Clear(); } if (UserListComboBox.SelectedValue == null) { UserListComboBox.MultiColumnComboBoxElement.BackColor = Color.OrangeRed; errorProvider1.SetError(this.UserListComboBox, "من فضلك اختر الموظف"); UserListComboBox.Focus(); return; } else { UserListComboBox.MultiColumnComboBoxElement.BackColor = Color.White; errorProvider1.Clear(); } /// if (ProjectCombo.Text == "") { ProjectCombo.MultiColumnComboBoxElement.BackColor = Color.OrangeRed; errorProvider1.SetError(this.ProjectCombo, "من فضلك اختر المشروع"); UserListComboBox.Focus(); return; } else { ProjectCombo.MultiColumnComboBoxElement.BackColor = Color.White; errorProvider1.Clear(); } if (UserListComboBox.SelectedValue == null) { ProjectCombo.MultiColumnComboBoxElement.BackColor = Color.OrangeRed; errorProvider1.SetError(this.ProjectCombo, "من فضلك اختر المشروع"); ProjectCombo.Focus(); return; } else { ProjectCombo.MultiColumnComboBoxElement.BackColor = Color.White; errorProvider1.Clear(); } /// #endregion Operation.BeginOperation(this); try { ProjectControl tb = new ProjectControl { UserID = int.Parse(UserListComboBox.SelectedValue.ToString()), ProjectID = int.Parse(ProjectCombo.SelectedValue.ToString()), Status = "فعال" }; ProjectControlCmd.AddNewProControl(tb); Operation.EndOperation(this); Operation.ShowToustOk(OperationX.AddMessageDone, this); UserListComboBox.ResetText(); ProjectCombo.ResetText(); UserListComboBox.Focus(); GC.SuppressFinalize(tb); GC.Collect(); GC.WaitForFullGCComplete(); GC.WaitForPendingFinalizers(); } catch (Xprema.XpremaException ex) { Operation.EndOperation(this); RadMessageBox.Show(ex.UserDescriptionArabic, "خطأ", MessageBoxButtons.OK, RadMessageIcon.Error); this.Close(); } }
private void SaveBtn_Click(object sender, EventArgs e) { #region " CheckFillTextBox " if (UserListComboBox.Text == "") { UserListComboBox.MultiColumnComboBoxElement.BackColor = Color.OrangeRed; errorProvider1.SetError(this.UserListComboBox, "من فضلك اختر الموظف"); UserListComboBox.Focus(); return; } else { UserListComboBox.MultiColumnComboBoxElement.BackColor = Color.White; errorProvider1.Clear(); } if (UserListComboBox.SelectedValue == null) { UserListComboBox.MultiColumnComboBoxElement.BackColor = Color.OrangeRed; errorProvider1.SetError(this.UserListComboBox, "من فضلك اختر الموظف"); UserListComboBox.Focus(); return; } else { UserListComboBox.MultiColumnComboBoxElement.BackColor = Color.White; errorProvider1.Clear(); } /// if (ProjectCombo.Text == "") { ProjectCombo.MultiColumnComboBoxElement.BackColor = Color.OrangeRed; errorProvider1.SetError(this.ProjectCombo, "من فضلك اختر المشروع"); UserListComboBox.Focus(); return; } else { ProjectCombo.MultiColumnComboBoxElement.BackColor = Color.White; errorProvider1.Clear(); } if (UserListComboBox.SelectedValue == null) { ProjectCombo.MultiColumnComboBoxElement.BackColor = Color.OrangeRed; errorProvider1.SetError(this.ProjectCombo, "من فضلك اختر المشروع"); ProjectCombo.Focus(); return; } else { ProjectCombo.MultiColumnComboBoxElement.BackColor = Color.White; errorProvider1.Clear(); } /// #endregion if (RadMessageBox.Show(this, OperationX.SaveMessage, "حفظ التعديلات", MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes) { Operation.BeginOperation(this); ProjectControl tb = new ProjectControl { ID = ProjectControlID, UserID = int.Parse(UserListComboBox.SelectedValue.ToString()), ProjectID = int.Parse(ProjectCombo.SelectedValue.ToString()), Status = StatusDropDownList.Text }; ProjectControlCmd.EditProControl(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(); } }