Example #1
0
        public static string GetMiscDataByKey3(ref MMS.DAO.ApplicationContext context, string key1, string key2, string key3)
        {
            var data = (from r in context.MiscData
                        where r.Key1 == key1 && r.Key2 == key2 && r.Key3 == key3
                        select r).FirstOrDefault();

            return(data.ToString());
        }
Example #2
0
        public static int GetIdByKeyValue(ref MMS.DAO.ApplicationContext context, string keyValue, string valueValue)
        {
            Domain mydomain = (Domain)(from r in context.Domains
                                       where r.Key == keyValue && r.Value == valueValue
                                       select r).FirstOrDefault();

            return(mydomain.id);
        }
Example #3
0
        public static string GetValueById(ref MMS.DAO.ApplicationContext context, int id)
        {
            Domain data = (Domain)(from r in context.Domains
                                   where r.id == id
                                   select r).First();

            return(data.Value);
        }
Example #4
0
        public static int GetStateIdByName(ref MMS.DAO.ApplicationContext context, string stateName)
        {
            State state = (State)(from r in context.States
                                  where r.Name == stateName
                                  select r).FirstOrDefault();

            return(state.id);
        }
Example #5
0
        public static List <string> GetValuesByKey(ref MMS.DAO.ApplicationContext context, string key)
        {
            List <string> data = (from r in context.Domains
                                  where r.Key == key
                                  select r.Value).ToList();

            if (data.Count() > 0)
            {
                return(data);
            }
            else
            {
                return(null);
            }
        }
Example #6
0
        public static IEnumerable <ResourceViewModel> GetResources(ref MMS.DAO.ApplicationContext context)
        {
            MMS.DAO.ApplicationContext tempContext = context;

            var resources = (from r in context.Resources
                             select r).AsEnumerable()
                            .Select(x => new ResourceViewModel
            {
                id           = x.id,
                Name         = x.Name,
                Type         = x.Type,
                UploadDate   = x.UploadDate,
                Description  = x.Description,
                Location     = x.Location,
                RelativeUrl  = x.RelativeUrl,
                DocumentType = DomainHelper.GetValueById(ref tempContext, x.Type)
            }).ToList();

            return(resources);
        }