/// <summary> /// This Function Will return all the receiving banks /// </summary> /// <returns></returns> public List <L_RecievingBank> GetReceivingBankInfo() { try { var idInformationKey = CacheKey.CDS_RECEVING_BANK_INFORMATION; var receivingBankList = new List <L_RecievingBank>(); if (StaticCache.Exist(idInformationKey)) { receivingBankList = (List <L_RecievingBank>)StaticCache.Get(idInformationKey); } else { using (var unitOfWork = new EFUnitOfWork()) { var lReceivingBankRepo = new L_RecievingBankRepository(new EFRepository <L_RecievingBank>(), unitOfWork); //Returning list of receiving bank values receivingBankList = lReceivingBankRepo.All().ToList(); //Store it into the cache StaticCache.Max(idInformationKey, receivingBankList); } } return(receivingBankList); } catch (Exception ex) { CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name); throw; } }
public void Clear_Should_Delete_All_Values() { StaticCache.Clear(); Assert.Equal(0, StaticCache.GetCount()); Assert.Null(StaticCache.GetOrNull("TestKey1")); }
/// <summary> /// This Function Will return all the ID Info types /// </summary> /// <returns></returns> public List <L_IDInformationType> GetIdInfoType() { try { var idInformationKey = CacheKey.CDS_ID_INFORMATION; var idInformationList = new List <L_IDInformationType>(); if (StaticCache.Exist(idInformationKey)) { idInformationList = (List <L_IDInformationType>)StaticCache.Get(idInformationKey); } else { using (var unitOfWork = new EFUnitOfWork()) { var lIdInfoTypeRepo = new L_IDInformationTypeRepository(new EFRepository <L_IDInformationType>(), unitOfWork); //Returning list of ID info type values idInformationList = lIdInfoTypeRepo.All().ToList(); StaticCache.Max(idInformationKey, idInformationList); } } return(idInformationList); } catch (Exception ex) { CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name); throw; } }
public void Should_Contain_Initial_Values() { Assert.Equal(2, StaticCache.GetCount()); Assert.Equal("TestValue1", StaticCache.GetOrNull("TestKey1")); Assert.Equal("TestValue2", StaticCache.GetOrNull("TestKey2")); }
public List <Person> FindPeople(int?gender, string name) { var data = StaticCache.GetData(); if (data == null) { return(null); } var query = data.People.Where(p => p.Name.IndexOf(name, StringComparison.CurrentCultureIgnoreCase) >= 0); if (gender.HasValue) { query = query.Where(p => p.Gender.Equals((Enums.Gender)gender.Value == Enums.Gender.Male ? "M" : "F")); } var results = query.ToList(); foreach (var person in results) { person.BirthPlace = StaticCache.GetPlaceById(person.Place_Id); } return(results); }
/// <summary> /// This Function Will return all the AccountCODE /// </summary> /// <returns></returns> public List <L_AccountCode> GetAccountCodes() { try { var accountCodeKey = CacheKey.CDS_ACCOUNTCODE; var accountCodeList = new List <L_AccountCode>(); if (StaticCache.Exist(accountCodeKey)) { accountCodeList = (List <L_AccountCode>)StaticCache.Get(accountCodeKey); } else { using (var unitOfWork = new EFUnitOfWork()) { var lAccountRepo = new L_AccountCodeRepository(new EFRepository <L_AccountCode>(), unitOfWork); //Returning List Of Demo Lead accountCodeList = lAccountRepo.All().ToList(); //Store it into the cache StaticCache.Max(accountCodeKey, accountCodeList); } } return(accountCodeList); } catch (Exception ex) { CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name); throw; } }
/// <summary> /// This Function Will return all initialInvestment /// </summary> /// <returns></returns> public List <L_InitialInvestment> GetInitialInvestment() { try { var initialInvestmentKey = CacheKey.CDS_INITIALINVESTMENTS; var initialInvestmentList = new List <L_InitialInvestment>(); if (StaticCache.Exist(initialInvestmentKey)) { initialInvestmentList = (List <L_InitialInvestment>)StaticCache.Get(initialInvestmentKey); } else { using (var unitOfWork = new EFUnitOfWork()) { var initialInvestmentRepo = new L_InitialInvestmentRepository(new EFRepository <L_InitialInvestment>(), unitOfWork); initialInvestmentList = initialInvestmentRepo.All().ToList(); StaticCache.Max(initialInvestmentKey, initialInvestmentList); } } return(initialInvestmentList); } catch (Exception ex) { CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name); throw; } }
/// <summary> /// This Function Will return all the estimated annual income values /// </summary> /// <returns></returns> public List <L_AnnualIncomeValue> GetEstimatedAnnualIncomeValues() { try { var annualIncomeKey = CacheKey.CDS_ANNUALINCOME; var annualIncomeList = new List <L_AnnualIncomeValue>(); if (StaticCache.Exist(annualIncomeKey)) { annualIncomeList = (List <L_AnnualIncomeValue>)StaticCache.Get(annualIncomeKey); } else { using (var unitOfWork = new EFUnitOfWork()) { var lAnnualIncomeRepo = new L_AnnualIncomeValueRepository(new EFRepository <L_AnnualIncomeValue>(), unitOfWork); //Returning list of annual income values annualIncomeList = lAnnualIncomeRepo.All().ToList(); //Store it into the cache StaticCache.Max(annualIncomeKey, annualIncomeList); } } return(annualIncomeList); } catch (Exception ex) { CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name); throw; } }
public void CreateShowShouldPassTest() { StaticCache.LoadStaticCache(); ShowController sc = new ShowController(); var config = new HttpConfiguration(); var request = new HttpRequestMessage(HttpMethod.Get, "http://localhost:22121/api/show/CreateShow"); var route = config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{action}", defaults: new { id = RouteParameter.Optional } ); var routeData = new HttpRouteData(route, new HttpRouteValueDictionary { { "controller", "show" } }); sc.ControllerContext = new HttpControllerContext(config, routeData, request); request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration()); var show = new ShawCodeExercise.Models.ShowModel(); show.ID = 10; show.ShowName = "the muppets"; show.ShowCategories = StaticCache.Categories; show.BackgroundImagePath = string.Empty; var response = sc.CreateShow(show); Assert.AreEqual(response.StatusCode, HttpStatusCode.Created); }
public void GetShowDataIDExistsShouldPassTest() { StaticCache.LoadStaticCache(); ShowController sc = new ShowController(); var config = new HttpConfiguration(); var request = new HttpRequestMessage(HttpMethod.Get, "http://localhost:22121/api/show/GetShowData"); var route = config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{action}/{id}", defaults: new { id = RouteParameter.Optional } ); var routeData = new HttpRouteData(route, new HttpRouteValueDictionary { { "controller", "show" } }); sc.ControllerContext = new HttpControllerContext(config, routeData, request); request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration()); var response = sc.GetShowData(1); Assert.AreEqual(response.StatusCode, HttpStatusCode.OK); response = sc.GetShowData(100); Assert.AreEqual(response.StatusCode, HttpStatusCode.NotFound); }
/// <summary> /// This Function Will return all the TicketSize /// </summary> /// <returns></returns> public List <L_TicketSize> GetTickets() { try { var ticketSizeKey = CacheKey.CDS_TICKETSIZES; var ticketSizeList = new List <L_TicketSize>(); if (StaticCache.Exist(ticketSizeKey)) { ticketSizeList = (List <L_TicketSize>)StaticCache.Get(ticketSizeKey); } else { using (var unitOfWork = new EFUnitOfWork()) { var lTicketSizeRepo = new L_TicketSizeRepository(new EFRepository <L_TicketSize>(), unitOfWork); //Returning List Of Demo Lead ticketSizeList = lTicketSizeRepo.All().ToList(); StaticCache.Max(ticketSizeKey, ticketSizeList); } } return(ticketSizeList); } catch (Exception ex) { CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name); throw; } }
public void CreateCategoryShouldPassTest() { StaticCache.LoadStaticCache(); VideoController vc = new VideoController(); var config = new HttpConfiguration(); var request = new HttpRequestMessage(HttpMethod.Get, "http://localhost:22121/api/category/CreateCategory"); var route = config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{action}/{id}", defaults: new { id = RouteParameter.Optional } ); var routeData = new HttpRouteData(route, new HttpRouteValueDictionary { { "controller", "category" } }); vc.ControllerContext = new HttpControllerContext(config, routeData, request); request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration()); ShawCodeExercise.Models.VideoModel video = new ShawCodeExercise.Models.VideoModel() { ID = 6, Title = "Mock title", Description = "Mock Description", SeasonNo = "S012", EpisodeNo = "E01", IsLocked = false, }; var response = vc.CreateVideo(video); Assert.AreEqual(response.StatusCode, HttpStatusCode.Created); }
/// <summary> /// This Function will Return All Trustee Type /// </summary> /// <returns></returns> public List <L_TrusteeTypeValue> GetTrusteeType() { try { var trusteeTypeKey = CacheKey.CDS_TRUSTEETYPEVALUES; var trusteeTypeList = new List <L_TrusteeTypeValue>(); if (StaticCache.Exist(trusteeTypeKey)) { trusteeTypeList = (List <L_TrusteeTypeValue>)StaticCache.Get(trusteeTypeKey); } else { using (var unitOfWork = new EFUnitOfWork()) { var lTrusteeTypeRepo = new L_TrusteeTypeValueRepository(new EFRepository <L_TrusteeTypeValue>(), unitOfWork); //Returning List Of Demo Lead trusteeTypeList = lTrusteeTypeRepo.All().ToList(); StaticCache.Max(trusteeTypeKey, trusteeTypeList); } } return(trusteeTypeList); } catch (Exception ex) { CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name); throw; } }
internal ContactInformation ToModel() { State state = null; List <State> list = StaticCache.GetStates(); if (this.StateId != 0) { state = new State(); state = list.Single(s => s.Id == this.StateId); } else if (this.State != null) { state = new State(); state = list.Single(s => s.Name == this.State); } var contactInfo = new ContactInformation { Id = this.Id, Address1 = this.Address1, Address2 = this.Address2, City = this.City, State = state, StateId = state.Id, ZipCode = this.Zip, Country = null, Email1 = this.Email1, Phone1 = this.Phone1, Website1 = this.Website1 }; return(contactInfo); }
/// <summary> /// This Function will Return All Trustee Type /// </summary> /// <returns></returns> public List <L_CompanyTypeValue> GetCompanyType() { try { var companyTypeKey = CacheKey.CDS_COMPANYTYPE; var companyTypeList = new List <L_CompanyTypeValue>(); if (StaticCache.Exist(companyTypeKey)) { companyTypeList = (List <L_CompanyTypeValue>)StaticCache.Get(companyTypeKey); } else { using (var unitOfWork = new EFUnitOfWork()) { var lCompanyTypeRepo = new L_CompanyTypeValueRepository(new EFRepository <L_CompanyTypeValue>(), unitOfWork); //Returning List Of Demo Lead companyTypeList = lCompanyTypeRepo.All().ToList(); //Store it into the cache StaticCache.Max(companyTypeKey, companyTypeList); } } return(companyTypeList); } catch (Exception ex) { CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name); throw; } }
public void CreateVideoExistingShouldFailTest() { StaticCache.LoadStaticCache(); VideoController vc = new VideoController(); var config = new HttpConfiguration(); var request = new HttpRequestMessage(HttpMethod.Get, "http://localhost:22121/api/video/CreateVideo"); var route = config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{action}/{id}", defaults: new { id = RouteParameter.Optional } ); var routeData = new HttpRouteData(route, new HttpRouteValueDictionary { { "controller", "video" } }); vc.ControllerContext = new HttpControllerContext(config, routeData, request); request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration()); ShawCodeExercise.Models.VideoModel video = new ShawCodeExercise.Models.VideoModel() { ID = 1, Title = "video 1 title", Description = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Hic ambiguo ludimur. Que Manilium, ab iisque M. Efficiens dici potest. Falli igitur possumus. Quae sequuntur igitur? Duo Reges: constructio interrete.", SeasonNo = "S012", EpisodeNo = "E01", IsLocked = false, }; var response = vc.CreateVideo(video); Assert.AreEqual(response.StatusCode, HttpStatusCode.Conflict); }
public ActionResult ListPost(int?page, string category) { BlogEntities db = new BlogEntities(); List <PostViewModel> viewModel = new List <PostViewModel>(); string sql = ""; if (category == null || category == "") { sql = string.Format(@"SELECT * FROM POST ORDER BY CREATED_DATE DESC"); } else { List <TAG> tags = StaticCache.GetTags(); if (tags.Any(c => c.NAME.ToUpper() == category.ToUpper())) { sql = string.Format(@"SELECT * FROM POST WHERE UPPER(MAIN_TAG)='{0}' ORDER BY CREATED_DATE DESC ", category.ToUpper()); } else { sql = string.Format(@"SELECT * FROM POST ORDER BY CREATED_DATE DESC"); } } viewModel = db.POSTs.SqlQuery(sql).Select(c => new PostViewModel { TITLE = c.TITLE, IMAGE_COVER = c.IMAGE_COVER, SLUG = c.SLUG, CREATED_DATE = c.CREATED_DATE, CREATED_USER = c.CREATED_USER, MAIN_TAG = c.MAIN_TAG, META_DESC = c.META_DESC }).ToList(); int pageSize = 5; int pageNumber = (page ?? 1); ViewBag.tag = category; return(View(viewModel.ToPagedList(pageNumber, pageSize))); }
/// <summary> /// This Function Will return all the net worth euros values /// </summary> /// <returns></returns> public List <L_TradingExperience> GetTradingExpValues() { try { var tradingExpKey = CacheKey.CDS_TRADINGEXPS; var tradingExpList = new List <L_TradingExperience>(); if (StaticCache.Exist(tradingExpKey)) { tradingExpList = (List <L_TradingExperience>)StaticCache.Get(tradingExpKey); } else { using (var unitOfWork = new EFUnitOfWork()) { var lTradingExpRepo = new L_TradingExperienceRepository(new EFRepository <L_TradingExperience>(), unitOfWork); //Returning list of trading exp look up values tradingExpList = lTradingExpRepo.All().ToList(); StaticCache.Max(tradingExpKey, tradingExpList); } } return(tradingExpList); } catch (Exception ex) { CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name); throw; } }
/// <summary> /// This Function Will return all the liquid assets values /// </summary> /// <returns></returns> public List <L_LiquidAssetsValue> GetLiquidAssetsValues() { try { var liquidAssetKey = CacheKey.CDS_LIQUIDASSETS; var liquidAssetList = new List <L_LiquidAssetsValue>(); if (StaticCache.Exist(liquidAssetKey)) { liquidAssetList = (List <L_LiquidAssetsValue>)StaticCache.Get(liquidAssetKey); } else { using (var unitOfWork = new EFUnitOfWork()) { var lLiquidAssetsRepo = new L_LiquidAssetsValueRepository(new EFRepository <L_LiquidAssetsValue>(), unitOfWork); //Returning list of liquid assets values liquidAssetList = lLiquidAssetsRepo.All().ToList(); StaticCache.Max(liquidAssetKey, liquidAssetList); } } return(liquidAssetList); } catch (Exception ex) { CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name); throw; } }
public List <Person> FindPeopleAndRelations(int?gender, string name, bool includeAncestors, int maxRecordsToDisplay) { var data = StaticCache.GetData(); if (data == null) { return(null); } var query = data.People.Where(p => p.Name.Equals(name, StringComparison.CurrentCultureIgnoreCase)); var personOfInterest = query.FirstOrDefault(); if (personOfInterest == null) { return(null); } var results = BuildUpList(personOfInterest, maxRecordsToDisplay, gender, includeAncestors); if (results == null) { return(null); } foreach (var person in results) { person.BirthPlace = StaticCache.GetPlaceById(person.Place_Id); } return(results); }
public void CreateShowTestShouldFailTest() { StaticCache.LoadStaticCache(); ShowController sc = new ShowController(); var config = new HttpConfiguration(); var request = new HttpRequestMessage(HttpMethod.Get, "http://localhost:22121/api/show/CreateShow"); var route = config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{action}", defaults: new { id = RouteParameter.Optional } ); var routeData = new HttpRouteData(route, new HttpRouteValueDictionary { { "controller", "show" } }); sc.ControllerContext = new HttpControllerContext(config, routeData, request); request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration()); ShawCodeExercise.Models.ShowModel show = null; var response = sc.CreateShow(show); Assert.AreEqual(response.StatusCode, HttpStatusCode.NotAcceptable); }
private List <Person> GetDirectParents(Person person) { var listOfParents = new List <Person>(); if (!person.Mother_Id.HasValue && !person.Father_Id.HasValue) { return(listOfParents); } if (person.Mother_Id.HasValue) { var mother = StaticCache.GetPersonById(person.Mother_Id.Value); if (mother != null) { listOfParents.Add(mother); } } if (person.Father_Id.HasValue) { var father = StaticCache.GetPersonById(person.Father_Id.Value); if (father != null) { listOfParents.Add(father); } } return(listOfParents); }
public static string Get(string lanKey) { var lanCache = new StaticCache(); LanguageEntity lan = lanCache.Get(lanKey, m => { m.When(LanguageService.SignalLanguageUpdate); if (LanService == null) return new LanguageEntity { LanKey = lanKey, LanValue = lanKey }; var language = LanService.Get(lanKey, GetCurrentLanID()); if (language == null) { string lanValue = lanKey; string lanType = "UnKnown"; string module = "Unknown"; if (lanKey.Contains("@")) { lanValue = lanKey.Split('@')[1]; lanType = "EntityProperty"; module = lanKey.Split('@')[0]; } language = new LanguageEntity { LanID = GetCurrentLanID(), LanValue = lanValue, LanKey = lanKey, LanType = lanType, Module = module }; LanService.Add(language); } return language; }); return lan.LanValue; }
public void SetupData() { var sampleData = new Data(); var samplePlace = new Place { Id = 1, Name = "Testville" }; sampleData.Places = new List <Place> { samplePlace }; var samplePerson = new Person { Id = 1, Gender = "F", Level = 1, Name = "Mollie Smith", Place_Id = 1 }; sampleData.People = new List <Person> { samplePerson }; StaticCache.LoadStaticData(sampleData); }
public JsonResult GetEstablecimientos(string Prefix) { //var establecimientoBl = new EstablecimientoBl(); var establecimientoList = new List <Establecimiento>(); //var listaEstablecimientos = Session["loginEstablecimientoList"] as List<Establecimiento>; //establecimientoList = establecimientoBl.GetEstablecimientosByTextoBusqueda(Prefix, ((Usuario)Session["UsuarioLogin"]).idUsuario, listaEstablecimientos); //establecimientoList = establecimientoBl.GetEstablecimientosByTextoBusqueda(Prefix, 1); var laboratorioList = StaticCache.ObtenerLaboratorios(); var filtrados = laboratorioList.Where(x => (x.IdLabIns == 0 || x.IdLabIns == 2) && x.NombreEstablecimiento.ToLower().Contains(Prefix.ToLower()) || x.CodigoUnico.ToLower().Contains(Prefix.ToLower())); if (filtrados.Any()) { filtrados.Take(50).ToList().ForEach(x => { establecimientoList.Add(new Establecimiento { IdEstablecimiento = x.IdEstablecimiento, CodigoInstitucion = string.Empty, CodigoUnico = x.CodigoUnico, Nombre = x.Nombre, clasificacion = x.clasificacion, IdLabIns = x.IdLabIns ?? 0, // x.IdLabIns.Value : 0, Ubigeo = x.Ubigeo }); }); } Session["establecimientoList"] = establecimientoList; return(Json(establecimientoList, JsonRequestBehavior.AllowGet)); }
/// <summary> /// This Function Will return all the net worth euros values /// </summary> /// <returns></returns> public List <L_NetWorthEuros> GetNetWorthEurosValues() { try { var netWorthKey = CacheKey.CDS_NETWORTHEUROS; var netWorthList = new List <L_NetWorthEuros>(); if (StaticCache.Exist(netWorthKey)) { netWorthList = (List <L_NetWorthEuros>)StaticCache.Get(netWorthKey); } else { using (var unitOfWork = new EFUnitOfWork()) { var lNetWorthEurosRepo = new L_NetWorthEurosRepository(new EFRepository <L_NetWorthEuros>(), unitOfWork); //Returning list of net worth euros look up values netWorthList = lNetWorthEurosRepo.All().ToList(); StaticCache.Max(netWorthKey, netWorthList); } } return(netWorthList); } catch (Exception ex) { CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name); throw; } }
private OrganizationVm SaveModel(OrganizationVm organization, HttpResponseMessage response) { OrganizationVm newOrganization = null; WorkflowInstance workflowInstanceToSave = null; try { bool populateInitialLocation = false; var workflowInstance = organization.WorkflowInstance; if (organization.Id == 0) { populateInitialLocation = true; } var start = DateTime.Now; Debug.WriteLine("####Entering Get States: " + start); var state = StaticCache.GetStates().First(s => s.Id == organization.ContactInformation.StateId); var end = DateTime.Now; Debug.WriteLine("#####Total Get State time: " + end.Subtract(start)); start = DateTime.Now; Debug.WriteLine("####Entering Save Org: " + start); organization.ContactInformation.StateId = state.Id; var organizationToSave = organization.ToModel(); organizationService.Save(organizationToSave); newOrganization = OrganizationVm.FromModel(organizationToSave); end = DateTime.Now; Debug.WriteLine("#####Total Save org time: " + end.Subtract(start)); newOrganization.Saved = true; if (populateInitialLocation) { newOrganization.Locations = SaveLocationOnFirstSave(newOrganization); } if (workflowInstance != null) { workflowInstanceToSave = workflowInstance.ToModel(); workflowInstanceToSave.OrganizationId = organizationToSave.Id; } } catch (Exception e) { emailHelper.SendErrorEmail(e); newOrganization.Saved = false; } //as long as organization saves, don't worry about workflow state, just send an email try { this.workflowInstanceService.Save(workflowInstanceToSave); if (workflowInstanceToSave != null) { newOrganization.WorkflowInstance = WorkflowInstanceVm.FromModel(workflowInstanceToSave); } } catch { //Not emailing this because it's not a real error in this location. It's an expected exception when thhe org is saved outside the workflow //emailHelper.SendErrorEmail(e); } return(newOrganization); }
public static DataConfigureAttribute GetAttribute(Type type) { StaticCache cache = new StaticCache(); string typeName = type.FullName; var attribute = cache.Get("DataConfigureAttribute_" + typeName, m => GetCustomAttribute(type, typeof(DataConfigureAttribute)) as DataConfigureAttribute); return(attribute); }
// GET: Recepcion public ActionResult RegistroRecepcionMasivaROM() { int labVirusResp = 995; ViewBag.LabVirusRespId = labVirusResp; ViewBag.LabVirusRespNombre = StaticCache.ObtenerLaboratorios().FirstOrDefault(x => x.IdEstablecimiento == 995).Nombre; return(View()); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); BundleTable.EnableOptimizations = true; StaticCache.LoadStaticCache(); }
// ctor. public ObjectMapper(DbDataReader reader, SqlORM sqlOrm) { _reader = reader; _sqlOrm = sqlOrm; // Инициализирует из ленивого хранилища. _activator = StaticCache.FromLazyActivator(typeof(T)); }
public void OnActionExecuted(ActionExecutedContext filterContext) { var zones = new ZoneWidgetCollection(); var cache = new StaticCache(); //Page string path = filterContext.RequestContext.HttpContext.Request.Path; if (path.EndsWith("/") && path.Length > 1) { path = path.Substring(0, path.Length - 1); //filterContext.HttpContext.Response.Redirect(path); filterContext.Result = new RedirectResult(path); return; } bool publish = !ReView.Review.Equals(filterContext.RequestContext.HttpContext.Request.QueryString[ReView.QueryKey], StringComparison.CurrentCultureIgnoreCase); var page = new PageService().GetByPath(path, publish); if (page != null) { var layoutService = new LayoutService(); LayoutEntity layout = layoutService.Get(page.LayoutId); layout.Page = page; Action<WidgetBase> processWidget = m => { IWidgetPartDriver partDriver = cache.Get("IWidgetPartDriver_" + m.AssemblyName + m.ServiceTypeName, source => Activator.CreateInstance(m.AssemblyName, m.ServiceTypeName).Unwrap() as IWidgetPartDriver ); WidgetPart part = partDriver.Display(partDriver.GetWidget(m), filterContext.HttpContext); lock (zones) { if (zones.ContainsKey(part.Widget.ZoneID)) { zones[part.Widget.ZoneID].Add(part); } else { var partCollection = new WidgetCollection { part }; zones.Add(part.Widget.ZoneID, partCollection); } } }; var layoutWidgetsTask = Task.Factory.StartNew(layoutId => { var widgetServiceIn = new WidgetService(); IEnumerable<WidgetBase> layoutwidgets = widgetServiceIn.Get(new DataFilter().Where("LayoutID", OperatorType.Equal, layoutId)); layoutwidgets.Each(processWidget); }, page.LayoutId); var widgetService = new WidgetService(); IEnumerable<WidgetBase> widgets = widgetService.Get(new DataFilter().Where("PageID", OperatorType.Equal, page.ID)); int middle = widgets.Count() / 2; var pageWidgetsTask = Task.Factory.StartNew(() => widgets.Skip(middle).Each(processWidget)); widgets.Take(middle).Each(processWidget); Task.WaitAll(new[] { pageWidgetsTask, layoutWidgetsTask }); layout.ZoneWidgets = zones; var viewResult = (filterContext.Result as ViewResult); if (viewResult != null) { //viewResult.MasterName = "~/Modules/Easy.Web.CMS.Page/Views/Shared/_Layout.cshtml"; viewResult.ViewData[LayoutEntity.LayoutKey] = layout; } } else { filterContext.Result = new HttpStatusCodeResult(404); } }