private void SelectRepresentation() { ConditionClass c = Classify(cd); panelConditionType.Items.Clear(); // dependent on program classification, select what we can pick if (c == ConditionClass.Key) { panelConditionType.Items.AddRange(new string[] { "Full Condition", "Key" }); } else { panelConditionType.Items.AddRange(new string[] { "Always Action/True", "Never Action/False", "Full Condition" }); } if (overrideshowfull) { c = ConditionClass.Full; } labelAlwaysTrue.Visible = (c == ConditionClass.AlwaysTrue); labelAlwaysFalse.Visible = (c == ConditionClass.AlwaysFalse); textBoxCondition.Visible = (c == ConditionClass.Full); buttonKeys.Visible = (c == ConditionClass.Key); textBoxCondition.Text = cd.ToString(); buttonKeys.Text = (cd.Fields.Count > 0) ? cd.Fields[0].MatchString.Left(20) : "?"; }
public void ConditionClass(decimal conditionPrice1, decimal conditionQuantity1, decimal conditionPrice2, decimal conditionQuantity2) { var condition1 = new ConditionClass(conditionPrice1, conditionQuantity1); var condition2 = new ConditionClass(conditionPrice2, conditionQuantity2); Debug.WriteLine(condition1.Equals(condition2)); }
public SingleContract(int article, int clause, ConditionClass conditionClass, ConditionType conditionType, int conditionValue, ResultClass resultClass, float resultValue, string contractText, List <SimpleContract> relatedContracts) { this.article = article; this.clause = clause; isAgree = false; this.conditionClass = conditionClass; this.conditionType = conditionType; this.conditionValue = conditionValue; this.resultClass = resultClass; this.resultValue = resultValue; this.contractText = contractText; this.relatedContracts = relatedContracts; }
public List <SingleContract> ParseContract(int level) { List <SingleContract> ret = new List <SingleContract>(); List <List <string> > data = Parser.ContractParse(contractAsset[level]); for (int i = 0; i < data.Count; i++) { int article = int.Parse(data[i][0]); int clause = int.Parse(data[i][1]); ConditionClass conditionClass = (ConditionClass)System.Enum.Parse(typeof(ConditionClass), data[i][2]); ConditionType conditionType = (ConditionType)System.Enum.Parse(typeof(ConditionType), data[i][3]); int conditionValue = int.Parse(data[i][4]); ResultClass resultClass = (ResultClass)System.Enum.Parse(typeof(ResultClass), data[i][5]); float resultValue = float.Parse(data[i][6]); string contractText = data[i][7]; List <SimpleContract> relatedContracts = new List <SimpleContract>(); if (data[i].Count > 8) { for (int j = 8; j < data[i].Count; j++) { if (data[i][j] == "") { continue; } int relatedContract = int.Parse(data[i][j]); int relatedArticle = relatedContract / 10; int relatedClause = relatedContract % 10; SimpleContract cont = new SimpleContract(relatedArticle, relatedClause); relatedContracts.Add(cont); } } SingleContract contract = new SingleContract(article, clause, conditionClass, conditionType, conditionValue, resultClass, resultValue, contractText, relatedContracts); if (contract.Article == 0) { contract.isAgree = true; } ret.Add(contract); } return(ret); }
private async void AddData(object para) { if (SelectedTreeItem == null) { #if XBAP MessageBox.Show("请选中要查询的组织机构", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); #else Xceed.Wpf.Toolkit.MessageBox.Show("请选中要查询的组织机构", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); #endif return; } if (Unit == null || Unit == "") { #if XBAP MessageBox.Show("请选择要查询的测点的数据类型", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); #else Xceed.Wpf.Toolkit.MessageBox.Show("请选择要查询的测点的数据类型", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); #endif return; } if (SelectedTreeItem is ItemTreeItemViewModel) { if ((SelectedTreeItem as ItemTreeItemViewModel).T_Item != null && (SelectedTreeItem as ItemTreeItemViewModel).T_Item.ItemType == (int)ChannelType.WirelessScalarChannelInfo) { AnInfoSelected = true; } if ((SelectedTreeItem as ItemTreeItemViewModel).T_Item != null && (SelectedTreeItem as ItemTreeItemViewModel).T_Item.ItemType == (int)ChannelType.WirelessVibrationChannelInfo) { VInfoSelected = true; } } string conditionWave; string conditionAlarm; object[] objectWave; object[] objectAlarm; ConditionClass.GetConditionStr(out conditionWave, out conditionAlarm, out objectWave, out objectAlarm, AllowNormal, AllowPreWarning, AllowWarning, AllowDanger, AllowInvalid, AllowRPMFilter, Unit, DownRPMFilter, UpRPMFilter); string selectedip = _cardProcess.GetOrganizationServer(SelectedTreeItem); #region 分频 var divfre = SelectedTreeItem as DivFreTreeItemViewModel; if (divfre != null) { try { WaitInfo = "获取数据中"; Status = ViewModelStatus.Querying; var item_parent = divfre.Parent as ItemTreeItemViewModel; var divfreinfo = divfre.T_DivFreInfo; if (divfreinfo == null) { return; } //var channel = _cardProcess.GetChannel(_hardwareService.ServerTreeItems, item_parent.T_Item); //if (channel == null || channel.IChannel == null) //{ // return; //} var result = await _databaseComponent.GetHistoryData <D1_DivFreInfo>(selectedip, divfreinfo.Guid, null, StartTime.Value, EndTime.Value, null, null); if (result.Count == 0) { #if XBAP MessageBox.Show("没有数据,请重新选择条件", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); #else Xceed.Wpf.Toolkit.MessageBox.Show("没有数据,请重新选择条件", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); #endif return; } List <IBaseDivfreSlot> slotdata = null; switch (item_parent.T_Item.ItemType) { case (int)ChannelType.IEPEChannelInfo: { var resultslot = await _databaseComponent.GetHistoryData <D_IEPESlot>(selectedip, item_parent.T_Item.Guid, null, StartTime.Value, EndTime.Value, null, null); if (resultslot.Count == 0) { return; } slotdata = resultslot.Select(p => p as IBaseDivfreSlot).ToList(); break; } case (int)ChannelType.EddyCurrentDisplacementChannelInfo: { var resultslot = await _databaseComponent.GetHistoryData <D_EddyCurrentDisplacementSlot>(selectedip, item_parent.T_Item.Guid, null, StartTime.Value, EndTime.Value, null, null); if (resultslot.Count == 0) { return; } slotdata = resultslot.Select(p => p as IBaseDivfreSlot).ToList(); break; } case (int)ChannelType.WirelessVibrationChannelInfo: { string unit = Unit; var resultslot = await _databaseComponent.GetHistoryData <D_WirelessVibrationSlot>(selectedip, item_parent.T_Item.Guid, null, StartTime.Value, EndTime.Value, conditionWave, new object[] { unit, DownRPMFilter, UpRPMFilter }); if (resultslot.Count == 0) { return; } slotdata = resultslot.Select(p => p as IBaseDivfreSlot).ToList(); break; } default: return; } if (slotdata == null) { return; } for (int i = 0; i < result.Count; i++) { DivFreObject divFreObj = new DivFreObject(); divFreObj.OrganizationName = item_parent.BaseAlarmSignal.OrganizationName; divFreObj.DeviceName = item_parent.BaseAlarmSignal.DeviceName; divFreObj.ItemName = item_parent.BaseAlarmSignal.ItemName; divFreObj.DivFreName = divfre.Name; var data = (from p in slotdata where p.RecordLab == result[i].RecordLab select new { p.ACQDatetime, p.Unit }).SingleOrDefault(); if (data == null) { return; } divFreObj.ACQDatetime = data.ACQDatetime; divFreObj.DescriptionFre = result[i].DescriptionFre; divFreObj.Result = result[i].Result.Value; //divFreObj.Phase = result[i].Phase; divFreObj.Unit = data.Unit; if (divFreCollection.Where(p => p.OrganizationName == divFreObj.OrganizationName && p.DeviceName == divFreObj.DeviceName && p.ItemName == divFreObj.ItemName && p.DivFreName == divFreObj.DivFreName && p.ACQDatetime == divFreObj.ACQDatetime).Count() == 0) //去重 { divFreCollection.Add(divFreObj); } } } catch (Exception ex) { _eventAggregator.GetEvent <ThrowExceptionEvent>().Publish(Tuple.Create <string, Exception>("数据回放-分频查询", ex)); } finally { Status = ViewModelStatus.None; } return; } #endregion #region 测点 var item = SelectedTreeItem as ItemTreeItemViewModel; if (item != null) { if (item.T_Item != null && item.T_Item.ItemType != 0) { try { WaitInfo = "获取数据中"; Status = ViewModelStatus.Querying; await SubAddData(item, conditionWave, conditionAlarm, objectWave, objectAlarm); } catch (Exception ex) { _eventAggregator.GetEvent <ThrowExceptionEvent>().Publish(Tuple.Create <string, Exception>("数据回放-测点查询", ex)); } finally { Status = ViewModelStatus.None; } return; } else { #if XBAP MessageBox.Show("该测点没绑定或无信息", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); #else Xceed.Wpf.Toolkit.MessageBox.Show("该测点无信息", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); #endif return; } } #endregion #region 组织机构 if (SelectedTreeItem != null) { try { WaitInfo = "获取数据中"; Status = ViewModelStatus.Querying; var items = _cardProcess.GetItems(SelectedTreeItem).Where(p => p.IsPaired); foreach (var subitem in items) { await SubAddData(subitem, conditionWave, conditionAlarm, objectWave, objectAlarm, false); } } catch (Exception ex) { _eventAggregator.GetEvent <ThrowExceptionEvent>().Publish(Tuple.Create <string, Exception>("数据回放-测点批量查询", ex)); } finally { Status = ViewModelStatus.None; } return; } #endregion }