Exemplo n.º 1
0
        private void InitializeComponent()
        {
            ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(EnegAnalysis));

            this.fLyPlEnegAnalysis = new FlowLayoutPanel();
            this.butGenReport      = new Button();
            this.butReportMng      = new Button();
            this.panel2            = new Panel();
            this.rptManage1        = new ERptManage();
            this.genRptPara1       = new EGenRptPara();
            this.EgenRptShow1      = new EGenRptShow();
            this.fLyPlEnegAnalysis.SuspendLayout();
            this.panel2.SuspendLayout();
            base.SuspendLayout();
            this.fLyPlEnegAnalysis.BackColor = Color.Gainsboro;
            this.fLyPlEnegAnalysis.Controls.Add(this.butGenReport);
            this.fLyPlEnegAnalysis.Controls.Add(this.butReportMng);
            componentResourceManager.ApplyResources(this.fLyPlEnegAnalysis, "fLyPlEnegAnalysis");
            this.fLyPlEnegAnalysis.Name = "fLyPlEnegAnalysis";
            componentResourceManager.ApplyResources(this.butGenReport, "butGenReport");
            this.butGenReport.MinimumSize             = new Size(150, 27);
            this.butGenReport.Name                    = "butGenReport";
            this.butGenReport.Tag                     = "Tag_genreport";
            this.butGenReport.UseVisualStyleBackColor = true;
            this.butGenReport.Click                  += new System.EventHandler(this.comm_butClick);
            componentResourceManager.ApplyResources(this.butReportMng, "butReportMng");
            this.butReportMng.MinimumSize             = new Size(150, 27);
            this.butReportMng.Name                    = "butReportMng";
            this.butReportMng.Tag                     = "Tag_reportmng";
            this.butReportMng.UseVisualStyleBackColor = true;
            this.butReportMng.Click                  += new System.EventHandler(this.comm_butClick);
            this.panel2.Controls.Add(this.rptManage1);
            this.panel2.Controls.Add(this.genRptPara1);
            this.panel2.Controls.Add(this.EgenRptShow1);
            componentResourceManager.ApplyResources(this.panel2, "panel2");
            this.panel2.Name          = "panel2";
            this.rptManage1.BackColor = Color.WhiteSmoke;
            componentResourceManager.ApplyResources(this.rptManage1, "rptManage1");
            this.rptManage1.Name       = "rptManage1";
            this.genRptPara1.BackColor = Color.WhiteSmoke;
            componentResourceManager.ApplyResources(this.genRptPara1, "genRptPara1");
            this.genRptPara1.Name       = "genRptPara1";
            this.EgenRptShow1.BackColor = Color.WhiteSmoke;
            componentResourceManager.ApplyResources(this.EgenRptShow1, "EgenRptShow1");
            this.EgenRptShow1.Name = "EgenRptShow1";
            base.AutoScaleMode     = AutoScaleMode.None;
            this.BackColor         = Color.WhiteSmoke;
            base.Controls.Add(this.panel2);
            base.Controls.Add(this.fLyPlEnegAnalysis);
            componentResourceManager.ApplyResources(this, "$this");
            base.Name = "EnegAnalysis";
            this.fLyPlEnegAnalysis.ResumeLayout(false);
            this.fLyPlEnegAnalysis.PerformLayout();
            this.panel2.ResumeLayout(false);
            base.ResumeLayout(false);
        }
Exemplo n.º 2
0
        public void pageInit(EGenRptPara pPara)
        {
            this.m_stxttitle            = pPara.Txttitle;
            this.m_stxtwrite            = pPara.Txtwriter;
            this.m_sdtptime             = pPara.Dtptime;
            this.m_period_SelectedIndex = pPara.Cboperiod_SelectedIndex;
            this.m_sBeginText           = pPara.BeginText;
            this.m_iduration            = pPara.Cboduration;
            this.m_gppara_list          = this.getAnalysisGroup(pPara);
            this.m_chkchart1_Checked    = pPara.chkchart1_Checked();
            this.m_chkchart2_Checked    = pPara.chkchart2_Checked();
            this.m_chkchart3_Checked    = pPara.chkchart3_Checked();
            this.m_chkchart4_Checked    = pPara.chkchart4_Checked();
            this.m_chkchart5_Checked    = pPara.chkchart5_Checked();
            this.m_chkchart6_Checked    = pPara.chkchart6_Checked();
            this.m_chkchart7_Checked    = pPara.chkchart7_Checked();
            this.m_chkchart8_Checked    = pPara.chkchart8_Checked();
            this.m_chkchart9_Checked    = pPara.chkchart9_Checked();
            this.m_dCo2_elec            = pPara.Co2_elec();
            this.m_dprice_elec          = pPara.price_elec();
            this.m_dprice_Co2           = pPara.price_Co2();
            int num = 1;

            if (DBUrl.DB_CURRENT_TYPE.ToUpper().Equals("MYSQL") || DBUrl.SERVERMODE)
            {
                num = 2;
            }
            switch (this.Cboperiod_SelectedIndex)
            {
            case 0:
                this.DTbegin        = System.Convert.ToDateTime(this.BeginText + ":0:0");
                this.DTend          = this.DTbegin.AddHours((double)this.Cboduration);
                this.DTbegin_minus1 = this.DTbegin.AddHours(-1.0);
                this.report_from    = EcoLanguage.getMsg(LangRes.Rpt_shfromHourly, new string[0]) + " " + this.Txtwriter;
                if (num == 1)
                {
                    this.groupby = "FORMAT(insert_time, 'yyyy-MM-dd HH')";
                }
                else
                {
                    this.groupby = "date_format(insert_time, '%Y-%m-%d %H')";
                }
                this.dblibnameDev           = "device_data_hourly";
                this.dblibnamePort          = "port_data_hourly";
                this.strBegin               = this.DTbegin.ToString("yyyy-MM-dd HH:mm:ss");
                this.strEnd                 = this.DTend.ToString("yyyy-MM-dd HH:mm:ss");
                this.extra_str              = ":0:0";
                this.AxisX_LabelStyleFormat = "yyyy-MM-dd HH";
                this.AxisX_IntervalType     = DateTimeIntervalType.Hours;
                return;

            case 1:
                this.DTbegin        = System.Convert.ToDateTime(this.BeginText);
                this.DTend          = this.DTbegin.AddDays((double)this.Cboduration);
                this.DTbegin_minus1 = this.DTbegin.AddDays(-1.0);
                this.report_from    = EcoLanguage.getMsg(LangRes.Rpt_shfromDaily, new string[0]) + " " + this.Txtwriter;
                if (num == 1)
                {
                    this.groupby = "FORMAT(insert_time, 'yyyy-MM-dd')";
                }
                else
                {
                    this.groupby = "date_format(insert_time, '%Y-%m-%d')";
                }
                this.dblibnameDev           = "device_data_daily";
                this.dblibnamePort          = "port_data_daily";
                this.strBegin               = this.DTbegin.ToString("yyyy-MM-dd");
                this.strEnd                 = this.DTend.ToString("yyyy-MM-dd");
                this.AxisX_LabelStyleFormat = "yyyy-MM-dd";
                this.AxisX_IntervalType     = DateTimeIntervalType.Days;
                return;

            case 2:
                this.DTbegin        = System.Convert.ToDateTime(this.BeginText);
                this.DTend          = this.DTbegin.AddMonths(this.Cboduration);
                this.DTbegin_minus1 = this.DTbegin.AddMonths(-1);
                this.report_from    = EcoLanguage.getMsg(LangRes.Rpt_shfromMonthly, new string[0]) + " " + this.Txtwriter;
                if (num == 1)
                {
                    this.groupby = "FORMAT(insert_time, 'yyyy-MM')";
                }
                else
                {
                    this.groupby = "date_format(insert_time, '%Y-%m')";
                }
                this.dblibnameDev           = "device_data_daily";
                this.dblibnamePort          = "port_data_daily";
                this.strBegin               = this.DTbegin.ToString("yyyy-MM-dd");
                this.strEnd                 = this.DTend.ToString("yyyy-MM-dd");
                this.AxisX_LabelStyleFormat = "yyyy-MM";
                this.AxisX_IntervalType     = DateTimeIntervalType.Months;
                return;

            case 3:
                this.DTbegin        = System.Convert.ToDateTime(this.BeginText + "-01");
                this.DTend          = this.DTbegin.AddMonths(this.Cboduration * 3);
                this.DTbegin_minus1 = this.DTbegin.AddMonths(-3);
                this.report_from    = EcoLanguage.getMsg(LangRes.Rpt_shfromQuarterly, new string[0]) + " " + this.Txtwriter;
                if (num == 1)
                {
                    this.groupby = "FORMAT(insert_time, 'yyyy')+'Q'+FORMAT(insert_time, 'q')";
                }
                else
                {
                    this.groupby = "concat(date_format(insert_time, '%Y'),'Q',quarter(insert_time))";
                }
                this.dblibnameDev           = "device_data_daily";
                this.dblibnamePort          = "port_data_daily";
                this.strBegin               = this.DTbegin.ToString("yyyy-MM-dd");
                this.strEnd                 = this.DTend.ToString("yyyy-MM-dd");
                this.AxisX_LabelStyleFormat = "yyyy-MM";
                this.AxisX_Interval         = 3.0;
                this.AxisX_IntervalType     = DateTimeIntervalType.Months;
                return;

            default:
                return;
            }
        }
Exemplo n.º 3
0
        private System.Collections.ArrayList getAnalysisGroup(EGenRptPara m_pParaWindow)
        {
            System.Collections.ArrayList arrayList = new System.Collections.ArrayList();
            foreach (ListViewItem listViewItem in m_pParaWindow.Grouplist)
            {
                string text = System.Convert.ToString(listViewItem.Tag).Split(new char[]
                {
                    '|'
                })[0];
                string text2 = System.Convert.ToString(listViewItem.Tag).Split(new char[]
                {
                    '|'
                })[1];
                if (text2.Length == 0)
                {
                    text2 = "0";
                }
                string text3 = System.Convert.ToString(listViewItem.Tag).Split(new char[]
                {
                    '|'
                })[2];
                string text4 = System.Convert.ToString(listViewItem.Tag).Split(new char[]
                {
                    '|'
                })[3];
                string text5  = listViewItem.SubItems[1].Text;
                string text6  = "0,";
                string text7  = "0,";
                string text8  = "0,";
                string text9  = "0,";
                string text10 = "0,";
                System.Text.StringBuilder stringBuilder  = new System.Text.StringBuilder();
                System.Text.StringBuilder stringBuilder2 = new System.Text.StringBuilder();
                System.Text.StringBuilder stringBuilder3 = new System.Text.StringBuilder();
                string key;
                switch (key = text3)
                {
                case "zone":
                {
                    string    str_sql   = "select racks from zone_info where id in (" + text2 + ") and racks <>''";
                    DataTable dataTable = DBTools.CreateDataTable4SysDB(str_sql);
                    text9 = "0,";
                    for (int i = 0; i < dataTable.Rows.Count; i++)
                    {
                        string    str_sql2   = "select id,model_nm,fw_version from device_base_info where rack_id in (" + System.Convert.ToString(dataTable.Rows[i]["racks"]) + ") ";
                        DataTable dataTable2 = DBTools.CreateDataTable4SysDB(str_sql2);
                        string    text11     = "";
                        text10         = "0,";
                        stringBuilder2 = new System.Text.StringBuilder();
                        stringBuilder3 = new System.Text.StringBuilder();
                        stringBuilder  = new System.Text.StringBuilder();
                        for (int j = 0; j < dataTable2.Rows.Count; j++)
                        {
                            System.Convert.ToString(dataTable2.Rows[j]["id"]);
                            string         modelname         = System.Convert.ToString(dataTable2.Rows[j]["model_nm"]);
                            string         fmwareVer         = System.Convert.ToString(dataTable2.Rows[j]["fw_version"]);
                            DevModelConfig deviceModelConfig = DevAccessCfg.GetInstance().getDeviceModelConfig(modelname, fmwareVer);
                            if (!deviceModelConfig.devcapacity.Equals("N/A"))
                            {
                                if (deviceModelConfig.perportreading == 2)
                                {
                                    stringBuilder2.Append(System.Convert.ToString(dataTable2.Rows[j]["id"]) + ",");
                                }
                                else
                                {
                                    stringBuilder3.Append(System.Convert.ToString(dataTable2.Rows[j]["id"]) + ",");
                                }
                                stringBuilder.Append(System.Convert.ToString(dataTable2.Rows[j]["id"]) + ",");
                            }
                        }
                        text11 += stringBuilder.ToString();
                        text10 += stringBuilder2.ToString();
                        text8  += stringBuilder3.ToString();
                        if (text11.Length > 0)
                        {
                            text11 = text11.Substring(0, text11.Length - 1);
                        }
                        if (text10.Length > 0)
                        {
                            text10 = text10.Substring(0, text10.Length - 1);
                        }
                        string    str_sql3   = "select id from port_info where device_id in (" + text10 + ")";
                        DataTable dataTable3 = DBTools.CreateDataTable4SysDB(str_sql3);
                        stringBuilder = new System.Text.StringBuilder();
                        for (int k = 0; k < dataTable3.Rows.Count; k++)
                        {
                            stringBuilder.Append(System.Convert.ToString(dataTable3.Rows[k]["id"]) + ",");
                        }
                        text7 += stringBuilder.ToString();
                        text9  = text9 + text11 + ",";
                    }
                    text9 = commUtil.uniqueIDs(text9);
                    if (text9.Length > 0)
                    {
                        text6 = text9.Substring(0, text9.Length - 1);
                    }
                    text8 = commUtil.uniqueIDs(text8);
                    if (text8.Length > 0)
                    {
                        text8 = text8.Substring(0, text8.Length - 1);
                    }
                    text7 = commUtil.uniqueIDs(text7);
                    if (text7.Length > 0)
                    {
                        text7 = text7.Substring(0, text7.Length - 1);
                    }
                    break;
                }

                case "rack":
                case "allrack":
                {
                    string    str_sql2   = "select id,model_nm,fw_version from device_base_info where rack_id in (" + text2 + ")";
                    DataTable dataTable2 = DBTools.CreateDataTable4SysDB(str_sql2);
                    stringBuilder2 = new System.Text.StringBuilder();
                    stringBuilder3 = new System.Text.StringBuilder();
                    stringBuilder  = new System.Text.StringBuilder();
                    for (int l = 0; l < dataTable2.Rows.Count; l++)
                    {
                        System.Convert.ToString(dataTable2.Rows[l]["id"]);
                        string         modelname2         = System.Convert.ToString(dataTable2.Rows[l]["model_nm"]);
                        string         fmwareVer2         = System.Convert.ToString(dataTable2.Rows[l]["fw_version"]);
                        DevModelConfig deviceModelConfig2 = DevAccessCfg.GetInstance().getDeviceModelConfig(modelname2, fmwareVer2);
                        if (!deviceModelConfig2.devcapacity.Equals("N/A"))
                        {
                            if (deviceModelConfig2.perportreading == 2)
                            {
                                stringBuilder2.Append(System.Convert.ToString(dataTable2.Rows[l]["id"]) + ",");
                            }
                            else
                            {
                                stringBuilder3.Append(System.Convert.ToString(dataTable2.Rows[l]["id"]) + ",");
                            }
                            stringBuilder.Append(System.Convert.ToString(dataTable2.Rows[l]["id"]) + ",");
                        }
                    }
                    text9  += stringBuilder.ToString();
                    text10 += stringBuilder2.ToString();
                    text8  += stringBuilder3.ToString();
                    if (text9.Length > 0)
                    {
                        text6 = text9.Substring(0, text9.Length - 1);
                    }
                    if (text10.Length > 0)
                    {
                        text10 = text10.Substring(0, text10.Length - 1);
                    }
                    if (text8.Length > 0)
                    {
                        text8 = text8.Substring(0, text8.Length - 1);
                    }
                    string    str_sql3   = "select id from port_info where device_id in (" + text10 + ")";
                    DataTable dataTable3 = DBTools.CreateDataTable4SysDB(str_sql3);
                    stringBuilder = new System.Text.StringBuilder();
                    for (int m = 0; m < dataTable3.Rows.Count; m++)
                    {
                        stringBuilder.Append(System.Convert.ToString(dataTable3.Rows[m]["id"]) + ",");
                    }
                    text7 += stringBuilder.ToString();
                    if (text7.Length > 0)
                    {
                        text7 = text7.Substring(0, text7.Length - 1);
                    }
                    break;
                }

                case "dev":
                case "alldev":
                {
                    string    str_sql2   = "select id,model_nm,fw_version from device_base_info where id in (" + text2 + ")";
                    DataTable dataTable2 = DBTools.CreateDataTable4SysDB(str_sql2);
                    text10         = "0,";
                    stringBuilder2 = new System.Text.StringBuilder();
                    stringBuilder3 = new System.Text.StringBuilder();
                    stringBuilder  = new System.Text.StringBuilder();
                    for (int n = 0; n < dataTable2.Rows.Count; n++)
                    {
                        System.Convert.ToString(dataTable2.Rows[n]["id"]);
                        string         modelname3         = System.Convert.ToString(dataTable2.Rows[n]["model_nm"]);
                        string         fmwareVer3         = System.Convert.ToString(dataTable2.Rows[n]["fw_version"]);
                        DevModelConfig deviceModelConfig3 = DevAccessCfg.GetInstance().getDeviceModelConfig(modelname3, fmwareVer3);
                        if (!deviceModelConfig3.devcapacity.Equals("N/A"))
                        {
                            if (deviceModelConfig3.perportreading == 2)
                            {
                                stringBuilder2.Append(System.Convert.ToString(dataTable2.Rows[n]["id"]) + ",");
                            }
                            else
                            {
                                stringBuilder3.Append(System.Convert.ToString(dataTable2.Rows[n]["id"]) + ",");
                            }
                            stringBuilder.Append(System.Convert.ToString(dataTable2.Rows[n]["id"]) + ",");
                        }
                    }
                    text10 += stringBuilder2.ToString();
                    text8  += stringBuilder3.ToString();
                    text6  += stringBuilder.ToString();
                    if (text6.Length > 0)
                    {
                        text6 = text6.Substring(0, text6.Length - 1);
                    }
                    if (text10.Length > 0)
                    {
                        text10 = text10.Substring(0, text10.Length - 1);
                    }
                    if (text8.Length > 0)
                    {
                        text8 = text8.Substring(0, text8.Length - 1);
                    }
                    string    str_sql3   = "select id from port_info where device_id in (" + text10 + ")";
                    DataTable dataTable3 = DBTools.CreateDataTable4SysDB(str_sql3);
                    stringBuilder = new System.Text.StringBuilder();
                    for (int num2 = 0; num2 < dataTable3.Rows.Count; num2++)
                    {
                        stringBuilder.Append(System.Convert.ToString(dataTable3.Rows[num2]["id"]) + ",");
                    }
                    text7 += stringBuilder.ToString();
                    if (text7.Length > 0)
                    {
                        text7 = text7.Substring(0, text7.Length - 1);
                    }
                    break;
                }

                case "alloutlet":
                {
                    text6 = "0";
                    text8 = "0";
                    string    str_sql3   = "select a.id,b.model_nm,b.fw_version from port_info a  left join device_base_info b on a.device_id=b.id where a.id in (select id from port_info)";
                    DataTable dataTable3 = DBTools.CreateDataTable4SysDB(str_sql3);
                    stringBuilder = new System.Text.StringBuilder();
                    for (int num3 = 0; num3 < dataTable3.Rows.Count; num3++)
                    {
                        string         modelname4         = System.Convert.ToString(dataTable3.Rows[num3]["model_nm"]);
                        string         fmwareVer4         = System.Convert.ToString(dataTable3.Rows[num3]["fw_version"]);
                        DevModelConfig deviceModelConfig4 = DevAccessCfg.GetInstance().getDeviceModelConfig(modelname4, fmwareVer4);
                        if (!deviceModelConfig4.devcapacity.Equals("N/A") && deviceModelConfig4.perportreading == 2)
                        {
                            stringBuilder.Append(System.Convert.ToString(dataTable3.Rows[num3]["id"]) + ",");
                        }
                    }
                    text7 += stringBuilder.ToString();
                    if (text7.Length > 0)
                    {
                        text7 = text7.Substring(0, text7.Length - 1);
                    }
                    break;
                }

                case "outlet":
                {
                    text6 = "0";
                    text8 = "0";
                    string    str_sql3   = "select a.id,b.model_nm,b.fw_version from port_info a  left join device_base_info b on a.device_id=b.id where a.id in (select dest_id from group_detail where grouptype='outlet' and group_id=" + text + ")";
                    DataTable dataTable3 = DBTools.CreateDataTable4SysDB(str_sql3);
                    stringBuilder = new System.Text.StringBuilder();
                    for (int num4 = 0; num4 < dataTable3.Rows.Count; num4++)
                    {
                        string         modelname5         = System.Convert.ToString(dataTable3.Rows[num4]["model_nm"]);
                        string         fmwareVer5         = System.Convert.ToString(dataTable3.Rows[num4]["fw_version"]);
                        DevModelConfig deviceModelConfig5 = DevAccessCfg.GetInstance().getDeviceModelConfig(modelname5, fmwareVer5);
                        if (!deviceModelConfig5.devcapacity.Equals("N/A") && deviceModelConfig5.perportreading == 2)
                        {
                            stringBuilder.Append(System.Convert.ToString(dataTable3.Rows[num4]["id"]) + ",");
                        }
                    }
                    text7 += stringBuilder.ToString();
                    if (text7.Length > 0)
                    {
                        text7 = text7.Substring(0, text7.Length - 1);
                    }
                    break;
                }
                }
                arrayList.Add(string.Concat(new string[]
                {
                    text6,
                    "|",
                    text,
                    "|",
                    text5,
                    "|",
                    text3.ToString(),
                    "|",
                    text7,
                    "|",
                    text8,
                    "|",
                    text4
                }));
            }
            return(arrayList);
        }