Ejemplo n.º 1
0
 private void modifay_Click(object sender, EventArgs e)
 {
     try
     {
         var k = dataGridView1.CurrentRow.Index;
         if (area.Text != string.Empty)
         {
             int i = pr.CabinaExisting(Numcent.ToString() + dataGridView1.CurrentRow.Cells[3].Value.ToString());
             pr.UpDataCabina(i, area.Text);
             dataGridView1.Rows.RemoveAt(k);
             area.Clear();
         }
     }
     catch (SqlException ex)
     {
         int err = ex.State;
         MessageBox.Show(err.ToString());
     }
     area.Clear();
 }
Ejemplo n.º 2
0
        private void ComboCabina_SelectedIndexChanged(object sender, EventArgs e)
        {
            Numcabina = pr.CabinaExisting(ComboCabina.Text);
            MyList.Clear();
            var DBonWork = new DB.SmartCentralDB(Properties.Settings.Default.ConctToDataBase);
            var SelecDP  = (from D in DBonWork.DPs
                            where D.IDcabina == Numcabina
                            select D.DPNumber).Distinct();

            if (SelecDP.Count() > 0)
            {
                foreach (var item in SelecDP)
                {
                    MyList.Add(item);
                }
            }
            DPNumber.Focus();
        }
        private void ComboCabina_SelectedIndexChanged(object sender, EventArgs e)
        {
            ComboDP.Items.Clear();
            Main.DPInfo.Clear();
            int j        = pr.CabinaExisting(num.ToString() + ComboCabina.Text);
            var DBonWork = new DB.SmartCentralDB(Properties.Settings.Default.ConctToDataBase);
            var SelecDP  = from D in DBonWork.DPs
                           where D.IDcabina == j
                           select new { D.IDdp, D.DPGeneral, D.DPNumber };
            var i = from c in SelecDP
                    orderby c.DPNumber ascending
                    select c;

            if (i.Count() > 0)
            {
                foreach (var item in SelecDP)
                {
                    ComboDP.Items.Add(item.DPNumber);
                    Main.DPInfo.Add(item.IDdp, item.DPGeneral);
                }
            }
            var selectdata = from p in DBonWork.DPs
                             where p.IDcabina == j
                             from B in DBonWork.Cabinas
                             where B.IDcabina == p.IDcabina
                             from D in DBonWork.Cabels
                             where D.IDCable == B.IDCable
                             from c in DBonWork.Centrals
                             where c.IDcentral == D.IDcentral
                             select new { c.CentralName, D.CableNumber, B.ODU, B.CABINA, p.DPNumber, p.Area, D.PunctuationBG, D.PunctuationEN };
            var t = from c in selectdata
                    orderby c.DPNumber ascending
                    select c;

            this.dataGridView1.DataSource = null;
            this.dataGridView1.DataSource = t;
            ComboDP.Focus();
        }