Skip to content

Commit

Permalink
fixed bug @ storeitem
Browse files Browse the repository at this point in the history
	modified:   Quyd/Quyd.v12.suo
	modified:   Quyd/Quyd/Controls/ControlItemDetail.xaml.cs
	modified:   Quyd/Quyd/Controls/ControlPost.xaml.cs
	modified:   Quyd/Quyd/Models/Item.cs
	modified:   Quyd/Quyd/PagePost.xaml.cs
	modified:   Quyd/Quyd/PivotPage1.xaml
	modified:   Quyd/Quyd/PivotPage1.xaml.cs
	Quyd/Quyd/Resources/Images/HDPE.jpg
	Quyd/Quyd/Resources/Images/LDPE.jpg
	Quyd/Quyd/Resources/Images/Other.jpg
	Quyd/Quyd/Resources/Images/PETE.jpg
	Quyd/Quyd/Resources/Images/PP.jpg
	Quyd/Quyd/Resources/Images/PS.jpg
	Quyd/Quyd/Resources/Images/V.jpg
  • Loading branch information
tnnkrt committed Jul 10, 2014
1 parent b7075ec commit 03e2a1f
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 24 deletions.
Binary file modified Quyd/Quyd.v12.suo
Binary file not shown.
2 changes: 1 addition & 1 deletion Quyd/Quyd/Controls/ControlItemDetail.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ private async void BoxValue_LostFocus(object sender, RoutedEventArgs e)
if (item != null)
{
(item as Priceable).Price = input;
await item.saveAsync();
await (item as StoreItem).saveAsync();
}
}
catch (System.FormatException)
Expand Down
2 changes: 1 addition & 1 deletion Quyd/Quyd/Controls/ControlPost.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private async void BtnBid_Click(object sender, RoutedEventArgs e)
bid.Post = post;
await bid.saveAsync();
Notification notification = new Notification();
await notification.sendAsync(post.PostBy, false, post, notificationType.bid, false);
//await notification.sendAsync(post.PostBy, false, post, notificationType.bid, false);
}
}
}
24 changes: 12 additions & 12 deletions Quyd/Quyd/Models/Item.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,21 +109,21 @@ orderby postItem["name"] ascending
ParseQuery<ParseObject> query;
if (userItems == null)
{
query = from storeItem in ParseObject.GetQuery("StoreItem")
where storeItem.ObjectId == store.Object.ObjectId
query = from storeItem in ParseObject.GetQuery("StoreItem").Include("item")
where storeItem.Get<ParseObject>("store") == store.Object
where storeItem["item"] == item
where storeItem.CreatedAt <= atDateTime
where storeItem.Get<DateTime>("validTo") >= atDateTime
//where storeItem.CreatedAt <= atDateTime
//where storeItem.Get<DateTime>("validTo") >= atDateTime
orderby storeItem["name"] ascending
select storeItem;
}
else
{
query = from storeItem in ParseObject.GetQuery("StoreItem")
where storeItem.ObjectId == store.Object.ObjectId
query = from storeItem in ParseObject.GetQuery("StoreItem").Include("item")
where storeItem.Get<ParseObject>("store") == store.Object
where userItems.itemList.Contains(storeItem.Get<Item>("item"))
where storeItem.CreatedAt <= atDateTime
where storeItem.Get<DateTime>("validTo") >= atDateTime
//where storeItem.CreatedAt <= atDateTime
//where storeItem.Get<DateTime>("validTo") >= atDateTime
orderby storeItem["name"] ascending
select storeItem;
}
Expand All @@ -141,10 +141,10 @@ orderby storeItem["name"] ascending
}
}

if (storeItem_result.ObjectId == null)
{
await storeItem_result.SaveAsync();
}
//if (storeItem_result.ObjectId == null)
//{
// await storeItem_result.SaveAsync();
//}

itemList.Add(new StoreItem(storeItem_result));
}
Expand Down
12 changes: 8 additions & 4 deletions Quyd/Quyd/PagePost.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,14 @@ private async void Button_Click(object sender, RoutedEventArgs e)
ItemList itemList = await post.getUserItem();
foreach (var item in (itemList))
{
(item as PostItem).Quantity = Convert.ToInt32((StackItem.Children.ElementAt<UIElement>(i) as Quyd.Controls.ControlItemDetail).BoxValue.Text);
i++;
(item as PostItem).Post = post;
await (item as PostItem).saveAsync();
int q = Convert.ToInt32((StackItem.Children.ElementAt<UIElement>(i) as Quyd.Controls.ControlItemDetail).BoxValue.Text);
if (q > 0)
{
(item as PostItem).Quantity = q;
i++;
(item as PostItem).Post = post;
await (item as PostItem).saveAsync();
}
}

NavigationService.GoBack();
Expand Down
4 changes: 2 additions & 2 deletions Quyd/Quyd/PivotPage1.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@

</phone:PivotItem>

<phone:PivotItem x:Name="Notifications" Header="แจ้งเตือน" Margin="0,28,0,0" Background="Transparent">
<!--phone:PivotItem x:Name="Notifications" Header="แจ้งเตือน" Margin="0,28,0,0" Background="Transparent">
<Grid Background="#66FFFFFF">
<TextBlock x:Name="notificationBox" HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top" Height="583" Width="436" Foreground="Black"/>
</Grid>
</phone:PivotItem>
</-->

<!--Unpublish feature
<phone:PivotItem x:Name="Search" Header="ค้นหา" Margin="0,28,0,0" Background="Transparent">
Expand Down
9 changes: 5 additions & 4 deletions Quyd/Quyd/PivotPage1.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public async Task reloadFeedPage(Store store)
controlFeed.controlUserProfile.usernameBox.Text = post.PostBy.Get<string>("name");
string facebookId = post.PostBy.Get<string>("facebookId");
controlFeed.controlUserProfile.profilePictureBox.Source = new BitmapImage(new Uri("http://graph.facebook.com/" + facebookId + "/picture", UriKind.Absolute));
controlFeed.controlPost.locationBox.Text += " (" + post.Location.Latitude + "," + post.Location.Longitude + ")";
controlFeed.controlPost.locationBox.Text = "Bangkok , Thailand";
controlFeed.controlPost.BtnBid.Visibility = (await post.isBidable(ParseUser.CurrentUser)) ? Visibility.Visible : Visibility.Collapsed;
controlFeed.controlPost.setItems(await post.getUserItem());
controlFeed.controlPost.setValue(post, store);
Expand All @@ -142,7 +142,8 @@ public async Task reloadFeedPage(Store store)

public async Task reloadStorePage(Store store)
{
if ((await store.getStoreItemsAsync()).Size > 0)
ItemList itemList = await store.getStoreItemsAsync();
if (itemList.Size > 0)
{
StackItemDetail.Children.Clear();
}
Expand All @@ -151,7 +152,7 @@ public async Task reloadStorePage(Store store)
StoreItemsLoad.Text = "ไม่มีข้อมูล";
}

foreach (var item in (await store.getStoreItemsAsync()))
foreach (var item in itemList)
{
var controlItemDetail = new Quyd.Controls.ControlItemDetail(item);
controlItemDetail.BoxItemName.Text = item.Name;
Expand Down Expand Up @@ -180,7 +181,7 @@ public async Task reloadStorePage(Store store)
controlFeed.controlUserProfile.usernameBox.Text = post.PostBy.Get<string>("name");
string facebookId = post.PostBy.Get<string>("facebookId");
controlFeed.controlUserProfile.profilePictureBox.Source = new BitmapImage(new Uri("http://graph.facebook.com/" + facebookId + "/picture", UriKind.Absolute));
controlFeed.controlPost.locationBox.Text += " (" + post.Location.Latitude + "," + post.Location.Longitude + ")";
controlFeed.controlPost.locationBox.Text = "Bangkok , Thailand";
controlFeed.controlPost.setItems(await post.getUserItem());
controlFeed.controlPost.timeBox.Text = post.CreateAt.ToString();
controlFeed.controlPost.BtnBid.Visibility = (await post.isBidable(ParseUser.CurrentUser)) ? Visibility.Visible : Visibility.Collapsed;
Expand Down

0 comments on commit 03e2a1f

Please sign in to comment.