Ejemplo n.º 1
0
 public static bool Afiseaza(Form pEcranPariente, List <StructImportClienti> pLista)
 {
     using (FormImportaClienti ecran = new FormImportaClienti(pLista))
     {
         ecran.AplicaPreferinteleUtilizatorului();
         return(CCL.UI.IHMUtile.DeschideEcran(pEcranPariente, ecran));
     }
 }
Ejemplo n.º 2
0
        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 <StructImportClienti> listaClienti = new List <StructImportClienti>();
                    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)
                                {
                                    listaClienti.Add(new StructImportClienti(dateLinie));
                                }
                            }
                        }
                    }

                    if (CUtil.EsteListaVida <StructImportClienti>(listaClienti))
                    {
                        CCL.UI.Mesaj.Eroare(this.GetFormParinte(), "Eroare");
                    }
                    else
                    {
                        if (FormImportaClienti.Afiseaza(this.GetFormParinte(), listaClienti))
                        {
                            ConstruiesteRanduriDGV();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                GestiuneErori.AfiseazaMesaj(this.GetFormParinte(), ex);
            }
            finally
            {
                finalizeazaIncarcarea();
            }
        }