Ejemplo n.º 1
0
        /// <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

                        );
Ejemplo n.º 2
0
        /// <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);
        }
Ejemplo n.º 3
0
 public InfoSource(GuidPrefix guidPrefix)
     : base(SubMessageKind.INFO_SRC)
 {
     this.protocolVersion = ProtocolVersion.PROTOCOLVERSION_2_1;
     this.vendorId = VendorId.VENDORID_UNKNOWN;
     this.guidPrefix = guidPrefix;
 }
Ejemplo n.º 4
0
        /// <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);
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
        public override int GetHashCode()
        {
            var hashCode = -810527825;

            hashCode = hashCode * -1521134295 + VendorId.GetHashCode();
            hashCode = hashCode * -1521134295 + ProductId.GetHashCode();
            return(hashCode);
        }
Ejemplo n.º 7
0
 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);
     }));
 }
Ejemplo n.º 10
0
 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);
     }));
 }
Ejemplo n.º 11
0
        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());
        }
Ejemplo n.º 12
0
 /// <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(
         "==============================================================================================================");
 }
Ejemplo n.º 13
0
        /// <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);
        }
Ejemplo n.º 14
0
        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}");
            }
        }
Ejemplo n.º 15
0
        /// <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))));
        }
Ejemplo n.º 16
0
        /// <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));
            }
        }
Ejemplo n.º 17
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()));
        }
Ejemplo n.º 18
0
        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()));
        }
Ejemplo n.º 19
0
        /// <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));
        }
Ejemplo n.º 20
0
 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();
 }
Ejemplo n.º 21
0
 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);
 }
Ejemplo n.º 22
0
        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);
        }
Ejemplo n.º 23
0
        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);
        }
Ejemplo n.º 24
0
        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" }));
            }
        }
Ejemplo n.º 25
0
 public static VendorId GetVendorId(this IoBuffer buffer)
 {
     VendorId obj = new VendorId();
     buffer.GetVendorId(ref obj);
     return obj;
 }
Ejemplo n.º 26
0
 public static void GetVendorId(this IoBuffer buffer, ref VendorId obj)
 {
     obj.Byte0 = buffer.Get();
     obj.Byte1 = buffer.Get();
 }
Ejemplo n.º 27
0
 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;
 }
Ejemplo n.º 29
0
 public override string ToString()
 {
     return("Vendor 0x" + VendorId.ToString("X") + " - Device 0x" + DeviceId.ToString("X"));
 }