private void UpdateData_Click(Object sender, RoutedEventArgs e) { const string link = @"https://bdu.fstec.ru/files/documents/thrlist.xlsx"; var webClient = new WebClient(); webClient.DownloadFile(new Uri(link), "thrlist.xlsx"); FilePath = "thrlist.xlsx"; var updateDataWindow = new UpdateDataWindow(); updateDataWindow.Show(); }
private void cbxCN_SelectionChanged(object sender, SelectionChangedEventArgs e) { ComboBox cbxCN = (ComboBox)sender; QLVTDataSet.V_CNDataTable cn = (QLVTDataSet.V_CNDataTable)Common.ChiNhanhInfo; DataRow[] rows = cn.Select("ChiNhanhId =" + (int)cbxCN.SelectedValue); string sv = (string)rows[0]["subscriber_server"]; Common.CurrentChiNhanh = sv; Common.CurrentChiNhanhId = cbxCN.SelectedValue; Common.CurrentCNName = ((DataRowView)cbxCN.SelectedItem).Row["Ten"].ToString(); Common.Database = (Common.GetDatabase0); Common.Server = ((string)Common.CurrentChiNhanh); Common.Userid = (Common.GetUserid0); Common.Password = (Common.GetPassword0); string connectionString = Common.buildConnectionString(); try { if (Common.IsServerConnected(connectionString)) { Common.connection = new SqlConnection(connectionString); if (pnContent.Children.Count > 0) { UpdateDataWindow w = (UpdateDataWindow)pnContent.Children[0]; w.loadData(0); } } else { MessageBox.Show("Lỗi kết nối"); } } catch (Exception ex) { MessageBox.Show("Lỗi kết nối"); } }