コード例 #1
0
ファイル: StartExperiment.aspx.cs プロジェクト: nianyang/CHD
 /// <summary>
 /// 绑定试验名
 /// </summary>
 public void BindReportName()
 {
     ThermalTestTemplate template = new ThermalTestTemplate();
     //template.UnitID = "0";
     template.UnitID = this.ddlUnit.SelectedValue;
     DataTable dt = template.GetReportName();
     this.ddlSYName.DataSource = dt;
     this.ddlSYName.DataTextField = "TemplateName";
     this.ddlSYName.DataValueField = "TEMPLATEID";
     this.ddlSYName.DataBind();
     ddlSYName.Items.Add(new ListItem { Text = "--请选择试验名称--", Value = "0", Selected = true });
 }
コード例 #2
0
    private void BindExprimentName()
    {
        Bussiness.ThermalTestTemplate template = new Bussiness.ThermalTestTemplate();
        template.UnitID = this.ddlUnit.SelectedValue;
        DataTable dt = template.GetReportName();

        this.ddlExperiment.DataSource    = dt;
        this.ddlExperiment.DataTextField = "TemplateName";
        //this.ddlExperiment.DataValueField = "TemplateID";
        this.ddlExperiment.DataBind();
        ddlExperiment.Items.Add(new ListItem {
            Text = "--全部--", Value = "0", Selected = true
        });
    }
コード例 #3
0
    //protected void ddlCompute_SelectedIndexChanged(object sender, EventArgs e)
    //{
    //    BindExprimentName();
    //    //ddlExperiment_SelectedIndexChanged(null, null);
    //}
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        if (ddlUnit.SelectedValue == "0")
        {
            JScript.Alert("请选择机组!");
            BindReport(this.calStartTime.Text, this.calEndTime.Text, "0", ddlUnit.SelectedValue.Trim());

            return;
        }
        Bussiness.ThermalTestReport report = new Bussiness.ThermalTestReport();
        //DataTable dt = report.GetFinishExpriment(this.calStartTime.Text, this.calEndTime.Text, Convert.ToInt32(this.ddlExperiment.SelectedValue));
        //DataTable dt = report.GetExpriment(this.calStartTime.Text, this.calEndTime.Text, Convert.ToInt32(this.ddlExperiment.SelectedValue));
        //this.grvFeeInfo.DataSource = dt;
        //this.grvFeeInfo.DataBind();
        Bussiness.ThermalTestTemplate TestTemplate = new Bussiness.ThermalTestTemplate();
        //int templateId = TestTemplate.GetTemplateID(this.ddlExperiment.SelectedValue, this.ddlCompute.SelectedValue);

        DataTable dt = null;

        if (this.ddlExperiment.SelectedValue != "0")
        {
            dt = TestTemplate.GetTemplateIDs(this.ddlExperiment.SelectedValue, this.ddlUnit.SelectedValue);
            string templateId = "";
            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    templateId += dr[0].ToString() + ",";
                }
                templateId = templateId.Substring(0, templateId.Length - 1);
            }

            BindReport(this.calStartTime.Text, this.calEndTime.Text, templateId, ddlUnit.SelectedValue.Trim());
        }
        else
        {
            BindReport(this.calStartTime.Text, this.calEndTime.Text, "0", ddlUnit.SelectedValue.Trim());
        }


        //BindReport(this.calStartTime.Text, this.calEndTime.Text, templateId);
    }
コード例 #4
0
ファイル: StartExperiment.aspx.cs プロジェクト: nianyang/CHD
    /// <summary>
    /// 开始试验
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnStartEnd_Click(object sender, EventArgs e)
    {
        ThermalTestReport report = new ThermalTestReport();

        if (ddlCompany.SelectedValue == "0")
        {
            ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "msg1", "alert('请选择分公司...');", true);
            return;
        }
        if (ddlPlant.SelectedValue == "0")
        {
            ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "msg1", "alert('请选择电厂...');", true);
            return;
        }
        if (ddlUnit.SelectedValue == "0")
        {
            ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "msg1", "alert('请选择机组...');", true);
            return;
        }
        if (ddlSYName.SelectedValue=="0")
        {
            JScript.Alert("请选择试验名称!");
            return;
        }
        if (txtSYR.Value == "")
        {
            JScript.Alert("请填写试验人!");
            return;
        }
        if (btnStartEnd.Text == "开始试验")
        {
            if (report.IsDoingExpriment())
            {
                ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "msg1", "alert('已有试验正在运行,请稍后运行试验...');", true);
                return;
            }
            this.btnView.Enabled = false;

            ThermalTestTemplate template = new ThermalTestTemplate();
            if (template.GetTemplateID(this.ddlSYName.SelectedItem.Text.Trim(), this.ddlUnit.SelectedValue).ToString() == string.Empty)
            {
                ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "msg1", "alert('该机组尚未配置...');", true);
                return;
            }
            report.TESTTemplateID = template.GetTemplateID(this.ddlSYName.SelectedItem.Text.Trim(), this.ddlUnit.SelectedValue);
            report.TESTCondition = GetCondition();
            report.ReportName = this.txtReportName.Value;
            report.Tester = this.txtSYR.Value;
            report.UNITID = ddlUnit.SelectedValue.Trim();
            report.TestBegin = Convert.ToDateTime(this.calSYStartTime.Text);
            report.TestCalBegin = Convert.ToDateTime(DateTime.Now.ToLongTimeString());
            report.TestDuration = Convert.ToInt32(this.txtSYTime.Value);
            report.SampleInterval = Convert.ToInt32(this.txtSplitTime.Value);
            Bussiness.ThermalTestReport.UserState userState = ThermalTestReport.UserState.New;

            report.InsertTest(userState,report);

            this.Timer1.Interval = 1000;
            this.Timer1.Enabled = true;
            btnStartEnd.Text = "终止试验";

            this.Label1.Text = this.txtReportName.Value + "试验正在进行已完成0%";

        }
        else
        {
            this.Timer1.Enabled = false;
            int curReportId = report.GetMaxReportId();
            report.EndTest(curReportId);
            btnStartEnd.Text = "开始试验";
            report.EndTest(curReportId);
            this.Timer1.Enabled = true;
            btnStartEnd.Enabled = false;
            this.Label1.Text = "试验已中止";
        }
    }
コード例 #5
0
 private void BindExprimentName()
 {
     Bussiness.ThermalTestTemplate template = new Bussiness.ThermalTestTemplate();
     template.UnitID = this.ddlUnit.SelectedValue;
     DataTable dt = template.GetReportName();
     this.ddlExperiment.DataSource = dt;
     this.ddlExperiment.DataTextField = "TemplateName";
     //this.ddlExperiment.DataValueField = "TemplateID";
     this.ddlExperiment.DataBind();
     ddlExperiment.Items.Add(new ListItem { Text = "--全部--", Value = "0", Selected = true });
 }
コード例 #6
0
    //protected void ddlCompute_SelectedIndexChanged(object sender, EventArgs e)
    //{
    //    BindExprimentName();
    //    //ddlExperiment_SelectedIndexChanged(null, null);
    //}
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        if (ddlUnit.SelectedValue == "0")
        {
            JScript.Alert("请选择机组!");
            BindReport(this.calStartTime.Text, this.calEndTime.Text, "0", ddlUnit.SelectedValue.Trim());

            return;
        }
        Bussiness.ThermalTestReport report = new Bussiness.ThermalTestReport();
        //DataTable dt = report.GetFinishExpriment(this.calStartTime.Text, this.calEndTime.Text, Convert.ToInt32(this.ddlExperiment.SelectedValue));
        //DataTable dt = report.GetExpriment(this.calStartTime.Text, this.calEndTime.Text, Convert.ToInt32(this.ddlExperiment.SelectedValue));
        //this.grvFeeInfo.DataSource = dt;
        //this.grvFeeInfo.DataBind();
        Bussiness.ThermalTestTemplate TestTemplate = new Bussiness.ThermalTestTemplate();
        //int templateId = TestTemplate.GetTemplateID(this.ddlExperiment.SelectedValue, this.ddlCompute.SelectedValue);

        DataTable dt = null;
        if (this.ddlExperiment.SelectedValue != "0")
        {
            dt = TestTemplate.GetTemplateIDs(this.ddlExperiment.SelectedValue, this.ddlUnit.SelectedValue);
            string templateId = "";
            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    templateId += dr[0].ToString() + ",";
                }
                templateId = templateId.Substring(0, templateId.Length - 1);
            }

            BindReport(this.calStartTime.Text, this.calEndTime.Text, templateId,ddlUnit.SelectedValue.Trim());
        }
        else
            BindReport(this.calStartTime.Text, this.calEndTime.Text, "0", ddlUnit.SelectedValue.Trim());

        //BindReport(this.calStartTime.Text, this.calEndTime.Text, templateId);
    }
コード例 #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string   colReportId = Request.QueryString["ReportID"];
            string[] reportIds   = colReportId.Split(',');
            int      isSplit     = colReportId.IndexOf(',');
            int      count       = 1;
            for (int L = 0; L < colReportId.Length; L++)
            {
                string temp = colReportId.Substring(L, 1);
                if (temp == ",")
                {
                    count = count + 1;
                }
            }

            colReportId = "(" + colReportId + ")";
            Bussiness.ThermalTestReport Report = new Bussiness.ThermalTestReport();
            DataTable nameDT = Report.GetTest(colReportId);

            System.Text.StringBuilder builder = new System.Text.StringBuilder();
            builder.Append("<table class=\"grid\" cellspacing=\"0\" rules=\"all\" border=\"1\" id=\"tab\" style=\"width: 100%;border-collapse: collapse; z-index: 100; left: 0px; top: 20px;\">");

            builder.Append("<tr><th scope='col'>序号</th><th scope='col'>参数描述</th>");
            if (nameDT != null && nameDT.Rows.Count > 0)
            {
                for (int n = 0; n < nameDT.Rows.Count; n++)
                {
                    builder.Append(string.Format("<th scope=\"col\">{0}</th>", nameDT.Rows[n]["REPORTNAME"].ToString() + "的实验值"));
                }
            }
            builder.Append("</tr>");

            Bussiness.ThermalTestTemplate TestTemplate = new Bussiness.ThermalTestTemplate();
            Bussiness.TestReport          Test         = new Bussiness.TestReport();
            DataTable dt = Test.GetReportResult(colReportId);
            Bussiness.ThermaltestPara Para = new Bussiness.ThermaltestPara();
            string preReportId             = "";
            int    sortId      = 0;
            int    reportCount = 0;
            int    copycount   = 0;
            System.Collections.ArrayList lstHtml = new ArrayList();
            System.Collections.ArrayList lstDesc = new ArrayList();

            if (!isSplit.Equals(-1))
            {
                if (dt != null && dt.Rows.Count > 0)
                {
                    int    descCount  = 0;
                    string firstValue = "";
                    foreach (string r in reportIds)
                    {
                        DataTable rDT = Test.GetReportResult(Convert.ToInt32(r));
                        DataTable nDT = Report.GetTest(Convert.ToInt32(r));
                        int       Id  = Convert.ToInt32(nDT.Rows[0]["TESTTEMPLATEID"]);
                        System.Collections.ArrayList lstValue = new ArrayList();
                        if (rDT != null && rDT.Rows.Count > 0)
                        {
                            for (int M = 0; M < rDT.Rows.Count; M++)
                            {
                                bool exist = TestTemplate.IsExitTemplatePara(Id, rDT.Rows[M][1].ToString());
                                if (exist)
                                {
                                    try
                                    {
                                        if (descCount == 0)
                                        {
                                            string descript = Para.GetParaDescUnit(rDT.Rows[M][1].ToString());
                                            lstDesc.Add(descript);
                                            lstValue.Add(rDT.Rows[M][2].ToString());
                                            reportCount += 1;
                                        }
                                        else
                                        {
                                            lstValue.Add(rDT.Rows[M][2].ToString());
                                            copycount += 1;
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        throw ex;
                                    }
                                }
                            }
                        }

                        if (descCount == 0)
                        {
                            lstHtml.Add(lstDesc);
                        }
                        lstHtml.Add(lstValue);
                        descCount += 1;
                    }

                    for (int rC = 0; rC < reportCount; rC++)
                    {
                        builder.Append("<tr>");
                        builder.Append(string.Format("<td>{0}</td>", rC + 1));
                        for (int N = 0; N < count + 1; N++)
                        {
                            builder.Append(string.Format("<td>{0}</td>", ((System.Collections.ArrayList)lstHtml[N])[rC].ToString()));
                        }

                        builder.Append("</tr>");
                    }


                    #region 旧方法
                    //int allCount = reportCount * (count + 1);
                    //string[] splitHTML = new string[allCount];
                    //splitHTML = colHtml.Split(';');
                    //for (int rC = 0; rC < reportCount; rC++)
                    //{
                    //    builder.Append("<tr>");
                    //    builder.Append(string.Format("<td>{0}</td>", rC + 1));
                    //    for (int N = 0; N < count + 1; N++)
                    //    {
                    //        builder.Append(string.Format("<td>{0}</td>", splitHTML[rC + N * reportCount].ToString()));
                    //    }

                    //    builder.Append("</tr>");
                    //    //builder.Append(string.Format("<td>{0}</td>", desc[0]));

                    ////    foreach (string html in splitHTML)
                    ////    {
                    ////        if (html.IndexOf(":") != -1)
                    ////        {
                    ////            string[] descvalue = html.Split(",");
                    ////            for (int d = 0; d < descvalue.Length; d++)
                    ////            {
                    ////                string[] desc = descvalue[d].Split(':');
                    ////                builder.Append(string.Format("<td>{0}</td>", desc[0]));
                    ////                builder.Append(string.Format("<td>{0}</td>", desc[1]));

                    ////            }
                    ////        }
                    ////    }
                    //}


                    //int rowCount = dt.Rows.Count / count;

                    //for (int i = 0; i < dt.Rows.Count; i++)
                    //{

                    //    int templateId = Convert.ToInt32(nameDT.Rows[0][1]);
                    //    bool falg = TestTemplate.IsExitTemplatePara(templateId, dt.Rows[i][1].ToString());

                    //    if (falg)
                    //    {
                    //        sortId += 1;
                    //        builder.Append("<tr>");
                    //        builder.Append(string.Format("<td>{0}</td>", sortId));
                    //        string desc = Para.GetParaDescUnit(dt.Rows[i][1].ToString());
                    //        builder.Append(string.Format("<td>{0}</td>", desc));
                    //        for (int j = 0; j < count; j++)
                    //        {

                    //            builder.Append(string.Format("<td>{0}</td>", dt.Rows[i + j][2].ToString()));
                    //        }
                    //        builder.Append("</tr>");
                    //        //builder.Append("</td>");
                    //    }

                    //    i = i + count - 1;
                    //}


                    #endregion
                }
            }
            else
            {
                if (dt != null && dt.Rows.Count > 0)
                {
                    for (int k = 0; k < dt.Rows.Count; k++)
                    {
                        if (preReportId != dt.Rows[k][0].ToString())
                        {
                            int  templateId = Convert.ToInt32(nameDT.Rows[0]["TESTTEMPLATEID"]);
                            bool falg       = TestTemplate.IsExitTemplatePara(templateId, dt.Rows[k][1].ToString());
                            if (falg)
                            {
                                sortId += 1;
                                builder.Append("<tr>");
                                builder.Append(string.Format("<td>{0}</td>", sortId));
                                string desc = Para.GetParaDescUnit(dt.Rows[k][1].ToString());
                                builder.Append(string.Format("<td>{0}</td>", desc));
                                builder.Append(string.Format("<td>{0}</td>", dt.Rows[k][2].ToString()));
                                builder.Append("</tr>");
                            }
                        }
                    }
                }
            }
            builder.Append("</table>");

            this.result.InnerHtml = builder.ToString();
        }
    }
コード例 #8
0
ファイル: DisplayReport.aspx.cs プロジェクト: nianyang/CHD
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string colReportId = Request.QueryString["ReportID"];
            string[] reportIds = colReportId.Split(',');
            int isSplit = colReportId.IndexOf(',');
            int count = 1;
            for (int L = 0; L < colReportId.Length; L++)
            {
                string temp = colReportId.Substring(L, 1);
                if (temp == ",")
                    count = count + 1;
            }

            colReportId = "(" + colReportId + ")";
            Bussiness.ThermalTestReport Report = new Bussiness.ThermalTestReport();
            DataTable nameDT = Report.GetTest(colReportId);

            System.Text.StringBuilder builder = new System.Text.StringBuilder();
            builder.Append("<table class=\"grid\" cellspacing=\"0\" rules=\"all\" border=\"1\" id=\"tab\" style=\"width: 100%;border-collapse: collapse; z-index: 100; left: 0px; top: 20px;\">");

            builder.Append("<tr><th scope='col'>���</th><th scope='col'>��������</th>");
            if (nameDT != null && nameDT.Rows.Count > 0)
            {
                for (int n = 0; n < nameDT.Rows.Count; n++)
                {
                    builder.Append(string.Format("<th scope=\"col\">{0}</th>", nameDT.Rows[n]["TESTCONDITION"].ToString() + "��ʵ��ֵ"));
                }
            }
            builder.Append("</tr>");

            Bussiness.ThermalTestTemplate TestTemplate = new Bussiness.ThermalTestTemplate();
            Bussiness.TestReport Test = new Bussiness.TestReport();
            DataTable dt = Test.GetReportResult(colReportId);
            Bussiness.ThermaltestPara Para = new Bussiness.ThermaltestPara();
            string preReportId = "";
            int sortId = 0;
            int reportCount = 0;
            int copycount = 0;
            System.Collections.ArrayList lstHtml = new ArrayList();
            System.Collections.ArrayList lstDesc = new ArrayList();

            if (!isSplit.Equals(-1))
            {
                if (dt != null && dt.Rows.Count > 0)
                {
                    int descCount = 0;
                    string firstValue = "";
                    foreach (string r in reportIds)
                    {
                        DataTable rDT = Test.GetReportResult(Convert.ToInt32(r));
                        DataTable nDT = Report.GetTest(Convert.ToInt32(r));
                        int Id = Convert.ToInt32(nDT.Rows[0][1]);
                        System.Collections.ArrayList lstValue = new ArrayList();
                        if (rDT != null && rDT.Rows.Count > 0)
                        {
                            for (int M = 0; M < rDT.Rows.Count; M++)
                            {

                                bool exist = TestTemplate.IsExitTemplatePara(Id, rDT.Rows[M][1].ToString());
                                if (exist)
                                {
                                    try
                                    {
                                        if (descCount == 0)
                                        {

                                            string descript = Para.GetParaDescUnit(rDT.Rows[M][1].ToString());
                                            lstDesc.Add(descript);
                                            lstValue.Add(rDT.Rows[M][2].ToString());
                                            reportCount += 1;

                                        }
                                        else
                                        {
                                            lstValue.Add(rDT.Rows[M][2].ToString());
                                            copycount += 1;
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        throw ex;
                                    }

                                }

                            }
                        }

                        if (descCount == 0)
                        {
                            lstHtml.Add(lstDesc);
                        }
                        lstHtml.Add(lstValue);
                        descCount += 1;
                    }

                    for (int rC = 0; rC < reportCount; rC++)
                    {

                        builder.Append("<tr>");
                        builder.Append(string.Format("<td>{0}</td>", rC + 1));
                        for (int N = 0; N < count + 1; N++)
                        {
                            builder.Append(string.Format("<td>{0}</td>", ((System.Collections.ArrayList)lstHtml[N])[rC].ToString()));
                        }

                        builder.Append("</tr>");

                    }

                    #region �ɷ���
                    //int allCount = reportCount * (count + 1);
                    //string[] splitHTML = new string[allCount];
                    //splitHTML = colHtml.Split(';');
                    //for (int rC = 0; rC < reportCount; rC++)
                    //{
                    //    builder.Append("<tr>");
                    //    builder.Append(string.Format("<td>{0}</td>", rC + 1));
                    //    for (int N = 0; N < count + 1; N++)
                    //    {
                    //        builder.Append(string.Format("<td>{0}</td>", splitHTML[rC + N * reportCount].ToString()));
                    //    }

                    //    builder.Append("</tr>");
                    //    //builder.Append(string.Format("<td>{0}</td>", desc[0]));

                    ////    foreach (string html in splitHTML)
                    ////    {
                    ////        if (html.IndexOf(":") != -1)
                    ////        {
                    ////            string[] descvalue = html.Split(",");
                    ////            for (int d = 0; d < descvalue.Length; d++)
                    ////            {
                    ////                string[] desc = descvalue[d].Split(':');
                    ////                builder.Append(string.Format("<td>{0}</td>", desc[0]));
                    ////                builder.Append(string.Format("<td>{0}</td>", desc[1]));

                    ////            }
                    ////        }
                    ////    }
                    //}

                    //int rowCount = dt.Rows.Count / count;

                    //for (int i = 0; i < dt.Rows.Count; i++)
                    //{

                    //    int templateId = Convert.ToInt32(nameDT.Rows[0][1]);
                    //    bool falg = TestTemplate.IsExitTemplatePara(templateId, dt.Rows[i][1].ToString());

                    //    if (falg)
                    //    {
                    //        sortId += 1;
                    //        builder.Append("<tr>");
                    //        builder.Append(string.Format("<td>{0}</td>", sortId));
                    //        string desc = Para.GetParaDescUnit(dt.Rows[i][1].ToString());
                    //        builder.Append(string.Format("<td>{0}</td>", desc));
                    //        for (int j = 0; j < count; j++)
                    //        {

                    //            builder.Append(string.Format("<td>{0}</td>", dt.Rows[i + j][2].ToString()));
                    //        }
                    //        builder.Append("</tr>");
                    //        //builder.Append("</td>");
                    //    }

                    //    i = i + count - 1;
                    //}

                    #endregion

                }
            }
            else
            {
                if (dt != null && dt.Rows.Count > 0)
                {
                    for (int k = 0; k < dt.Rows.Count; k++)
                    {
                        if (preReportId != dt.Rows[k][0].ToString())
                        {
                            int templateId = Convert.ToInt32(nameDT.Rows[0]["TESTTEMPLATEID"]);
                            bool falg = TestTemplate.IsExitTemplatePara(templateId, dt.Rows[k][1].ToString());
                            if (falg)
                            {
                                sortId += 1;
                                builder.Append("<tr>");
                                builder.Append(string.Format("<td>{0}</td>", sortId));
                                string desc = Para.GetParaDescUnit(dt.Rows[k][1].ToString());
                                builder.Append(string.Format("<td>{0}</td>", desc));
                                builder.Append(string.Format("<td>{0}</td>", dt.Rows[k][2].ToString()));
                                builder.Append("</tr>");
                            }
                        }
                    }
                }
            }
            builder.Append("</table>");

            this.result.InnerHtml = builder.ToString();
        }
    }