private void abrirToolStripMenuItem_Click(object sender, EventArgs e) { if (openFileDialog.ShowDialog() == DialogResult.OK) { lista = new DeploymentSqlDst(); lista.ReadXml(openFileDialog.FileName); AtuatlizarItems((DeploymentSqlDst.FileRow[])lista.File.Select("0=0","Arquivo")); } }
private void AtuatlizarItems(DeploymentSqlDst.FileRow[] items) { dgvItems.Rows.Clear(); cbxItems.Items.Clear(); cbxItems.Text = string.Empty; foreach (DataRow drw in items) { dgvItems.Rows.Add(drw["Arquivo"].ToString()); cbxItems.Items.Add(drw["Arquivo"].ToString()); } if (cbxItems.Items.Count > 0) cbxItems.SelectedIndex = 0; AtualizarDependencias((DeploymentSqlDst.FileRow[])lista.File.Select("0=0", "Arquivo")); }
private void AtualizarDependencias(DeploymentSqlDst.FileRow[] items) { clbDependecias.Items.Clear(); string sql = "codigo = {0} and Dependencia = {1}"; if (cbxItems.SelectedIndex != -1) { DataRow item = ObterFileRow(lista, cbxItems.Text); foreach (DataRow drw in items) { if (drw["Arquivo"].ToString() != cbxItems.Text) if (lista.Dependeci.Select(string.Format(sql, item["Codigo"].ToString(), drw["Codigo"].ToString())).Length > 0) clbDependecias.Items.Add(drw["Arquivo"].ToString(), true); else clbDependecias.Items.Add(drw["Arquivo"].ToString()); } } }
private void OrdenaDependecias(DeploymentSqlDst valor) { OrdenacaoAtributo(lista,1); foreach (DeploymentSqlDst.FileRow row in valor.File.Rows) { if (row.Atributo == 0) { OrdenaDependecias(row.Codigo); if (!ordem.Contains(row.Codigo)) ordem.Add(row.Codigo); } } OrdenacaoAtributo(lista, 2); }
private void OrdenacaoAtributo(DeploymentSqlDst valor, int atributo) { foreach (DeploymentSqlDst.FileRow row in valor.File.Rows) { if (row.Atributo == atributo) { ordem.Add((int)row["Codigo"]); } } }
private DeploymentSqlDst.FileRow ObterFileRow(DeploymentSqlDst valor, int codigo) { DeploymentSqlDst.FileRow[] rows = (DeploymentSqlDst.FileRow[])lista.File.Select("Codigo = " + codigo); if (rows.Length > 0) return rows[0]; return null; }
private DeploymentSqlDst.FileRow ObterFileRow(DeploymentSqlDst valor, string path) { DeploymentSqlDst.FileRow[] rows = (DeploymentSqlDst.FileRow[])lista.File.Select("Arquivo = '" + path + "'"); if (rows.Length > 0) return rows[0]; return null; }
private DeploymentSqlDst.DependeciRow[] ObterDependeciRows(DeploymentSqlDst valor, int codigo) { DeploymentSqlDst.DependeciRow[] rows = (DeploymentSqlDst.DependeciRow[])lista.Dependeci.Select("Codigo = " + codigo); if (rows.Length > 0) return rows; return new List<DeploymentSqlDst.DependeciRow>().ToArray(); }
private int ObterCodigo(DeploymentSqlDst valor, string path) { DeploymentSqlDst.FileRow[] rows = (DeploymentSqlDst.FileRow[])lista.File.Select("Arquivo = '" + path + "'"); if (rows.Length > 0) return (int)rows[0]["Codigo"]; return -1; }