public static List <DataUsage> Map(this List <DataUsageDTO> data) { List <DataUsage> dataList = new List <DataUsage>(); try { if (data == null) { return(dataList); } foreach (var item in data) { var mappedItem = new DataUsage() { MSISDN = item.MSISDN.ToLong(), Data_Usage = item.DataUsage1.ToDecimal(), DataUsageDate = item.DataUsageDate.ToDate(), DataUsageStatus = item.DataUsageStatus.ToStatus(), }; dataList.Add(mappedItem); } return(dataList); } catch (Exception ex) { ex.Data.Add("Map", "An error occurred while trying to Add Data Mapper Usage Record - BLL"); Tracer.Error(ex); return(dataList); } }
public DataTable GetExcelDataTable(DataUsage usage) { DataTable dt = dtExcel.Copy(); FixDataTable(dt, usage); return(dt); }
/// <summary> /// Allows to create a numeric DataType for TYPEDEF with a usage clause that makes the Data Numeric. /// </summary> /// <param name="usage"></param> /// <returns></returns> public static DataType Create(DataUsage usage) { if (usage == DataUsage.Binary || usage == DataUsage.NativeBinary || usage == DataUsage.FloatingPoint || usage == DataUsage.LongFloatingPoint || usage == DataUsage.PackedDecimal) { return(DataType.Numeric); } return(DataType.Unknown); }
public void removeUsagesForSpecificModel(Model theModel) { if (theModel == null) { return; } foreach (MemberInfo MI in GetFieldsAndProperties(theModel.GetType())) { ReflectedItem RI = ReflectedItem.NewItem(MI, theModel); //Need this to 'ignore' redundant AggregatedConstituentModels //if (typeof(Model).IsAssignableFrom(RI.itemType) && RI.itemValue != null) if (RI.itemValue != null) { if (RI.itemValue is Model) { //This member is a model itself removeUsagesForSpecificModel((Model)RI.itemValue); continue; } } string GDDName = Scenario.Network.DataManager.GetUsageFullName(RI); if (!String.IsNullOrEmpty(GDDName))//Will be "" if no usages for this RI { string[] split = GDDName.Split(new[] { '.' }); if (split.Count() <= 1) { return; } string groupName = string.Join(".", split.Take(split.Count() - 1)); bool removeTS = true; GenericDataDetails GDD = Scenario.Network.DataManager.DataGroups.Where(g => g.Name == groupName).Select(@group => @group.GetUsage(split.Last())).FirstOrDefault(gdd => gdd != null); //GenericDataDetails GDD = Scenario.Network.DataManager.GetDetails(GDDName); if (GDD.Usages.Count > 1) { //Other items need this timeseries, don't remove removeTS = false; } DataUsage DU = GDD.Usages.First(x => x.ReflectedItem.Equals(RI)); GDD.Usages.Remove(DU); if (removeTS) { string DGName = GDDName.Split('.')[0]; DataGroupItem DGI = Scenario.Network.DataManager.DataGroups.FirstOrDefault(x => x.Name == DGName); DGI.RemoveItem(GDD); Scenario.Network.DataManager.Refresh(); } } } }
public virtual void Read(PackFileDeserializer des, BinaryReaderEx br) { m_byteOffset = br.ReadUInt32(); m_type = (DataType)br.ReadUInt16(); m_usage = (DataUsage)br.ReadUInt16(); m_byteStride = br.ReadUInt32(); m_numElements = br.ReadByte(); br.ReadUInt16(); br.ReadByte(); m_channelID = des.ReadStringPointer(br); }
/// <summary> /// /// </summary> /// <param name="dt"></param> /// <param name="attributeName">配置文件的属性名。Code或Name</param> private void FixDataTable(DataTable dt, DataUsage usage) { int firstColumnIndex = GetCol(xmlConfig.Element("Columns").Elements("Column").First().Attribute("Col").Value); string firstColumnName = xmlConfig.Element("Columns").Elements("Column").First().Attribute("Name").Value; //移除结束标志以后的行 while (dt.Rows.Count - 1 >= intEndRowIndex) { dt.Rows.RemoveAt(dt.Rows.Count - 1); } int j = intStartRowIndex; //移除标题行以前的行 while (j > 0) { //if (dt.Rows[intStartRowIndex-1][firstColumnIndex].ToString() == firstColumnName) //{ // dt.Rows.RemoveAt(0); // break; //} dt.Rows.RemoveAt(0); j--; } //移除多余的列,并设置列名 for (int i = dt.Columns.Count - 1; i >= 0; i--) { var query = xmlConfig.Element("Columns").Elements("Column").Where(c => GetCol(c.Attribute("Col").Value) == i); if (query.Count() == 0) { dt.Columns.RemoveAt(i); } else { if (usage == DataUsage.display) { dt.Columns[i].ColumnName = query.Single().Attribute("Name").Value; } else { dt.Columns[i].ColumnName = query.Single().Attribute("Code").Value; } } } }
public Dictionary <string, string> GetExcelDataItemDic(DataUsage usage) { Dictionary <string, string> dic = new Dictionary <string, string>(); var quary = xmlConfig.Element("Items").Elements("Item"); foreach (var item in quary) { string code = item.Attribute("Code").Value; string name = item.Attribute("Name").Value; string row = item.Attribute("Row").Value; string col = item.Attribute("Col").Value; string type = item.Attribute("Type").Value; string value = ""; //如果要求的条目在列表的上方则直接取值,否则要求表尾行+偏移行 if (type.ToLower().Trim() == "up") { value = GetExcelData(row, col); } else { int aboseluteRow = intEndRowIndex + int.Parse(row); int aboseluteCol = GetCol(col); value = GetExcelData(aboseluteRow, aboseluteCol); } if (usage == DataUsage.display) { dic.Add(name, value); } else { dic.Add(code, value); } } return(dic); }
private void UpdateIsInternetConnected() { ConnectionProfile connectionProfile = NetworkInformation.GetInternetConnectionProfile(); if (connectionProfile != null) { ConnectionName = connectionProfile.ProfileName; ConnectionCost = connectionProfile.GetConnectionCost(); DataUsage = connectionProfile.GetLocalUsage(DateTimeOffset.Now - TimeSpan.FromHours(24), DateTimeOffset.Now); switch (connectionProfile.GetNetworkConnectivityLevel()) { case NetworkConnectivityLevel.None: ConnectionStatus = "None"; break; case NetworkConnectivityLevel.LocalAccess: ConnectionStatus = "Local access"; break; case NetworkConnectivityLevel.ConstrainedInternetAccess: ConnectionStatus = "Constrained internet access"; break; case NetworkConnectivityLevel.InternetAccess: ConnectionStatus = "Internet access"; break; } } else { ConnectionName = "None"; ConnectionStatus = "None"; ConnectionCost = null; DataUsage = null; } }
private SyntaxProperty<DataUsage> CreateDataUsageProperty(DataUsage usage, ITerminalNode node) { if (node == null) return null; return new SyntaxProperty<DataUsage>(usage, ParseTreeUtils.GetFirstToken(node)); }
public DataAnnotationAttribute(DataUsage usage) { this.Usage = usage; }
public virtual void Read(PackFileDeserializer des, BinaryReaderEx br) { m_use = (DataUsage)br.ReadUInt16(); m_useIndexOrig = br.ReadByte(); m_useIndexLocal = br.ReadByte(); }
public async Task InitializeAESEngine(IStartupLoader sl) { DataUsage.safeReloadPlugins(); SessionDetail.setSession(); }
public MainVM() : base("AESGAME") { DataUsage.safeReloadPlugins(); NotificationsManager.Instance.PropertyChanged += RefreshNotifications_PropertyChanged; }