Esempio n. 1
0
        private void BindData()
        {
            DataTable dtError = new DataTable();

            dtError.Columns.Add("Domain", typeof(string));
            dtError.Columns.Add("Error", typeof(string));
            dtError.Columns.Add("CreationTime", typeof(DateTime));

            IConfigurator config      = Configurator.Create();
            string        installPath = config.InstallPath;

            foreach (ICompanyInfo company in config.ListCompanies(false))
            {
                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);
                    string ErrorPortal = ErrorLink.Substring(0, PureName.LastIndexOf("_"));

                    if (fileinfo.Length == 0)
                    {
                        continue;
                    }

                    DataRow dr = dtError.NewRow();
                    dr["Domain"] = company.Host;
                    dr["Error"]  = String.Format(CultureInfo.InvariantCulture,
                                                 "<a href='../Pages/SiteErrorLog.aspx?fileName={0}&amp;id={1}&amp;back=reports'>{2}</a>",
                                                 PureName,
                                                 company.Id,
                                                 ErrorID);
                    dr["CreationTime"] = fileinfo.CreationTime;
                    dtError.Rows.Add(dr);
                }
            }

            DataView dv = dtError.DefaultView;

            dv.Sort = "CreationTime DESC";

            dgErrors.DataSource = dv;
            if (dv.Count <= 25)
            {
                dgErrors.PagerStyle.Visible = false;
            }
            dgErrors.DataBind();

            using (IDataReader reader = CManage.GetTotalStatistic())
            {
                if (reader.Read())
                {
                    BillableCountValue.Text         = reader["BillableCount"].ToString();
                    ActiveBillableCountValue.Text   = reader["ActiveBillableCount"].ToString();
                    InactiveBillableCountValue.Text = ((int)reader["BillableCount"] - (int)reader["ActiveBillableCount"]).ToString();

                    TrialCountValue.Text         = reader["TrialCount"].ToString();
                    ActiveTrialCountValue.Text   = reader["ActiveTrialCount"].ToString();
                    InactiveTrialCountValue.Text = ((int)reader["TrialCount"] - (int)reader["ActiveTrialCount"]).ToString();

                    CompaniesCountValue.Text = reader["CompaniesCount"].ToString();
                    ActiveCountValue.Text    = reader["ActiveCount"].ToString();
                    InactiveCountValue.Text  = ((int)reader["CompaniesCount"] - (int)reader["ActiveCount"]).ToString();

                    PendingTrialsCountValue.Text = reader["PendingTrialsCount"].ToString();
                }
            }
        }