コード例 #1
0
ファイル: BaseController.cs プロジェクト: jochemstoel/EPONS
        internal ViewObjects.Base GetBaseObject()
        {
            string key = string.Format("BaseObject-{0}", this.User.Identity.Name);

            ViewObjects.Base result = null;

            if (result == null)
            {
                Application.Entities.User             user             = new UserRepository(GetConnection()).FindByUsername(this.User.Identity.Name);
                Application.Services.MessagingService messagingService = new Application.Services.MessagingService(new MessagingRepository(GetConnection()));

                result = new ViewObjects.Base()
                {
                    DisplayName = this.User.Identity.Name,
                    User        = user,
                    Messages    = messagingService.Retrieve(user.Id)
                };
            }

            var adminMessageData = GetConnection().Query <dynamic>("[EPONS].[FindAdminMessage]", commandType: CommandType.StoredProcedure).AsList <dynamic>();

            if (adminMessageData.Count > 0)
            {
                result.AdminMessageTitle = adminMessageData.First().Title;
                result.AdminMessageBody  = adminMessageData.First().Message;
            }

            string ePONSFont = _settingGateway.Find("ePONSFont");

            result.Settings.Add("ePONSFont", ePONSFont);

            string ePONSFontSize = _settingGateway.Find("ePONSFontSize");

            result.Settings.Add("ePONSFontSize", ePONSFontSize);

            string[] userMeasurementToolAccreditationExpirySettings = new string[]
            {
                "UserMeasurementToolAccreditationExpiry-Alpha",
                "UserMeasurementToolAccreditationExpiry-APOM",
                "UserMeasurementToolAccreditationExpiry-Beta",
                "UserMeasurementToolAccreditationExpiry-Delta",
                "UserMeasurementToolAccreditationExpiry-Epsilon",
                "UserMeasurementToolAccreditationExpiry-Eta",
                "UserMeasurementToolAccreditationExpiry-FAM",
                "UserMeasurementToolAccreditationExpiry-Gamma",
                "UserMeasurementToolAccreditationExpiry-Omega",
                "UserMeasurementToolAccreditationExpiry-VitalSigns",
                "UserMeasurementToolAccreditationExpiry-Zeta",
            };

            foreach (var userMeasurementToolAccreditationExpirySetting in userMeasurementToolAccreditationExpirySettings)
            {
                string value = _settingGateway.Find(userMeasurementToolAccreditationExpirySetting);

                result.Settings.Add(userMeasurementToolAccreditationExpirySetting, string.IsNullOrWhiteSpace(value) || value == "null"? "180" : value);
            }

            return(result);
        }
コード例 #2
0
        public void Find()
        {
            SettingGateway gateway = new SettingGateway();

            gateway.Update("TestSetting", "123456");

            string result = gateway.Find("TestSetting");

            Assert.AreEqual("123456", result);
        }