private bool ValidateVCFile(string fpath) { bool valid = true; try { var checks = ExcelDataReader.GetVoidedChecks(fpath); var clr = (from c in checks where (string.IsNullOrEmpty(c.Clr)) select c).FirstOrDefault(); if (clr == null) { valid = false; } } catch (Exception e) { valid = false; } return(valid); // return true; }
public static List <Check> GetVoidedChecks(string vcFileName, string vcFileType) { if (vcFileName.Equals("unknown")) { // Return an emmpty list of checks. return(new List <Check>()); } //List<Check> voidedChecks = new List<Check>(); string pathToVoidedChecksFile = System.Web.HttpContext.Current.Request.MapPath(string.Format("~/Uploads/{0}.{1}", vcFileName, vcFileType)); List <Check> voidedChecks = ExcelDataReader.GetVoidedChecks(pathToVoidedChecksFile); /* * var voidedChecksFile = Linq2Excel.GetFactory(pathToVoidedChecksFile); * var vChecks = from vc in voidedChecksFile.Worksheet<Check>("Sheet1") select vc; * * foreach(Check check in vChecks) * { * voidedChecks.Add(check); * } */ return(voidedChecks); }