예제 #1
0
        public void Display(EtyDataPoint dp)
        {
            string Function_Name = "Display";

            colorPanel.BackColor = Color.Black;

            try
            {
                seriesTypeBox.Items.Add(StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_LintTypeLine, LanguageHelper.TrendViewer_LintTypeLine_EN));
                seriesTypeBox.Items.Add(StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_LintTypeSpline, LanguageHelper.TrendViewer_LintTypeSpline_EN));
                seriesTypeBox.Text    = StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_LintTypeLine, LanguageHelper.TrendViewer_LintTypeLine_EN);
                opcServerHostBox.Text = ConfigureFileHelper.GetInstance().HostIPAddress; //dp.DPHost.ToString();
                opcServerNameBox.Text = ConfigureFileHelper.GetInstance().OPCServerName; //dp.DPServer.ToString();

                if (m_formType == FormType.Edit)
                {
                    opcServerHostBox.Text = dp.DPHost.ToString();
                    opcServerNameBox.Text = dp.DPServer.ToString();
                    dataPointBox.Text     = dp.DPName.ToString();
                    seriesTypeBox.Text    = TrendViewerHelper.convertLineTypeToDispLan(dp.DPType);
                    dataLegendBox.Text    = dp.DPLblName;
                    if (TrendViewerHelper.isNumeric(dp.DPColor, System.Globalization.NumberStyles.Number))
                    {
                        colorPanel.BackColor = Color.FromArgb(Convert.ToInt32(dp.DPColor));
                    }
                    dataPointEnabledCb.Checked = dp.DPEnabled;
                    labelEnabledCb.Checked     = dp.DPLblEnabled;
                    dataPointVisibleCb.Checked = dp.DPVisible;
                }
            }
            catch (Exception localException)
            {
                LogHelper.Error(CLASS_NAME, Function_Name, localException.ToString());
            }
        }
예제 #2
0
        public EtyFormula GetNewFormula()
        {
            EtyFormula formula = new EtyFormula();

            formula.DPEquation   = equationBox.Text;
            formula.DPType       = TrendViewerHelper.convertLineTypeToEnum(seriesTypeBox.Text);
            formula.DPColor      = colorPanel.BackColor.ToArgb().ToString();
            formula.DPEnabled    = dataPointEnabledCb.Checked;
            formula.DPLblEnabled = labelEnabledCb.Checked;
            formula.DPLblName    = dataLegendBox.Text;
            return(formula);
        }
예제 #3
0
        public EtyDataPoint GetNewDataPoint()
        {
            EtyDataPoint dataPoint = new EtyDataPoint();

            dataPoint.DPHost       = opcServerHostBox.Text;
            dataPoint.DPServer     = opcServerNameBox.Text;
            dataPoint.DPName       = dataPointBox.Text;
            dataPoint.DPType       = TrendViewerHelper.convertLineTypeToEnum(seriesTypeBox.Text);
            dataPoint.DPLblName    = dataLegendBox.Text;
            dataPoint.DPColor      = colorPanel.BackColor.ToArgb().ToString();
            dataPoint.DPEnabled    = dataPointEnabledCb.Checked;
            dataPoint.DPLblEnabled = labelEnabledCb.Checked;
            dataPoint.DPVisible    = dataPointVisibleCb.Checked;

            return(dataPoint);
        }
예제 #4
0
        private void EditDataPointFormula_Load(object sender, EventArgs e)
        {
            string Function_Name = "EditDataPointFormula_Load";

            try
            {
                colorPanel.BackColor = Color.Black;
                seriesTypeBox.Items.Add(StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_LintTypeLine, LanguageHelper.TrendViewer_LintTypeLine_EN));
                seriesTypeBox.Items.Add(StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_LintTypeSpline, LanguageHelper.TrendViewer_LintTypeSpline_EN));

                if (m_formType == FormType.Add)
                {
                    seriesTypeBox.Text = StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_LintTypeLine, LanguageHelper.TrendViewer_LintTypeLine_EN);
                    this.Text          = StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_FormulaData_AddTitle, LanguageHelper.TrendViewer_FormulaData_AddTitle_EN);
                }
                else //for "Edit"
                {
                    FormulaDataController ctl     = (FormulaDataController)(getController());
                    EtyFormula            formula = ctl.GetFormula();

                    equationBox.Text   = formula.DPEquation;
                    seriesTypeBox.Text = TrendViewerHelper.convertLineTypeToDispLan(formula.DPType);
                    dataLegendBox.Text = formula.DPLblName;
                    if (isNumeric(formula.DPColor, System.Globalization.NumberStyles.Number))
                    {
                        colorPanel.BackColor = Color.FromArgb(Convert.ToInt32(formula.DPColor));
                    }
                    dataPointEnabledCb.Checked = formula.DPEnabled;
                    labelEnabledCb.Checked     = formula.DPLblEnabled;
                    this.Text = StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_FormulaData_EditTitle, LanguageHelper.TrendViewer_FormulaData_EditTitle_EN);
                }
            }
            catch (Exception localException)
            {
                LogHelper.Error(CLASS_NAME, Function_Name, localException.ToString());
            }
        }
예제 #5
0
        public void PopulateDataPointListDataGridView(int mode, DataTable dpList)
        {
            //  <summary>
            //  DataPointListDataGridView Data Population
            //  </summary>

            string Function_Name = "PopulateDataPointListDataGridView";

            dataPointListDataGridViewprogressBar.Visible = true;
            try
            {
                dataPointListDataGridViewprogressBar.Value = 0;

                totalDataPointListDataGridView.Text = "1";
                if (mode == 1)
                {
                    pageNumDataPointListDataGridView.Value = 1;
                }

                int totalRecord = dpList.Rows.Count;
                int upperRecord = 0;
                int lowerRecord = 0;
                if (totalRecord > 0)
                {
                    if (totalRecord % RECORDSIZE > 0)
                    {
                        totalRecord = totalRecord / RECORDSIZE;
                        totalRecord++;
                    }
                    else
                    {
                        totalRecord = totalRecord / RECORDSIZE;
                    }
                    totalDataPointListDataGridView.Text      = totalRecord.ToString();
                    pageNumDataPointListDataGridView.Maximum = totalRecord;
                }
                else
                {
                    pageNumDataPointListDataGridView.Maximum = 1;
                }

                upperRecord = (int)(RECORDSIZE * pageNumDataPointListDataGridView.Value);
                if (pageNumDataPointListDataGridView.Value > 1)
                {
                    lowerRecord = (int)(RECORDSIZE * (pageNumDataPointListDataGridView.Value - 1)) + 1;
                }
                else
                {
                    lowerRecord = (int)(RECORDSIZE * (pageNumDataPointListDataGridView.Value - 1));
                }

                string localSQL = "";
                if (dataPointListDataGridView.SortedColumn != null && dataPointListDataGridView.Rows.Count > 0)
                {
                    if (dataPointListDataGridView.SortedColumn.Name != null && dataPointListDataGridView.SortedColumn.Name.Trim() != "")
                    {
                        localSQL = dataPointListDataGridView.SortedColumn.Name;
                        if (dataPointListDataGridView.SortOrder.ToString().ToLower() != "ascending")
                        {
                            localSQL += " DESC ";
                        }
                        else
                        {
                            localSQL += " ASC ";
                        }
                    }
                    else
                    {
                        localSQL = " DATA_PT_NAME ASC ";
                    }
                }
                else
                {
                    localSQL = " DATA_PT_NAME ASC ";
                }



                DataRow[] dataRowArray = dpList.Select("", localSQL);

                DataGridViewRow dataGridRow = null;
                DataRow         dataRow     = null;


                if (upperRecord > dataRowArray.Length)
                {
                    upperRecord = dataRowArray.Length;
                }

                int    counter    = 0;
                string tempString = "";
                dataPointListDataGridView.Rows.Clear();
                if (lowerRecord > 0)
                {
                    lowerRecord--;
                }
                dataPointListDataGridViewprogressBar.Value = 0;
                for (int i = lowerRecord; i < upperRecord; i++)
                {
                    dataPointListDataGridView.Rows.Add();
                    dataPointListDataGridViewprogressBar.Value++;
                    dataGridRow = dataPointListDataGridView.Rows[counter];
                    dataRow     = dataRowArray[i];

                    tempString = "";
                    tempString = dataRow["DATA_PT_NAME"].ToString();
                    if (tempString.Length > 100)
                    {
                        dataGridRow.Cells[2].Value = tempString.Substring(0, 100) + "...";
                    }
                    else
                    {
                        dataGridRow.Cells[2].Value = tempString;
                    }

                    tempString = "";
                    tempString = dataRow["DATA_PT_LBL_NAME"].ToString();
                    if (tempString.Length > 100)
                    {
                        dataGridRow.Cells[3].Value = tempString.Substring(0, 100) + "...";
                    }
                    else
                    {
                        dataGridRow.Cells[3].Value = tempString;
                    }

                    dataGridRow.Cells[5].Value = dataRow["DATA_PT_TYPE"].ToString();

                    if (TrendViewerHelper.isNumeric(dataRow["DATA_PT_COLOR"].ToString(), System.Globalization.NumberStyles.Number))
                    {
                        dataGridRow.Cells[4].Value           = "";
                        dataGridRow.Cells[4].Style.BackColor = Color.FromArgb(Convert.ToInt32(dataRow["DATA_PT_COLOR"].ToString()));
                    }

                    if (TrendViewerHelper.ChangeStrToBool(dataRow["DATA_PT_ENABLED"].ToString()))
                    {
                        dataGridRow.Cells[6].Value = Properties.Resources.img_checkmark;
                    }
                    else
                    {
                        dataGridRow.Cells[6].Value = Properties.Resources.blank;
                    }

                    if (TrendViewerHelper.ChangeStrToBool(dataRow["DATA_PT_LBL_ENABLED"].ToString()))
                    {
                        dataGridRow.Cells[7].Value = Properties.Resources.img_checkmark;
                    }
                    else
                    {
                        dataGridRow.Cells[7].Value = Properties.Resources.blank;
                    }

                    if (TrendViewerHelper.ChangeStrToBool(dataRow["DATA_PT_VISIBLE"].ToString()))
                    {
                        dataGridRow.Cells[8].Value = Properties.Resources.img_checkmark;
                    }
                    else
                    {
                        dataGridRow.Cells[8].Value = Properties.Resources.blank;
                    }


                    dataGridRow.Cells[9].Value = dataRow["DATA_PT_SERVER"].ToString();

                    dataGridRow.Cells[10].Value = dataRow["DATA_PT_HOST"].ToString();
                    counter++;
                }
            }
            catch (Exception localException)
            {
                LogHelper.Error(CLASS_NAME, Function_Name, localException.ToString());
            }

            dataPointListDataGridViewprogressBar.Visible = false;
        }