Пример #1
0
		public void PutNewComment(Comment comment)
		{
			lock (Database.Main)
			{
				Database.Main.Insert(comment);
			}
		}
Пример #2
0
		public void PutNewComment(Comment comment)
		{
			var cms = new Comments() { Comment = comment };
			var uri = string.Format("http://storage.21offserver.com/json/syncreply/Comments");
			
			var request = (HttpWebRequest) WebRequest.Create (uri);
			request.Method = "PUT";	
			using (var reqStream = request.GetRequestStream())
			{
				ServiceStack.Text.JsonSerializer.SerializeToStream(cms, typeof(Comments), reqStream);
			};
			using (var response = request.GetResponse())
			{
				using (var stream = response.GetResponseStream())
				{
					var responseString = new StreamReader(stream).ReadToEnd();
				}
			}
		}
Пример #3
0
		public static Comment JsonToComment(JsonObject obj)
		{
			var comment = new Comment()
			{
				Id = Convert.ToInt32(obj["Id"].ToString()),
				UserId = Convert.ToInt32(obj["UserId"].ToString()),
				ParentId = Convert.ToInt32(obj["ParentId"].ToString()),
				Name = obj["Name"].ToString().Replace("\"", ""),
				//Time =  DateTime.ParseExact (obj ["Time"], "ddd MMM dd HH:mm:ss zzz yyyy", CultureInfo.InvariantCulture),
			};
			
			DateTime? time = ActivitiesService.JsonToTime(obj["Time"]);
			if (time.HasValue)			
			{
				comment.Time = time.Value;
			}
			
			return comment;
		}
Пример #4
0
		/// <summary>
		/// Called only on user authentification
		/// </summary>
		private void AddNewCommentAsync(AddLoadMoreWithImageElement lme, Section section)
		{
			try
			{
				var comment = new Comment()
				{
					Name = lme.Value,
					ParentId = _ImageID,
					UserId = AppDelegateIPhone.AIphone.MainUser.Id,
					Time = DateTime.UtcNow,
				};
				
				AppDelegateIPhone.AIphone.CommentServ.PutNewComment(comment);
			
				// Now make sure we invoke on the main thread the updates
				this.BeginInvokeOnMainThread(delegate {
					lme.Animating = false;
											
					var uicomment = new UIComment()
					{
						Comment = comment,
						PhotoOwner = _photoOwner,
					};
					
					var act = new CommentElement(uicomment);
					section.Insert(1, act);
					lme.Value = null;							
				});
			}
			catch (Exception ex)
			{
				Util.LogException("Add comment", ex);
			}
		}