private void GenerateExcel(string val) { var obj = new OperationFunctions(); List <CurrScanDTO > List = new List <CurrScanDTO>(); switch (int.Parse(val)) { case 1: List = obj.GenerateRegularScanReport(int.Parse(drpScanList.SelectedValue)); if (List.Count > 0) { ShowExcelFile(List, "GenerateRegularScanReport"); } else { lblNoRecords.Visible = true; } break; case 2: List = obj.GenerateComplianceScanReport(int.Parse(drpScanList.SelectedValue)); if (List.Count > 0) { ShowExcelFile(List, "Generate Compliance Scan Report"); } else { lblNoRecords.Visible = true; } break; case 3: // obj.GenerateVulnerabilityScanReport(int.Parse(drpScanList.SelectedValue)); //if (List.Count > 0) // ShowExcelFile(List, "Generate Vulnerabilities Not Reported-1"); //else // lblNoRecords.Visible = true; break; case 4: List = obj.NewPluginOutputVarianceSecond(int.Parse(drpScanList.SelectedValue)); if (List.Count > 0) { ShowExcelFile(List, "PluginOutputVariance-2"); } else { lblNoRecords.Visible = true; } break; default: break; } }
public List <ScanMasterDTO> GetRecords() { List <ScanMasterDTO> scanMasters = new List <ScanMasterDTO>(); var obj = new OperationFunctions(); scanMasters = obj.GetPreviousScanResult(HttpContext.Current.Session["UserName"] as string); grdScanList.DataSource = scanMasters; grdScanList.DataBind(); return(null); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { var obj = new OperationFunctions(); var listOfData = obj.GetScanIds(); drpScanList.DataSource = listOfData; drpScanList.DataTextField = "ScanName"; drpScanList.DataValueField = "ScanId"; drpScanList.DataBind(); } (this.Master.FindControl("lblLoginName") as Label).Text = Session["UserName"] as string; (this.Master.FindControl("hypLogOut") as HyperLink).Visible = true; }
private void PerformCustomAction() { dvAdditionalScan.Visible = false; dvNewScan.Visible = true; var obj = new OperationFunctions(); var dtoItem = obj.GetsScanResultByScanId(Session["UserName"] as string, int.Parse(((System.Web.UI.WebControls.TableRow)(grdScanList.SelectedRow)).Cells[0].Text)); if (dtoItem.Count > 0) { txtClientName.Text = dtoItem.First().ClientName; txtNewScanName.Text = dtoItem.First().ScanName; Session["ScanId"] = dtoItem.First().ScanID; Session["SubscanId"] = dtoItem.First().SubScanID; } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { var obj = new OperationFunctions(); var listOfData = obj.GetScanIds(); drpScanList.DataSource = listOfData; drpScanList.DataTextField = "ScanName"; drpScanList.DataValueField = "ScanId"; drpScanList.DataBind(); } if (Session["IsAdmin"] != null) { Menu mnuControl = this.Master.FindControl("menuMaster") as Menu; if (!((bool)Session["IsAdmin"])) { mnuControl.Items[0].Enabled = false; mnuControl.Items[3].Enabled = false; } } (this.Master.FindControl("lblLoginName") as Label).Text = Session["UserName"] as string; (this.Master.FindControl("hypLogOut") as HyperLink).Visible = true; }
private void GenerateExcel(string val) { var obj = new OperationFunctions(); List <CurrScanDTO> List = new List <CurrScanDTO>(); switch (int.Parse(val)) { case 1: var ListOfPlugin = obj.NewRegularScan(int.Parse(drpScanList.SelectedValue)); if (ListOfPlugin.Count > 0) { ShowExcelFile(ListOfPlugin, "NewPluginData"); } else { lblNoRecords.Visible = true; } break; case 2: var ListOfComp = obj.NewComplianceData(int.Parse(drpScanList.SelectedValue)); if (ListOfComp.Count > 0) { ShowExcelFile(ListOfComp, "NewComplianceData"); } else { lblNoRecords.Visible = true; } break; case 3: List = obj.NewPluginOutputVarianceFirst(int.Parse(drpScanList.SelectedValue)); if (List.Count > 0) { ShowExcelFile(List, "PluginOutputVariance-1"); } else { lblNoRecords.Visible = true; } break; case 4: List = obj.NewPluginOutputVarianceSecond(int.Parse(drpScanList.SelectedValue)); if (List.Count > 0) { ShowExcelFile(List, "PluginOutputVariance-2"); } else { lblNoRecords.Visible = true; } break; default: break; } }
protected void btnUpload_Click(object sender, EventArgs e) { List <string> columnNmaes; DataSet result; List <MasterPluginDTO> ItemList; List <MasterComplianceDTO> complianceDTO; List <double> pluginIds; ReturnResultDTO retDto; switch (int.Parse(drpOptionList.SelectedValue)) { case 5: { columnNmaes = new List <string>(); columnNmaes.Add("PluginID"); columnNmaes.Add("Synopsis"); columnNmaes.Add("Description"); columnNmaes.Add("ExploitAvailable"); columnNmaes.Add("ExploitabilityEase"); columnNmaes.Add("ExploitedByMalwar"); columnNmaes.Add("RiskFactor"); columnNmaes.Add("Solution"); columnNmaes.Add("SeeAlso"); columnNmaes.Add("PluginOutput"); result = ValidateColumnInSheet(columnNmaes); ItemList = result.Tables[0].ToList <MasterPluginDTO>(); pluginIds = ItemList.Select(c => c.PluginId).ToList(); pluginIds = pluginIds.Distinct().ToList(); ItemList = ItemList.Where(c => pluginIds.Contains(c.PluginId)).GroupBy(c => c.PluginId).Select(v => v.First()).ToList(); var obj = new OperationFunctions(); retDto = obj.UpdateMasterPluginData(ItemList); lblNoRecords.Visible = true; lblNoRecords.Text = retDto.Message; } break; case 6: columnNmaes = new List <string>(); columnNmaes.Add("PluginID"); columnNmaes.Add("ComplianceCheckID"); columnNmaes.Add("Description"); columnNmaes.Add("RiskFactor"); columnNmaes.Add("PluginOutput"); result = ValidateColumnInSheet(columnNmaes); complianceDTO = result.Tables[0].ToList <MasterComplianceDTO>(); pluginIds = complianceDTO.Select(c => c.PluginId).ToList(); pluginIds = pluginIds.Distinct().ToList(); complianceDTO = complianceDTO.Where(c => pluginIds.Contains(c.PluginId)).GroupBy(c => new { c.ComplianceCheckID, c.PluginId }).Select(v => v.First()).ToList(); var objCon = new OperationFunctions(); retDto = objCon.UpdateMasterCompliance(complianceDTO); lblNoRecords.Visible = true; lblNoRecords.Text = retDto.Message; break; case 7: columnNmaes = new List <string>(); columnNmaes.Add("PluginID"); columnNmaes.Add("Synopsis"); columnNmaes.Add("Description"); columnNmaes.Add("PluginOutput"); result = ValidateColumnInSheet(columnNmaes); ItemList = result.Tables[0].AsEnumerable().Select(s => new MasterPluginDTO() { PluginOutPutReportable = s.Field <bool>("PluginOutputReportable"), PluginId = s.Field <double>("PluginId"), }).ToList(); pluginIds = ItemList.Select(c => c.PluginId).ToList(); pluginIds = pluginIds.Distinct().ToList(); ItemList = ItemList.Where(c => pluginIds.Contains(c.PluginId)).GroupBy(c => c.PluginId).Select(v => v.First()).ToList(); var objdataCon = new OperationFunctions(); retDto = objdataCon.UpdatePluginVariance1(ItemList); lblNoRecords.Visible = true; lblNoRecords.Text = retDto.Message; break; case 8: columnNmaes = new List <string>(); columnNmaes.Add("PluginID"); columnNmaes.Add("ComplianceCheckID"); columnNmaes.Add("Description"); columnNmaes.Add("PluginOutput"); result = ValidateColumnInSheet(columnNmaes); ItemList = result.Tables[0].AsEnumerable().Select(s => new MasterPluginDTO() { PluginOutPutReportable = s.Field <bool>("PluginOutputReportable"), ComplianceCheckID = s.Field <string>("ComplianceCheckID"), PluginId = s.Field <double>("PluginId"), }).ToList(); pluginIds = ItemList.Select(c => c.PluginId).ToList(); pluginIds = pluginIds.Distinct().ToList(); ItemList = ItemList.Where(c => pluginIds.Contains(c.PluginId)).GroupBy(c => new { c.ComplianceCheckID, c.PluginId }).Select(v => v.First()).ToList(); var objdataConection = new OperationFunctions(); retDto = objdataConection.UpdatePluginVariance2(ItemList); lblNoRecords.Visible = true; lblNoRecords.Text = retDto.Message; break; } }
protected void btnsave_Click(object sender, EventArgs e) { XDocument myDoc = XDocument.Load(fileUpload1.FileContent); XNamespace cm = myDoc.Descendants("Report").First().Attributes().ElementAt(1).Value; var dtl = (from r in myDoc.Descendants("ReportItem") select new ImportXMLDataDTO() { ReportHost = r.Parent.Attribute("name").Value, ClientName = txtClientName.Text, ScanDate = DateTime.Parse(txtDate.Text), ScanName = txtNewScanName.Text, IsAdditionalScan = rdbtnAddtional.Checked, ScanId = Session["ScanId"] != null ? Convert.ToInt32(Session["ScanId"]) : 0, SubScanId = Session["SubscanId"] != null ? Convert.ToInt32(Session["SubscanId"]) : 0, UserId = Session["UserName"] as string, PlugId = r.Attribute("pluginID").Value, Port = r.Attribute("port") == null ? null : r.Attribute("port").Value, Compliance = r.Element("compliance") == null ? null : r.Element("compliance").Value, ComplianceResult = r.Element(cm + "compliance-result") == null ? null : r.Element(cm + "compliance-result").Value, ComplianceActualValue = r.Element(cm + "compliance-actual-value") == null ? null : r.Element(cm + "compliance-actual-value").Value, ComplianceCheckID = r.Element(cm + "compliance-check-id") == null ? null : r.Element(cm + "compliance-check-id").Value, ComplianceOutPut = r.Element(cm + "compliance-output") == null ? null : r.Element(cm + "compliance-output").Value, CompliancePolicyValue = r.Element(cm + "compliance-policy-value") == null ? null : r.Element(cm + "compliance-policy-value").Value, Description = r.Element("description") == null ? null : r.Element("description").Value, ExploitAvailable = r.Element("exploit_available") == null ? null : r.Element("exploit_available").Value, ExploitabilityEase = r.Element("exploitability_ease") == null ? null : r.Element("exploitability_ease").Value, ExploitedByMalware = r.Element("exploited_by_malware") == null ? null : r.Element("exploited_by_malware").Value, RiskFactor = r.Element("risk_factor") == null ? null : r.Element("risk_factor").Value, SeeLAlso = r.Element("see_also") == null ? null : r.Element("see_also").Value, Solution = r.Element("solution") == null ? null : r.Element("solution").Value, Synopsis = r.Element("synopsis") == null ? null : r.Element("synopsis").Value, PluginOutput = r.Element("plugin_output") == null ? null : r.Element("plugin_output").Value, ComplianceCheckName = r.Element(cm + "compliance-check-name") == null ? null : r.Element(cm + "compliance-check-name").Value, Complianceinfo = r.Element(cm + "compliance-info") == null ? null : r.Element(cm + "compliance-info").Value, ComplianceSeeAlso = r.Element(cm + "compliance-see-also") == null ? null : r.Element(cm + "compliance-see-also").Value, ComplianceSolution = r.Element(cm + "compliance-solution") == null ? null : r.Element(cm + "compliance-solution").Value, }).ToList(); var obj = new OperationFunctions(); try { ReturnResultDTO retValue = obj.ImportXmlData(dtl); if (retValue.IsSuccess) { txtNewScanName.Text = string.Empty; txtDate.Text = string.Empty; txtClientName.Text = string.Empty; lblmessage.Visible = true; lblmessage.Text = "Upload successfull."; lblComplianceMessage.Text = retValue.NewComplianceMessage; lblNewCompaliance.Text = retValue.NewComplianceCount.ToString(); lblNewPlugins.Text = retValue.NewPluginCount.ToString(); lblPluginMessage.Text = retValue.NewPluginMessage; lblNewVariance.Text = retValue.NewVarianceCount.ToString(); lblVarianceMessage.Text = retValue.NewVarianceMessage; pnlMessage.Visible = true; RadioButton1.Checked = true; } else { lblmessage.Visible = true; lblmessage.Text = "Import failed."; RadioButton1.Checked = true; } } catch (Exception ex) { lblmessage.Visible = true; lblmessage.Text = "Import failed."; //throw; } }