Example #1
0
 private void SerchAsArea_Click(object sender, EventArgs e)
 {
     if (ComboCentral.Text == string.Empty || Street.Text == string.Empty)
     {
         if (ComboCentral.Text == string.Empty)
         {
             MessageBox.Show("اختار السنترال", "Erorr", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else if (Street.Text == string.Empty)
         {
             MessageBox.Show("ادخل عنوان للبحث", "Erorr", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     else
     {
         Numcent = pr.GetNumber(ComboCentral.Text);
         var DBonWork   = new DB.SmartCentralDB(Properties.Settings.Default.ConctToDataBase);
         var selectdata = from p in DBonWork.Centrals
                          where p.IDcentral == Numcent
                          from d in DBonWork.Cabels
                          where d.IDcentral == p.IDcentral
                          from c in DBonWork.Cabinas
                          where c.IDCable == d.IDCable && c.Area.Contains(Street.Text)
                          select new { p.CentralName, d.CableNumber, c.ODU, c.CABINA, c.Area, d.PunctuationBG, d.PunctuationEN };
         this.dataGridView1.DataSource = null;
         this.dataGridView1.DataSource = selectdata;
     }
     Street.Clear();
 }
        private void ComboCentral_SelectedIndexChanged(object sender, EventArgs e)
        {
            num = pr.GetNumber(ComboCentral.Text);
            ComboCabina.Items.Clear();
            Main.CabinaInfo.Clear();
            var DBonWork   = new DB.SmartCentralDB(Properties.Settings.Default.ConctToDataBase);
            var selectdata = (from p in DBonWork.Centrals
                              where p.IDcentral == num
                              from d in DBonWork.Cabels
                              where d.IDcentral == p.IDcentral
                              from c in DBonWork.Cabinas
                              where c.IDCable == d.IDCable
                              select new { c.IDcabina, c.CABINA, c.CabinaGeneral }).Distinct();
            var i = from c in selectdata
                    orderby c.CABINA ascending
                    select c;

            if (i.Count() > 0)
            {
                foreach (var X in i)
                {
                    Main.CabinaInfo.Add(X.IDcabina, X.CabinaGeneral);
                    ComboCabina.Items.Add(X.CABINA);
                }
            }
            Street.Focus();
        }
Example #3
0
 private void ComboCentral_SelectedIndexChanged(object sender, EventArgs e)
 {
     Numcent = pr.GetNumber(ComboCentral.Text);
     if (ComboCentral.Text != CentralName)
     {
         ComboCabina.Items.Clear();
         CentralName = ComboCentral.Text;
         Main.CabinaInfo.Clear();
         var DBonWork   = new DB.SmartCentralDB(Properties.Settings.Default.ConctToDataBase);
         var SelecCabel = (from D in DBonWork.Cabels
                           where D.IDcentral == Numcent
                           from c in DBonWork.Cabels
                           where c.IDcentral == D.IDcentral
                           from P in DBonWork.Cabinas
                           where P.IDCable == c.IDCable
                           select new { P.IDcabina, P.CABINA });
         if (SelecCabel.Count() > 0)
         {
             foreach (var X in SelecCabel.Distinct())
             {
                 ComboCabina.Items.Add(X.CABINA);
                 Main.CabinaInfo.Add(X.IDcabina, X.CABINA);
             }
         }
     }
 }
Example #4
0
 private void Delete_Click(object sender, EventArgs e)
 {
     try
     {
         num = pr.GetNumber(CellactCentral.Text);
         var k         = dataGridView1.CurrentRow.Index;
         var DBonWork  = new DB.SmartCentralDB(Properties.Settings.Default.ConctToDataBase);
         var deletcent = (from c in DBonWork.Centrals
                          where c.IDcentral.Equals(num)
                          select c).FirstOrDefault();
         DBonWork.Centrals.DeleteOnSubmit(deletcent);
         DBonWork.SubmitChanges();
         Program.InfoCentralList.RemoveAt(k);
         comboBox1.Items.Clear();
         foreach (var item in Program.InfoCentralList)
         {
             comboBox1.Items.Add(item.CentralName);
         }
         this.dataGridView1.DataSource = null;
         this.dataGridView1.DataSource = Program.InfoCentralList;
     }
     catch (SqlException ex)
     {
         if (ex.Number == 547)
         {
             MessageBox.Show("السنترال يحتوى على بيانات يجب حذفهااولا");
         }
         else
         {
             MessageBox.Show(ex.ToString());
         }
     }
     catch (Exception exp)
     {
         MessageBox.Show(exp.ToString());
     }
     finally
     {
         CellactCentral.Clear();
         ModifyCentral.Clear();
     }
 }
 private void combocent_SelectedIndexChanged(object sender, EventArgs e)
 {
     NumCentral = pr.GetNumber(combocent.Text);
     if (combocent.Text != CentrlName)
     {
         CentrlName = combocent.Text;
         Main.CabelInfo.Clear();
         ComboType.Items.Clear();
         MyList.Clear();
         var DBonWork       = new DB.SmartCentralDB(Properties.Settings.Default.ConctToDataBase);
         var SelectAllCabel = (from c in DBonWork.Cabels
                               where c.IDcentral == NumCentral
                               select new { c.IDCable, c.CableNumber });
         foreach (var item in SelectAllCabel)
         {
             Main.CabelInfo.Add(item.IDCable, item.CableNumber);
             ComboType.Items.Add(item.CableNumber);
         }
         var j = from c in DBonWork.Cabels
                 where c.IDcentral == NumCentral
                 from p in DBonWork.Cabinas
                 where p.IDCable == c.IDCable
                 select p.CabinaGeneral;
         foreach (var item in j)
         {
             MyList.Add(item);
         }
     }
     if (button1.Text == "حفظ")
     {
         CabinaCabel.Clear();
     }
     label6.Text = "";
     ODU.Clear();
     ComboType.Focus();
 }