예제 #1
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is Shift other &&
                   ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) &&
                   ((EmployeeId == null && other.EmployeeId == null) || (EmployeeId?.Equals(other.EmployeeId) == true)) &&
                   ((LocationId == null && other.LocationId == null) || (LocationId?.Equals(other.LocationId) == true)) &&
                   ((Timezone == null && other.Timezone == null) || (Timezone?.Equals(other.Timezone) == true)) &&
                   ((StartAt == null && other.StartAt == null) || (StartAt?.Equals(other.StartAt) == true)) &&
                   ((EndAt == null && other.EndAt == null) || (EndAt?.Equals(other.EndAt) == true)) &&
                   ((Wage == null && other.Wage == null) || (Wage?.Equals(other.Wage) == true)) &&
                   ((Breaks == null && other.Breaks == null) || (Breaks?.Equals(other.Breaks) == true)) &&
                   ((Status == null && other.Status == null) || (Status?.Equals(other.Status) == true)) &&
                   ((Version == null && other.Version == null) || (Version?.Equals(other.Version) == true)) &&
                   ((CreatedAt == null && other.CreatedAt == null) || (CreatedAt?.Equals(other.CreatedAt) == true)) &&
                   ((UpdatedAt == null && other.UpdatedAt == null) || (UpdatedAt?.Equals(other.UpdatedAt) == true)) &&
                   ((TeamMemberId == null && other.TeamMemberId == null) || (TeamMemberId?.Equals(other.TeamMemberId) == true)));
        }
예제 #2
0
        public void updateManhour()
        {
            TimeSpan span = EndAt.Subtract(StartAt);
            decimal  hour = new decimal(span.Hours);
            decimal  min  = new decimal(span.Minutes);

            min = decimal.Divide(min, 60);
            min = decimal.Round(min, 2);

            Manhour = hour + min;
        }
        public async void OnSaveClick(object sender, RoutedEventArgs e)
        {
            if (SaveBtn_IsEnabled)
            {
                DealPostModel model = new DealPostModel
                {
                    start_at    = StartAt.ToString("o"),
                    end_at      = EndAt.ToString("o"),
                    label       = Label,
                    description = Description
                };

                try
                {
                    var customer = await _api.PostDealWithRetryAsync(model);

                    if (customer != null)
                    {
                        Views.ShellPage.ShellFrame.Navigate(typeof(Views.DealsPage), customer);
                    }
                    else
                    {
                        var unknowErrordialog = new Windows.UI.Popups.MessageDialog(
                            "Une erreur est survenue",
                            "Erreur");
                        unknowErrordialog.Commands.Add(new Windows.UI.Popups.UICommand("Fermer")
                        {
                            Id = 0
                        });

                        unknowErrordialog.DefaultCommandIndex = 0;

                        var resultUnknow = await unknowErrordialog.ShowAsync();
                    }
                }
                catch (Exception ex)
                {
                    var dialog = new Windows.UI.Popups.MessageDialog(
                        ex.Message,
                        "Erreur"
                        );
                    dialog.Commands.Add(new Windows.UI.Popups.UICommand("Fermer")
                    {
                        Id = 0
                    });

                    dialog.DefaultCommandIndex = 0;

                    var result = await dialog.ShowAsync();
                }
            }
        }
예제 #4
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is Break other &&
                   ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) &&
                   ((StartAt == null && other.StartAt == null) || (StartAt?.Equals(other.StartAt) == true)) &&
                   ((EndAt == null && other.EndAt == null) || (EndAt?.Equals(other.EndAt) == true)) &&
                   ((BreakTypeId == null && other.BreakTypeId == null) || (BreakTypeId?.Equals(other.BreakTypeId) == true)) &&
                   ((Name == null && other.Name == null) || (Name?.Equals(other.Name) == true)) &&
                   ((ExpectedDuration == null && other.ExpectedDuration == null) || (ExpectedDuration?.Equals(other.ExpectedDuration) == true)) &&
                   IsPaid.Equals(other.IsPaid));
        }
예제 #5
0
        public override int GetHashCode()
        {
            int hashCode = 168552180;

            if (Id != null)
            {
                hashCode += Id.GetHashCode();
            }

            if (StartAt != null)
            {
                hashCode += StartAt.GetHashCode();
            }

            if (EndAt != null)
            {
                hashCode += EndAt.GetHashCode();
            }

            if (BreakTypeId != null)
            {
                hashCode += BreakTypeId.GetHashCode();
            }

            if (Name != null)
            {
                hashCode += Name.GetHashCode();
            }

            if (ExpectedDuration != null)
            {
                hashCode += ExpectedDuration.GetHashCode();
            }
            hashCode += IsPaid.GetHashCode();

            return(hashCode);
        }
예제 #6
0
        public override int GetHashCode()
        {
            int hashCode = -1338935965;

            if (Id != null)
            {
                hashCode += Id.GetHashCode();
            }

            if (EmployeeId != null)
            {
                hashCode += EmployeeId.GetHashCode();
            }

            if (LocationId != null)
            {
                hashCode += LocationId.GetHashCode();
            }

            if (Timezone != null)
            {
                hashCode += Timezone.GetHashCode();
            }

            if (StartAt != null)
            {
                hashCode += StartAt.GetHashCode();
            }

            if (EndAt != null)
            {
                hashCode += EndAt.GetHashCode();
            }

            if (Wage != null)
            {
                hashCode += Wage.GetHashCode();
            }

            if (Breaks != null)
            {
                hashCode += Breaks.GetHashCode();
            }

            if (Status != null)
            {
                hashCode += Status.GetHashCode();
            }

            if (Version != null)
            {
                hashCode += Version.GetHashCode();
            }

            if (CreatedAt != null)
            {
                hashCode += CreatedAt.GetHashCode();
            }

            if (UpdatedAt != null)
            {
                hashCode += UpdatedAt.GetHashCode();
            }

            if (TeamMemberId != null)
            {
                hashCode += TeamMemberId.GetHashCode();
            }

            return(hashCode);
        }
예제 #7
0
 public void Move(TimeSpan offset)
 {
     StartAt = StartAt.Add(offset);
     EndAt   = EndAt.Add(offset);
 }
예제 #8
0
 public CurrencyFetcher()
 {
     EndAt   = DateTime.Today;
     StartAt = EndAt.AddYears(-1);
 }