コード例 #1
0
 public EndOfServicesVacationsBLL MapEndOfServiceVacation(EndOfServicesVacations EndOfServiceVacation)
 {
     try
     {
         EndOfServicesVacationsBLL EndOfServiceVacationBLL = null;
         if (EndOfServiceVacation != null)
         {
             EndOfServiceVacationBLL = new EndOfServicesVacationsBLL()
             {
                 EndOfServiceVacationID = EndOfServiceVacation.EndOfServiceVacationID,
                 VacationStartDate      = EndOfServiceVacation.VacationStartDate,
                 VacationEndDate        = EndOfServiceVacation.VacationEndDate
             };
             if (EndOfServiceVacation.VacationsTypes != null)
             {
                 EndOfServiceVacationBLL.VacationType = new VacationsTypesBLL().MapVacationsTypes(EndOfServiceVacation.VacationsTypes);
             }
             if (EndOfServiceVacation.EndOfServices != null)
             {
                 EndOfServiceVacationBLL.EndOfService = new EndOfServicesBLL().MapEndOfService(EndOfServiceVacation.EndOfServices);
             }
         }
         return(EndOfServiceVacationBLL);
     }
     catch
     {
         throw;
     }
 }
コード例 #2
0
        public virtual Result Update()
        {
            Result result = new Result();
            EndOfServicesVacations EndOfServiceVacation = new EndOfServicesVacations();

            EndOfServiceVacation.EndOfServiceVacationID = this.EndOfServiceVacationID;
            EndOfServiceVacation.VacationStartDate      = this.VacationStartDate;
            EndOfServiceVacation.VacationEndDate        = this.VacationEndDate;
            EndOfServiceVacation.EndOfServiceID         = this.EndOfService.EndOfServiceID;
            EndOfServiceVacation.VacationTypeID         = this.VacationType.VacationTypeID;
            EndOfServiceVacation.LastUpdatedDate        = DateTime.Now;
            EndOfServiceVacation.LastUpdatedBy          = this.LoginIdentity.EmployeeCodeID;
            this.EndOfServiceVacationID = new EndOfServicesVacationsDAL().Update(EndOfServiceVacation);
            if (this.EndOfServiceVacationID != 0)
            {
                result.Entity     = this;
                result.EnumType   = typeof(LookupsValidationEnum);
                result.EnumMember = LookupsValidationEnum.Done.ToString();
            }
            return(result);
        }
コード例 #3
0
        public virtual Result Add()
        {
            Result result = null;

            result = new Result();

            #region Check if vacation after his endOfService date.
            EndOfServicesBLL EndOfServicesBLL = new EndOfServicesBLL().GetByEndOfServiceID(this.EndOfService.EndOfServiceID);
            if (EndOfServicesBLL.EndOfServiceDate < this.VacationEndDate)
            {
                result.Entity     = this;
                result.EnumType   = typeof(EndOfServicesVacationsValidationEnum);
                result.EnumMember = EndOfServicesVacationsValidationEnum.RejectedBecauseOfVacationEndDateBiggerThanEndOfServiceDate.ToString();
                return(result);
            }
            #endregion



            EndOfServicesVacations EndOfServiceVacation = new EndOfServicesVacations();
            EndOfServiceVacation.VacationStartDate = this.VacationStartDate;
            EndOfServiceVacation.VacationEndDate   = this.VacationEndDate;
            EndOfServiceVacation.EndOfServiceID    = this.EndOfService.EndOfServiceID;
            EndOfServiceVacation.VacationTypeID    = this.VacationType.VacationTypeID;
            EndOfServiceVacation.CreatedDate       = DateTime.Now;
            EndOfServiceVacation.CreatedBy         = this.LoginIdentity.EmployeeCodeID;

            this.EndOfServiceVacationID = new EndOfServicesVacationsDAL().Insert(EndOfServiceVacation);
            if (this.EndOfServiceVacationID != 0)
            {
                result.Entity     = this;
                result.EnumType   = typeof(LookupsValidationEnum);
                result.EnumMember = LookupsValidationEnum.Done.ToString();
            }

            return(result);
        }