コード例 #1
0
		/// <summary>
		/// Creates sample user token
		/// </summary>
		/// <param name="context">context</param>
		/// <param name="userId">user identifier</param>
		/// <returns>sample user token</returns>
		public SampleUserToken CreateUserToken(Context context, int userId)
		{
			if (context == null)
				throw new MemoryPointerIsNullException("context");

			return new SampleUserToken(userId, utcTimeProviderResolver.GetService(context).GetCurrentUTCTime());
		}
コード例 #2
0
		/// <summary>
		/// Gets another sample type structured data
		/// </summary>
		/// <param name="context">context</param>
		/// <returns>another sample type structured data</returns>
		public UITree GetAnotherTypeStructuredData(Context context)
		{
			var setProvider = this.setProviderResolver.GetService(context);
			var structureProvider = this.structureProviderResolver.GetService(context);

			var descriptorTree = structureProvider.GetAnotherTypeDescriptorTree(context);
			return UITree.Create<string, AnotherType>(descriptorTree, name => setProvider.GetAnotherTypeInstanceByName(context, name));
		}
コード例 #3
0
		/// <summary>
		/// Gets user token
		/// </summary>
		/// <param name="context">context</param>
		/// <param name="userTokenRequest">user token request</param>
		/// <returns>user token</returns>
		public UserToken GetUserToken(Context context, UserTokenRequest userTokenRequest)
		{
			var request = userTokenRequest as UserTokenRequestWithCredentials;
			Debug.Assert(request != null, "request != null");

			var userToken = LoadUserToken(context, request.TenantName, request.AccountName, request.Password);

			return userToken;
		}
コード例 #4
0
		private UserToken LoadUserToken(Context context, string tenantName, string accountName, string password)
		{
			// TODO: implement this function

			var sampleUserTokenFactory = this.sampleUserTokenFactoryResolver.GetService(context);
			var result = sampleUserTokenFactory.CreateUserToken(context, 100);

			return result;
		}
コード例 #5
0
		/// <summary>
		/// Lists sample type instances
		/// </summary>
		/// <param name="context">context</param>
		/// <returns>list of sample type instances</returns>
		public List<SampleType> ListSampleTypes(Context context)
		{
			var setProvider = this.setProviderResolver.GetService(context);
			var structureProvider = this.structureProviderResolver.GetService(context);

			var descriptorsTree = structureProvider.GetSampleTypeDescriptorTree(context);
			var entityRootsTree = UITree
				.Create<string, SampleType>(descriptorsTree, name => setProvider.GetSampleTypeInstanceByName(context, name))
				.GetEntityRootsTree();

			return entityRootsTree.Roots.Select(root => ((EntityTreeNode<SampleType>)root).Entity).ToList();
		}
コード例 #6
0
		/// <summary>
		/// Gets user data by user token
		/// </summary>
		/// <param name="context">context</param>
		/// <param name="userToken">user token</param>
		/// <returns>user data</returns>
		public UserData GetUserData(Context context, UserToken userToken)
		{
			int userId = 0;

			if (!(userToken is AnonymousUserToken))
			{
				var token = userToken as SampleUserToken;
				Debug.Assert(token != null, "token != null");

				userId = token.UserId;
			}

			return this.userData[userId];
		}
コード例 #7
0
		/// <summary>
		/// Updates meeting
		/// </summary>
		/// <param name="context">context</param>
		/// <param name="userId">user identifier</param>
		/// <param name="meetingId">meeting identifier</param>
		/// <param name="updateData">meeting update data</param>
		public void UpdateMeeting(Context context, int userId, int meetingId, MeetingUpdateData updateData)
		{
			if (updateData == null)
				throw new MemoryPointerIsNullException("updateData");

			// TODO: user user id to check write access to the meeting

			// TODO: implement this method properly (the following implementation is just a hack)
			this.meetings.Remove(meetingId);

			var newMeetingInitData = new MeetingInitData()
			{
				Id = meetingId,
				Name = updateData.Name,
				StartTime = updateData.StartTime,
				EndTime = updateData.EndTime,
				DelegateProviderResolver = this.delegateProviderResolver,
				AttendeeProviderResolver = this.attendeeProviderResolver,
			};
			
			this.meetings.Add(meetingId, new Meeting(newMeetingInitData));
		}
コード例 #8
0
		/// <summary>
		/// Gets exception for the case when argument is null
		/// </summary>
		/// <param name="context">context</param>
		/// <returns>exception instance</returns>
		public EntityException<SampleType, TestError> GetTestErrorException(Context context)
		{
			var testErrorFactory = testErrorFactoryResolver.GetService(context);
			return new EntityException<SampleType, TestError>(context, this, testErrorFactory.CreateInfoEntity());
		}
コード例 #9
0
		/// <summary>
		/// Gets sample type instance by name
		/// </summary>
		/// <param name="context">context</param>
		/// <param name="name">name</param>
		/// <returns>sample type instance</returns>
		public SampleType GetSampleTypeInstanceByName(Context context, string name)
		{
			SampleType result;
			this.sampleTypes.TryGetValue(name, out result);
			return result;
		}
コード例 #10
0
ファイル: Strings.cs プロジェクト: RozenbergMikhail/Optimum
		/// <summary>
		/// Gets HTML-encoded transformed string with regard to the specified context
		/// </summary>
		/// <param name="context">context</param>
		/// <param name="rawString">raw string</param>
		/// <returns>HTML-encoded string</returns>
		public static string GetHtmlEncodedTransformedString(Context context, string rawString)
		{
			return GetHtmlEncodedString(GetTransformedString(context, rawString));
		}
コード例 #11
0
		/// <summary>
		/// Gets transformed string
		/// </summary>
		/// <param name="context">context</param>
		/// <param name="rawString">raw string</param>
		/// <returns>transformed string</returns>
		public static string Transform(Context context, string rawString)
		{
			return rawString != null ? rawString.Replace('s', '$') : null;
		}
コード例 #12
0
		/// <summary>
		/// Loads output string by key with regard to the specified context
		/// </summary>
		/// <param name="context">context</param>
		/// <param name="key">output string key</param>
		/// <returns>output string</returns>
		protected override string LoadOutputString(Context context, string key)
		{
			return this.resourceManager.GetString(key, context.GetCurrentUICulture());
		}
コード例 #13
0
ファイル: Strings.cs プロジェクト: RozenbergMikhail/Optimum
		/// <summary>
		/// Gets transformed string with regard to the specified context
		/// </summary>
		/// <param name="context">context</param>
		/// <param name="rawString">raw string</param>
		/// <returns>transformed string</returns>
		public static string GetTransformedString(Context context, string rawString)
		{
			return TransformedStrings.Transform(context, rawString);
		}
コード例 #14
0
		/// <summary>
		/// Gets string description of an object with regard to the specified context
		/// </summary>
		/// <param name="context">context</param>
		/// <returns>string representation</returns>
		public override string GetObjectDescription(Context context)
		{
			return string.Format("Name={0};", this.Name);
		}
コード例 #15
0
		/// <summary>
		/// Gets current user token
		/// </summary>
		/// <param name="context">context</param>
		/// <returns>user token</returns>
		public UserToken GetCurrentUserToken(Context context)
		{
			// TODO: read token data from cookie, possibly using IAuthCookiePropertiesProvider
			return new SampleUserToken(100, DateTime.UtcNow);
		}
コード例 #16
0
		/// <summary>
		/// Gets delegate
		/// </summary>
		/// <param name="context">context</param>
		/// <param name="delegateId">delegate identifier</param>
		/// <returns>delegate</returns>
		public Delegate GetDelegate(Context context, int delegateId)
		{
			return this.delegates[delegateId];
		}
コード例 #17
0
		/// <summary>
		/// Gets yet another sample type instance by name
		/// </summary>
		/// <param name="context">context</param>
		/// <param name="name">name</param>
		/// <returns>yet another sample type instance</returns>
		public YetAnotherType GetYetAnotherTypeInstanceByName(Context context, string name)
		{
			YetAnotherType result;
			this.yetAnotherTypes.TryGetValue(name, out result);
			return result;
		}
コード例 #18
0
ファイル: Attendee.cs プロジェクト: RozenbergMikhail/Optimum
		/// <summary>
		/// Gets attendee delegate
		/// </summary>
		/// <param name="context">context</param>
		public Delegate GetDelegate(Context context)
		{
			return this.delegateProvider.GetDelegate(context, this.DelegateId);
		}
コード例 #19
0
		/// <summary>
		/// Gets sample type instances
		/// </summary>
		/// <param name="context">context</param>
		/// <returns>sample type instances</returns>
		public IEnumerable<SampleType> GetSampleTypeInstances(Context context)
		{
			return this.sampleTypes.Values;
		}
コード例 #20
0
ファイル: Attendee.cs プロジェクト: RozenbergMikhail/Optimum
		/// <summary>
		/// Gets string description of an object with regard to the specified context
		/// </summary>
		/// <param name="context">context</param>
		/// <returns>string representation</returns>
		public override string GetObjectDescription(Context context)
		{
			return string.Format("Id={0}; DelegateId={1}; State={2}", this.Id, this.DelegateId, this.State);
		}
コード例 #21
0
ファイル: Object.cs プロジェクト: RozenbergMikhail/Optimum
		/// <summary>
		/// Gets string description of an object with regard to the specified context
		/// </summary>
		/// <param name="context">context</param>
		/// <returns>string representation</returns>
		public abstract string GetObjectDescription(Context context);
コード例 #22
0
ファイル: Delegate.cs プロジェクト: RozenbergMikhail/Optimum
		/// <summary>
		/// Gets string description of an object with regard to the specified context
		/// </summary>
		/// <param name="context">context</param>
		/// <returns>string representation</returns>
		public override string GetObjectDescription(Context context)
		{
			return Surname + "(" + Id + "," + UserId + ")";
		}
コード例 #23
0
		/// <summary>
		/// Gets description of the item
		/// </summary>
		/// <param name="context">context</param>
		/// <returns>description</returns>
		public string GetDescription(Context context)
		{
			return this.description;
		}
コード例 #24
0
		/// <summary>
		/// Gets string description of an object with regard to the specified context
		/// </summary>
		/// <param name="context">context</param>
		/// <returns>string representation</returns>
		public override string GetObjectDescription(Context context)
		{
			return string.Format("Name='{0}'; Description='{1}'", this.Name, this.Description);
		}
コード例 #25
0
		/// <summary>
		/// Gets yet another sample type instances
		/// </summary>
		/// <param name="context">context</param>
		/// <returns>yet another sample type instances</returns>
		public IEnumerable<YetAnotherType> GetYetAnotherTypeInstances(Context context)
		{
			return this.yetAnotherTypes.Values;
		}
コード例 #26
0
		/// <summary>
		/// Gets description of the item
		/// </summary>
		/// <param name="context">context</param>
		/// <returns>description</returns>
		public string GetDescription(Context context)
		{
			return this.resourceManager.GetString(resourceKey, context.GetCurrentUICulture());
		}
コード例 #27
0
		/// <summary>
		/// Lists attendees of specified meeting
		/// </summary>
		/// <param name="context">context</param>
		/// <param name="meetingId">meeting identifier</param>
		/// <returns>attendee instances</returns>
		public IEnumerable<Attendee> ListMeetingAttendees(Context context, int meetingId)
		{
			return this.attendees[meetingId];
		}
コード例 #28
0
		/// <summary>
		/// Gets description of the item
		/// </summary>
		/// <param name="context">context</param>
		/// <returns>description</returns>
		public string GetDescription(Context context)
		{
			return this.descriptionProvider.GetDescription(context);
		}
		/// <summary>
		/// Gets yet another sample type descriptor tree
		/// </summary>
		/// <param name="context">context</param>
		/// <returns>yet another sample type descriptors tree</returns>
		public IUITree GetYetAnotherTypeDescriptorTree(Context context)
		{
			return this.yetAnotherTypeConfigCollection;
		}
コード例 #30
0
		/// <summary>
		/// Gets string description of an object with regard to the specified context
		/// </summary>
		/// <param name="context">context</param>
		/// <returns>string representation</returns>
		public override string GetObjectDescription(Context context)
		{
			return GetDescription(context);
		}