Ejemplo n.º 1
0
        public List <OverTimesDetailsBLL> GetOverTimeDetailsByOverTimeID(int id)
        {
            List <OverTimesDetails>    OverTimesDetailsList    = new OverTimesDetailsDAL().GetOverTimesDetailsByOverTimeID(id);
            List <OverTimesDetailsBLL> OverTimesDetailsBLLList = new List <OverTimesDetailsBLL>();

            if (OverTimesDetailsList.Count > 0)
            {
                foreach (var item in OverTimesDetailsList)
                {
                    OverTimesDetailsBLLList.Add(new OverTimesDetailsBLL()
                    {
                        OverTimeDetailID      = item.OverTimeDetailID,
                        EmployeeCareerHistory = new EmployeesCareersHistoryBLL().MapEmployeeCareerHistory(item.EmployeesCareersHistory),
                    });
                }
            }

            return(OverTimesDetailsBLLList);
        }
Ejemplo n.º 2
0
        public IQueryable <EmployeesOverTimesBasedOnAssigngingsDTO> GetEmployeesOverTimesBasedOnAssigningsAsRanksCategories(DateTime FromDate, DateTime ToDate, int OrganizationID)
        {
            try
            {
                List <int> OrganizationIDsList = new OrganizationsStructuresBLL().GetByOrganizationIDsWithhAllChilds(OrganizationID);
                DateTime   FromDateGr          = Convert.ToDateTime(Globals.Calendar.UmAlquraToGreg(string.Format("{0}/{1}/{2}", FromDate.Day, FromDate.Month, FromDate.Year)), new CultureInfo("en-US"));
                DateTime   ToDateGr            = Convert.ToDateTime(Globals.Calendar.UmAlquraToGreg(string.Format("{0}/{1}/{2}", ToDate.Day, ToDate.Month, ToDate.Year)), new CultureInfo("en-US"));
                List <vwActualEmployeesBasedOnAssignings> ActualEmployeesHaveOverTimes = new List <vwActualEmployeesBasedOnAssignings>();

                // Get actual employees Based On Assignings by date
                List <vwActualEmployeesBasedOnAssignings> ActualEmployeesBasedOnAssignings = new AssigningsDAL().GetActualEmployeeBasedOnAssignings().Where(x =>
                                                                                                                                                            // (FromDateGr.Date >= x.AssigningStartDate.Date && FromDateGr.Date <= (!x.AssigningEndDate.HasValue ? DateTime.Now.Date : x.AssigningEndDate.Value.Date))
                                                                                                                                                            (
                                                                                                                                                                (FromDateGr >= x.AssigningStartDate && FromDateGr <= (!x.AssigningEndDate.HasValue ? DateTime.Now.Date : x.AssigningEndDate.Value.Date)) ||
                                                                                                                                                                (ToDate >= x.AssigningStartDate && ToDate <= (!x.AssigningEndDate.HasValue ? DateTime.Now.Date : x.AssigningEndDate.Value.Date)) ||
                                                                                                                                                                (FromDateGr >= x.AssigningStartDate && ToDate <= (!x.AssigningEndDate.HasValue ? DateTime.Now.Date : x.AssigningEndDate.Value.Date)) ||
                                                                                                                                                                (FromDateGr <= x.AssigningStartDate && ToDate >= (!x.AssigningEndDate.HasValue ? DateTime.Now.Date : x.AssigningEndDate.Value.Date))
                                                                                                                                                            ) &&
                                                                                                                                                            OrganizationIDsList.Contains(x.OrganizationID.Value)).ToList();
                List <int> EmployeeCareerHistoryIDs = new List <int>();
                ActualEmployeesBasedOnAssignings.ForEach(x => EmployeeCareerHistoryIDs.Add(x.EmployeeCareerHistoryID.Value));

                List <OverTimesDetails> EmployeesDelegationsOfActualEmployeesList = new OverTimesDetailsDAL().GetEmployeesOverTimesByDate(FromDateGr, EmployeeCareerHistoryIDs);

                var query = EmployeesDelegationsOfActualEmployeesList.Select(y => new EmployeesOverTimesBasedOnAssigngingsDTO(y.EmployeesCareersHistory.EmployeesCodes.EmployeeCodeNo,
                                                                                                                              ActualEmployeesBasedOnAssignings.FirstOrDefault(x => x.EmployeeCodeID == y.EmployeesCareersHistory.EmployeeCodeID).EmployeeNameAr,
                                                                                                                              ActualEmployeesBasedOnAssignings.FirstOrDefault(x => x.EmployeeCodeID == y.EmployeesCareersHistory.EmployeeCodeID).OrganizationName,
                                                                                                                              ActualEmployeesBasedOnAssignings.FirstOrDefault(x => x.EmployeeCodeID == y.EmployeesCareersHistory.EmployeeCodeID).JobName,
                                                                                                                              ActualEmployeesBasedOnAssignings.FirstOrDefault(x => x.EmployeeCodeID == y.EmployeesCareersHistory.EmployeeCodeID).RankCategoryName,
                                                                                                                              ActualEmployeesBasedOnAssignings.FirstOrDefault(x => x.EmployeeCodeID == y.EmployeesCareersHistory.EmployeeCodeID).RankName,
                                                                                                                              y.OverTimes.OverTimeStartDate,
                                                                                                                              y.OverTimes.OverTimeEndDate,
                                                                                                                              ActualEmployeesBasedOnAssignings.FirstOrDefault(x => x.EmployeeCodeID == y.EmployeesCareersHistory.EmployeeCodeID).Sorting
                                                                                                                              ));

                return(query.AsQueryable());
            }
            catch
            {
                throw;
            }
        }
Ejemplo n.º 3
0
        public Result IsValid()
        {
            Result result;

            //#region Validation for OverTime Dates
            //FinancialYearsBLL FinancialYearBLL = new FinancialYearsBLL().GetByFinancialYear(this.OverTimes.OverTimeFiscalYear);
            //if (FinancialYearBLL != null)
            //{
            //    if (this.OverTimes.OverTimeStartDate < FinancialYearBLL.FinancialYearStartDate && this.OverTimes.OverTimeEndDate < FinancialYearBLL.FinancialYearStartDate)
            //    {
            //        FinancialYearBLL = new FinancialYearsBLL().GetByFinancialYear(this.OverTimes.OverTimeFiscalYear - 1);
            //    }
            //    if (this.OverTimes.OverTimeStartDate < FinancialYearBLL.FinancialYearStartDate || this.OverTimes.OverTimeEndDate > FinancialYearBLL.FinancialYearEndDate)
            //    {
            //        result.EnumType = typeof(OverTimeValidationEnum);
            //        result.EnumMember = OverTimeValidationEnum.RejectedBecauseOfOverTimeDatesMustBeInSameFinancialYear.ToString();
            //        result.Entity = FinancialYearBLL;
            //        return result;
            //    }
            //}
            //#endregion


            #region Validation for OverTimes Dates
            //CultureInfo cul = Thread.CurrentThread.CurrentCulture;
            //List<FinancialYearsBLL> FinancialYearsBLLList = new FinancialYearsBLL().GetFinancialYears();
            //if (new Globals.Calendar().IsGreg(FinancialYearsBLLList.FirstOrDefault().FinancialYearStartDate.ToString(System.Configuration.ConfigurationManager.AppSettings["DateFormat"].ToString())))
            //{
            //    FinancialYearsBLLList.ForEach(x => x.FinancialYearStartDate = Convert.ToDateTime(Globals.Calendar.GregToUmAlQura(x.FinancialYearStartDate)));
            //    FinancialYearsBLLList.ForEach(x => x.FinancialYearEndDate = Convert.ToDateTime(Globals.Calendar.GregToUmAlQura(x.FinancialYearEndDate)));
            //}

            //FinancialYearsBLL FinancialYearBLL = FinancialYearsBLLList.Where(x => this.OverTime.OverTimeStartDate >= x.FinancialYearStartDate && this.OverTime.OverTimeEndDate <= x.FinancialYearEndDate).FirstOrDefault();
            //if (FinancialYearBLL == null)
            //{
            //    FinancialYearBLL = FinancialYearsBLLList.FirstOrDefault(x => x.FinancialYearStartDate <= this.OverTime.OverTimeStartDate && x.FinancialYearEndDate >= this.OverTime.OverTimeEndDate);
            //    result.EnumType = typeof(OverTimeValidationEnum);
            //    result.EnumMember = OverTimeValidationEnum.RejectedBecauseOfOverTimeDatesMustBeInSameFinancialYear.ToString();
            //    result.Entity = FinancialYearBLL;
            //    return result;
            //}
            result = ExpensesBLL.IsValidExpenseActionInSameFinancialYear(this.OverTime.OverTimeStartDate, this.OverTime.OverTimeEndDate, new OverTimesBLL());
            if (result != null)
            {
                return(result);
            }
            #endregion

            /*  As per business no need to validate Trainings related delegation    */
            #region Validaion for employee Exist
            OverTimesDetails employee = new OverTimesDetailsDAL().GetOverTimesDetailsByOverTimeID(this.OverTime.OverTimeID).Where(d => d.EmployeeCareerHistoryID == this.EmployeeCareerHistory.EmployeeCareerHistoryID).FirstOrDefault();
            if (employee != null)
            {
                result.Entity     = null;
                result.EnumType   = typeof(OverTimeValidationEnum);
                result.EnumMember = OverTimeValidationEnum.RejectedBecauseAlreadyExist.ToString();

                return(result);
            }
            #endregion

            #region validate for Conflict With Other Process
            if (this.OverTime.OverTimesDays == null || this.OverTime.OverTimesDays.Count == 0)
            {
                result = CommonHelper.IsNoConflictWithOtherProcess(this.EmployeeCareerHistory.EmployeeCode.EmployeeCodeID,
                                                                   this.OverTime.OverTimeStartDate, this.OverTime.OverTimeEndDate, BusinessSubCategoriesEnum.Vacations);
                if (result != null)
                {
                    return(result);
                }
            }
            else
            {
                foreach (var item in this.OverTime.OverTimesDays)
                {
                    result = CommonHelper.IsNoConflictWithOtherProcess(this.EmployeeCareerHistory.EmployeeCode.EmployeeCodeID,
                                                                       item.OverTimeDay, item.OverTimeDay, BusinessSubCategoriesEnum.Vacations);
                    if (result != null)
                    {
                        return(result);
                    }
                }
            }
            #endregion

            result            = new Result();
            result.EnumType   = typeof(OverTimeValidationEnum);
            result.EnumMember = OverTimeValidationEnum.Done.ToString();

            return(result);
        }
Ejemplo n.º 4
0
        public OverTimesDetailsBLL GetOverTimeDetailsByID(int id)
        {
            OverTimesDetails OverTimeDetail = new OverTimesDetailsDAL().GetOverTimeDetailsByID(id);

            return(MapOverTimeDetail(OverTimeDetail));
        }