/// <summary> /// Return a XML representation of this object. /// </summary> public XElement ToXML() => new XElement(OCPPNS.OCPPv1_6_CS + "statusNotificationRequest", new XElement(OCPPNS.OCPPv1_6_CS + "connectorId", ConnectorId.ToString()), new XElement(OCPPNS.OCPPv1_6_CS + "status", Status.AsText()), new XElement(OCPPNS.OCPPv1_6_CS + "errorCode", ErrorCode.AsText()), Info.IsNotNullOrEmpty() ? new XElement(OCPPNS.OCPPv1_6_CS + "info", Info) : null, StatusTimestamp.HasValue ? new XElement(OCPPNS.OCPPv1_6_CS + "timestamp", StatusTimestamp.Value.ToIso8601()) : null, VendorId.IsNotNullOrEmpty() ? new XElement(OCPPNS.OCPPv1_6_CS + "vendorId", VendorId) : null, VendorErrorCode.IsNotNullOrEmpty() ? new XElement(OCPPNS.OCPPv1_6_CS + "vendorErrorCode", VendorErrorCode) : null );
/// <summary> /// Return a JSON representation of this object. /// </summary> /// <param name="CustomStatusNotificationRequestSerializer">A delegate to serialize custom StatusNotification requests.</param> public JObject ToJSON(CustomJObjectSerializerDelegate <StatusNotificationRequest> CustomStatusNotificationRequestSerializer = null) { var JSON = JSONObject.Create( new JProperty("connectorId", ConnectorId.ToString()), new JProperty("status", Status.AsText()), new JProperty("errorCode", ErrorCode.AsText()), Info.IsNotNullOrEmpty() ? new JProperty("info", Info) : null, StatusTimestamp.HasValue ? new JProperty("timestamp", StatusTimestamp.Value.ToIso8601()) : null, VendorId.IsNotNullOrEmpty() ? new JProperty("vendorId", VendorId) : null, VendorErrorCode.IsNotNullOrEmpty() ? new JProperty("vendorErrorCode", VendorErrorCode) : null); return(CustomStatusNotificationRequestSerializer != null ? CustomStatusNotificationRequestSerializer(this, JSON) : JSON); }
public InfoSource(GuidPrefix guidPrefix) : base(SubMessageKind.INFO_SRC) { this.protocolVersion = ProtocolVersion.PROTOCOLVERSION_2_1; this.vendorId = VendorId.VENDORID_UNKNOWN; this.guidPrefix = guidPrefix; }
/// <summary> /// /// </summary> /// <returns></returns> public string ToLog(uint aDepth = 0) { string res = ""; const string KPrefix = " "; string prefix = ""; for (uint i = 0; i < aDepth; i++) { prefix += KPrefix; } string indent = prefix + KPrefix; res += prefix + "[HID Device]" + "\r\n"; res += indent + "String: " + ToString() + "\r\n"; res += indent + "Name: " + Name + "\r\n"; res += indent + "Manufacturer: " + Manufacturer + "\r\n"; res += indent + "Product: " + Product + "\r\n"; res += indent + "VendorID: 0x" + VendorId.ToString("X4") + "\r\n"; res += indent + "ProductID: 0x" + ProductId.ToString("X4") + "\r\n"; res += indent + "Version: " + Version.ToString() + "\r\n"; res += prefix + "[/HID Device]" + "\r\n"; return(res); }
public static void LoadForAllCategories(VendorId vendorId, out Dictionary <int, Product> productDict, out List <VendorProduct> venprodList) { List <Product> products = OrderingRepositories.Product.Get(vendorId); productDict = MakeProductDictionary(products); venprodList = OrderingRepositories.VendorProduct.Get(vendorId); }
public override int GetHashCode() { var hashCode = -810527825; hashCode = hashCode * -1521134295 + VendorId.GetHashCode(); hashCode = hashCode * -1521134295 + ProductId.GetHashCode(); return(hashCode); }
public void RefreshFromDefinitions(VendorId vendorId) { ExecuteNonQuery("dbo.PurLineRefreshFromDefinitions", delegate(SqlCommand cmd) { SqlHelper.AddParamInputId(cmd, "@VendorId", vendorId.Value); }); }
public List <VendorProduct> Get(VendorId vendorId) { return(Search("dbo.GetVendorProductsByVendor", delegate(SqlCommand cmd) { SqlHelper.AddParamInputId(cmd, "@VendorId", vendorId.Value); })); }
public List <VendorProduct> Get(VendorId vendorId, string vendorPartNum) { return(Search("dbo.GetVendorProductsByPartNum", delegate(SqlCommand cmd) { SqlHelper.AddParamInputId(cmd, "@VendorId", vendorId.Value); SqlHelper.AddParamVarchar(cmd, "@VendorPartNum", vendorPartNum); })); }
public List <Product> Get(VendorId vendorId, ProductCategoryId productCategoryId) { return(Search("dbo.GetProductsByVendorCategory", delegate(SqlCommand cmd) { SqlHelper.AddParamInputId(cmd, "@VendorId", vendorId.Value); SqlHelper.AddParamInputId(cmd, "@ProductCategoryId", productCategoryId.Value); })); }
private async Task <List <wde.DeviceInformation> > GetDevicesByIdSlowAsync() { var allDevices = await GetAllDevices(); Logger.Log($"Device Ids:{string.Join(", ", allDevices.Select(d => d.Id))} Names:{string.Join(", ", allDevices.Select(d => d.Name))}", null, nameof(UWPHidDevicePoller)); var vendorIdString = $"VID_{ VendorId.ToString("X").PadLeft(4, '0')}".ToLower(); var productIdString = $"PID_{ ProductId.ToString("X").PadLeft(4, '0')}".ToLower(); return(allDevices.Where(args => args.Id.ToLower().Contains(vendorIdString) && args.Id.ToLower().Contains(productIdString) && args.IsEnabled).ToList()); }
/// <summary> /// Print information about this device to our debug output. /// </summary> public void DebugWrite() { Debug.WriteLine( "================ HID ========================================================================================="); Debug.WriteLine("==== Name: " + Name); Debug.WriteLine("==== Manufacturer: " + Manufacturer); Debug.WriteLine("==== Product: " + Product); Debug.WriteLine("==== VendorID: 0x" + VendorId.ToString("X4")); Debug.WriteLine("==== ProductID: 0x" + ProductId.ToString("X4")); Debug.WriteLine("==== Version: " + Version); Debug.WriteLine( "=============================================================================================================="); }
/// <summary> /// Create a human readable string out of this object. /// </summary> /// <returns></returns> public override string ToString() { string res = "====== HidDevice ====\n"; res += "== Name: " + Name + "\n"; res += "== Manufacturer: " + Manufacturer + "\n"; res += "== Product: " + Product + "\n"; res += "== VendorID: 0x" + VendorId.ToString("X4") + "\n"; res += "== ProductID: 0x" + ProductId.ToString("X4") + "\n"; res += "== Version: " + Version + "\n"; res += "=====================\n"; return(res); }
internal string ToHidString() { string vendor = VendorId.ToString("X4").ToUpper(); string product = ProductId.ToString("X4").ToUpper(); if (VersionNumber == 0) { return($"HID\\VID_{vendor}&PID_{product}"); } else { string version = VersionNumber.ToString("X4").ToUpper(); return($"HID\\VID_{vendor}&PID_{product}&REV_{version}"); } }
/// <summary> /// Compares two DataTransfer requests for equality. /// </summary> /// <param name="DataTransferRequest">A DataTransfer request to compare with.</param> /// <returns>True if both match; False otherwise.</returns> public override Boolean Equals(DataTransferRequest DataTransferRequest) { if (DataTransferRequest is null) { return(false); } return(VendorId.Equals(DataTransferRequest.VendorId) && ((MessageId == null && DataTransferRequest.MessageId == null) || (MessageId != null && DataTransferRequest.MessageId != null && MessageId.Equals(DataTransferRequest.MessageId))) && ((Data == null && DataTransferRequest.Data == null) || (Data != null && DataTransferRequest.Data != null && Data.Equals(DataTransferRequest.Data)))); }
/// <summary> /// Return the HashCode of this object. /// </summary> /// <returns>The HashCode of this object.</returns> public override Int32 GetHashCode() { unchecked { return(VendorId.GetHashCode() * 17 ^ (MessageId != null ? MessageId.GetHashCode() * 11 : 0) ^ (Data != null ? Data.GetHashCode() : 0)); } }
/// <inheritdoc/> public string ToDelimitedString() { CultureInfo culture = CultureInfo.CurrentCulture; return(string.Format( culture, StringHelper.StringFormatSequence(0, 8, Configuration.FieldSeparator), Id, AnticipatedPrice, ManufacturerIdentifier?.ToDelimitedString(), ManufacturersCatalog, VendorId?.ToDelimitedString(), VendorCatalog, Taxable, SubstituteAllowed ).TrimEnd(Configuration.FieldSeparator.ToCharArray())); }
public override AmlCollection ToAml() { var element = new InternalElement { Name = "DeviceIdentity", Id = "DeviceIdentity" }; element.Attributes.Add(CreateAttribute("VendorId", "xs:integer", VendorId.ToString())); element.Attributes.Add(CreateAttribute("VendorName", "xs:string", VendorName)); element.Attributes.Add(CreateAttribute("DeviceId", "xs:integer", DeviceId)); element.Attributes.Add(CreateAttribute("VendorText", "xs:string", VendorText)); element.Attributes.Add(CreateAttribute("VendorUrl", "xs:anyURI", VendorUrl)); element.Attributes.Add(CreateAttribute("DeviceFamily", "xs:string", DeviceFamily)); element.Attributes.Add(CreateAttribute("DeviceName", "xs:string", DeviceName)); return(AmlCollection.Of(element, ConstructVendorLogo())); }
/// <summary> /// Compares two StatusNotification requests for equality. /// </summary> /// <param name="StatusNotificationRequest">A StatusNotification request to compare with.</param> /// <returns>True if both match; False otherwise.</returns> public override Boolean Equals(StatusNotificationRequest StatusNotificationRequest) { if (StatusNotificationRequest is null) { return(false); } return(ConnectorId.Equals(StatusNotificationRequest.ConnectorId) && Status.Equals(StatusNotificationRequest.Status) && ErrorCode.Equals(StatusNotificationRequest.ErrorCode) && Info.Equals(StatusNotificationRequest.Info) && ((!StatusTimestamp.HasValue && !StatusNotificationRequest.StatusTimestamp.HasValue) || (StatusTimestamp.HasValue && StatusNotificationRequest.StatusTimestamp.HasValue && StatusTimestamp.Value.Equals(StatusNotificationRequest.StatusTimestamp.Value))) && VendorId.Equals(StatusNotificationRequest.VendorId) && VendorErrorCode.Equals(StatusNotificationRequest.VendorErrorCode)); }
public void Show(VendorId vendorId, PurOrderId purOrderId, PersistedBindingList <JoinPlToVpToProd> purLines, List <ProductSubCategory> subCats, List <ProductBrand> brands) { mVendorId = vendorId; mOrderId = purOrderId; mPurLines = purLines; mPurLineDictionary = new Dictionary <string, JoinPlToVpToProd>(); foreach (JoinPlToVpToProd purLine in mPurLines) { if (!string.IsNullOrEmpty(purLine.PurLine_VendorPartNum)) { mPurLineDictionary.Add(purLine.PurLine_VendorPartNum, purLine); } } mSubCats = subCats; mBrands = brands; this.ShowDialog(); }
public string GetImportLine(VendorId vendorId, List <ProductSubCategory> allowedSubcategories) { mVendorId = vendorId; mAllowedSubcategories = allowedSubcategories; mImportLine = null; using (Ambient.DbSession.Activate()) { cboBrandName.Items.Clear(); foreach (ProductBrand brand in OrderingRepositories.ProductBrand.GetAll()) { cboBrandName.Items.Add(brand.BrandName); } } cboSubcategory.Items.Clear(); foreach (ProductSubCategory subCat in mAllowedSubcategories) { cboSubcategory.Items.Add(subCat.SubCategoryName); } this.ShowDialog(); return(mImportLine); }
private JoinVpToProdBindingList GetVendorProducts(VendorId vendorId) { JoinVpToProdBindingList venprodJoinList = new JoinVpToProdBindingList(); using (Ambient.DbSession.Activate()) { Dictionary <int, Product> productDict; List <VendorProduct> venprodList; if (mProductCategory.Id.Value == VendorProductHelper.AllCategoriesId) { VendorProductHelper.LoadForAllCategories(vendorId, out productDict, out venprodList); } else { VendorProductHelper.LoadForCategory(vendorId, mProductCategory.Id, out productDict, out venprodList); } bool showInactive = chkShowInactive.Checked; bool showDeleted = chkShowDeleted.Checked; foreach (VendorProduct venprod in venprodList) { Product product = productDict[venprod.ProductId.Value]; bool showProduct = true; if ((product.IsProductDeleted || venprod.IsProductDeleted) && !showDeleted) { showProduct = false; } if ((!product.IsActive || !venprod.IsActive) && !showInactive) { showProduct = false; } if (showProduct) { JoinVpToProd join = new JoinVpToProd(venprod, product); join.SetExternalData(this); venprodJoinList.Add(join); } } } return(venprodJoinList); }
public override byte[] ToArray() { var arr = base.ToArray(); arr[0x2] = USB.LoByte(); arr[0x3] = USB.HiByte(); arr[0x4] = DeviceClass; arr[0x5] = DeviceSubClass; arr[0x6] = DeviceProtocol; arr[0x7] = MaxPacketSize; arr[0x8] = VendorId.LoByte(); arr[0x9] = VendorId.HiByte(); arr[0xA] = ProductId.LoByte(); arr[0xB] = ProductId.HiByte(); arr[0xC] = Device.LoByte(); arr[0xD] = Device.HiByte(); arr[0xE] = ManufacturerIndex; arr[0xF] = ProductIndex; arr[0x10] = SerialNumberIndex; arr[0x11] = NumberOfConfigurations; return(arr); }
public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { DataAccess.Infrastructure.UserType userType = Business.AppLogic.GetUserType(this.UserTypeId); User oldUser = null; if (this.Id.HasValue) { oldUser = Business.AppLogic.GetUser(this.Id.Value); } switch (userType.UserTypeName) { case "Client Administrator": if (String.IsNullOrWhiteSpace(this.Password)) { yield return(new ValidationResult("Password is required.", new[] { "Password" })); } if (String.IsNullOrWhiteSpace(this.EmailAddress)) { yield return(new ValidationResult("Email Address is required.", new[] { "EmailAddress" })); } break; case "Vendor Administrator": if (String.IsNullOrWhiteSpace(this.Password)) { yield return(new ValidationResult("Password is required.", new[] { "Password" })); } if (String.IsNullOrWhiteSpace(this.EmailAddress)) { yield return(new ValidationResult("Email Address is required.", new[] { "EmailAddress" })); } if (VendorId == 0) { yield return(new ValidationResult("Vendor is required.", new[] { "VendorId" })); } break; case "Office Administrator": if (String.IsNullOrWhiteSpace(this.Password)) { yield return(new ValidationResult("Password is required.", new[] { "Password" })); } if (String.IsNullOrWhiteSpace(this.EmailAddress)) { yield return(new ValidationResult("Email Address is required.", new[] { "EmailAddress" })); } if (VendorId == 0) { yield return(new ValidationResult("Vendor is required.", new[] { "VendorId" })); } if (OfficeId == 0) { yield return(new ValidationResult("Office is required.", new[] { "OfficeId" })); } break; case "Door to Door": if (String.IsNullOrWhiteSpace(this.PhoneNumber)) { yield return(new ValidationResult("Phone Number is required.", new[] { "PhoneNumber" })); } if (this.OfficeId == 0) { yield return(new ValidationResult("Office is required.", new[] { "OfficeId" })); } if (this.VendorId == 0) { yield return(new ValidationResult("Vendor is required.", new[] { "VendorId" })); } if (this.Gender == "?") { yield return(new ValidationResult("Gender is required.", new[] { "Gender" })); } if (this.ShirtSize == "?") { yield return(new ValidationResult("Shirt Size is required.", new[] { "ShirtSize" })); } if (String.IsNullOrWhiteSpace(this.City)) { yield return(new ValidationResult("City is required.", new[] { "City" })); } if (String.IsNullOrWhiteSpace(this.State)) { yield return(new ValidationResult("State is required.", new[] { "State" })); } break; case "Telesales": if (String.IsNullOrWhiteSpace(this.PhoneNumber)) { yield return(new ValidationResult("Phone Number is required.", new[] { "PhoneNumber" })); } if (this.OfficeId == 0) { yield return(new ValidationResult("Office is required.", new[] { "OfficeId" })); } if (this.VendorId == 0) { yield return(new ValidationResult("Vendor is required.", new[] { "VendorId" })); } //if (String.IsNullOrWhiteSpace(this.SSN)) // yield return new ValidationResult("Last 4 of SSN is required.", new[] { "SSN" }); //if (String.IsNullOrWhiteSpace(this.City)) // yield return new ValidationResult("City is required.", new[] { "City" }); //if (String.IsNullOrWhiteSpace(this.State)) // yield return new ValidationResult("State is required.", new[] { "State" }); //if (DateTime.Compare(this.BirthDate , new DateTime(0001, 1, 1, 0, 0, 0)) == 0) // yield return new ValidationResult("Birthdate is required.", new[] { "BirthDate" }); break; case "Sales Administrator": break; default: yield return(new ValidationResult("Invalid User Type")); break; } if ( (oldUser == null && VendorId.GetValueOrDefault(0) == 0 && AppLogic.GetUser(Username) != null) || //client admin or vendor admin agent id already exists (oldUser == null && VendorId.GetValueOrDefault(0) > 0 && AppLogic.GetVendorUser(Username, VendorId.Value) != null) || //std user and agent id already exists for vendor (oldUser != null && VendorId.GetValueOrDefault(0) == 0 && oldUser.AgentId != this.Username && AppLogic.GetUser(Username) != null) || //client admin or vendor admin agent id that changed already exists (oldUser != null && VendorId.GetValueOrDefault(0) > 0 && oldUser.AgentId != this.Username && AppLogic.GetVendorUser(Username, VendorId.Value) != null)) //std user that agent id changed and agent id already exists for vendor { yield return(new ValidationResult("Username is already assigned.", new[] { "Username" })); } }
public static VendorId GetVendorId(this IoBuffer buffer) { VendorId obj = new VendorId(); buffer.GetVendorId(ref obj); return obj; }
public static void GetVendorId(this IoBuffer buffer, ref VendorId obj) { obj.Byte0 = buffer.Get(); obj.Byte1 = buffer.Get(); }
public static void PutVendorId(this IoBuffer buffer, VendorId obj) { buffer.Put(obj.ToBytes()); }
/// <summary> /// Initializes a new instance of the <see cref="VorwerkInterface" /> class. /// </summary> /// <param name="username">The username.</param> /// <param name="password">The password.</param> /// <param name="vendor">The vendor (Vorwerk by default or Neato).</param> public VorwerkInterface(string username, string password, VendorId vendor = VendorId.Vorwerk) { this.Username = username; this.Password = password; this.Vendor = vendor; }
public override string ToString() { return("Vendor 0x" + VendorId.ToString("X") + " - Device 0x" + DeviceId.ToString("X")); }