public void CapitalizerTest2() { CaseSettings cs = new CaseSettings(); string expected = "Ли-Хан-Чин"; string source = "Ли-хан-чин"; string actual = cs.Capitalizer(source); Assert.AreEqual(expected, actual); }
public void CapitalizerTest1() { CaseSettings cs = new CaseSettings(); string expected = "Назарова-Захарова"; string source = "НаЗарова-захарова"; string actual = cs.Capitalizer(source); Assert.AreEqual(expected, actual); }
public void CapitalizerTest() { CaseSettings cs = new CaseSettings(); string expected = "Гулам Оглы"; string source = "Гулам оглы"; string actual = cs.Capitalizer(source); Assert.AreEqual(expected, actual); }
private void SetCaseSettings() { if (levelDefinition.cases != null && levelDefinition.cases.Any()) { CaseSettings caseSettings = levelDefinition.cases[PMWrapper.currentCase].caseSettings; if (caseSettings == null) { return; } if (!string.IsNullOrEmpty(caseSettings.precode)) { PMWrapper.preCode = caseSettings.precode; } if (caseSettings.walkerStepTime > 0) { PMWrapper.walkerStepTime = caseSettings.walkerStepTime; } } }
private void Connection_Mysql() { while (myWorkState) { TimeSpan timeSpan = DateTime.Now.Subtract(ConnectionTime); if (timeSpan.TotalMilliseconds > 5000) { CaseSettings = Ewatch_MySqlMethod.CaseLoad(); #region AI上下限 var Alarmdata = Ewatch_MySqlMethod.AiConfig_Compare_Load(); foreach (var item in Alarmdata) { var caseSetting = CaseSettings.Where(g => g.CaseNo == item.CaseNo).ToList()[0]; var value = Ewatch_MySqlMethod.Ai64web(item); if (value != null) { var nowdata = Ewatch_MySqlMethod.Alarm_Procedure(item, value); var Adata = AiConfigs.Where(g => g.PK == item.PK).ToList(); if (Adata.Count > 0) { if (item.CompareType != Adata[0].CompareType) { NotifyTypeEnum notifyTypeEnum = (NotifyTypeEnum)caseSetting.NotifyTypeEnum; switch (notifyTypeEnum) { case NotifyTypeEnum.None: break; case NotifyTypeEnum.Line: { switch (item.CompareType) { case 0: //上限 { LineNotifyClass lineNotifyClass = new LineNotifyClass(); lineNotifyClass.LineNotifyFunction(caseSetting.NotifyToken, $"\r案場名稱: {caseSetting.TitleName}\r點位名稱: {item.AiName}\r超過上限值: {item.AiMax}\r目前數值為 {nowdata}"); } break; case 1: //正常 { LineNotifyClass lineNotifyClass = new LineNotifyClass(); lineNotifyClass.LineNotifyFunction(caseSetting.NotifyToken, $"\r案場名稱: {caseSetting.TitleName}\r點位名稱: {item.AiName}\r上限值: {item.AiMax}\r下限值: {item.AiMin}\r恢復正常,目前數值為 {nowdata}"); } break; case 2: //下限 { LineNotifyClass lineNotifyClass = new LineNotifyClass(); lineNotifyClass.LineNotifyFunction(caseSetting.NotifyToken, $"\r案場名稱: {caseSetting.TitleName}\r點位名稱: {item.AiName}\r低於下限值: {item.AiMin}\r目前數值為 {nowdata}"); } break; } } break; case NotifyTypeEnum.Telegram: { switch (item.CompareType) { case 0: //上限 { TelegramBotClass telegramBotClass = new TelegramBotClass(caseSetting.NotifyApi) { Chat_ID = caseSetting.NotifyToken }; telegramBotClass.Send_Message_Group($"\r案場名稱: {caseSetting.TitleName}\r點位名稱: {item.AiName}\r超過上限值: {item.AiMax}\r目前數值為 {nowdata}"); } break; case 1: //正常 { TelegramBotClass telegramBotClass = new TelegramBotClass(caseSetting.NotifyApi) { Chat_ID = caseSetting.NotifyToken }; telegramBotClass.Send_Message_Group($"\r案場名稱: {caseSetting.TitleName}\r點位名稱: {item.AiName}\r上限值: {item.AiMax}\r下限值: {item.AiMin}\r恢復正常,目前數值為 {nowdata}"); } break; case 2: //下限 { TelegramBotClass telegramBotClass = new TelegramBotClass(caseSetting.NotifyApi) { Chat_ID = caseSetting.NotifyToken }; telegramBotClass.Send_Message_Group($"\r案場名稱: {caseSetting.TitleName}\r點位名稱: {item.AiName}\r低於下限值: {item.AiMin}\r目前數值為 {nowdata}"); } break; } } break; } } } } } #endregion AiConfigs = Alarmdata; ConnectionTime = DateTime.Now; } else { Thread.Sleep(80); } } }
/// <summary> /// 斷線偵測畫面 /// </summary> /// <param name="ewatch_MySqlComponent">資料庫方法</param> public EwatchConnectionUserControl(Ewatch_MySqlComponent ewatch_MySqlComponent) { Ewatch_MySqlComponent = ewatch_MySqlComponent; CaseSettings = ewatch_MySqlComponent.CaseSettings; AiSettings = ewatch_MySqlComponent.AiSettings; ElectricSettings = ewatch_MySqlComponent.ElectricSettings; InitializeComponent(); #region AI斷線資訊 AigridControl.DataSource = AiSettings; gridView1.OptionsBehavior.Editable = false; gridView1.OptionsSelection.EnableAppearanceFocusedCell = false; for (int i = 0; i < gridView1.Columns.Count; i++) { gridView1.Columns[i].BestFit(); } gridView1.Columns["PK"].Visible = false; gridView1.Columns["NotifyFlag"].Visible = false; gridView1.Columns["CaseNo"].Caption = "案場名稱"; gridView1.Columns["AiNo"].Caption = "Ai編號"; gridView1.Columns["AiName"].Caption = "Ai名稱"; gridView1.Columns["NotifyFlag"].Visible = false; gridView1.Columns["TimeoutSpan"].Visible = false; gridView1.Columns["MTimeoutSpan"].Visible = false; gridView1.Columns["SendTime"].Visible = false; gridView1.Columns["ConnectionFlag"].Caption = "連線狀態"; #region 案場名稱顯示功能 gridView1.CustomColumnDisplayText += (s, e) => { if (e.Column.FieldName.ToString() == "CaseNo") { string cellValue = e.Value.ToString(); var data = CaseSettings.SingleOrDefault(g => g.CaseNo == cellValue); if (data != null) { e.DisplayText = data.TitleName; } } }; #endregion #region 斷線燈號顯示功能 gridView1.CustomDrawCell += (s, e) => { e.Appearance.TextOptions.HAlignment = HorzAlignment.Center; e.Appearance.Options.UseTextOptions = true; e.DefaultDraw(); if (e.Column.FieldName == "ConnectionFlag") { Color color; string cellValue = e.CellValue.ToString(); if (cellValue == "不使用") { color = normalPriority; } else if (cellValue == "斷線") { color = highPriority; } else { color = lowPriority; } e.Cache.FillEllipse(e.Bounds.X + 204, e.Bounds.Y + 1, markWidth, markWidth, color); } }; #endregion #endregion #region 電表斷線資訊 ElectricgridControl.DataSource = ElectricSettings; gridView2.OptionsBehavior.Editable = false; gridView2.OptionsSelection.EnableAppearanceFocusedCell = false; for (int i = 0; i < gridView2.Columns.Count; i++) { gridView2.Columns[i].BestFit(); } gridView2.Columns["PK"].Visible = false; gridView2.Columns["CaseNo"].Caption = "案場編號"; gridView2.Columns["ElectricNo"].Caption = "電表編號"; gridView2.Columns["PhaseTypeEnum"].Caption = "相位類型"; gridView2.Columns["ElectricName"].Caption = "電表名稱"; gridView2.Columns["NotifyFlag"].Visible = false; gridView2.Columns["TimeoutSpan"].Visible = false; gridView2.Columns["MTimeoutSpan"].Visible = false; gridView2.Columns["SendTime"].Visible = false; gridView2.Columns["ConnectionFlag"].Caption = "連線狀態"; #region 相位類型顯示功能 gridView2.CustomColumnDisplayText += (s, e) => { if (e.Column.FieldName.ToString() == "PhaseTypeEnum") { int cellValue = Convert.ToInt32(e.Value); if (cellValue == 0) { e.DisplayText = "三相"; } else if (cellValue == 1) { e.DisplayText = "單相"; } } else if (e.Column.FieldName.ToString() == "CaseNo") { string cellValue = e.Value.ToString(); var data = CaseSettings.SingleOrDefault(g => g.CaseNo == cellValue); if (data != null) { e.DisplayText = data.TitleName; } } }; #endregion #region 斷線燈號顯示功能 gridView2.CustomDrawCell += (s, e) => { e.Appearance.TextOptions.HAlignment = HorzAlignment.Center; e.Appearance.Options.UseTextOptions = true; e.DefaultDraw(); if (e.Column.FieldName == "ConnectionFlag") { Color color; string cellValue = e.CellValue.ToString(); if (cellValue == "不使用") { color = normalPriority; } else if (cellValue == "斷線") { color = highPriority; } else { color = lowPriority; } e.Cache.FillEllipse(e.Bounds.X + 150, e.Bounds.Y + 1, markWidth, markWidth, color); } }; #endregion #endregion }
public ChumgHsinConnectionUserControl(ChungHsin_MySqlComponent chungHsin_MySqlComponent) { ChungHsin_MySqlComponent = chungHsin_MySqlComponent; CaseSettings = chungHsin_MySqlComponent.CaseSettings; ReceiveSettings = chungHsin_MySqlComponent.ReceiveSettings; DeviceConfigs = chungHsin_MySqlComponent.DeviceConfigs; InitializeComponent(); #region Receive斷線資訊 AigridControl.DataSource = ReceiveSettings; gridView1.OptionsBehavior.Editable = false; gridView1.OptionsSelection.EnableAppearanceFocusedCell = false; for (int i = 0; i < gridView1.Columns.Count; i++) { gridView1.Columns[i].BestFit(); } gridView1.Columns["PK"].Visible = false; gridView1.Columns["NotifyFlag"].Visible = false; gridView1.Columns["DeviceTypeEnum"].Caption = "設備類型"; gridView1.Columns["CaseNo"].Caption = "案場名稱"; gridView1.Columns["ReceiveNo"].Caption = "Receive編號"; gridView1.Columns["ReceiveName"].Caption = "Receive名稱"; gridView1.Columns["NotifyFlag"].Visible = false; gridView1.Columns["HTimeoutSpan"].Visible = false; gridView1.Columns["MTimeoutSpan"].Visible = false; gridView1.Columns["SendTime"].Visible = false; gridView1.Columns["ConnectionFlag"].Caption = "連線狀態"; #region 案場名稱顯示功能 gridView1.CustomColumnDisplayText += (s, e) => { if (e.Column.FieldName.ToString() == "CaseNo") { string cellValue = e.Value.ToString(); var data = CaseSettings.SingleOrDefault(g => g.CaseNo == cellValue); if (data != null) { e.DisplayText = data.TitleName; } } else if (e.Column.FieldName.ToString() == "DeviceTypeEnum") { int cellValue = Convert.ToInt32(e.Value); var data = DeviceConfigs.SingleOrDefault(g => g.DeviceTypeEnum == cellValue); if (data != null) { e.DisplayText = data.DeviceName; } } }; #endregion #region 斷線燈號顯示功能 gridView1.CustomDrawCell += (s, e) => { e.Appearance.TextOptions.HAlignment = HorzAlignment.Center; e.Appearance.Options.UseTextOptions = true; e.DefaultDraw(); if (e.Column.FieldName == "ConnectionFlag") { Color color; string cellValue = e.CellValue.ToString(); if (cellValue == "不使用") { color = normalPriority; } else if (cellValue == "斷線") { color = highPriority; } else { color = lowPriority; } e.Cache.FillEllipse(e.Bounds.X + 150, e.Bounds.Y + 1, markWidth, markWidth, color); } }; #endregion #endregion }
public void SetUp() { _testEntity = new CaseSettings(); _privateObject = new PrivateObject(_testEntity); }