Пример #1
0
        public int CompareToByCompletionDate(ITask task)
        {
            bool isSameDate = true;

            if (CompletionDate.Year != task.CompletionDate.Year ||
                CompletionDate.DayOfYear != task.CompletionDate.DayOfYear)
            {
                isSameDate = false;
            }

            if (!isSameDate)
            {
                if (CompletionDate == DateTime.MinValue)
                {
                    // No completion date set for some reason.  Since we already
                    // tested to see if the dates were the same above, we know
                    // that the passed-in task has a CompletionDate set, so the
                    // passed-in task should be "higher" in the sort.
                    return(1);
                }
                else if (task.CompletionDate == DateTime.MinValue)
                {
                    // "this" task has a completion date and should evaluate
                    // higher than the passed-in task which doesn't have a
                    // completion date.
                    return(-1);
                }

                return(CompletionDate.CompareTo(task.CompletionDate));
            }

            // The completion dates are the same, so no sort based on other
            // things.
            return(CompareByPriorityAndName(task));
        }
Пример #2
0
        public IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
        {
            DateTime completionDateTime = CompletionDate.AddHours(CompletionTime.Hour)
                                          .AddMinutes(CompletionTime.Minute);

            if (completionDateTime < DateTime.Now)
            {
                yield return(new ValidationResult("The completion date cannot be less than the current date!",
                                                  new[] { nameof(CompletionDate), nameof(CompletionTime) }));
            }
        }
Пример #3
0
 public override int GetHashCode()
 {
     unchecked
     {
         int result = (CompletionDate != null ? CompletionDate.GetHashCode() : 0);
         result = (result * 397) ^ (Institution != null ? Institution.GetHashCode() : 0);
         result = (result * 397) ^ (Degree != null ? Degree.GetHashCode() : 0);
         result = (result * 397) ^ (Major != null ? Major.GetHashCode() : 0);
         result = (result * 397) ^ (Description != null ? Description.GetHashCode() : 0);
         result = (result * 397) ^ (City != null ? City.GetHashCode() : 0);
         result = (result * 397) ^ (Country != null ? Country.GetHashCode() : 0);
         return(result);
     }
 }
 public void MergeFrom(ApplicantEducationReply other)
 {
     if (other == null)
     {
         return;
     }
     if (other.Id.Length != 0)
     {
         Id = other.Id;
     }
     if (other.Applicant.Length != 0)
     {
         Applicant = other.Applicant;
     }
     if (other.Majot.Length != 0)
     {
         Majot = other.Majot;
     }
     if (other.CertificateDiploma.Length != 0)
     {
         CertificateDiploma = other.CertificateDiploma;
     }
     if (other.startDate_ != null)
     {
         if (startDate_ == null)
         {
             StartDate = new global::Google.Protobuf.WellKnownTypes.Timestamp();
         }
         StartDate.MergeFrom(other.StartDate);
     }
     if (other.completionDate_ != null)
     {
         if (completionDate_ == null)
         {
             CompletionDate = new global::Google.Protobuf.WellKnownTypes.Timestamp();
         }
         CompletionDate.MergeFrom(other.CompletionDate);
     }
     if (other.CompletionPercent != 0)
     {
         CompletionPercent = other.CompletionPercent;
     }
     if (other.TimeStamp.Length != 0)
     {
         TimeStamp = other.TimeStamp;
     }
     _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
 }
        public override int GetHashCode()
        {
            int hash = 1;

            if (Id.Length != 0)
            {
                hash ^= Id.GetHashCode();
            }
            if (Applicant.Length != 0)
            {
                hash ^= Applicant.GetHashCode();
            }
            if (Majot.Length != 0)
            {
                hash ^= Majot.GetHashCode();
            }
            if (CertificateDiploma.Length != 0)
            {
                hash ^= CertificateDiploma.GetHashCode();
            }
            if (startDate_ != null)
            {
                hash ^= StartDate.GetHashCode();
            }
            if (completionDate_ != null)
            {
                hash ^= CompletionDate.GetHashCode();
            }
            if (CompletionPercent != 0)
            {
                hash ^= CompletionPercent.GetHashCode();
            }
            if (TimeStamp.Length != 0)
            {
                hash ^= TimeStamp.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }