/// <summary> /// To the liquid. /// </summary> /// <returns></returns> /// <exception cref="System.NotImplementedException"></exception> public object ToLiquid() { var dictionary = new Dictionary <string, object>(); dictionary.Add("PrinterDeviceId", PrinterDeviceId); dictionary.Add("PrinterAddress", PrinterAddress); dictionary.Add("PrintFrom", PrintFrom.ConvertToString()); dictionary.Add("PrintTo", PrintTo.ConvertToString()); dictionary.Add("LabelFile", LabelFile); dictionary.Add("LabelKey", LabelKey); dictionary.Add("MergeFields", MergeFields); return(dictionary); }
public PrintOneInfo( String name, PrintType type, PrintFrom from, bool IsDuplex, bool IsValid) : base(name) { // base(name); this.mPrintName = name; this.mPrintType = type; this.mPrintFrom = from; this.mCanDuplex = IsDuplex; this.mIsValid = false; }
public PrintOneInfo( String name, PrintType type, PrintFrom from, String status) : base(name) { this.mPrintName = name; this.mPrintType = type; this.mPrintFrom = from; this.mStatus = status; if (String.IsNullOrEmpty(this.mStatus)) { this.mStatus = "未定义,崔兵兵"; } }
/// <summary> /// Binds the grid. /// </summary> private void BindGrid() { var deviceService = new DeviceService(new RockContext()); var sortProperty = gDevice.SortProperty; gDevice.EntityTypeId = EntityTypeCache.Get <Device>().Id; var queryable = deviceService.Queryable(); string name = fDevice.GetUserPreference("Name"); if (!string.IsNullOrWhiteSpace(name)) { queryable = queryable.Where(d => d.Name.Contains(name)); } int?deviceTypeId = fDevice.GetUserPreference("Device Type").AsIntegerOrNull(); if (deviceTypeId.HasValue) { queryable = queryable.Where(d => d.DeviceTypeValueId == deviceTypeId.Value); } string ipAddress = fDevice.GetUserPreference("IP Address"); if (!string.IsNullOrWhiteSpace(ipAddress)) { queryable = queryable.Where(d => d.IPAddress.Contains(ipAddress)); } if (!string.IsNullOrWhiteSpace(fDevice.GetUserPreference("Print To"))) { PrintTo printTo = (PrintTo)System.Enum.Parse(typeof(PrintTo), fDevice.GetUserPreference("Print To"));; queryable = queryable.Where(d => d.PrintToOverride == printTo); } int?printerId = fDevice.GetUserPreference("Printer").AsIntegerOrNull(); if (printerId.HasValue) { queryable = queryable.Where(d => d.PrinterDeviceId == printerId); } if (!string.IsNullOrWhiteSpace(fDevice.GetUserPreference("Print From"))) { PrintFrom printFrom = (PrintFrom)System.Enum.Parse(typeof(PrintFrom), fDevice.GetUserPreference("Print From"));; queryable = queryable.Where(d => d.PrintFrom == printFrom); } string activeFilterValue = fDevice.GetUserPreference("Active Status"); if (!string.IsNullOrWhiteSpace(activeFilterValue)) { if (activeFilterValue != "all") { var activeFilter = activeFilterValue.AsBoolean(); queryable = queryable.Where(b => b.IsActive == activeFilter); } } else { queryable = queryable.Where(b => b.IsActive); } gDevice.ObjectList = new Dictionary <string, object>(); queryable.ToList().ForEach(d => gDevice.ObjectList.Add(d.Id.ToString(), d)); var gridList = queryable.Select(a => new { a.Id, a.Name, DeviceTypeName = a.DeviceType.Value, a.IPAddress, a.PrintToOverride, a.PrintFrom, PrinterDeviceName = a.PrinterDevice.Name, a.PrinterDeviceId, a.DeviceTypeValueId, a.IsActive }); if (sortProperty != null) { gDevice.DataSource = gridList.Sort(sortProperty).ToList(); } else { gDevice.DataSource = gridList.OrderBy(d => d.Name).ToList(); } gDevice.EntityTypeId = EntityTypeCache.Get <Rock.Model.Device>().Id; gDevice.DataBind(); }
/// <summary> /// Binds the grid. /// </summary> private void BindGrid() { var deviceService = new DeviceService(); var sortProperty = gDevice.SortProperty; var queryable = deviceService.Queryable().Select(a => new { a.Id, a.Name, DeviceTypeName = a.DeviceType.Name, a.IPAddress, a.PrintToOverride, a.PrintFrom, PrinterDeviceName = a.PrinterDevice.Name, a.PrinterDeviceId, a.DeviceTypeValueId }); string name = fDevice.GetUserPreference("Name"); if (!string.IsNullOrWhiteSpace(name)) { queryable = queryable.Where(d => d.Name.Contains(name)); } int?deviceTypeId = fDevice.GetUserPreference("Device Type").AsInteger(); if (deviceTypeId.HasValue) { queryable = queryable.Where(d => d.DeviceTypeValueId == deviceTypeId.Value); } string ipAddress = fDevice.GetUserPreference("IP Address"); if (!string.IsNullOrWhiteSpace(ipAddress)) { queryable = queryable.Where(d => d.IPAddress.Contains(ipAddress)); } if (!string.IsNullOrWhiteSpace(fDevice.GetUserPreference("Print To"))) { PrintTo printTo = (PrintTo)System.Enum.Parse(typeof(PrintTo), fDevice.GetUserPreference("Print To"));; queryable = queryable.Where(d => d.PrintToOverride == printTo); } int?printerId = fDevice.GetUserPreference("Printer").AsInteger(); if (printerId.HasValue) { queryable = queryable.Where(d => d.PrinterDeviceId == printerId); } if (!string.IsNullOrWhiteSpace(fDevice.GetUserPreference("Print From"))) { PrintFrom printFrom = (PrintFrom)System.Enum.Parse(typeof(PrintFrom), fDevice.GetUserPreference("Print From"));; queryable = queryable.Where(d => d.PrintFrom == printFrom); } if (sortProperty != null) { gDevice.DataSource = queryable.Sort(sortProperty).ToList(); } else { gDevice.DataSource = queryable.OrderBy(d => d.Name).ToList(); } gDevice.DataBind(); }