private void saveBtn_Click(object sender, EventArgs e) { #region " CheckFillTextBox " if (NameTextBox.Text == "") { NameTextBox.TextBoxElement.Fill.BackColor = Color.OrangeRed; errorProvider1.SetError(this.NameTextBox, "من فضلك ادخل اسم المورد"); NameTextBox.Focus(); return; } else { NameTextBox.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); Supplier Sup = new Supplier() { ID = XSupID, Name = NameTextBox.Text, SuppliersNatural = SuppliersNaturalTextBox.Text, Email = EmailTextBox.Text, PhoneNumber = PhoneNumberTextBox.Text, Fax = faxTextBox4.Text, Adderss = AdressTextBox.Text }; SuppliersCmd.EditSupplier(Sup); Operation.EndOperation(this); RadMessageBox.Show(OperationX.SaveMessagedone, "نجاح العملية", MessageBoxButtons.OK,RadMessageIcon.Info); GC.SuppressFinalize(Sup); GC.Collect(); GC.WaitForFullGCComplete(); GC.WaitForPendingFinalizers(); this.Dispose(); } }
private void AddBtn_Click(object sender, EventArgs e) { #region " CheckFillTextBox " if (NameTextBox.Text == "") { NameTextBox.TextBoxElement.Fill.BackColor = Color.OrangeRed; errorProvider1.SetError(this.NameTextBox, "من فضلك ادخل اسم المورد"); NameTextBox.Focus(); return; } else { NameTextBox.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); Supplier Sup=new Supplier() { Name= NameTextBox.Text, SuppliersNatural=SuppliersNaturalTextBox.Text, Email=EmailTextBox.Text, PhoneNumber=PhoneNumberTextBox.Text, Fax=faxTextBox4.Text, Adderss=AdressTextBox.Text, }; SuppliersCmd.newSupplier(Sup); Operation.EndOperation(this); Operation.ShowToustOk(OperationX.AddMessageDone, this); GC.SuppressFinalize(Sup); GC.Collect(); GC.WaitForFullGCComplete(); GC.WaitForPendingFinalizers(); clearText(); }