示例#1
0
 public static async Task <List <Catalog> > GetAll()
 {
     using (DbHelper db = new DbHelper())
     {
         return(await CatalogRepository.GetAll(db));
     }
 }
示例#2
0
        protected List <Catalog> ThenThereShouldBeResults(int expectedCount)
        {
            var repository = new CatalogRepository();
            var entities   = repository.GetAll();

            Assert.Equal(expectedCount, entities.Count);
            return(entities);
        }
示例#3
0
        public static int GetPackageId(string value)
        {
            if (_Packages.IsNullOrEmpty())
            {
                _Packages = CatalogRepository.GetAll <PackageInfo>();
            }
            var entity = _Packages.FirstOrDefault(c => c.Name.Equals(value, StringComparison.CurrentCultureIgnoreCase));

            if (entity == null)
            {
                entity = new PackageInfo {
                    Name = value
                };
                entity.Id = CatalogRepository.Create(entity);
                _Packages.Add(entity);
            }
            return(entity.Id);
        }
示例#4
0
 // GET api/<controller>
 public IEnumerable <StatusCareInfo> Get()
 {
     return(CatalogRepository.GetAll <StatusCareInfo>());
 }
示例#5
0
 // GET api/<controller>
 public IEnumerable <CampaindTpeInfo> Get()
 {
     return(CatalogRepository.GetAll <CampaindTpeInfo>());
 }
示例#6
0
        private Catalog GetCatalogById(int catalogId)
        {
            var catalogRepository = new CatalogRepository();

            return(catalogRepository.GetAll().Single(c => c.Id == catalogId));
        }
示例#7
0
文件: Product.cs 项目: HungNV88/CRM
 // GET api/<controller>
 public IEnumerable <ProductInfo> Get()
 {
     return(CatalogRepository.GetAll <ProductInfo>());
 }
示例#8
0
 // GET api/<controller>
 public IEnumerable <TemplateAdsInfo> Get()
 {
     return(CatalogRepository.GetAll <TemplateAdsInfo>());
 }
示例#9
0
 // GET api/<controller>
 public IEnumerable <TeacherTypeInfo> Get()
 {
     return(CatalogRepository.GetAll <TeacherTypeInfo>());
 }
 public List <Catalog> GetAll()
 {
     return(_catalogRepository.GetAll());
 }
示例#11
0
 // GET api/<controller>
 public IEnumerable <QualityInfo> Get()
 {
     return(CatalogRepository.GetAll <QualityInfo>());
 }
示例#12
0
 // GET api/<controller>
 public IEnumerable <TimeSlotInfo> Get()
 {
     return(CatalogRepository.GetAll <TimeSlotInfo>());
 }
示例#13
0
 // GET api/<controller>
 public IEnumerable <LandingPageInfo> Get()
 {
     return(CatalogRepository.GetAll <LandingPageInfo>());
 }
示例#14
0
 // GET api/<controller>
 public IEnumerable <SearchKeywordInfo> Get()
 {
     return(CatalogRepository.GetAll <SearchKeywordInfo>());
 }
示例#15
0
 // GET api/<controller>
 public IEnumerable <PackageInfo> Get()
 {
     return(CatalogRepository.GetAll <PackageInfo>());
 }
示例#16
0
 // GET api/<controller>
 public IEnumerable <FeeMoneyTypeInfo> Get()
 {
     return(CatalogRepository.GetAll <FeeMoneyTypeInfo>());
 }
示例#17
0
        protected override void OnActionExecuted(ActionExecutedContext filterContext)
        {
            base.OnActionExecuted(filterContext);

            try
            {
                var userCurent = UserContext.GetCurrentUser();
                if (userCurent != null)
                {
                    ViewBag.GroupId      = userCurent.GroupId;
                    ViewBag.GroupType    = userCurent.GroupConsultantType;
                    ViewBag.UserBranches = UserRepository.GetBranchOfUser(userCurent.UserID);
                }

                //Gói niêm yết
                ViewBag.PackagePriceListed = CatalogRepository.GetAll <PackagePriceListed>();

                // GroupType
                var wbServiceConfigTypes = new Dictionary <int, string>();
                foreach (var item in Enum.GetValues(typeof(WebServiceConfigType)))
                {
                    wbServiceConfigTypes.Add((int)item, ObjectExtensions.GetEnumDescription((WebServiceConfigType)item));
                }
                ViewBag.WebServiceConfigTypes = wbServiceConfigTypes.Select(c => new { Id = c.Key, Name = c.Value });

                // GroupType
                var groupTypes = new Dictionary <int, string>();
                foreach (var item in Enum.GetValues(typeof(GroupConsultantType)))
                {
                    groupTypes.Add((int)item, ObjectExtensions.GetEnumDescription((GroupConsultantType)item));
                }
                ViewBag.GroupTypes = groupTypes.Select(c => new { Id = c.Key, Name = c.Value });

                //Branches
                filterContext.Controller.ViewBag.BranchId = UserContext.GetDefaultBranch();

                //UserId
                filterContext.Controller.ViewBag.UserId = UserContext.GetCurrentUser().UserID;

                // Group
                StoreData.ListGroup.RemoveAll(c => c.GroupId == 0);
                filterContext.Controller.ViewBag.Groups = StoreData.ListGroup;

                // User
                StoreData.ListUser.RemoveAll(c => c.UserID == 0);
                filterContext.Controller.ViewBag.Users = StoreData.ListUser;

                // Level
                filterContext.Controller.ViewBag.Levels = StoreData.ListLevel;

                // Branch
                filterContext.Controller.ViewBag.Branches = StoreData.ListBranch;

                //Collectors
                filterContext.Controller.ViewBag.Collectors = StoreData.ListCollector;

                //StatusMap
                filterContext.Controller.ViewBag.StatusMaps = StoreData.ListStatusMap ?? new List <StatusMapInfo>();

                //StatusCare
                filterContext.Controller.ViewBag.StatusCares = StoreData.ListStatusCare ?? new List <StatusCareInfo>();

                // SourceType
                filterContext.Controller.ViewBag.SourceTypes = StoreData.ListSourceType ?? new List <SourceTypeInfo>();

                //Email
                filterContext.Controller.ViewBag.Email = StoreData.ListEmail ?? new List <EmailInfo>();

                //EducationLevel
                filterContext.Controller.ViewBag.EducationLevels = StoreData.ListEducationLevel ?? new List <EducationLevelInfo>();

                //TimeSlot
                filterContext.Controller.ViewBag.TimeSlots = StoreData.ListTimeSlot ?? new List <TimeSlotInfo>();

                //TeacherType
                filterContext.Controller.ViewBag.TeacherTypes = StoreData.ListTeacherType ?? new List <TeacherTypeInfo>();

                // Container
                filterContext.Controller.ViewBag.Containers = StoreData.ListContainer ?? new List <ContainerInfo>();

                //Import Excels
                filterContext.Controller.ViewBag.ImportExcels = StoreData.ListImportExcel ?? new List <ImportExcelInfo>();

                // WebServiceConfig
                StoreData.ListWebServiceConfig.RemoveAll(c => c.Id == 0);

                // StatusConnectType
                var statusConnectType = new Dictionary <int, string>();
                foreach (var item in Enum.GetValues(typeof(StatusConnectType)))
                {
                    statusConnectType.Add((int)item, ObjectExtensions.GetEnumDescription((StatusConnectType)item));
                }
                ViewBag.StatusConnectTypes = statusConnectType.Select(c => new { Id = c.Key, Name = c.Value });

                // Product
                //if (StoreData.ListProduct.IsNullOrEmpty())
                //{
                //    StoreData.ListProduct = ProductRepository.GetAll() ?? new List<ProductInfo>();
                //}
                filterContext.Controller.ViewBag.Products = StoreData.ListProduct ?? new List <ProductInfo>();

                // Quality
                //if (StoreData.ListQuality.IsNullOrEmpty())
                //{
                //    StoreData.ListQuality = QualityRepository.GetAll() ?? new List<QualityInfo>();
                //}
                filterContext.Controller.ViewBag.Quality = StoreData.ListQuality ?? new List <QualityInfo>();

                // FeeMoneyType
                filterContext.Controller.ViewBag.FeeMoneyType = StoreData.ListFeeMoneyType;

                // PackageFeeEdu
                filterContext.Controller.ViewBag.PackageFeeEdu = StoreData.ListPackageFeeEdu;
            }
            catch (Exception ex)
            {
            }

            try
            {
                //Apply logging
                var objChanges = HttpContext.Items[ContactInfo.CONTACT_CHANGE] as List <ActivityObjectChangeInfo>;
                if (objChanges != null)
                {
                    var activityInfo = new ActivityLogInfo
                    {
                        FunctionId = 0,
                        CreatedBy  = UserContext.GetCurrentUser().UserID
                    };
                    activityInfo.Id = ActivityLogRepository.Create(activityInfo);
                    foreach (var objChange in objChanges)
                    {
                        objChange.ActivityId = activityInfo.Id;
                        ActivityObjectChangeRepository.Create(objChange);
                    }
                }
                HttpContext.Items[ContactInfo.CONTACT_CHANGE] = null;
            }
            catch
            {
                //Dont throw exception if loging failed
            }
        }
示例#18
0
 // GET api/<controller>
 public IEnumerable <ContainerInfo> Get()
 {
     return(CatalogRepository.GetAll <ContainerInfo>());
 }