Beispiel #1
0
        // TO DO: Use numeric constants below
        public async Task <Associate> Load(AssociateId id)
        {
            await using SqlCommand cmd = Db.Connection.CreateCommand();
            cmd.CommandText            = "SELECT ID, DUNSNumber, LongName, ShortName, IsParent, BusinessAssociateType, StatusId FROM Associate" +
                                         " WHERE ID = " + id.Value;

            Db.Connection.Open();

            await using SqlDataReader reader = cmd.ExecuteReader();

            if (!reader.Read())
            {
                return(null);
            }

            Associate associate = new Associate(new AssociateId(Convert.ToInt32(reader[0])))
            {
                DUNSNumber    = DUNSNumber.Create(Convert.ToInt32(reader[1])),
                LongName      = LongName.Create(reader[2].ToString()),
                ShortName     = ShortName.Create(reader[3].ToString()),
                IsParent      = Convert.ToBoolean(reader[4]),
                AssociateType = (AssociateType)reader[5],
                Status        = (Status)reader[6]
            };

            return(associate);
        }
Beispiel #2
0
        /// <summary>
        /// Returns true if HoursAssignmentOwningUnit instances are equal
        /// </summary>
        /// <param name="other">Instance of HoursAssignmentOwningUnit to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(HoursAssignmentOwningUnit other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Code == other.Code ||
                     Code != null &&
                     Code.Equals(other.Code)
                     ) &&
                 (
                     ShortName == other.ShortName ||
                     ShortName != null &&
                     ShortName.Equals(other.ShortName)
                 ) &&
                 (
                     LongName == other.LongName ||
                     LongName != null &&
                     LongName.Equals(other.LongName)
                 ) &&
                 (
                     ExternalReference == other.ExternalReference ||
                     ExternalReference != null &&
                     ExternalReference.Equals(other.ExternalReference)
                 ));
        }
Beispiel #3
0
        /// <summary>
        /// Merges the given values into this instance.
        /// </summary>
        /// <param name="longName">Protocol long name.</param>
        /// <param name="shortName">Protocol short name.</param>
        /// <param name="filterName">Protocol filter name.</param>
        public void Merge(string longName, string shortName, string filterName)
        {
            if (!ShortName.Equals(shortName, StringComparison.OrdinalIgnoreCase))
            {
                throw new Exception(string.Format("Unable to merge duplicate protocols (short name conflict): {0}", shortName));
            }

            if (!string.IsNullOrEmpty(FilterName) && !string.IsNullOrEmpty(filterName) && !FilterName.Equals(filterName, StringComparison.OrdinalIgnoreCase))
            {
                throw new Exception(string.Format("Unable to merge duplicate protocols (filter name conflict): {0}", shortName));
            }

            if (string.IsNullOrEmpty(LongName))
            {
                LongName = longName;
            }
            else if (!longName.Equals(LongName, StringComparison.OrdinalIgnoreCase))
            {
                LongName = string.Concat(LongName, " / ", longName);
            }

            if (string.IsNullOrEmpty(FilterName))
            {
                FilterName = filterName;
            }
        }
            public BusinessViewModel(Business business)
            {
                ID        = business.BusinessID;
                ShortName = Name = business.BusinessName;
                CanSwitch = business.CanSwitchInto;
                Avatar    = new SmallEntityAvatarViewModel(ID, Name, business.BusinessImgUrl)
                            .DisableNameInclude();

                if (ShortName.Length > 15)
                {
                    ShortName = $"{ShortName.Substring(0, 12)}...";
                }

                if (business.CanSwitchInto && business.Warnings.HasValue)
                {
                    Warnings = $"{business.Warnings}";
                    if (business.UnreadWarnings.HasValue)
                    {
                        Warnings += $" ({business.UnreadWarnings} unread)";
                    }
                }

                if (business.CanSwitchInto && business.Messages.HasValue)
                {
                    Messages = $"{business.Messages}";
                    if (business.UnreadMessages.HasValue)
                    {
                        Messages += $" ({business.UnreadMessages} unread)";
                    }
                }
            }
Beispiel #5
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Code != null)
         {
             hashCode = hashCode * 59 + Code.GetHashCode();
         }
         if (ShortName != null)
         {
             hashCode = hashCode * 59 + ShortName.GetHashCode();
         }
         if (LongName != null)
         {
             hashCode = hashCode * 59 + LongName.GetHashCode();
         }
         if (ExternalReference != null)
         {
             hashCode = hashCode * 59 + ExternalReference.GetHashCode();
         }
         return(hashCode);
     }
 }
Beispiel #6
0
 public override int GetHashCode()
 {
     unchecked
     {
         return(((ShortName != null ? ShortName.GetHashCode() : 0) * 397) ^ (FullName != null ? FullName.GetHashCode() : 0));
     }
 }
Beispiel #7
0
            public Definition(FileDescriptor fileDesc, MessageDescriptor msgDesc, string type, string nameField, CommonResource common, IEnumerable <string> patterns)
            {
                MsgDesc  = msgDesc;
                FileName = fileDesc.Name;
                UnifiedResourceTypeName = type;
                var typeNameParts = type.Split('/');

                if (typeNameParts.Length != 2)
                {
                    throw new InvalidOperationException($"Invalid unified resource name: '{type}' used in message '{msgDesc?.Name}'");
                }
                ShortName = typeNameParts[1];
                FieldName = ShortName.ToLowerCamelCase();
                NameField = string.IsNullOrEmpty(nameField) ? "name" : nameField;
                DocName   = ShortName;
                Patterns  = patterns.Select(x => new Pattern(x)).ToList();
                if (patterns.Distinct().Count() != Patterns.Count)
                {
                    throw new InvalidOperationException("All patterns must be unique within a resource-name.");
                }
                IsCommon        = common != null;
                ResourceNameTyp = IsCommon ?
                                  Typ.Manual(common.CsharpNamespace, common.CsharpClassName) :
                                  Typ.Manual(fileDesc.CSharpNamespace(), $"{ShortName}Name");
                ResourceParserTyp = ResourceNameTyp;
                IsUnparsed        = false;
            }
Beispiel #8
0
 public override int GetHashCode()
 {
     unchecked
     {
         return(((ShortName?.GetHashCode() ?? 0) * 397) ^ (Code?.GetHashCode() ?? 0));
     }
 }
Beispiel #9
0
        public Framework(string targetName)
        {
            Assemblies    = new Dictionary <string, Version>();
            FrameworkName = new FrameworkName(targetName);
            var nugetFramework = new NuGetFramework(FrameworkName.Identifier, FrameworkName.Version);

            ShortName = nugetFramework.GetShortFolderName();

            if (ShortName.EndsWith(nugetFramework.Version.Major.ToString()) && nugetFramework.Version.Minor == 0)
            {
                // prefer a trailing zero
                ShortName += "0";
            }

            if (ShortName == "win" || ShortName == "netcore45")
            {
                // prefer the versioned short name
                ShortName = "win8";
            }

            if (ShortName == "netcore451")
            {
                ShortName = "win81";
            }
        }
Beispiel #10
0
 public User(Guid id, ShortName name, Email email)
 {
     Id    = id;
     Name  = name;
     Email = email;
     Roles = new RoleCollection();
 }
Beispiel #11
0
        /// <summary>
        /// Returns true if Grade instances are equal
        /// </summary>
        /// <param name="other">Instance of Grade to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Grade other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     LongName == other.LongName ||
                     LongName != null &&
                     LongName.Equals(other.LongName)
                     ) &&
                 (
                     ShortName == other.ShortName ||
                     ShortName != null &&
                     ShortName.Equals(other.ShortName)
                 ) &&
                 (
                     ExternalReference == other.ExternalReference ||
                     ExternalReference != null &&
                     ExternalReference.Equals(other.ExternalReference)
                 ));
        }
Beispiel #12
0
        public void AddLocation(string shortName, string locationName, string addressLine1, string addressLine2,
                                string city, string state, string zip)
        {
            GotoPracticeSettings();

            Location.Click();

            SearchGrid("celebration", 1);

            Thread.Sleep(1000);

            WaitForElementVisible <Locations>(30);

            Add.Click();

            ShortName.SendKeys(shortName);
            LocationName.SendKeys(locationName);
            AddressLine1.SendKeys(addressLine1);
            AddressLine2.SendKeys(addressLine2);
            City.SendKeys(city);
            State.Select(state);
            Zip.SendKeys(zip);

            Save.Click();

            Assert.AreEqual("Location saved successfully", Toastr.Text);
        }
Beispiel #13
0
        public string this[string columnName]
        {
            get
            {
                return(columnName switch
                {
                    "ShortName" when string.IsNullOrEmpty(ShortName.Trim()) => "Short Name can't be empty",

                    "LongName" when string.IsNullOrEmpty(LongName.Trim()) => "Long Name can't be empty",

                    "Age" when Age < 18 || Age > 100 => "Age must be between [18, 100]",

                    "Height" when Height < 100 || Height > 300 => "Height must be between [100, 300]",

                    "Weight" when Weight < 40 || Weight > 200 => "Weight must be between [40, 200]",

                    "Club" when string.IsNullOrEmpty(Club.Trim()) => "Club can't be empty",

                    "Nationality" when string.IsNullOrEmpty(Nationality.Trim()) => "Nationality can't be empty",

                    "Overall" when Overall < 0 || Overall > 100 => "Overall must be between [0, 100]",

                    "Potential" when Potential < 0 || Potential > 100 => "Potential must be between [0, 100]",

                    "SofifaID" when SofifaID < 0 => "SofifaID can't be negative",

                    "PlayerURL" when string.IsNullOrEmpty(PlayerURL.Trim()) => "Player URL can't be empty",

                    _ => null
                });
 public override void ToStream(Stream output)
 {
     output.Write(TLUtils.SignatureToBytes(Signature));
     Id.ToStream(output);
     ShortName.ToStream(output);
     SendMessage.ToStream(output);
 }
Beispiel #15
0
        /**
         * Create a {@link ShortName} object
         *
         * @param sValue
         *        The value to assign
         * @return Never <code>null</code>.
         */
        public static ShortName CreateShortName(string value)
        {
            ShortName shortName = new ShortName();

            shortName.Value = value;
            return(shortName);
        }
Beispiel #16
0
        private string GenerateIdShort()
        {
            var shortName = ShortName.GetDefault();
            var name      = shortName.Length > 0 ? shortName : PreferredName.GetDefault();

            return(Iec61360Utils.CreateIdShort(name));
        }
Beispiel #17
0
        /// <summary>
        /// Activate this switch when found
        /// </summary>
        /// <param name="arguments">Arguments from the command line.</param>
        public override bool TryActivate(Queue <string> arguments)
        {
            if (arguments == null)
            {
                throw new ArgumentNullException(nameof(arguments));
            }

            if (arguments.Count == 0)
            {
                return(false);
            }

            var arg = arguments.Peek();

            if (ShortName.Equals(arg, StringComparison.CurrentCultureIgnoreCase) ||
                AlternateShortName.Equals(arg, StringComparison.CurrentCultureIgnoreCase) ||
                LongName.Equals(arg, StringComparison.CurrentCultureIgnoreCase))
            {
                arguments.Dequeue();
                _method.Invoke(_instance, null);
                return(true);
            }

            return(false);
        }
Beispiel #18
0
        private void WriteDefinition(UdnWriter Writer)
        {
            List <string> Lines = new List <string>();

            Lines.Add(String.Format("enum {0}", ShortName.StartsWith("@")? "" : ShortName));
            Lines.Add(Utility.EscapeText("{"));
            if (Values.Count > 0)
            {
                int NamePadding = Values.Max(x => x.Name.Length) + 4;
                foreach (APIEnumValue Value in Values)
                {
                    string ValueLine = UdnWriter.TabSpaces + Value.Name;
                    if (Value.Initializer != null)
                    {
                        for (int Idx = 0; Idx < NamePadding - Value.Name.Length; Idx++)
                        {
                            ValueLine += UdnWriter.Space;
                        }
                        ValueLine += Value.Initializer;
                    }
                    Lines.Add(ValueLine + ",");
                }
            }
            Lines.Add(Utility.EscapeText("}"));

            WriteNestedSimpleCode(Writer, Lines);
        }
Beispiel #19
0
 public override int GetHashCode()
 {
     unchecked
     {
         return(((ShortName != null ? ShortName.GetHashCode() : 0) * 397) ^ IsImporting.GetHashCode());
     }
 }
 public override int GetHashCode()
 {
     unchecked
     {
         return((ShortName.GetHashCode() * 397) ^ TreeOffset);
     }
 }
Beispiel #21
0
        // TO DO:  The number of parameters here is obviously ridiculous... but is consistent with DDD
        //   principles
        public static Customer Create(int customerId, DateTime startDate, DateTime endDate, int statusCodeId, int nominationLevelId,
                                      AccountNumber accountNumber, int customerTypeId, int deliveryTypeId, DUNSNumber dunsNumber, LongName longName,
                                      ShortName shortName, DatabaseId ldcId, int lossTierId, DatabaseId deliveryLocation, int shipperId,
                                      DeliveryPressure deliveryPressure, MDQ mdq, MaxHourlyInterruptible maxHourlyInterruptible,
                                      MaxDailyInterruptible maxDailyInterruptible, HourlyInterruptible hourlyInterruptible,
                                      DailyInterruptible dailyInterruptible, TotalHourlySpecifiedFirm totalHourlySpecifiedFirm,
                                      TotalDailySpecifiedFirm totalDailySpecifiedFirm, InterstateSpecifiedFirm interstateSpecifiedFirm,
                                      IntrastateSpecifiedFirm intrastateSpecifiedFirm, CurrentDemand currentDemand, PreviousDemand previousDemand,
                                      int groupTypeId, int balancingLevelId, NAICSCode naicsCode, SICCode sicCode,
                                      SICCodePercentage sicCodePercentage, DateTime shippersLetterFromDate, DateTime shippersLetterToDate,
                                      bool ss1, bool isFederal, DateTime turnOffDate, DateTime turnOnDate)
        {
            DebugLog.Log("Entering Customer::Create");

            return(new Customer
            {
                Id = customerId,
                AccountNumber = accountNumber,
                AlternateCustomerId = null,
                BalancingLevelId = balancingLevelId,
                BasicPoolId = null,
                ContractTypeId = null,
                CurrentDemand = null,
                CustomerTypeId = customerTypeId,
                DailyInterruptible = dailyInterruptible,
                DeliveryLocation = deliveryLocation,
                DeliveryPressure = deliveryPressure,
                DeliveryTypeId = deliveryTypeId,
                DUNSNumber = dunsNumber,
                EndDate = endDate,
                GroupTypeId = groupTypeId,
                HourlyInterruptible = hourlyInterruptible,
                InterstateSpecifiedFirm = interstateSpecifiedFirm,
                IntrastateSpecifiedFirm = intrastateSpecifiedFirm,
                IsFederal = isFederal,
                LDCId = ldcId,
                LongName = longName,
                LossTierId = lossTierId,
                MaxDailyInterruptible = maxDailyInterruptible,
                MaxHourlyInterruptible = maxHourlyInterruptible,
                MDQ = mdq,
                NAICSCode = naicsCode,
                NominationLevelId = nominationLevelId,
                PreviousDemand = previousDemand,
                StartDate = startDate,
                StatusCodeId = statusCodeId,
                ShortName = shortName,
                ShipperId = shipperId,
                ShippersLetterFromDate = shippersLetterFromDate,
                ShippersLetterToDate = shippersLetterToDate,
                SICCode = sicCode,
                SICCodePercentage = sicCodePercentage,
                SS1 = ss1,
                TotalDailySpecifiedFirm = totalDailySpecifiedFirm,
                TotalHourlySpecifiedFirm = totalHourlySpecifiedFirm,
                TurnOffDate = turnOffDate,
                TurnOnDate = turnOnDate
            });
        }
 public override byte[] ToBytes()
 {
     return(TLUtils.Combine(
                TLUtils.SignatureToBytes(Signature),
                Id.ToBytes(),
                ShortName.ToBytes(),
                SendMessage.ToBytes()));
 }
Beispiel #23
0
 public User(ShortName name, Email email, Password password)
 {
     Id       = Guid.NewGuid();
     Name     = name;
     Email    = email;
     Password = password;
     Roles    = new RoleCollection();
 }
Beispiel #24
0
 /// <summary>
 /// Logical or Short Name of DLMS object.
 /// </summary>
 /// <returns></returns>
 public override string ToString()
 {
     if (ShortName != 0)
     {
         return(ShortName.ToString() + " " + Description);
     }
     return(LogicalName + " " + Description);
 }
Beispiel #25
0
 public Agent(DUNSNumber dunsNumber, LongName longName, ShortName shortName,
              ExternalAssociateType externalBusinessAssociateType) : base(dunsNumber, longName, shortName, externalBusinessAssociateType)
 {
     DUNSNumber = dunsNumber;
     LongName   = longName;
     ShortName  = shortName;
     ExternalBusinessAssociateType = externalBusinessAssociateType;
 }
Beispiel #26
0
 public override void ToStream(Stream output)
 {
     output.Write(TLUtils.SignatureToBytes(Signature));
     Id.ToStream(output);
     AccessHash.ToStream(output);
     Title.ToStream(output);
     ShortName.ToStream(output);
 }
Beispiel #27
0
        /// <summary>
        /// Merges the given values into this instance.
        /// </summary>
        /// <param name="protocol">Parent protocol.</param>
        /// <param name="longName">Field long name.</param>
        /// <param name="shortName">Field short name.</param>
        /// <param name="description">Field description.</param>
        /// <param name="displayBase">Field display base.</param>
        /// <param name="bitmask">Field bitmask.</param>
        /// <param name="type">Field type.</param>
        public void Merge(TSharkProtocol protocol, string longName, string shortName, string description, string displayBase, string bitmask, Type type)
        {
            if (Protocol != protocol)
            {
                throw new Exception(string.Format("Unable to merge duplicate fields (protocol conflict): {0}", shortName));
            }

            if (!ShortName.Equals(shortName, StringComparison.OrdinalIgnoreCase))
            {
                throw new Exception(string.Format("Unable to merge duplicate fields (short name conflict): {0}", shortName));
            }

            if (Type != null && type != null && Type != type)
            {
                throw new Exception(string.Format("Unable to merge duplicate fields (type conflict): {0}", shortName));
            }

            if (Type == null)
            {
                Type = type;
            }

            if (string.IsNullOrEmpty(Bitmask))
            {
                Bitmask = bitmask;
            }
            else if (!bitmask.Equals(Bitmask, StringComparison.OrdinalIgnoreCase))
            {
                Bitmask = string.Concat(Bitmask, " / ", bitmask);
            }

            if (string.IsNullOrEmpty(LongName))
            {
                LongName = longName;
            }
            else if (!longName.Equals(LongName, StringComparison.OrdinalIgnoreCase))
            {
                LongName = string.Concat(LongName, " / ", longName);
            }

            if (string.IsNullOrEmpty(Description))
            {
                Description = description;
            }
            else if (!description.Equals(Description, StringComparison.OrdinalIgnoreCase))
            {
                Description = string.Concat(Description, " / ", description);
            }

            if (string.IsNullOrEmpty(DisplayBase))
            {
                DisplayBase = displayBase;
            }
            else if (!displayBase.Equals(DisplayBase, StringComparison.OrdinalIgnoreCase))
            {
                DisplayBase = string.Concat(DisplayBase, " / ", displayBase);
            }
        }
Beispiel #28
0
 public override bool Equals(Object obj)
 {
     if (obj is Executor ob)
     {
         return(Id.Equals(ob.Id) && Name.Equals(ob.Name) && ShortName.Equals(ob.ShortName) && Login.Equals(ob.Login) &&
                StructureId.Equals(ob.StructureId) && Activity.Equals(ob.Activity));
     }
     return(false);
 }
        public virtual int _GetUniqueIdentifier()
        {
            var hashCode = 399326290;

            hashCode = hashCode * -1521134295 + (Id?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (FullName?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (ShortName?.GetHashCode() ?? 0);
            return(hashCode);
        }
Beispiel #30
0
        /// <summary>
        /// Returns a value that indicates whether the current instance and a specified <see cref="CommandLine.NameInfo"/> have the same value.
        /// </summary>
        /// <param name="other">The <see cref="CommandLine.NameInfo"/> instance to compare.</param>
        /// <returns><value>true</value> if this instance of <see cref="CommandLine.NameInfo"/> and <paramref name="other"/> have the same value; otherwise, <value>false</value>.</returns>
        public bool Equals(NameInfo other)
        {
            if (other == null)
            {
                return(false);
            }

            return(ShortName.Equals(other.ShortName) && LongName.Equals(other.LongName));
        }