Exemplo n.º 1
0
        public virtual DelegationsDetailsBLL GetDetails(int DetailID)
        {
            DelegationsDetailsBLL Obj = new DelegationsDetailsBLL();

            Obj.DetailID = DetailID;
            Obj          = new DelegationsDetailsBLL().GetDelegationsDetailsByDelegationDetailID(DetailID);
            return(Obj);
        }
Exemplo n.º 2
0
        public DelegationsDetailsBLL GetDelegationsDetailsByDelegationDetailID(int DelegationDetailID)
        {
            DelegationsDetails    DelegationsDetails    = new DelegationsDetailsDAL().GetDelegationsDetailsByDelegationDetailID(DelegationDetailID);
            DelegationsDetailsBLL DelegationsDetailsBLL = new DelegationsDetailsBLL();

            if (DelegationsDetails != null)
            {
                DelegationsDetailsBLL = new DelegationsDetailsBLL().MapDelegationDetail(DelegationsDetails);
            }

            return(DelegationsDetailsBLL);
        }
Exemplo n.º 3
0
        public Result Add(DelegationsDetailsBLL DelegationDetailBLL)
        {
            Result result = new Result();

            // validate employee already exists
            DelegationsDetails employee = new DelegationsDetailsDAL().GetDelegationsDetailsByDelegationID(DelegationDetailBLL.Delegation.DelegationID)
                                          .Where(d => d.EmployeeCareerHistoryID == DelegationDetailBLL.EmployeeCareerHistory.EmployeeCareerHistoryID).FirstOrDefault();

            if (employee != null)
            {
                result.Entity     = null;
                result.EnumType   = typeof(DelegationsValidationEnum);
                result.EnumMember = DelegationsValidationEnum.RejectedBecauseAlreadyExist.ToString();

                return(result);
            }

            // other validation
            result = new EmployeeDelegationBLL(DelegationDetailBLL.Delegation.DelegationStartDate, DelegationDetailBLL.Delegation.DelegationEndDate, DelegationDetailBLL.Delegation.DelegationKind.DelegationKindID, new EmployeesCodesBLL()
            {
                EmployeeCodeID = DelegationDetailBLL.EmployeeCareerHistory.EmployeeCode.EmployeeCodeID
            }).IsValid();

            if (result.EnumMember == DelegationsValidationEnum.Done.ToString())
            {
                result = new Result();
                DelegationsDetails DelegationDetail = new DelegationsDetails()
                {
                    DelegationID            = DelegationDetailBLL.Delegation.DelegationID,
                    EmployeeCareerHistoryID = DelegationDetailBLL.EmployeeCareerHistory.EmployeeCareerHistoryID,
                    CreatedDate             = DateTime.Now,
                    CreatedBy = DelegationDetailBLL.LoginIdentity.EmployeeCodeID,
                    IsPassengerOrderCompensation = DelegationDetailBLL.IsPassengerOrderCompensation
                };
                this.DelegationDetailID = new DelegationsDetailsDAL().Insert(DelegationDetail);
                if (this.DelegationDetailID != 0)
                {
                    result.Entity     = null;
                    result.EnumType   = typeof(DelegationsValidationEnum);
                    result.EnumMember = DelegationsValidationEnum.Done.ToString();
                }
            }
            return(result);
        }
Exemplo n.º 4
0
 internal DelegationsDetailsBLL MapDelegationDetail(DelegationsDetails DelegationDetail)
 {
     try
     {
         DelegationsDetailsBLL DelegationDetailBLL = null;
         if (DelegationDetail != null)
         {
             DelegationDetailBLL = new DelegationsDetailsBLL()
             {
                 DelegationDetailID           = DelegationDetail.DelegationDetailID,
                 Delegation                   = new BaseDelegationsBLL().MapDelegation(DelegationDetail.Delegations),
                 EmployeeCareerHistory        = new EmployeesCareersHistoryBLL().MapEmployeeCareerHistory(DelegationDetail.EmployeesCareersHistory),
                 IsPassengerOrderCompensation = DelegationDetail.IsPassengerOrderCompensation
             };
         }
         return(DelegationDetailBLL);
     }
     catch
     {
         throw;
     }
 }