private void AddBtn_Click(object sender, EventArgs e) { #region " CheckFillTextBox " if (ActivitiesNameTextBox.Text == "") { ActivitiesNameTextBox.TextBoxElement.Fill.BackColor = Color.OrangeRed; errorProvider1.SetError(this.ActivitiesNameTextBox, "من فضلك ادخل النشاط"); ActivitiesNameTextBox.Focus(); return; } else { ActivitiesNameTextBox.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(); } #endregion Operation.BeginOperation(this); try { ProjectActivity tb = new ProjectActivity() { ProjectProfile_ID = InformationsClass.ProjID, ActivityName = ActivitiesNameTextBox.Text, Description = ActivitiesDescriptionTextBox.Text, StartDate = DateTime.Parse(StartDateTimePicker.Value.Date.ToString()), EndDate = DateTime.Parse(EndDateTimePicker.Value.Date.ToString()), Status = "فعال", Progress = 0, TotalCost = Convert.ToDouble(TotalCostTextBox.Text), }; ActivityCmd.NewActivity(tb); Operation.EndOperation(this); Operation.ShowToustOk(OperationX.AddMessageDone, this); ClearTxt(); GC.SuppressFinalize(tb); GC.Collect(); GC.WaitForFullGCComplete(); GC.WaitForPendingFinalizers(); } catch (Xprema.XpremaException ex) { Operation.EndOperation(this); RadMessageBox.Show(this,ex.OtherDescription,"خطأ",MessageBoxButtons.OK,RadMessageIcon.Error); } }
private void SaveBtn_Click(object sender, EventArgs e) { #region " CheckFillTextBox " if (ActivitiesNameTextBox.Text == "") { ActivitiesNameTextBox.TextBoxElement.Fill.BackColor = Color.OrangeRed; errorProvider1.SetError(this.ActivitiesNameTextBox, "من فضلك ادخل النشاط"); ActivitiesNameTextBox.Focus(); return; } else { ActivitiesNameTextBox.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(); } #endregion if (RadMessageBox.Show(this, OperationX.SaveMessage, "حفظ التعديلات", MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes) { try { Operation.BeginOperation(this); ProjectActivity tb = new ProjectActivity() { ID = xID, ActivityName = ActivitiesNameTextBox.Text, Description = ActivitiesDescriptionTextBox.Text, StartDate = StartDateTimePicker.Value.Date, EndDate = EndDateTimePicker.Value.Date, TotalCost = Convert.ToDouble(TotalCostTextBox.Text), Status = StatusDropDownList.Text, }; ActivityCmd.EditActivity(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(this,ex.OtherDescription,"",MessageBoxButtons.OK,RadMessageIcon.Error); } } }