public static bool Afiseaza(Form pEcranPariente, List <StructImportListaPreturi> pListaPreturi) { using (FormImportaListaPreturi ecran = new FormImportaListaPreturi(pListaPreturi)) { ecran.AplicaPreferinteleUtilizatorului(); return(CCL.UI.IHMUtile.DeschideEcran(pEcranPariente, ecran)); } }
private void BtnImporta_Click(object sender, EventArgs e) { if (this.lSeIncarca) { return; } try { incepeIncarcarea(); System.IO.FileInfo fisier = IHMUtile.GetFisierUnic(this.GetFormParinte()); if (fisier != null) { List <StructImportListaPreturi> listaInterv = new List <StructImportListaPreturi>(); using (StreamReader sr = new StreamReader(fisier.FullName)) { string currentLine; // currentLine will be null when the StreamReader reaches the end of file while ((currentLine = sr.ReadLine()) != null) { // Search, case insensitive, if the currentLine contains the searched keyword if (currentLine.IndexOf(",", StringComparison.CurrentCultureIgnoreCase) >= 0) { string[] dateLinie = currentLine.Split(new string[] { "," }, StringSplitOptions.None); if (dateLinie.Length > 1) { listaInterv.Add(new StructImportListaPreturi(dateLinie)); } } } } if (CUtil.EsteListaVida <StructImportListaPreturi>(listaInterv)) { CCL.UI.Mesaj.Eroare(this.GetFormParinte(), "Eroare"); } else { if (FormImportaListaPreturi.Afiseaza(this.GetFormParinte(), listaInterv)) { ConstruiesteRanduriDGV(); this.panelOptiuni.Visible = false; } } } } catch (Exception ex) { GestiuneErori.AfiseazaMesaj(this.GetFormParinte(), ex); } finally { finalizeazaIncarcarea(); } }