private void SaveBtn_Click(object sender, EventArgs e) { #region " CheckFillTextBox " if (ProjectNameTextBox.Text == "") { ProjectNameTextBox.TextBoxElement.Fill.BackColor = Color.OrangeRed; errorProvider1.SetError(this.ProjectNameTextBox, "من فضلك ادخل اسم المشروع"); ProjectNameTextBox.Focus(); return; } else { ProjectNameTextBox.TextBoxElement.Fill.BackColor = Color.White; errorProvider1.Clear(); } if (TotalCostTextBox.Text == "") { TotalCostTextBox.TextBoxElement.Fill.BackColor = Color.OrangeRed; errorProvider1.SetError(this.TotalCostTextBox, "من فضلك ادخل الميزانية"); TotalCostTextBox.Focus(); return; } else { TotalCostTextBox.TextBoxElement.Fill.BackColor = Color.White; errorProvider1.Clear(); } if (CoineDropDownList.Text == null) { CoineDropDownList.DropDownListElement.TextBox.BackColor = Color.OrangeRed; errorProvider1.SetError(this.CoineDropDownList, "من فضلك ادخل العملة"); CoineDropDownList.Focus(); return; } else { CoineDropDownList.DropDownListElement.TextBox.BackColor = Color.White; errorProvider1.Clear(); } #endregion if (RadMessageBox.Show(this, OperationX.SaveMessage, "حفظ التعديلات", MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes) { try { Operation.BeginOperation(this); ProjectProfile pro = new ProjectProfile() { ID = XProID, ProjectName = ProjectNameTextBox.Text, ProjectDescription = ProjectDescriptionTextBox.Text, StartDate = DateTime.Parse(StartDateTimePicker.Value.ToString()), EndDate = DateTime.Parse(EndDateTimePicker.Value.ToString()), TotalCost = Double.Parse(TotalCostTextBox.Text), Status = StatusDownList.Text, Coin = CoineDropDownList.Text.ToString() }; ProjectProfileCmd.EditProjectProfile(pro); Operation.EndOperation(this); RadMessageBox.Show(OperationX.SaveMessagedone, "نجاح العملية", MessageBoxButtons.OK, RadMessageIcon.Info); GC.SuppressFinalize(pro); GC.Collect(); GC.WaitForFullGCComplete(); GC.WaitForPendingFinalizers(); this.Dispose(); } catch (Xprema.XpremaException ex) { Operation.EndOperation(this); RadMessageBox.Show(this, ex.OtherDescription, "", MessageBoxButtons.OK, RadMessageIcon.Error); } } }
private void AddBtn_Click(object sender, EventArgs e) { #region " CheckFillTextBox " if (ProjectNameTextBox.Text == "") { ProjectNameTextBox.TextBoxElement.Fill.BackColor = Color.OrangeRed; errorProvider1.SetError(this.ProjectNameTextBox, "من فضلك ادخل اسم المشروع"); ProjectNameTextBox.Focus(); return; } else { ProjectNameTextBox.TextBoxElement.Fill.BackColor = Color.White; errorProvider1.Clear(); } if (TotalCostTextBox.Text == "") { TotalCostTextBox.TextBoxElement.Fill.BackColor = Color.OrangeRed; errorProvider1.SetError(this.TotalCostTextBox, "من فضلك ادخل الميزانية"); TotalCostTextBox.Focus(); return; } else { TotalCostTextBox.TextBoxElement.Fill.BackColor = Color.White; errorProvider1.Clear(); } if (CoineDropDownList.Text == null) { CoineDropDownList.DropDownListElement.TextBox.BackColor = Color.OrangeRed; errorProvider1.SetError(this.CoineDropDownList, "من فضلك ادخل العملة"); CoineDropDownList.Focus(); return; } else { CoineDropDownList.DropDownListElement.TextBox.BackColor = Color.White; errorProvider1.Clear(); } #endregion Operation.BeginOperation(this); try { ProjectProfile pro = new ProjectProfile() { ProjectName = ProjectNameTextBox.Text, ProjectDescription = ProjectDescriptionTextBox.Text, StartDate = DateTime.Parse(StartDateTimePicker.Value.ToString()), EndDate = DateTime.Parse(EndDateTimePicker.Value.ToString()), TotalCost = Double.Parse(TotalCostTextBox.Text), Status = "فعال", progress = 0, Coin = CoineDropDownList.SelectedItem.ToString() }; ProjectProfileCmd.AddNewProject(pro); Operation.EndOperation(this); Operation.ShowToustOk(OperationX.AddMessageDone, this); GC.SuppressFinalize(pro); GC.Collect(); GC.WaitForFullGCComplete(); GC.WaitForPendingFinalizers(); ClearText(); } catch (Xprema.XpremaException ex) { Operation.EndOperation(this); RadMessageBox.Show(this, ex.OtherDescription, "", MessageBoxButtons.OK, RadMessageIcon.Error); } }