Exemplo n.º 1
0
        public static Dictionary <int, string> GetCompaniesListByFacilityCode(string facilityCode)
        {
            Dictionary <int, string> result;

            using (LookupEntities context = new LookupEntities())
            {
                var divisions = (from d in context.Lookups_Division_Divisions
                                 where d.FacilityCode == facilityCode
                                 select d.CompanyID).Distinct();

                if (divisions.Count() < 1)
                {
                    return(null);
                }


                var companies = from c in context.Lookups_Company_Companies
                                where divisions.Contains(c.CompanyID)
                                orderby c.CorporationName
                                select new
                {
                    c.CompanyID,
                    c.CorporationName
                };

                result = companies.ToDictionary(r => r.CompanyID, r => r.CorporationName);
            }

            return(result);
        }
Exemplo n.º 2
0
        public static int NewPersonDivisionXrefEnty(int personDivisionXrefID)
        {
            int result = -1;

            using (LookupEntities context = new LookupEntities())
            {
                var entity = new Lookups_Common_Entities();
                entity.PersonDivisionXrefID = personDivisionXrefID;
                context.SaveChanges();
                result = entity.EntityID;
            }
            return(result);
        }
Exemplo n.º 3
0
        public static IQueryable GetCounties()
        {
            var context = new LookupEntities();

            var results = from result in context.Miscellaneous_Countries
                          select new
            {
                result.CountryCode,
                result.CountryDescription,
                result.CountrySubdivisionTypeName
            };

            return(results);
        }
Exemplo n.º 4
0
        public static IQueryable GetCountrySubdivisions(string countryCode)
        {
            var context = new LookupEntities();

            var results = from result in context.Miscellaneous_CountrySubdivisions
                          where result.CountryCode == countryCode
                          select new
            {
                result.CountrySubdivisionCode,
                result.CountrySubdivisionName
            };

            return(results);
        }
Exemplo n.º 5
0
        public static List <LEO_Officers> GetLEO_Officers()
        {
            List <LEO_Officers> result;

            using (LookupEntities context = new LookupEntities())
            {
                var officers = from officer in context.LEO_Officers
                               select officer;

                result = officers.ToList();
            }

            return(result);
        }
Exemplo n.º 6
0
        public static LEO_Officers GetLEO_Officer(int personID)
        {
            LEO_Officers result = null;

            using (LookupEntities context = new LookupEntities())
            {
                var officers = from officer in context.LEO_Officers
                               where officer.PersonID == personID
                               select officer;

                result = officers.FirstOrDefault();
            }

            return(result);
        }
Exemplo n.º 7
0
        public static List <LEO_Officers> GetActiveLEO_Officers()
        {
            List <LEO_Officers> result;

            using (LookupEntities context = new LookupEntities())
            {
                var officers = from officer in context.LEO_Officers
                               where officer.BadgeStatusCode == "ACTV"
                               select officer;

                result = officers.ToList();
            }

            return(result);
        }
Exemplo n.º 8
0
        public static string GetRequirementCodeFromDescription(string description)
        {
            string code = string.Empty;

            using (LookupEntities context = new LookupEntities())
            {
                var codes = from c in context.Lookups_Common_Requirement_Requirements
                            where c.RequirementDescription == description || c.RequirementCode == description
                            select c.RequirementCode;

                code = codes.FirstOrDefault();
            }

            return(code);
        }
        public static string GetMimeTypeFromFileName(string fileName)
        {
            string result = string.Empty;
            string ext    = Path.GetExtension(fileName).Replace(".", "");

            using (LookupEntities context = new LookupEntities())
            {
                var extentions = from extention in context.Lookups_Common_Requirement_ContentTypes_Extensions
                                 where extention.FileExtention == ext
                                 select extention;

                result = extentions.FirstOrDefault().ContentTypeCode;
            }

            return(result);
        }
Exemplo n.º 10
0
        public static List <Lookups_Company_Companies> CompaniesWithActiveDivisions(string facilityCode)
        {
            List <Lookups_Company_Companies> companies = null;

            using (LookupEntities context = new LookupEntities())
            {
                var divisions = (from d in context.Lookups_Division_Divisions
                                 where d.FacilityCode == facilityCode &&
                                 d.DivisionStatusCode == "A"
                                 select d.CompanyID).Distinct();

                companies = (from c in context.Lookups_Company_Companies
                             where divisions.Contains(c.CompanyID)
                             orderby c.CorporationName
                             select c).ToList <Lookups_Company_Companies>();
            }

            return(companies);
        }
        public static Person_PersonDivisionXref GetPersonDivisionXref(int personID, int divisionID)
        {
            Person_PersonDivisionXref result = null;

            try
            {
                using (LookupEntities context = new LookupEntities())
                {
                    result = (from p in context.Person_PersonDivisionXref
                              where p.PersonID == personID &&
                              p.DivisionID == divisionID
                              select p).Single();
                    ;
                }
            }
            catch (Exception)
            {
                result = null;
            }
            return(result);
        }