public HistDataPointData()
        {
            InitializeComponent();

            this.historyStartDateBox.CustomFormat = DateTimeFormatter.getInstance().getDateFormatStr();
            this.historyEndDateBox.CustomFormat   = DateTimeFormatter.getInstance().getDateFormatStr();
        }
예제 #2
0
        public void TestSetLanaguageType01()
        {
            LanguageTypeHelper languageTypeHelper = LanguageTypeHelperFactory.CreateLanguageTypeHelper01();
            LanguageType       langType           = LanguageType.Default;

            languageTypeHelper.SetLanaguageType(langType);
            //Post Condition Check
            Accessor languageTypeHelperaccessor = ReflectionAccessor.Wrap(languageTypeHelper);

            Assert.AreEqual(langType, languageTypeHelperaccessor.GetField("m_langType"));
            Accessor dateTimeFormatterAccessor = ReflectionAccessor.Wrap(DateTimeFormatter.getInstance());

            Assert.AreEqual(languageTypeHelperaccessor.GetField("DateFormat_EN"), dateTimeFormatterAccessor.GetField("m_DateFormatStr"));

            //for chinese language
            langType = LanguageType.Chinese;
            languageTypeHelper.SetLanaguageType(langType);
            //Post Condition Check
            Assert.AreEqual(langType, languageTypeHelperaccessor.GetField("m_langType"));
            Assert.AreEqual(languageTypeHelperaccessor.GetField("DateFormat_CH"), dateTimeFormatterAccessor.GetField("m_DateFormatStr"));
        }
예제 #3
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[4].Value = dataRow["DATA_PT_TYPE"].ToString();

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

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

                    dataGridRow.Cells[6].Value = ((DateTime)dataRow["DATA_PT_DT"]).ToString(DateTimeFormatter.getInstance().getDateFormatStr());
                    dataGridRow.Cells[7].Value = ((DateTime)dataRow["DATA_PT_DT_END"]).ToString(DateTimeFormatter.getInstance().getDateFormatStr());


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

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

                    counter++;
                }
            }
            catch (Exception localException)
            {
                LogHelper.Error(CLASS_NAME, Function_Name, localException.ToString());
            }

            dataPointListDataGridViewprogressBar.Visible = false;
        }
예제 #4
0
 public void TestgetInstance01()
 {
     DateTimeFormatter dateTimeFormatter = DateTimeFormatter.getInstance();
 }
예제 #5
0
        public static DateTimeFormatter CreateDateTimeFormatter01()
        {
            DateTimeFormatter dateTimeFormatter = DateTimeFormatter.getInstance();

            return(dateTimeFormatter);
        }