private void BindError() { IConfigurator config = Configurator.Create(); ICompanyInfo company = config.GetCompanyInfo(CompanyUid.ToString()); string installPath = config.InstallPath; string companyCodePath = Path.Combine(installPath, company.CodePath); string errorsPath = Path.Combine(companyCodePath, @"Web\Portal\Admin\Log\Error"); string FilePath = Path.Combine(errorsPath, FileName + ".html"); if (!File.Exists(FilePath)) { FilePath = FilePath.Replace(".html", ".aspx"); } if (!File.Exists(FilePath)) { return; } StreamReader sr = File.OpenText(FilePath); string sTemp = sr.ReadToEnd(); sr.Close(); lblError.Text = sTemp.Replace("../../../Admin/errorlog.aspx", "../Pages/SiteErrorLog.aspx?id=" + CompanyUid.ToString()); }
private void BinddgErrors() { DataTable dt = new DataTable(); dt.Columns.Add("ErrorID"); dt.Columns.Add("CreationTime", typeof(DateTime)); IConfigurator config = Configurator.Create(); ICompanyInfo company = config.GetCompanyInfo(CompanyUid.ToString()); string installPath = config.InstallPath; string companyCodePath = Path.Combine(installPath, company.CodePath); string errorsPath = Path.Combine(companyCodePath, @"Web\Portal\Admin\Log\Error"); DirectoryInfo dir = new DirectoryInfo(errorsPath); foreach (FileInfo fileinfo in dir.GetFiles()) { string ErrorLink = fileinfo.Name; string ext = ""; if (ErrorLink.IndexOf(".aspx") >= 0) { ext = ".aspx"; } else if (ErrorLink.IndexOf(".html") >= 0) { ext = ".html"; } else { continue; } string PureName = ErrorLink.Substring(0, ErrorLink.IndexOf(ext)); string ErrorID = PureName.Substring(PureName.LastIndexOf("_") + 1); DataRow dr = dt.NewRow(); dr["ErrorID"] = "<a href='SiteErrorLog.aspx?id=" + CompanyUid.ToString() + "&fileName=" + PureName + "'>" + ErrorID + "</a>"; dr["CreationTime"] = fileinfo.CreationTime; dt.Rows.Add(dr); } DataView dv = dt.DefaultView; dv.Sort = "CreationTime DESC"; dgErrors.DataSource = dv; dgErrors.DataBind(); }
private void BindToolbar() { string sDomain = Configurator.Create().GetCompanyInfo(CompanyUid.ToString()).Host; if (FileName == null) { secH.Title = sDomain; secH.AddLink("<img alt='' src='../Layouts/Images/cancel.gif'/> Manage Sites", "../Pages/Sites.aspx"); } else { secH.Title = "Error View"; if (Back != "reports") { secH.AddLink("<img alt='' src='../Layouts/Images/cancel.gif'/> Error Log", "../Pages/SiteErrorLog.aspx?id=" + CompanyUid.ToString()); } else { secH.AddLink("<img alt='' src='../Layouts/Images/cancel.gif'/> Back To Reports", "../Pages/ASPHome.aspx?Tab=1"); } } }