示例#1
0
        public EmpTasksViewModel GetEmployeeTask(int Id, string culture)
        {
            EmpTasksViewModel task = context.EmpTasks.Where(t => t.Id == Id)
                                     .Select(t => new EmpTasksViewModel
            {
                Id           = t.Id,
                EmpList      = t.EmpChklist.Name,
                Manager      = HrContext.TrlsName(t.Manager.Title + " " + t.Manager.FirstName + " " + t.Manager.Familyname, culture),
                Description  = t.Description,
                Priority     = t.Priority,
                Status       = t.Status,
                TaskCategory = HrContext.GetLookUpCode("EmpTaskCat", t.TaskCat.Value, culture),
                TaskNo       = t.TaskNo,
                AssignedTime = t.AssignedTime,
                Attachments  = HrContext.GetAttachments("EmpTasksForm", t.Id),
                StartTime    = t.StartTime,
                EndTime      = t.EndTime,
                Duration     = t.Duration,
                EmpListId    = t.EmpListId,
                ExpectDur    = t.ExpectDur,
                Unit         = t.Unit,
                Required     = t.Required,
                Employee     = HrContext.TrlsName(t.EmpChklist.Employee.Title + " " + t.EmpChklist.Employee.FirstName + " " + t.EmpChklist.Employee.Familyname, culture),
            }).FirstOrDefault();

            return(task);
        }
示例#2
0
        public IQueryable <EmpTasksViewModel> ReadEmployeeTasksGrid(int empId, string culture)
        {
            var tasks = context.EmpTasks.Where(t => t.EmpId == empId && t.Status != 0).OrderBy(t => new { t.Status, t.Priority }).Select(t => new EmpTasksViewModel
            {
                Id           = t.Id,
                EmpList      = HrContext.TrlsName(t.EmpChklist.Name, culture),
                EmpListId    = t.EmpListId,
                Manager      = HrContext.TrlsName(t.Manager.Title + " " + t.Manager.FirstName + " " + t.Manager.Familyname, culture),
                Description  = t.Description,
                Priority     = t.Priority,
                Status       = t.Status,
                TaskCategory = HrContext.GetLookUpCode("EmpTaskCat", t.TaskCat.Value, culture),
                TaskNo       = t.TaskNo,
                AssignedTime = t.AssignedTime,
                StartTime    = t.StartTime,
                EndTime      = t.EndTime,
                Duration     = t.Duration,
                ExpectDur    = t.ExpectDur,
                Unit         = t.Unit,
                Required     = t.Required,
                SubPeriodId  = t.SubPeriodId,
                SubPeriod    = t.SubPeriod.Name
            });

            return(tasks);
        }
示例#3
0
        public IEnumerable ReadEmployeeTasks(int CompanyId, int empId, string culture)
        {
            var tasks = context.EmpTasks.Where(t => t.EmpId == empId && t.CompanyId == CompanyId && t.Status == 1).OrderBy(t => t.Priority).Select(t => new NavBarItemVM
            {
                Id       = t.Id,
                From     = HrContext.GetLookUpCode("EmpTaskCat", t.TaskCat.Value, culture),
                Message  = t.Description,
                MoreInfo = HrContext.TrlsName(t.EmpChklist.Employee.Title + " " + t.EmpChklist.Employee.FirstName + " " + t.EmpChklist.Employee.Familyname, culture),
                PicUrl   = HrContext.GetDoc("EmployeePic", t.Manager.Id),
                Gender   = t.Manager.Gender
            }).Take(5).ToList();

            return(tasks);
        }
        public IQueryable <CompanyViewModel> GetAllCompanies(string culture)
        {
            var lang   = culture.Split('-')[0];
            var result = context.Companies.Select(company => new CompanyViewModel
            {
                Id          = company.Id,
                SearchName  = company.SearchName != null ? company.SearchName : "",
                Name        = company.Name,
                LocalName   = HrContext.TrlsName(company.Name, culture),
                LogoUrl     = HrContext.GetCompanyDoc("Company", company.Id, 1),
                Purpose     = HrContext.GetLookUpCode("Purpose", company.Purpose.Value, culture),
                Country     = lang == "ar" ? company.Country.NameAr : company.Country.Name,
                Email       = company.Email,
                WebSite     = company.WebSite,
                Attachement = HrContext.GetDoc("CompanyLogo", company.Id)
            });

            return(result);
        }
示例#5
0
        public IEnumerable <ExcelJobViewModel> ReadExcelJobs(int company, string culture)
        {
            var Job = (from J in context.Jobs
                       where (((J.IsLocal && J.CompanyId == company) || J.IsLocal == false) && (J.StartDate <= DateTime.Today && (J.EndDate == null || J.EndDate >= DateTime.Today)))
                       select new ExcelJobViewModel
            {
                Id = J.Id,
                Code = J.Code,
                Name = J.Name,
                IsLocal = HrContext.TrlsMsg(J.IsLocal.ToString(), culture),
                LName = HrContext.TrlsName(J.Name, culture),
                DefaultGradeId = J.DefaultGradeId != null ? HrContext.TrlsName(J.PayrollGrade.Name, culture) : " ",
                StartDate = J.StartDate.ToString(),
                EndDate = J.EndDate != null ? J.EndDate.Value.ToString() : " ",
                NameInInsurance = J.NameInInsurance,
                PlanCount = J.PlanCount.ToString(),
                PlanTurnOverRate = J.PlanTurnOverRate != null? J.PlanTurnOverRate.Value.ToString():" ",
                ProbationPeriod = J.ProbationPeriod != null? J.ProbationPeriod.Value.ToString():" ",
                PrimaryRole = HrContext.TrlsMsg(J.PrimaryRole.ToString(), culture),
                StartTime = J.StartTime != null ? J.StartTime.Value.ToString() : " ",
                EndTime = J.EndTime != null ? J.EndTime.Value.ToString() : " ",
                Frequency = J.Frequency != null ? HrContext.GetLookUpCode("Frequency", J.Frequency.Value, culture) : " ",
                WorkHours = J.WorkHours != null? J.WorkHours.Value.ToString():" ",
                DescInRecruitment = J.DescInRecruitment,
                ReplacementRequired = HrContext.TrlsMsg(J.ReplacementRequired.Value.ToString(), culture),
                EnTime = J.EndTime,
                StarTime = J.StartTime
            }).ToList();

            foreach (var item in Job)
            {
                item.StartTime = item.StarTime != null?item.StarTime.Value.ToString("HH:mm") : " ";

                item.EndTime = item.EnTime != null?item.EnTime.Value.ToString("HH:mm") : " ";
            }
            return(Job);
        }
示例#6
0
        public IQueryable <EmpTasksViewModel> ReadManagerEmpTasks(int managerId, int empId, int?periodId, int?subPeriodId, string culture)
        {
            var tasks = context.EmpTasks.Where(t => t.ManagerId == managerId && t.EmpId == empId && (subPeriodId == null ? true : subPeriodId == t.SubPeriodId) && (periodId == null ? true : periodId == t.SubPeriod.PeriodId))
                        .Select(t => new EmpTasksViewModel
            {
                Id           = t.Id,
                EmpList      = t.EmpChklist.Name,
                EmpId        = t.EmpId,
                Employee     = HrContext.TrlsName(t.Employee.Title + " " + t.Employee.FirstName + " " + t.Employee.Familyname, culture),
                ManagerId    = t.ManagerId,
                Description  = t.Description,
                Priority     = t.Priority,
                Status       = t.Status,
                TaskCategory = HrContext.GetLookUpCode("EmpTaskCat", t.TaskCat.Value, culture),
                TaskNo       = t.TaskNo,
                AssignedTime = t.AssignedTime,
                StartTime    = t.StartTime,
                EndTime      = t.EndTime,
                SubPeriodId  = t.SubPeriodId,
                SubPeriod    = t.SubPeriod.Name
            });

            return(tasks);
        }
        public IQueryable <MeetingViewModel> GetMeetings(int EmpId, byte Range, DateTime?Start, DateTime?End, string culture, int CompanyId, DateTime currentTime)
        {
            //10- All, 0-Custom
            if (Range != 10 && Range != 0)
            {
                RequestRangeFilter(Range, CompanyId, out Start, out End);
            }

            // Organizer
            var query = (from m in context.Meetings
                         where m.CompanyId == CompanyId && m.EmpId == EmpId && m.Status != 3
                         join P in context.People on m.EmpId equals P.Id
                         select new MeetingViewModel
            {
                Id = m.Id,
                MeetDate = m.MeetDate,
                Status = m.Status,
                StartTime = m.StartTime.ToString(),
                EndTime = m.EndTime.ToString(),
                MeetSubject = HrContext.GetLookUpCode("MeetSubject", m.MeetSubject, culture),
                EmpId = m.EmpId,
                organiser = HrContext.TrlsName(P.Title + " " + P.FirstName + " " + P.Familyname, culture),
                IsActivate = m.IsActivate == true ? "active" : "inactive",
                SubjectDesc = m.SubjectDesc,
                AttUrl = HrContext.GetDoc("Meeting", m.Id),
                IsOrganiser = true,
            }).Union(from m in context.Meetings
                     where m.CompanyId == CompanyId && m.Status != 3
                     join ma in context.MeetAttendees on m.Id equals ma.MeetingId
                     where ma.EmpId == EmpId && m.EmpId != EmpId
                     join P in context.People on m.EmpId equals P.Id
                     select new MeetingViewModel
            {
                Id          = m.Id,
                MeetDate    = m.MeetDate,
                Status      = m.Status,
                StartTime   = m.StartTime.ToString(),
                EndTime     = m.EndTime.ToString(),
                MeetSubject = HrContext.GetLookUpCode("MeetSubject", m.MeetSubject, culture),
                EmpId       = m.EmpId,
                organiser   = HrContext.TrlsName(P.Title + " " + P.FirstName + " " + P.Familyname, culture),
                IsActivate  = m.IsActivate == true ? "active" : "inactive",
                SubjectDesc = m.SubjectDesc,
                AttUrl      = null,
                IsOrganiser = false,
            }).Union(from m in context.Meetings
                     where m.CompanyId == CompanyId && m.Status != 3
                     join ma in context.MeetViewers on m.Id equals ma.MeetingId
                     where ma.EmpId == EmpId && m.EmpId != EmpId
                     join P in context.People on m.EmpId equals P.Id
                     select new MeetingViewModel
            {
                Id          = m.Id,
                MeetDate    = m.MeetDate,
                Status      = m.Status,
                StartTime   = m.StartTime.ToString(),
                EndTime     = m.EndTime.ToString(),
                MeetSubject = HrContext.GetLookUpCode("MeetSubject", m.MeetSubject, culture),
                EmpId       = m.EmpId,
                organiser   = HrContext.TrlsName(P.Title + " " + P.FirstName + " " + P.Familyname, culture),
                IsActivate  = m.IsActivate == true ? "active" : "inactive",
                SubjectDesc = m.SubjectDesc,
                AttUrl      = null,
                IsOrganiser = false,
            }).ToList().Select(l => new MeetingViewModel
            {
                Id          = l.Id,
                StartTime   = Convert.ToDateTime(l.StartTime).ToString("hh:mm tt"),
                EndTime     = Convert.ToDateTime(l.EndTime).ToString("hh:mm tt"),
                Status      = l.Status,
                MeetDate    = l.MeetDate,
                SubjectDesc = l.SubjectDesc,
                MeetSubject = l.MeetSubject,
                Time        = (Convert.ToDateTime(l.EndTime) - Convert.ToDateTime(l.StartTime)).ToString(@"hh\:mm"),
                EmpId       = l.EmpId,
                organiser   = l.organiser,
                IsActivate  = l.IsActivate,
                AttUrl      = l.AttUrl,
                Attendes    = l.Attendes,
                IsOrganiser = l.IsOrganiser,
                CanUpload   = (currentTime.Date > l.MeetDate.Date || (currentTime.Date == l.MeetDate.Date && Convert.ToDateTime(l.EndTime).TimeOfDay < currentTime.TimeOfDay)) ? true : false,
                CanCancel   = (currentTime.Date > l.MeetDate.Date || (currentTime.Date == l.MeetDate.Date && Convert.ToDateTime(l.StartTime).TimeOfDay <= currentTime.TimeOfDay)) ? true : false
            });

            if (Range != 10)
            {
                query = query.Where(c => Start <= c.MeetDate && End >= c.MeetDate);
            }

            return(query.OrderByDescending(a => a.MeetDate).AsQueryable());
        }