/// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            // credit: http://stackoverflow.com/a/263416/677735
            unchecked // Overflow is fine, just wrap
            {
                int hash = 41;

                // Suitable nullity checks
                hash = hash * 59 + Id.GetHashCode();

                if (LocalArea != null)
                {
                    hash = hash * 59 + LocalArea.GetHashCode();
                }

                if (EquipmentCount != null)
                {
                    hash = hash * 59 + EquipmentCount.GetHashCode();
                }

                if (EquipmentTypeName != null)
                {
                    hash = hash * 59 + EquipmentTypeName.GetHashCode();
                }

                if (ProjectName != null)
                {
                    hash = hash * 59 + ProjectName.GetHashCode();
                }

                if (PrimaryContact != null)
                {
                    hash = hash * 59 + PrimaryContact.GetHashCode();
                }

                if (Status != null)
                {
                    hash = hash * 59 + Status.GetHashCode();
                }

                if (ProjectId != null)
                {
                    hash = hash * 59 + ProjectId.GetHashCode();
                }

                if (ExpectedStartDate != null)
                {
                    hash = hash * 59 + ExpectedStartDate.GetHashCode();
                }

                if (ExpectedEndDate != null)
                {
                    hash = hash * 59 + ExpectedEndDate.GetHashCode();
                }

                return(hash);
            }
        }
Пример #2
0
        public EquipmentType SaveEquipmentType()
        {
            SqlDataReader      result;
            DatabaseConnection dbconn     = new DatabaseConnection();
            SqlCommand         command    = new SqlCommand();
            SqlConnection      connection = new SqlConnection(dbconn.SQLSEVERConnString);

            try
            {
                connection.Open();
                command.Connection  = connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "InsertUpdate_EquipmentType";
                command.Parameters.Add(dbconn.GenerateParameterObj("@EquipmentTypeID", SqlDbType.Int, EquipmentTypeID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@EquipmentTypeName", SqlDbType.VarChar, EquipmentTypeName.ToString(), 50));
                command.Parameters.Add(dbconn.GenerateParameterObj("@EquipmentTypeDescription", SqlDbType.Int, EquipmentTypeDescription.ToString(), 100));
                //    command.Parameters.Add(dbconn.GenerateParameterObj("@CharacterLevelArmor", SqlDbType.Int, CharacterLevelArmor.ToString(), 0));
                //    command.Parameters.Add(dbconn.GenerateParameterObj("@AbilityMod", SqlDbType.Int, AbilityMod.ToString(), 0));
                //    command.Parameters.Add(dbconn.GenerateParameterObj("@ClassMod", SqlDbType.Int, ClassMod.ToString(), 0));
                //    command.Parameters.Add(dbconn.GenerateParameterObj("@RaceMod", SqlDbType.Int, RaceMod.ToString(), 0));
                //    command.Parameters.Add(dbconn.GenerateParameterObj("@FeatTalentMod", SqlDbType.Int, FeatTalentMod.ToString(), 0));
                //    command.Parameters.Add(dbconn.GenerateParameterObj("@MiscellaneousMod", SqlDbType.Int, MiscellaneousMod.ToString(), 0));

                result = command.ExecuteReader();

                result.Read();
                SetReaderToObject(ref result);
            }
            catch
            {
                Exception e = new Exception();
                this._insertUpdateOK = false;
                this._insertUpdateMessage.Append(e.Message.ToString());
                throw e;
            }
            finally
            {
                command.Dispose();
                connection.Close();
            }
            return(this);
        }
        /// <summary>
        /// Returns true if RentalRequestSearchResultViewModel instances are equal
        /// </summary>
        /// <param name="other">Instance of RentalRequestSearchResultViewModel to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(RentalRequestSearchResultViewModel other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id.Equals(other.Id)
                     ) &&
                 (
                     LocalArea == other.LocalArea ||
                     LocalArea != null &&
                     LocalArea.Equals(other.LocalArea)
                 ) &&
                 (
                     EquipmentCount == other.EquipmentCount ||
                     EquipmentCount != null &&
                     EquipmentCount.Equals(other.EquipmentCount)
                 ) &&
                 (
                     EquipmentTypeName == other.EquipmentTypeName ||
                     EquipmentTypeName != null &&
                     EquipmentTypeName.Equals(other.EquipmentTypeName)
                 ) &&
                 (
                     ProjectName == other.ProjectName ||
                     ProjectName != null &&
                     ProjectName.Equals(other.ProjectName)
                 ) &&
                 (
                     PrimaryContact == other.PrimaryContact ||
                     PrimaryContact != null &&
                     PrimaryContact.Equals(other.PrimaryContact)
                 ) &&
                 (
                     Status == other.Status ||
                     Status != null &&
                     Status.Equals(other.Status)
                 ) &&
                 (
                     ProjectId == other.ProjectId ||
                     ProjectId != null &&
                     ProjectId.Equals(other.ProjectId)
                 ) &&
                 (
                     ExpectedStartDate == other.ExpectedStartDate ||
                     ExpectedStartDate != null &&
                     ExpectedStartDate.Equals(other.ExpectedStartDate)
                 ) &&
                 (
                     ExpectedEndDate == other.ExpectedEndDate ||
                     ExpectedEndDate != null &&
                     ExpectedEndDate.Equals(other.ExpectedEndDate)
                 ));
        }