Exemplo n.º 1
0
        internal int GetDaysWithTwoDates(int EmployeeCodeID, DateTime StartDate, DateTime EndDate)
        {
            DateTime InternshipStartDate, InternshipEndDate, Date;
            int      DaysCounter = 0;
            List <InternshipScholarshipsDetails> InternshipScholarships =
                new InternshipScholarshipsDetailsDAL().GetInternshipScholarshipsDetailsByEmployeeCodeID(EmployeeCodeID).Where(o => o.InternshipScholarships.IsActive).ToList();

            for (DateTime i = StartDate; i <= EndDate;)
            {
                Date = i;// Convert.ToDateTime(Globals.Calendar.UmAlquraToGreg(string.Format("{0}/{1}/{2}", i.Day, i.Month, i.Year)), new CultureInfo("en-US"));

                foreach (InternshipScholarshipsDetails item in InternshipScholarships)
                {
                    InternshipStartDate = item.InternshipScholarships.InternshipScholarshipStartDate.Date;
                    InternshipEndDate   = item.InternshipScholarships.InternshipScholarshipEndDate.Date;

                    if (Date >= InternshipStartDate && Date <= InternshipEndDate)
                    {
                        DaysCounter++;
                    }
                }

                i = i.AddDays(1);
            }

            return(DaysCounter);
        }
        public InternshipScholarshipsDetailsBLL GetInternshipScholarshipsDetailsByInternshipScholarshipDetailID(int InternshipScholarshipDetailID)
        {
            InternshipScholarshipsDetails    InternshipScholarshipsDetails    = new InternshipScholarshipsDetailsDAL().GetInternshipScholarshipsDetailsByInternshipScholarshipDetailID(InternshipScholarshipDetailID);
            InternshipScholarshipsDetailsBLL InternshipScholarshipsDetailsBLL = new InternshipScholarshipsDetailsBLL();

            if (InternshipScholarshipsDetails != null)
            {
                InternshipScholarshipsDetailsBLL = new InternshipScholarshipsDetailsBLL().MapInternshipScholarshipDetail(InternshipScholarshipsDetails);
            }

            return(InternshipScholarshipsDetailsBLL);
        }
        public List <InternshipScholarshipsDetailsBLL> GetInternshipScholarshipsDetails()
        {
            List <InternshipScholarshipsDetails>    InternshipScholarshipsDetailsList    = new InternshipScholarshipsDetailsDAL().GetInternshipScholarshipsDetails();
            List <InternshipScholarshipsDetailsBLL> InternshipScholarshipsDetailsBLLList = new List <InternshipScholarshipsDetailsBLL>();

            if (InternshipScholarshipsDetailsList.Count > 0)
            {
                foreach (var item in InternshipScholarshipsDetailsList)
                {
                    InternshipScholarshipsDetailsBLLList.Add(new InternshipScholarshipsDetailsBLL().MapInternshipScholarshipDetail(item));
                }
            }
            return(InternshipScholarshipsDetailsBLLList.ToList());
        }
 public List <InternshipScholarshipsDetailsBLL> GetInternshipScholarshipsDetailsByEmployeeCodeID(int EmployeeCodeID)
 {
     try
     {
         List <InternshipScholarshipsDetails>    InternshipScholarshipsDetailsList    = new InternshipScholarshipsDetailsDAL().GetInternshipScholarshipsDetailsByEmployeeCodeID(EmployeeCodeID);
         List <InternshipScholarshipsDetailsBLL> InternshipScholarshipsDetailsBLLList = new List <InternshipScholarshipsDetailsBLL>();
         if (InternshipScholarshipsDetailsList.Count > 0)
         {
             foreach (var item in InternshipScholarshipsDetailsList)
             {
                 InternshipScholarshipsDetailsBLLList.Add(new InternshipScholarshipsDetailsBLL().MapInternshipScholarshipDetail(item));
             }
         }
         return(InternshipScholarshipsDetailsBLLList);
     }
     catch
     {
         throw;
     }
 }
        public Result Add(InternshipScholarshipsDetailsBLL InternshipScholarshipDetailBLL)
        {
            Result result = new Result();

            // validate employee already exists
            InternshipScholarshipsDetails employee = new InternshipScholarshipsDetailsDAL().GetInternshipScholarshipsDetailsByInternshipScholarshipID(InternshipScholarshipDetailBLL.InternshipScholarship.InternshipScholarshipID)
                                                     .Where(d => d.EmployeeCareerHistoryID == InternshipScholarshipDetailBLL.EmployeeCareerHistory.EmployeeCareerHistoryID).FirstOrDefault();

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

                return(result);
            }

            result = new Result();
            InternshipScholarshipsDetails InternshipScholarshipDetail = new InternshipScholarshipsDetails()
            {
                InternshipScholarshipID = InternshipScholarshipDetailBLL.InternshipScholarship.InternshipScholarshipID,
                EmployeeCareerHistoryID = InternshipScholarshipDetailBLL.EmployeeCareerHistory.EmployeeCareerHistoryID,
                CreatedDate             = DateTime.Now,
                CreatedBy = InternshipScholarshipDetailBLL.LoginIdentity.EmployeeCodeID,
                IsPassengerOrderCompensation = InternshipScholarshipDetailBLL.IsPassengerOrderCompensation
            };

            this.InternshipScholarshipDetailID = new InternshipScholarshipsDetailsDAL().Insert(InternshipScholarshipDetail);
            if (this.InternshipScholarshipDetailID != 0)
            {
                result.Entity     = null;
                result.EnumType   = typeof(InternshipScholarshipsValidationEnum);
                result.EnumMember = InternshipScholarshipsValidationEnum.Done.ToString();
            }

            return(result);
        }