public EditBD(int ID) { InitializeComponent(); IDBD = ID; _BD = new BaseDados.BD(ID); RefreshList(); }
public void addLigacao(Ligacoes.Ligacao liga, BaseDados.BD bd) { XDocument doc = XDocument.Load(Ficheiro); XElement selectedElement = doc.Descendants(MainTag).Elements(MainLinkTag).Where(x => (int)x.Attribute("Id") == _IdLink).FirstOrDefault(); XElement nElem = new XElement(LigacaoTag, new XAttribute("Id", selectedElement.Elements().Count() + 1), new XAttribute("BD", bd.Name), new XAttribute("IDReal", liga.Id)); nElem.Value = liga.Name; selectedElement.Element(MainLigacaoTag).Add(nElem); doc.Save(Ficheiro); }
private void RefreshLigacoes() { BaseDados.BD item = bdcb.SelectedItem as BaseDados.BD; Ligacoes liga = new Ligacoes(item.Id); ligacoesCb.DataSource = liga.ListaLigacoes; ligacoesCb.DisplayMember = "Name"; ligacoesCb.ValueMember = "Id"; ligacoesCb.Refresh(); }
private void button2_Click(object sender, EventArgs e) { if (_link.Id == 0) { BaseDados.BD item = bdcb.SelectedItem as BaseDados.BD; tmpList.Add(ligacoesCb.SelectedItem as Ligacoes.Ligacao); RefreshList(); } else { _link.addLigacao(ligacoesCb.SelectedItem as Ligacoes.Ligacao, bdcb.SelectedItem as BaseDados.BD); RefreshList(); } }
public EditBD() { InitializeComponent(); _BD = new BaseDados.BD(); }