Exemple #1
0
 public BusinessTrip(BusinessTrip businessTrip)
 {
     BusinessTripID      = businessTrip.BusinessTripID;
     BTof                = businessTrip.BTof;
     CancelComment       = businessTrip.CancelComment;
     Comment             = businessTrip.Comment;
     EmployeeID          = businessTrip.EmployeeID;
     EndDate             = businessTrip.EndDate;
     Flights             = businessTrip.Flights;
     FlightsConfirmed    = businessTrip.FlightsConfirmed;
     Habitation          = businessTrip.Habitation;
     HabitationConfirmed = businessTrip.HabitationConfirmed;
     Invitation          = businessTrip.Invitation;
     LocationID          = businessTrip.LocationID;
     UnitID              = businessTrip.UnitID;
     Unit                = businessTrip.Unit;
     Manager             = businessTrip.Manager;
     OldEndDate          = businessTrip.OldEndDate;
     OldLocationID       = businessTrip.OldLocationID;
     OldLocationTitle    = businessTrip.OldLocationTitle;
     OldStartDate        = businessTrip.OldStartDate;
     Purpose             = businessTrip.Purpose;
     RejectComment       = businessTrip.RejectComment;
     AccComment          = businessTrip.AccComment;
     BTMComment          = businessTrip.BTMComment;
     Responsible         = businessTrip.Responsible;
     StartDate           = businessTrip.StartDate;
     Status              = businessTrip.Status;
     LastCRUDedBy        = businessTrip.LastCRUDedBy;
     LastCRUDTimestamp   = businessTrip.LastCRUDTimestamp;
     OrderStartDate      = businessTrip.OrderStartDate;
     OrderEndDate        = businessTrip.OrderEndDate;
     RowVersion          = businessTrip.RowVersion;
     Location            = businessTrip.Location;
     DaysInBtForOrder    = businessTrip.DaysInBtForOrder;
 }
Exemple #2
0
        public List <string> PrepareToXLSExportVisasVU()
        {
            List <string> stringifiedProperties = new List <string>();

            stringifiedProperties.Add(this.EID);
            if (this.DateDismissed != null)
            {
                stringifiedProperties.Add(this.LastName + " " + this.FirstName + "\r\n" + this.DateDismissed.Value.ToShortDateString());
            }
            else
            {
                stringifiedProperties.Add(this.LastName + " " + this.FirstName);
            }

            if (this.Passport != null)
            {
                if (this.Passport.EndDate.HasValue)
                {
                    stringifiedProperties.Add("till\r\n" + this.Passport.EndDate.Value.ToString(String.Format("dd.MM.yyyy")));
                }
                else
                {
                    stringifiedProperties.Add("yes");
                }
            }
            else
            {
                stringifiedProperties.Add("no");
            }

            if (this.Visa != null)
            {
                stringifiedProperties.Add(this.Visa.VisaType);
                stringifiedProperties.Add(this.Visa.StartDate.ToString(String.Format("yyyy-MM-dd")));
                stringifiedProperties.Add(this.Visa.DueDate.ToString(String.Format("yyyy-MM-dd")));

                if (this.Visa.Entries == 0)
                {
                    stringifiedProperties.Add("MULT");
                }
                else
                {
                    stringifiedProperties.Add(this.Visa.Entries.ToString() + "(" + (this.Visa.EntriesUsedInPrivateTrips.GetValueOrDefault() + this.Visa.EntriesUsedInBT.GetValueOrDefault() + this.Visa.CorrectionForVisaEntries.GetValueOrDefault()).ToString() + ")");
                }

                stringifiedProperties.Add(this.Visa.Days.ToString() + "(" + (this.Visa.DaysUsedInPrivateTrips.GetValueOrDefault() + this.Visa.DaysUsedInBT.GetValueOrDefault() + this.Visa.CorrectionForVisaDays.GetValueOrDefault()).ToString() + ")");
            }
            else
            {
                stringifiedProperties.Add("");
                stringifiedProperties.Add("No Visa");
                stringifiedProperties.Add("No Visa");
                stringifiedProperties.Add("");
                stringifiedProperties.Add("");
            }

            if (this.VisaRegistrationDate != null && this.VisaRegistrationDate.RegistrationDate != null && this.VisaRegistrationDate.RegistrationDate.HasValue)
            {
                stringifiedProperties.Add(this.VisaRegistrationDate.RegistrationDate.Value.ToString(String.Format("dd.MM.yyyy")));
            }
            else
            {
                stringifiedProperties.Add("");
            }

            if (this.Permit != null)
            {
                if (this.Permit.Number != null || this.Permit.StartDate != null || this.Permit.EndDate != null)
                {
                    stringifiedProperties.Add(this.Permit.Number ?? "");

                    if (this.Permit.IsKartaPolaka)
                    {
                        if (this.Permit.StartDate != null && this.Permit.EndDate != null)
                        {
                            stringifiedProperties.Add("Karta Polaka" + "\r\n" + this.Permit.StartDate.Value.ToString(String.Format("dd.MM.yyyy")) + " - " + this.Permit.EndDate.Value.ToString(String.Format("dd.MM.yyyy")));
                        }
                        else
                        {
                            stringifiedProperties.Add("Karta Polaka");
                        }
                    }
                    else
                    {
                        stringifiedProperties.Add(this.Permit.StartDate.Value.ToShortDateString() + " - " + this.Permit.EndDate.Value.ToShortDateString());
                    }
                }
                else
                {
                    stringifiedProperties.Add("");
                    if (this.Permit.IsKartaPolaka == true && this.Permit.Number == null && this.Permit.StartDate == null && this.Permit.EndDate == null)
                    {
                        stringifiedProperties.Add("Karta Polaka");
                    }
                    else
                    {
                        stringifiedProperties.Add("");
                    }
                }
            }
            else
            {
                stringifiedProperties.Add("");
                stringifiedProperties.Add("No Permit");
            }

            if (this.BusinessTrips != null)
            {
                BusinessTrip lastBT = this.BusinessTrips
                                      .Where(b => (b.EndDate < DateTime.Now.ToLocalTimeAzure().Date) &&
                                             (b.Status == (BTStatus.Confirmed | BTStatus.Reported)))
                                      .OrderBy(b => b.EndDate)
                                      .LastOrDefault();
                if (lastBT != null)
                {
                    stringifiedProperties.Add(lastBT.Location.Title + ":" + lastBT.StartDate.ToString("dd.MM.yy") + " - " + lastBT.EndDate.ToString("dd.MM.yy"));
                }
                else
                {
                    stringifiedProperties.Add("");
                }
            }
            else
            {
                stringifiedProperties.Add("");
            }

            if (this.Permit != null && this.Permit.EndDate != null)
            {
                DateTime StartingPoint = DisplayPermitStatusHelper.GetStartingDateTimePointForPermitExpiration(this);
                if (DisplayPermitStatusHelper.Is90DaysAndAbove(StartingPoint))
                {
                    stringifiedProperties.Add("Contact Gov");
                }

                else if (DisplayPermitStatusHelper.Is60ToLessThan90Days(StartingPoint))
                {
                    stringifiedProperties.Add("Contact Gov");
                }

                else if (this.Permit.ProlongRequestDate != null)
                {
                    stringifiedProperties.Add(this.Permit.ProlongRequestDate.Value.ToString(String.Format("dd.MM.yyyy")));
                }

                else if (this.Permit.CancelRequestDate != null)
                {
                    stringifiedProperties.Add(this.Permit.CancelRequestDate.Value.ToString(String.Format("dd.MM.yyyy")));
                }
            }
            else
            {
                stringifiedProperties.Add("");
            }
            return(stringifiedProperties);
        }