Ejemplo n.º 1
0
 private void Save_Click(object sender, EventArgs e)
 {
     if (CenteralToSave.Text != string.Empty)
     {
         var        DBonWork    = new DB.SmartCentralDB(Properties.Settings.Default.ConctToDataBase);
         DB.Central SaveCentral = new DB.Central {
             CentralName = CenteralToSave.Text.Trim()
         };
         DBonWork.Centrals.InsertOnSubmit(SaveCentral);
         DBonWork.SubmitChanges();
         var newcentral = (from c in DBonWork.Centrals
                           where c.CentralName.Equals(CenteralToSave.Text)
                           select c).FirstOrDefault();
         Program.InfoCentralList.Add(newcentral);
         this.dataGridView1.DataSource = null;
         this.dataGridView1.DataSource = Program.InfoCentralList;
         comboBox1.Items.Add(CenteralToSave.Text);
         CenteralToSave.Clear();
         CenteralToSave.Focus();
     }
     else
     {
         CenteralToSave.Focus();
     }
 }
Ejemplo n.º 2
0
 private void CenteralToSave_Validated(object sender, EventArgs e)
 {
     if (CenteralToSave.Text != string.Empty)
     {
         if (pr.GetNumber(CenteralToSave.Text) > 0)
         {
             MessageBox.Show("السنترال موجود");
             CenteralToSave.Focus();
             CenteralToSave.Clear();
         }
     }
 }