private void AddBtn_Click(object sender, EventArgs e) { #region " CheckFillTextBox " if (TheDonorsNameTextBox.Text == "") { TheDonorsNameTextBox.TextBoxElement.Fill.BackColor = Color.OrangeRed; errorProvider1.SetError(this.TheDonorsNameTextBox, "من فضلك ادخل اسم الممول"); TheDonorsNameTextBox.Focus(); return; } else { TheDonorsNameTextBox.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); TheDonor Donrs=new TheDonor() { Name= TheDonorsNameTextBox.Text, agentName=AgentNameTextBox.Text, Email=EmailTextBox.Text, PhoneNumber=PhoneNumberTextBox.Text, Fax=faxTextBox4.Text, Adderss=AdressTextBox.Text, }; TheDonorCmd.AddDonor(Donrs); Operation.EndOperation(this); Operation.ShowToustOk(OperationX.AddMessageDone, this); GC.SuppressFinalize(Donrs); GC.Collect(); GC.WaitForFullGCComplete(); GC.WaitForPendingFinalizers(); ClearText(); }
private void SaveBtn_Click(object sender, EventArgs e) { #region " CheckFillTextBox " if (TheDonorsNameTextBox.Text == "") { TheDonorsNameTextBox.TextBoxElement.Fill.BackColor = Color.OrangeRed; errorProvider1.SetError(this.TheDonorsNameTextBox, "من فضلك ادخل اسم الممول"); TheDonorsNameTextBox.Focus(); return; } else { TheDonorsNameTextBox.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); TheDonor tb = new TheDonor() { ID = XDonorsId, Name = TheDonorsNameTextBox.Text, agentName = AgentNameTextBox.Text, Email = EmailTextBox.Text, PhoneNumber = PhoneNumberTextBox.Text, Fax = faxTextBox4.Text, Adderss = AdressTextBox.Text, }; TheDonorCmd.EditDonor(tb); Operation.EndOperation(this); RadMessageBox.Show(OperationX.SaveMessagedone, "نجاح العملية", MessageBoxButtons.OK, RadMessageIcon.Info); GC.SuppressFinalize(tb); GC.Collect(); GC.WaitForFullGCComplete(); GC.WaitForPendingFinalizers(); this.Dispose(); } }