Пример #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     PageTitle = "Отчет";
     PageMenu = "~/App_Data/SideMenu/Research/ResearchMenu.xml";
     Int32 researchId = Convert.ToInt32(Request.QueryString["research"]);
     Rs = ResearchManager.GetResearch(researchId);
     if (Rs == null)
     {
         Response.Redirect("~/Error");
     }
     ASPxLabel1.Text =String.Format("Исследование: (№{0}) {1}", Rs.Id, Rs.ResearchName);
 }
Пример #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     base.Page_Load(sender, e);
     PageTitle = "Список портов";
     PageMenu = "~/App_Data/SideMenu/Research/ResearchMenu.xml";
     Int32 researchId = Convert.ToInt32(Request.QueryString["research"]);
     Rs = ResearchManager.GetResearch(researchId);
     if (Rs == null)
     {
         Response.Redirect("~/Error");
     }
     ASPxLabel1.Text =String.Format("Исследование: {0}",Rs.ResearchName);
     UpdateGridView();
 }
Пример #3
0
        protected new void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);
            PageTitle = "Отчет";
            PageMenu  = "~/App_Data/SideMenu/Research/ResearchMenu.xml";

            Int32 researchId = Convert.ToInt32(Request.QueryString["research"]);
            //Session.Clear();
            Session["rsch"] = researchId;
            Rs = ResearchManager.GetResearch(researchId);
            if (Rs == null)
            {
                Response.Redirect("~/Error");
            }

            gridViewReports.DataSource = ReportManager.GetReports(researchId);
            gridViewReports.DataBind();

            if (!IsPostBack)
            {

            }
        }
Пример #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);
            PageTitle = "Распределение событий и классификация";
            PageMenu = "~/App_Data/SideMenu/Research/ResearchMenu.xml";
            Int32 researchId = Convert.ToInt32(Request.QueryString["research"]);
            Rs = ResearchManager.GetResearch(researchId);
            if (Rs == null)
            {
                Response.Redirect("~/Error");
            }
            ASPxLabel1.Text = String.Format("Исследование (№{0}): {1}", Rs.Id,Rs.ResearchName);
            string Os = ResearchManager.GetRschOS(Rs.Id);
            if (Os != null && Os != String.Empty)
                ASPxLabel2.Text = String.Format("ОС: {0}", Os);
            else ASPxLabel2.Visible = false;
            if (!IsPostBack)
            {

            }
            gridViewReports.DataSource = ResearchManager.GetEventsViewWithSignByRschId(Rs.Id);
            gridViewReports.DataBind();
            var test = ResearchManager.GetEventsChartView(Rs.Id);
            List<string> serNames = new List<string>();
            Dictionary<string, List<EventChartItem>> dict = new Dictionary<string, List<EventChartItem>>();
            foreach (var t in test)
            {
                if (!serNames.Contains(t.Sign))
                {
                    serNames.Add(t.Sign);
                }
                if (dict.ContainsKey(t.Sign))
                {
                    if (dict[t.Sign].Count == 0 || dict[t.Sign] == null)
                    {
                        dict[t.Sign] = new List<EventChartItem>();
                        EventChartItem item = new EventChartItem() { Module = t.Module, Value = 1, Sign = t.Sign };
                    }
                    else
                    {
                        bool plased = false;
                        foreach (var p in dict[t.Sign])
                        {
                            if (p.Module == t.Module)
                            {
                                p.Value++;
                                plased = true;
                                break;
                            }
                        }
                        if (!plased)
                        {
                            dict[t.Sign].Add(new EventChartItem() { Module = t.Module, Value = 1, Sign = t.Sign });
                        }
                    }
                }
                else
                {
                    var i = new List<EventChartItem>() { new EventChartItem() { Module = t.Module, Sign = t.Sign, Value = 1 } };
                    dict.Add(t.Sign, i);
                }
            }

            //foreach (var t in test)
            //{
            //    if (dict.ContainsKey(t.Sign))
            //    {
            //        if (dict[t.Sign].Count == 0 || dict[t.Sign] == null)
            //        {
            //            dict[t.Sign] = new List<EventChartItem>();
            //            EventChartItem item = new EventChartItem() { Module = t.Module, Value = 1, Sign = t.Sign };
            //        }
            //        else
            //        {
            //            bool plased = false;
            //            foreach (var p in dict[t.Sign])
            //            {
            //                if (p.Module == t.Module)
            //                {
            //                    p.Value++;
            //                    plased = true;
            //                    break;
            //                }
            //            }
            //            if (!plased)
            //            {
            //                dict[t.Sign].Add(new EventChartItem() { Module = t.Module, Value = 1, Sign = t.Sign });
            //            }
            //        }
            //    }
            //    else
            //    {
            //        var  i = new List<EventChartItem>(){ new EventChartItem(){ Module = t.Module, Sign = t.Sign, Value = 1}};
            //        dict.Add(t.Sign, i);
            //    }
            //}
            WebChartControl1.Series.Clear();
            foreach (var k in dict.Keys)
            {
                Series series1 = new Series(k, DevExpress.XtraCharts.ViewType.Bar);
                foreach(var p in dict[k])
                    series1.Points.Add(new SeriesPoint(p.Module, p.Value));
                WebChartControl1.Series.Add(series1);
                //.Series.Add(series1);
                series1.Label.PointOptions.PointView = PointView.Values;
                series1.Label.PointOptions.ValueNumericOptions.Format = NumericFormat.Number;
            }

            //WebChartControl1
        }
Пример #5
0
        protected new void Page_Load(object sender, EventArgs e)
        {
            gridViewReports.KeyFieldName = "Id";
            base.Page_Load(sender, e);
            PageTitle = "Отчет";
            PageMenu  = "~/App_Data/SideMenu/Research/ResearchMenu.xml";
            researchId = -1;
            try
            {
                researchId = (int)Session["rsId"];
            }
            catch
            {
                researchId =  Convert.ToInt32(Request.QueryString["researchId"]);
            }
            /*Convert.ToInt32(Request.QueryString["research"]);*/
            Rs = ResearchManager.GetResearch(researchId);
            if (Rs == null)
            {
                Response.Redirect("~/Error");
            }
            LHeader.Text = String.Format("Исследование (№{0}): {1}", Rs.Id, Rs.ResearchName);
            if (!User.IsInRole("Administrator"))
                if (Rs.UserId!=UserId) {
                    string scriptstring = "alert(\"У Вас нет доступа к данному исследованию.\");document.location.href = '/Pages/Research/Current.aspx';";
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alert", scriptstring, true);
                    return;
                }
            Mlwr mlwrrec = ResearchManager.GetMlwrByRschId(researchId);
            if (mlwrrec != null) Mlwr.Text = mlwrrec.Name + " (" + mlwrrec.Path + ")";
            LOS.Text = ResearchManager.GetRschOS(researchId);
            LIRType.Text = ResearchManager.GetRschVmType(researchId);
            LCreateTime.Text = Rs.CreatedDate.ToString("dd MMM yyyyг. HH:mm:ss");
            if (Rs.StartedDate.HasValue) LStartTime.Text = ((DateTime)Rs.StartedDate).ToString("dd MMM yyyyг. HH:mm:ss");
            if (Rs.StoppedDate.HasValue) LStopTime.Text = ((DateTime)Rs.StoppedDate).ToString("dd MMM yyyyг. HH:mm:ss");
            if (Rs.Duration > 0) LTimerStopTime.Text = Rs.Duration.ToString() + " мин.";
            if (Rs.StartedDate.HasValue) //Сессия начата
            {
                Int32 elapsedMins;
                if (Rs.StoppedDate.HasValue) //Сессия завершена
                {
                    elapsedMins = (Int32)((Rs.StoppedDate.Value - Rs.StartedDate.Value).TotalMinutes);
                    if (Rs.Duration > 0)
                    {
                        Int32 leftMins = Rs.Duration - elapsedMins;
                        if (leftMins <= 0)
                        {
                            LStatus.Text = "Завершено по таймеру";
                        }
                        else
                        {
                            LStatus.Text = "Завершено принудительно (ост. " + leftMins + " мин.)";
                        }
                    }
                    else LStatus.Text = "Завершено принудительно (через " + elapsedMins + " мин.)";
                }
                else
                {
                    elapsedMins = (Int32)((DateTime.Now - Rs.StartedDate.Value).TotalMinutes);
                    LStatus.Text = "Выполняется (" + elapsedMins + " мин.)";
                }
            }
            else
            {
                LStatus.Text = "Готово к запуску";
            }
            //            HLPorts.NavigateUrl += ("?research=" + researchId);
            //            linkGetRegistryList.NavigateUrl += ("?researchId=" + researchId);
            //            linkGetFileList.NavigateUrl += ("?researchId=" + researchId);
            //            linkGetProcessList.NavigateUrl += ("?researchId=" + researchId);
            Session["rsch"] = researchId;
            DEventsCount.Clear();

            gridAddParams.DataSource = TaskManager.GetTasksViewForRsch(researchId);//dataX;
            gridAddParams.DataBind();

            gridViewReports.DataSource = ResearchManager.GetEventsForRsch(Rs.Id);
            //            var newPageSize = (Int32)CBPagingSize.SelectedItem.Value;
            //            gridViewReports.SettingsPager.PageSize = newPageSize;
            gridViewReports.DataBind();
            ProcTreeList.DataSource = TreeViewBuilder.GetProcsTableView(researchId);
            ProcTreeList.KeyFieldName = "Pid1";
            ProcTreeList.ParentFieldName = "Pid2";
            ProcTreeList.DataBind();
            ProcVPOTreeList.DataSource = TreeViewBuilder.GetResearchProcesses(researchId);
            ProcVPOTreeList.KeyFieldName = "pid";
            ProcVPOTreeList.ParentFieldName = "parentpid";
            ProcVPOTreeList.DataBind();
            gvPorts.DataSource = ResearchManager.GetPortsViewForRsch(Rs.Id);
            gvPorts.DataBind();
            if (RegTreeList.FocusedNode != null)
            {
                gvRegKeys.DataSource = TreeViewBuilder.GetKeyValues(Convert.ToInt32(RegTreeList.FocusedNode.Key));
                gvRegKeys.DataBind();
            }

            if (Rs.TrafficFileReady == (Int32)TrafficFileReady.COMPLETE)
            {

                String link = Rs.TrafficFileName;
                linkGetTraffic.NavigateUrl = link;
                linkGetTraffic.Visible = true;
                linkGetTraffic.Enabled = true;
                ASPxButton1.Visible = false;
                ASPxButton1.Visible = false;
            }

            if (!IsPostBack)
            {
                Layout lt = WebTables.GetLayout((int)Membership.GetUser().ProviderUserKey, "ReportTable");
                if (lt != null)
                {
                    string customState = lt.UserLayout.Substring(0, lt.UserLayout.IndexOf(separator));
                    gridViewReports.Settings.ShowFilterRow = customState[0].ToString() == "T";
                    string gridState = lt.UserLayout.Substring(customState.Length + separator.Length);
                    gridViewReports.LoadClientLayout(gridState);
                }
                TableFilterMenu.Items.FindByName("ShowFiterRow").Checked = gridViewReports.Settings.ShowFilterRow;

                RegCompTreeList.Columns[1].Caption = "Эталон " + LOS.Text;
                RegCompTreeList.Columns[2].Caption = "Исследование " + researchId.ToString();

                string RschRegRoot = TaskManager.GetRegRootForRsch(researchId);
                int rschsysid = ResearchManager.GetRschOSId(researchId);
                Session["rschsysid"] = rschsysid;
                //                 TreeViewBuilder.CompareRegTree(researchId, ResearchManager.GetRschOSId(researchId));
                long eltrootid = TreeViewBuilder.GetRegsEtlRowIdByRootstr(rschsysid, RschRegRoot);
                Session["eltrootid"] = eltrootid;

            //                ReportsBuilder.RschPropsListBuilder(TreeView1, Rs.Id);
            //                 ASPxHyperLink5.NavigateUrl += ("?research=" + researchId);
                if (Rs.TrafficFileReady == (Int32)TrafficFileReady.NOACTION)
                {
                    AskPCAPFile(researchId);
               }

            }
                int[] FileEvs = new int[2];
                int[] RegistryEvs = new int[2];
                int[] NetEvs = new int[2];
                int[] ProcessEvs = new int[2];

                var db = new SandBoxDataContext();
                var rdof = from d in db.EventsChartCounts
                           where d.Id == researchId
                           select d;
                foreach (var rr in rdof)
                {
                    switch (rr.Module)
                    {
                        case "Файловая система":
                            switch (rr.Sign)
                            {
                                case 1: FileEvs[0] += (int)rr.Count; break;
                                case 2: FileEvs[1] += (int)rr.Count; break;
                            } break;
                        case "Реестр":
                            switch (rr.Sign)
                            {
                                case 1: RegistryEvs[0] += (int)rr.Count; break;
                                case 2: RegistryEvs[1] += (int)rr.Count; break;
                            } break;
                        case "Процессы":
                            switch (rr.Sign)
                            {
                                case 1: ProcessEvs[0] += (int)rr.Count; break;
                                case 2: ProcessEvs[1] += (int)rr.Count; break;
                            } break;
                        case "Сеть":
            //                        case "TDIMON":
            //                        case "NDISMON":
                            switch (rr.Sign)
                            {
                                case 1: NetEvs[0] += (int)rr.Count; break;
                                case 2: NetEvs[1] += (int)rr.Count; break;
                            } break;
                    }
                }
                string scripttxt = "drawHalfPie('chartHolder1',Array(" + FileEvs[1].ToString() + ","
                         + FileEvs[0].ToString() + ")); drawHalfPie('chartHolder2',Array(" + RegistryEvs[1].ToString() + ","
                         + RegistryEvs[0].ToString() + ")); drawHalfPie('chartHolder3',Array(" + ProcessEvs[1].ToString() + ","
                         + ProcessEvs[0].ToString() + ")); drawHalfPie('chartHolder4',Array(" + NetEvs[1].ToString() + ","
                         + NetEvs[0].ToString() + "));";
                Page.ClientScript.RegisterStartupScript(Type.GetType("System.String"), "addScript", scripttxt, true);
                //gridAddParams.ClientSideEvents.Init = "function(s, e) { drawHalfPie('chartHolder1',Array(" + FileEvs[1].ToString() + ","
                //         + FileEvs[0].ToString() + ")); drawHalfPie('chartHolder2',Array(" + RegistryEvs[1].ToString() + ","
                //         + RegistryEvs[0].ToString() + ")); drawHalfPie('chartHolder3',Array(" + ProcessEvs[1].ToString() + ","
                //         + ProcessEvs[0].ToString() + ")); drawHalfPie('chartHolder4',Array(" + NetEvs[1].ToString() + ","
                //         + NetEvs[0].ToString() + "));}";
        }
Пример #6
0
        protected new void Page_Load(object sender, EventArgs e)
        {
            gridViewReports.KeyFieldName = "Id";
            base.Page_Load(sender, e);
            PageTitle = "Отчет";
            PageMenu  = "~/App_Data/SideMenu/Research/ResearchMenu.xml";
            Int32 researchId = -1;
            try
            {
                researchId = (int)Session["rsId"];
            }
            catch
            {
                researchId =  Convert.ToInt32(Request.QueryString["research"]);
            }
            /*Convert.ToInt32(Request.QueryString["research"]);*/
            Rs = ResearchManager.GetResearch(researchId);
            if (Rs == null)
            {
                Response.Redirect("~/Error");
            }
            LOS.Text = ResearchManager.GetRschOS(researchId);
            LStartTime.Text = Rs.CreatedDate.ToString("dd MMM HH:mm:ss");
            LStopTime.Text = ResearchManager.GetElapsedTimeInMinutes(Rs.StartedDate, Rs.StoppedDate, Rs.Duration);
            LTimeToWork.Text =ResearchManager.GetLeftTimeInMinutes(Rs.StartedDate, Rs.Duration);
            LHeader.Text = String.Format("Исследлвание (№{0}): {1}", Rs.Id, Rs.ResearchName);
            HLPorts.NavigateUrl += ("?research=" + researchId);
            ASPxHyperLink4.NavigateUrl += ("?research=" + researchId);
            Session["rsch"] = researchId;

            gridViewReports.DataSource = ResearchManager.GetEventsForRsch(Rs.Id);
            var newPageSize = (Int32)CBPagingSize.SelectedItem.Value;
            gridViewReports.SettingsPager.PageSize = newPageSize;
            gridViewReports.DataBind();

            if (Rs.TrafficFileReady == (Int32)TrafficFileReady.COMPLETE)
            {

                String link = Rs.TrafficFileName;
                linkGetTraffic.NavigateUrl = link;
                linkGetTraffic.Visible = true;
                linkGetTraffic.Enabled = true;
                ASPxButton1.Visible = false;
                ASPxButton1.Visible = false;
            }

            if (!IsPostBack)
            {
                ReportsBuilder.RschPropsListBuilder(TreeView1, Rs.Id);
                ASPxHyperLink5.NavigateUrl += ("?research=" + researchId);
                //if (Rs.TrafficFileReady == (Int32)TrafficFileReady.NOACTION)
                //{
                //    var researchVmData = ResearchManager.GetResearchVmData(Rs.ResearchVmData);
                //    if (researchVmData == null) return;

                //    String ip = researchVmData.VmEnvIp;
                //    String beginTime = Rs.StartedDate.HasValue ? Rs.StartedDate.Value.ToString("yyyy-MM-dd HH':'mm':'ss") : DateTime.Now.ToString("yyyy-MM-dd HH':'mm':'ss");
                //    String endTime = Rs.StoppedDate.HasValue ? Rs.StoppedDate.Value.ToString("yyyy-MM-dd HH':'mm':'ss") : DateTime.Now.ToString("yyyy-MM-dd HH':'mm':'ss");

                //    Packet packet = new Packet { Type = PacketType.CMD_LOAD_TRAFFIC, Direction = PacketDirection.REQUEST };
                //    packet.AddParameter(Encoding.UTF8.GetBytes(ip));
                //    packet.AddParameter(Encoding.UTF8.GetBytes(beginTime));
                //    packet.AddParameter(Encoding.UTF8.GetBytes(endTime));
                //    SendPacket(packet);

                //    String filename = ip + beginTime + ".pcap";
                //    ResearchManager.UpdateTrafficInfo(Rs.Id, TrafficFileReady.EXECUTING, filename);
                //}

            }
        }
Пример #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);
            PageTitle = "Сравнение веток реестра";
            PageMenu = "~/App_Data/SideMenu/Research/ResearchMenu.xml";
            Int32 researchId = Convert.ToInt32(Request.QueryString["research"]);
            Rs = ResearchManager.GetResearch(researchId);
            if (TreeView1.Nodes.Count > 0)
            {
                ASPxTreeList1.Columns.Clear();
                ASPxTreeList1.ClearNodes();
                ASPxTreeList1.Columns.Add(new DevExpress.Web.ASPxTreeList.TreeListDataColumn("KeyName", "Имя ключя"));
                ASPxTreeList1.Columns.Add(new DevExpress.Web.ASPxTreeList.TreeListDataColumn("IsNodeInRsch", Rs.ResearchName));
                ASPxTreeList1.Columns.Add(new DevExpress.Web.ASPxTreeList.TreeListDataColumn("IsMoneInCompared", ASPxComboBox1.SelectedItem.Text));
                ConvertTreeViewToTreeList(TreeView1.Nodes[0], null);
            }
            if (Rs == null)
            {
                Response.Redirect("~/Error");
            }
             if (!IsPostBack)
             {

                 var rschs = ResearchManager.GetReadyResearches();
                 foreach (var r in rschs)
                 {
                     string text  = String.Format("{0}: id = {1}",r.ResearchName, r.Id);
                     ASPxComboBox1.Items.Add(new ListEditItem(text, r.Id));
                 }
             }
             if (ASPxTreeList1.Summary.Count == 0)
             {
                 TreeListSummaryItem siPrice = new TreeListSummaryItem();
                 siPrice.FieldName = "KeyName";
                 siPrice.ShowInColumn = "KeyName";
                 ASPxTreeList1.Summary.Add(siPrice);
             }
             LHeader.Text = String.Format("Исследлвание (№{0}): {1}", Rs.Id, Rs.ResearchName);
        }
Пример #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);
            PageTitle = "Сравнение исследований";
            PageMenu = "~/App_Data/SideMenu/Research/ResearchMenu.xml";
            researchId = -1;
            try
            {
                researchId = (int)Session["rsId"];
            }
            catch
            {
                researchId = Convert.ToInt32(Request.QueryString["researchId"]);
            }
            researchId2 = -1;
            try
            {
                researchId2 = (int)Session["rsId2"];
            }
            catch
            {
                researchId2 = Convert.ToInt32(Request.QueryString["researchId2"]);
            }
            /*Convert.ToInt32(Request.QueryString["research"]);*/
            Rs = ResearchManager.GetResearch(researchId);
            if (Rs == null)
            {
                Response.Redirect("~/Error");
            }
            Rs2 = ResearchManager.GetResearch(researchId2);
            if (Rs2 == null)
            {
                Response.Redirect("~/Error");
            }
            var etalonRsch = ResearchManager.GetEtalonRsch(researchId);
            //            UpdateTreeView(true);
            if (Rs == null)
            {
                Response.Redirect("~/Error");
            }
            //if (etalonRsch == null)
            //{
            //    lEtalonEx.Text = "Эталонного ислледования не найдено";
            //}
            //            TreeViewBuilder.CompareRegTree(researchId, ResearchManager.GetRschOSId(researchId));
            Mlwr mlwrrec = ResearchManager.GetMlwrByRschId(researchId);
            if (mlwrrec != null) Mlwr.Text = mlwrrec.Name + " (" + mlwrrec.Path + ")";
            LOS.Text = ResearchManager.GetRschOS(researchId);
            LIRType.Text = ResearchManager.GetRschVmType(researchId);
            LCreateTime.Text = Rs.CreatedDate.ToString("dd MMM yyyyг. HH:mm:ss");
            if (Rs.StartedDate.HasValue) LStartTime.Text = ((DateTime)Rs.StartedDate).ToString("dd MMM yyyyг. HH:mm:ss");
            if (Rs.StoppedDate.HasValue) LStopTime.Text = ((DateTime)Rs.StoppedDate).ToString("dd MMM yyyyг. HH:mm:ss");
            if (Rs.Duration > 0) LTimerStopTime.Text = Rs.Duration.ToString() + " мин.";
            Int32 elapsedMins;
            Int32 leftMins;
            if (Rs.StartedDate.HasValue) //Сессия начата
            {
                if (Rs.StoppedDate.HasValue) //Сессия завершена
                {
                    elapsedMins = (Int32)((Rs.StoppedDate.Value - Rs.StartedDate.Value).TotalMinutes);
                    if (Rs.Duration > 0)
                    {
                        leftMins = Rs.Duration - elapsedMins;
                        if (leftMins <= 0)
                        {
                            LStatus.Text = "Завершено по таймеру";
                        }
                        else
                        {
                            LStatus.Text = "Завершено принудительно (ост. " + leftMins + " мин.)";
                        }
                    }
                    else LStatus.Text = "Завершено принудительно (через " + elapsedMins + " мин.)";
                }
                else
                {
                    elapsedMins = (Int32)((DateTime.Now - Rs.StartedDate.Value).TotalMinutes);
                    LStatus.Text = "Выполняется (" + elapsedMins + " мин.)";
                }
            }
            else
            {
                LStatus.Text = "Готово к запуску";
            }
            Session["rsch"] = researchId;

            gridAddParams.DataSource = TaskManager.GetTasksViewForRsch(researchId);//dataX;
            gridAddParams.DataBind();

            Mlwr mlwrrec2 = ResearchManager.GetMlwrByRschId(researchId2);
            if (mlwrrec2 != null) Mlwr2.Text = mlwrrec2.Name + " (" + mlwrrec2.Path + ")";
            LOS2.Text = ResearchManager.GetRschOS(researchId2);
            LIRType2.Text = ResearchManager.GetRschVmType(researchId2);
            LCreateTime2.Text = Rs2.CreatedDate.ToString("dd MMM yyyyг. HH:mm:ss");
            if (Rs2.StartedDate.HasValue) LStartTime2.Text = ((DateTime)Rs2.StartedDate).ToString("dd MMM yyyyг. HH:mm:ss");
            if (Rs2.StoppedDate.HasValue) LStopTime2.Text = ((DateTime)Rs2.StoppedDate).ToString("dd MMM yyyyг. HH:mm:ss");
            if (Rs2.Duration > 0) LTimerStopTime2.Text = Rs2.Duration.ToString() + " мин.";
            if (Rs2.StartedDate.HasValue) //Сессия начата
            {
                if (Rs2.StoppedDate.HasValue) //Сессия завершена
                {
                    elapsedMins = (Int32)((Rs2.StoppedDate.Value - Rs2.StartedDate.Value).TotalMinutes);
                    if (Rs2.Duration > 0)
                    {
                        leftMins = Rs2.Duration - elapsedMins;
                        if (leftMins <= 0)
                        {
                            LStatus2.Text = "Завершено по таймеру";
                        }
                        else
                        {
                            LStatus2.Text = "Завершено принудительно (ост. " + leftMins + " мин.)";
                        }
                    }
                    else LStatus2.Text = "Завершено принудительно (через " + elapsedMins + " мин.)";
                }
                else
                {
                    elapsedMins = (Int32)((DateTime.Now - Rs2.StartedDate.Value).TotalMinutes);
                    LStatus2.Text = "Выполняется (" + elapsedMins + " мин.)";
                }
            }
            else
            {
                LStatus2.Text = "Готово к запуску";
            }
            Session["rsch2"] = researchId2;

            gridAddParams2.DataSource = TaskManager.GetTasksViewForRsch(researchId2);//dataX;
            gridAddParams2.DataBind();

             if (!IsPostBack)
             {
                 LHeaderLink.Text = String.Format("Исследование (№{0}): {1}", Rs.Id, Rs.ResearchName);
                 LHeaderLink.NavigateUrl = "~/Pages/Research/ReportList.aspx?researchId=" + researchId.ToString();
                 LHeaderLink2.Text = String.Format("Исследование (№{0}): {1}", Rs2.Id, Rs2.ResearchName);
                 LHeaderLink2.NavigateUrl = "~/Pages/Research/ReportList.aspx?researchId=" + researchId2.ToString();
                 int rschsysid = ResearchManager.GetRschOSId(researchId);
                 int rschsysid2 = ResearchManager.GetRschOSId(researchId2);
                 if (rschsysid == rschsysid2)
                 {
                     RegTreeList.Columns[1].Caption = "Эталон " + LOS.Text;
                     RegTreeList.Columns[2].Caption = "Исследование " + researchId.ToString();
                     RegTreeList.Columns[3].Caption = "Исследование " + researchId2.ToString();
                     string RschRegRoot = TaskManager.GetRegRootForRsch(researchId);
                     string RschRegRoot2 = TaskManager.GetRegRootForRsch(researchId2);
                     Session["rschsysid"] = rschsysid;
                     //                 TreeViewBuilder.CompareRegTree(researchId, ResearchManager.GetRschOSId(researchId));
                     long eltrootid = TreeViewBuilder.GetRegsEtlRowIdByRootstr2(rschsysid, RschRegRoot, RschRegRoot2);
                     List<long> rschparids = TreeViewBuilder.GetRegsRootIDs(rschsysid, RschRegRoot);
                     List<long> rschparids2 = TreeViewBuilder.GetRegsRootIDs(rschsysid, RschRegRoot2);
                     Session["eltrootid"] = eltrootid;
                     Session["rschparids"] = rschparids;
                     Session["rschparids2"] = rschparids2;
                     lbNoComp.ClientVisible = false;
                     RegTreeList.ClientVisible = true;
                 }
                 //var rschs = ResearchManager.GetReadyResearches();
                 //foreach (var r in rschs)
                 //{
                 //    string text  = String.Format("{0}: id = {1}",r.ResearchName, r.Id);
                 //    ASPxComboBox1.Items.Add(new ListEditItem(text, r.Id));
                 //}
             }
             //if (ASPxTreeList1.Summary.Count == 0)
             //{
             //    TreeListSummaryItem siPrice = new TreeListSummaryItem();
             //    siPrice.FieldName = "KeyName";
             //    siPrice.ShowInColumn = "KeyName";
             //    ASPxTreeList1.Summary.Add(siPrice);
             //}
             //LHeader.Text = String.Format("Исследлвание (№{0}): {1}", Rs.Id, Rs.ResearchName);
             int[] FileEvs = new int[2];
             int[] RegistryEvs = new int[2];
             int[] NetEvs = new int[2];
             int[] ProcessEvs = new int[2];

             var db = new SandBoxDataContext();
             var rdof = from d in db.EventsChartCounts
                        where d.Id == researchId
                        select d;
             foreach (var rr in rdof)
             {
                 switch (rr.Module)
                 {
                     case "Файловая система":
                         switch (rr.Sign)
                         {
                             case 1: FileEvs[0] += (int)rr.Count; break;
                             default: FileEvs[1] += (int)rr.Count; break;
                         } break;
                     case "Реестр":
                         switch (rr.Sign)
                         {
                             case 1: RegistryEvs[0] += (int)rr.Count; break;
                             default: RegistryEvs[1] += (int)rr.Count; break;
                         } break;
                     case "Процессы":
                         switch (rr.Sign)
                         {
                             case 1: ProcessEvs[0] += (int)rr.Count; break;
                             default: ProcessEvs[1] += (int)rr.Count; break;
                         } break;
                     case "TDIMON":
                     case "NDISMON":
                         switch (rr.Sign)
                         {
                             case 1: NetEvs[0] += (int)rr.Count; break;
                             default: NetEvs[1] += (int)rr.Count; break;
                         } break;
                 }
             }
             string scripttxt = "drawHalfPie('chartHolder1',Array(" + FileEvs[1].ToString() + ","
                      + FileEvs[0].ToString() + ")); drawHalfPie('chartHolder2',Array(" + RegistryEvs[1].ToString() + ","
                      + RegistryEvs[0].ToString() + ")); drawHalfPie('chartHolder3',Array(" + ProcessEvs[1].ToString() + ","
                      + ProcessEvs[0].ToString() + ")); drawHalfPie('chartHolder4',Array(" + NetEvs[1].ToString() + ","
                      + NetEvs[0].ToString() + "));";
            //             Page.ClientScript.RegisterStartupScript(Type.GetType("System.String"), "addScript", scripttxt, true);

             FileEvs[0] = 0;
             FileEvs[1] = 0;
             RegistryEvs[0] = 0;
             RegistryEvs[1] = 0;
             NetEvs[0] = 0;
             NetEvs[1] = 0;
             ProcessEvs[0] = 0;
             ProcessEvs[1] = 0;

             var rdof2 = from d in db.EventsChartCounts
                        where d.Id == researchId2
                        select d;
             foreach (var rr in rdof2)
             {
                 switch (rr.Module)
                 {
                     case "Файловая система":
                         switch (rr.Sign)
                         {
                             case 1: FileEvs[0] += (int)rr.Count; break;
                             default: FileEvs[1] += (int)rr.Count; break;
                         } break;
                     case "Реестр":
                         switch (rr.Sign)
                         {
                             case 1: RegistryEvs[0] += (int)rr.Count; break;
                             default: RegistryEvs[1] += (int)rr.Count; break;
                         } break;
                     case "Процессы":
                         switch (rr.Sign)
                         {
                             case 1: ProcessEvs[0] += (int)rr.Count; break;
                             default: ProcessEvs[1] += (int)rr.Count; break;
                         } break;
                     case "TDIMON":
                     case "NDISMON":
                         switch (rr.Sign)
                         {
                             case 1: NetEvs[0] += (int)rr.Count; break;
                             default: NetEvs[1] += (int)rr.Count; break;
                         } break;
                 }
             }
             string scripttxt2 = scripttxt+"drawHalfPie('chartHolder5',Array(" + FileEvs[1].ToString() + ","
                      + FileEvs[0].ToString() + ")); drawHalfPie('chartHolder6',Array(" + RegistryEvs[1].ToString() + ","
                      + RegistryEvs[0].ToString() + ")); drawHalfPie('chartHolder7',Array(" + ProcessEvs[1].ToString() + ","
                      + ProcessEvs[0].ToString() + ")); drawHalfPie('chartHolder8',Array(" + NetEvs[1].ToString() + ","
                      + NetEvs[0].ToString() + "));";
             Page.ClientScript.RegisterStartupScript(Type.GetType("System.String"), "addScript", scripttxt2, true);
        }