Beispiel #1
0
 private void SaveBt_Click(object sender, EventArgs e)
 {
     if (ComboCentral.Text == string.Empty || ComboCabina.Text == string.Empty || DPNumber.Text == string.Empty || AreaDP.Text == string.Empty)
     {
         if (ComboCentral.Text == string.Empty)
         {
             MessageBox.Show("اختار السنترال", "Erorr", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else if (ComboCabina.Text == string.Empty)
         {
             MessageBox.Show("اختار الكابينة", "Erorr", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else if (DPNumber.Text == string.Empty)
         {
             MessageBox.Show("حدد رقم البكس", "Erorr", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else if (AreaDP.Text == string.Empty)
         {
             MessageBox.Show("ادخل عنوان البكس", "Erorr", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     else
     {
         try
         {
             string dpGeneral = Numcent.ToString() + ComboCabina.Text + DPNumber.Text;
             var    DBonWork  = new DB.SmartCentralDB(Properties.Settings.Default.ConctToDataBase);
             DB.DP  SaveDP    = new DB.DP
             {
                 IDcabina  = Numcabina,
                 Area      = AreaDP.Text.Trim(),
                 DPNumber  = DPNumber.Text.Trim(),
                 DPGeneral = dpGeneral
             };
             DBonWork.DPs.InsertOnSubmit(SaveDP);
             DBonWork.SubmitChanges();
             MyList.Add(DPNumber.Text.Trim());
             AreaDP.Clear();
             DPNumber.Clear();
             DPNumber.Focus();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString(), "Erorr", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
Beispiel #2
0
 private void DPNumber_Validated(object sender, EventArgs e)
 {
     if (ComboCentral.Text == string.Empty || ComboCabina.Text == string.Empty || DPNumber.Text == string.Empty)
     {
         ComboCentral.Focus();
     }
     else
     {
         if (vrify(pr.ReturnUpperString(DPNumber.Text)))
         {
             MessageBox.Show("البكس موجود بالفعل", "Erorr", MessageBoxButtons.OK, MessageBoxIcon.Error);
             DPNumber.Clear();
             DPNumber.Focus();
         }
         else
         {
             AreaDP.Focus();
         }
     }
 }