Esempio n. 1
0
        public override void SetLine(int line, string message)
        {
            LogDebug("(IDisplay) ImonLcd.SetLine() called");
            if (message == null)
            {
                LogDebug("(IDisplay) ImonLcd.SetDefaults(): empty message, return");
                return;
            }

            int lineToCheckFirst, lineToCheckSecond;

            if (g_Player.Player != null && g_Player.Player.Playing)
            {
                LogDebug("(IDisplay) ImonLcd.SetLine(): determing line to display during playback");
                if (_preferLine1Playback)
                {
                    lineToCheckFirst  = 0;
                    lineToCheckSecond = 1;
                }
                else
                {
                    lineToCheckFirst  = 1;
                    lineToCheckSecond = 0;
                }
            }
            else
            {
                LogDebug("(IDisplay) ImonLcd.SetLine(): determine line to display during general use");
                if (_preferLine1General)
                {
                    lineToCheckFirst  = 0;
                    lineToCheckSecond = 1;
                }
                else
                {
                    lineToCheckFirst  = 1;
                    lineToCheckSecond = 0;
                }
            }
            LogDebug("(IDisplay) ImonLcd.SetLine(): preferred 0-based line: " + lineToCheckFirst);

            if (line == lineToCheckFirst)
            {
                Line1 = message;
                IDW_SetLcdText(Line1);
                LogDebug("(IDisplay) ImonLcd.SetLine(): displaying 0-based line (first choice): " + line + ", message: " + Line1);
            }
            else if (line == lineToCheckSecond)
            {
                if (Line1.Trim().Length == 0 && message.Length > 0)
                {
                    Line1 = message;
                    IDW_SetLcdText(Line1);
                    LogDebug("(IDisplay) ImonLcd.SetLine(): displaying 0-based line (second choice): " + line + ", message: " + Line1);
                }
            }
            LogDebug("(IDisplay) ImonLcd.SetDefaults() completed");
        }
Esempio n. 2
0
        public bool IsPOBox()
        {
            bool result = false;

            string check = Line1.Trim().ToLower();

            if (check.Contains("p.o. box"))
            {
                return(true);
            }
            if (check.Contains("po box"))
            {
                return(true);
            }
            if (check.Contains("p o box"))
            {
                return(true);
            }
            if (check.Contains("p.o.box"))
            {
                return(true);
            }
            if (check.Contains("p.o box"))
            {
                return(true);
            }
            if (check.Contains("po. box"))
            {
                return(true);
            }
            if (check.Contains("p-o box"))
            {
                return(true);
            }
            if (check.Contains("pobox"))
            {
                return(true);
            }
            if (check.Contains(" po "))
            {
                return(true);
            }
            if (check.Contains(" box "))
            {
                return(true);
            }

            return(result);
        }
Esempio n. 3
0
        public override bool Equals(object obj)
        {
            if (!(obj is Address))
            {
                throw new ArgumentException("Object is not of the correct Type", nameof(obj));
            }

            Address updated = obj as Address;

            return(Description.Trim() == updated.Description.Trim() &&
                   (Line1?.Trim() ?? "") == (updated.Line1?.Trim() ?? "") &&
                   (Line2?.Trim() ?? "") == (updated.Line2?.Trim() ?? "") &&
                   (City?.Trim() ?? "") == (updated.City?.Trim() ?? "") &&
                   (State?.Trim() ?? "") == (updated.State?.Trim() ?? "") &&
                   (ZipCode?.Trim() ?? "") == (updated.ZipCode?.Trim() ?? ""));
        }
Esempio n. 4
0
        public bool IsValid()
        {
            bool result = true;

            if (FirstName.Trim().Length < 1)
            {
                result = false;
            }
            if (LastName.Trim().Length < 1)
            {
                result = false;
            }
            if (Line1.Trim().Length < 1)
            {
                result = false;
            }
            if (CountryBvin.Trim().Length < 1)
            {
                result = false;
            }
            if (CountryName.Trim().Length < 1)
            {
                result = false;
            }
            if (CountryBvin == "bf7389a2-9b21-4d33-b276-23c9c18ea0c0")
            {
                if (RegionBvin.Trim().Length < 1)
                {
                    if (RegionName.Trim().Length < 1)
                    {
                        result = false;
                    }
                }
            }
            if (_PostalCode.Trim().Length < 1)
            {
                result = false;
            }

            return(result);
        }
Esempio n. 5
0
        /// <summary>
        ///     Allows you to compare another address object to determine if the two addresses are the same.
        /// </summary>
        /// <param name="a2">Another address object.</param>
        /// <returns>If true, the current address matches the address in the parameter.</returns>
        public bool IsEqualTo(Address a2)
        {
            if (a2 == null)
            {
                return(false);
            }

            var result = true;

            if (string.Compare(NickName.Trim(), a2.NickName.Trim(), true, CultureInfo.InvariantCulture) != 0)
            {
                result = false;
            }
            if (string.Compare(FirstName.Trim(), a2.FirstName.Trim(), true, CultureInfo.InvariantCulture) != 0)
            {
                result = false;
            }
            if (string.Compare(MiddleInitial.Trim(), a2.MiddleInitial.Trim(), true, CultureInfo.InvariantCulture) != 0)
            {
                result = false;
            }
            if (string.Compare(LastName.Trim(), a2.LastName.Trim(), true, CultureInfo.InvariantCulture) != 0)
            {
                result = false;
            }
            if (string.Compare(Company.Trim(), a2.Company.Trim(), true, CultureInfo.InvariantCulture) != 0)
            {
                result = false;
            }
            if (string.Compare(Line1.Trim(), a2.Line1.Trim(), true, CultureInfo.InvariantCulture) != 0)
            {
                result = false;
            }
            if (string.Compare(Line2.Trim(), a2.Line2.Trim(), true, CultureInfo.InvariantCulture) != 0)
            {
                result = false;
            }
            if (string.Compare(Line3.Trim(), a2.Line3.Trim(), true, CultureInfo.InvariantCulture) != 0)
            {
                result = false;
            }
            if (string.Compare(RegionBvin.Trim(), a2.RegionBvin.Trim(), true, CultureInfo.InvariantCulture) != 0)
            {
                result = false;
            }
            if (string.Compare(City.Trim(), a2.City.Trim(), true, CultureInfo.InvariantCulture) != 0)
            {
                result = false;
            }
            if (string.Compare(PostalCode.Trim(), a2.PostalCode.Trim(), true, CultureInfo.InvariantCulture) != 0)
            {
                result = false;
            }
            if (string.Compare(CountryBvin.Trim(), a2.CountryBvin.Trim(), true, CultureInfo.InvariantCulture) != 0)
            {
                result = false;
            }
            if (string.Compare(Phone.Trim(), a2.Phone.Trim(), true, CultureInfo.InvariantCulture) != 0)
            {
                result = false;
            }
            if (string.Compare(Fax.Trim(), a2.Fax.Trim(), true, CultureInfo.InvariantCulture) != 0)
            {
                result = false;
            }
            if (string.Compare(WebSiteUrl.Trim(), a2.WebSiteUrl.Trim(), true, CultureInfo.InvariantCulture) != 0)
            {
                result = false;
            }
            //if (this.Residential != a2.Residential) {
            //    result = false;
            //}

            return(result);
        }