public void DeleteReport(Report DelReport)
        {
            string deleteFolder = string.Empty;

            var id = DelReport.Id;

            using (var db = new SAPTestContext())
            {
                var report = db.Reports.Find(id);
                if(report!=null && report.Executor == User.Identity.Name)
                {
                    deleteFolder = Path.Combine(HostingEnvironment.MapPath("/Report1/ReportFiles"), report.Url);
                    db.Reports.Remove(report);
                    db.SaveChanges();
                }
            }

            if (deleteFolder != "" && deleteFolder != HostingEnvironment.MapPath("/Report1/ReportFiles"))
            {
                if (Directory.Exists(deleteFolder))
                {
                    Directory.Delete(deleteFolder, true);
                }
            }
        }
 public void UpdateReport(Report rp)
 {
     var id = rp.Id;
     var atId = rp.AssetId;
     using (var db = new SAPTestContext())
     {
         var report = db.Reports.Find(id);
         var asset = db.Assets.Find(atId);
         if(report!=null && asset != null && report.Executor == User.Identity.Name)
         {
             report.AssetId = atId;
             db.SaveChanges();
         }
     }
 }
        public static Report ReadReport(XmlDocument xDoc)
        {
            Report report = new Report();
            report.TestName = readContent(xDoc, "ReportRoot/Summary/TestName", "No Test Name found");
            //report.Executor = readContent(xDoc, "ReportRoot/Summary/Executor", "No Executor Found");
            string result = readContent(xDoc, "ReportRoot/Summary/OverallStatus", "No OverallStatus Found");
            report.CompanyCode = readContent(xDoc, "ReportRoot/Summary/CompanyCode", "No CompanyCode Found");
            report.CaseNum = report.TestName.Split('_')[1];
            if(result.ToLower()=="pass")
            {
                report.TestResult = true;
            }
            else
            {
                report.TestResult = false;
            }

            report.SubmitDt = DateTime.Now;
            return report;
        }