コード例 #1
0
        public IQueryable <RenewRequestViewModel> ReadRenewRequestTabs(int companyId, byte Tab, byte Range, DateTime?Start, DateTime?End, string culture, byte Version, int EmpId)
        {
            if (Range != 10 && Range != 0)
            {
                RequestRangeFilter(Range, companyId, out Start, out End);
            }


            DateTime Today = DateTime.Today.Date;

            var query1 = from RQ in context.RenewRequests
                         where RQ.EmpId == EmpId && RQ.CompanyId == companyId
                         select RQ;

            if (Range != 10) // Allow date range
            {
                query1 = query1.Where(l => Start <= l.RequestDate && l.RequestDate <= End);
            }


            if (Tab == 1) //Pending
            {
                query1 = query1.Where(l => l.ApprovalStatus == 2);
            }
            else if (Tab == 2) //Approved
            {
                query1 = query1.Where(l => l.ApprovalStatus == 6);
            }
            else if (Tab == 3) //Rejected
            {
                query1 = query1.Where(l => l.ApprovalStatus == 9);
            }

            IQueryable <RenewRequestViewModel> query = from q in query1
                                                       select new RenewRequestViewModel
            {
                Id             = q.Id,
                ApprovalStatus = q.ApprovalStatus,
                ColumnName     = HrContext.GetColumnTitle(companyId, culture, "People", Version, q.ColumnName),
                EmpId          = q.EmpId,
                CompanyId      = q.CompanyId,
                NewValue       = q.NewValue,
                NewValueId     = q.NewValueId,
                OldValue       = q.OldValue,
                OldValueId     = q.OldValueId,
                RequestDate    = q.RequestDate,
                CreatedUser    = q.CreatedUser,
                CreatedTime    = q.CreatedTime,
                RejectionRes   = q.RejectionRes,
                AttUrl         = HrContext.GetDoc("RenewRequest", q.Id)
            };

            return(query);
        }
コード例 #2
0
        public IEnumerable <NotifyColumnsViewModel> GetColumnList(string tableName, string ObjectName, byte version, string type, int companyId, string culture)
        {
            IEnumerable <NotifyColumnsViewModel> query = null;

            //var pageTitle = MsgUtils.Instance.Trls(culture, "ColumnProperties");

            if (type == null)
            {
                type = context.PageDiv.Where(p => p.CompanyId == companyId && p.ObjectName == ObjectName && p.Version == version).Select(p => p.DivType).FirstOrDefault();
            }

            if (type == "Form")
            {
                query = (from s in context.SysColumns
                         where s.obj_name == tableName
                         join p in context.PageDiv on s.obj_name equals p.TableName
                         where p.CompanyId == companyId && p.ObjectName == ObjectName && p.DivType == "Form" && p.Version == version
                         join fc in context.FormsColumns on p.Id equals fc.Section.FieldSet.PageId
                         where s.column_name == fc.ColumnName || s.column_name == "CompanyId" || s.column_name == "EmpId"
                         select new NotifyColumnsViewModel
                {
                    pageTitle = HrContext.GetColumnTitle(companyId, culture, p.ObjectName, version, p.Title),
                    pageType = p.DivType,
                    type = s.data_type,
                    objectName = p.ObjectName,
                    value = s.column_name,
                    text = HrContext.GetColumnTitle(p.CompanyId, culture, p.ObjectName, p.Version, s.column_name) ?? s.column_name,
                    id = s.column_name,
                    name = HrContext.GetColumnTitle(p.CompanyId, culture, p.ObjectName, p.Version, s.column_name) ?? s.column_name,
                }).Distinct().ToList();
            }
            else if (type == "Grid")
            {
                query = (from s in context.SysColumns
                         where s.obj_name == tableName
                         join p in context.PageDiv on s.obj_name equals p.TableName
                         where p.CompanyId == companyId && p.ObjectName == ObjectName && p.DivType == "Grid" && p.Version == version
                         join gc in context.GridColumns on p.Id equals gc.GridId
                         where s.column_name == gc.ColumnName || s.column_name == "CompanyId" || s.column_name == "EmpId"
                         select new NotifyColumnsViewModel
                {
                    pageTitle = HrContext.GetColumnTitle(companyId, culture, p.ObjectName, version, p.TableName),
                    pageType = type,
                    type = s.data_type,
                    objectName = p.ObjectName,
                    value = s.column_name,
                    text = HrContext.GetColumnTitle(p.CompanyId, culture, p.ObjectName, p.Version, s.column_name) ?? s.column_name,
                    id = s.column_name,
                    name = HrContext.GetColumnTitle(p.CompanyId, culture, p.ObjectName, p.Version, s.column_name) ?? s.column_name,
                }).Distinct().ToList();
            }
            return(query);
        }
コード例 #3
0
        public IQueryable <RoleGridColumnsViewModel> GetRoleGridColumns(string RoleId, string objectName, byte version, int companyId, string culture)
        {
            var query = from column in context.GridColumns
                        where column.Grid.CompanyId == companyId && column.Grid.Version == version && column.Grid.ObjectName == objectName && column.OrgInputType != "none"
                        join rc in context.RoleColumns on new { j1 = companyId, j2 = objectName, j3 = version, j4 = RoleId, j5 = column.ColumnName }
            equals new { j1 = rc.CompanyId, j2 = rc.ObjectName, j3 = rc.Version, j4 = rc.RoleId, j5 = rc.ColumnName } into g
            from rc in g.DefaultIfEmpty()
            select new RoleGridColumnsViewModel
            {
                Id         = column.Id,
                RoleId     = RoleId,
                Title      = HrContext.GetColumnTitle(companyId, culture, objectName, version, column.ColumnName),
                ColumnName = column.ColumnName,
                isEnabled  = rc.ObjectName == null ? true : rc.isEnabled,
                isVisible  = rc.ObjectName == null ? true : rc.isVisible
            };

            return(query);
        }