protected void Importbtn_Click(object sender, EventArgs e) { if (VcardUploader.HasFile) { if ((VcardUploader.FileName.ToLower().EndsWith(".vcf")) || VcardUploader.FileName.ToLower().EndsWith(".csv")) { uploaderError.Visible = false; VCardCSVParser vcfparser = new VCardCSVParser(); StreamReader streamReader = new StreamReader(VcardUploader.FileContent); if (VcardUploader.FileName.ToLower().EndsWith(".vcf")) GridView1.DataSource = vcfparser.GetRecepientFromVCards(streamReader.ReadToEnd()); else GridView1.DataSource = vcfparser.GetRecepientFromCSV(streamReader.ReadToEnd(), ","); if (((IList)GridView1.DataSource).Count == 0) ShowUploaderError("Can not find any Contact"); else GridView1.DataBind(); streamReader.Close(); } else ShowUploaderError("You must upload vcf or scv File"); } else ShowUploaderError("Choose file to be imported"); }
protected void Importbtn_Click(object sender, EventArgs e) { if (VcardUploader.HasFile) { if ((VcardUploader.FileName.ToLower().EndsWith(".vcf")) || VcardUploader.FileName.ToLower().EndsWith(".csv")) { uploaderError.Visible = false; VCardCSVParser vcfparser = new VCardCSVParser(); StreamReader streamReader = new StreamReader(VcardUploader.FileContent); if (VcardUploader.FileName.ToLower().EndsWith(".vcf")) { GridView1.DataSource = vcfparser.GetRecepientFromVCards(streamReader.ReadToEnd()); } else { GridView1.DataSource = vcfparser.GetRecepientFromCSV(streamReader.ReadToEnd(), ","); } if (((IList)GridView1.DataSource).Count == 0) { ShowUploaderError("Can not find any Contact"); } else { GridView1.DataBind(); } streamReader.Close(); } else { ShowUploaderError("You must upload vcf or scv File"); } } else { ShowUploaderError("Choose file to be imported"); } }