-
Notifications
You must be signed in to change notification settings - Fork 0
/
BlVerifyLead.xaml.cs
64 lines (59 loc) · 2.36 KB
/
BlVerifyLead.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using BoothLeads.ServiceClient;
using BoothLeads.ServiceClient.DataContracts;
using System.Runtime.Serialization.Json;
using System.IO;
using System.Text;
namespace BoothLeads
{
public partial class BlVerifyLead : PhoneApplicationPage
{
public BlVerifyLead()
{
InitializeComponent();
}
private void ContentPanel_Loaded(object sender, RoutedEventArgs e)
{
boothLeadsHeader boothLead = new boothLeadsHeader();
boothLead.HeaderText = "Veryfy Lead";
boothLead.PreviousPage = "mainpage";
TitlePanel.Children.Add(boothLead);
VerifyLeads(BoothLeadGlobalAccess.BLUserDetails.UserID, "a00F0000008DPw9IAG", "a0CF000000E0asdMAB");
}
private void VerifyLeads(string userid, string eventId, string qrCodeValue)
{
WebClient wbClient = new WebClient();
wbClient.UploadStringCompleted += new UploadStringCompletedEventHandler(wbClient_UploadStringCompleted);
string syncLeadsUrl = string.Format(SalesForceServiceURL.SVC_VERIFYLEADS_URL, eventId, userid, qrCodeValue);
wbClient.Headers["Authorization"] = BoothLeadGlobalAccess.Access_Token;
wbClient.UploadStringAsync(new Uri(syncLeadsUrl), "POST", string.Empty);
}
void wbClient_UploadStringCompleted(object sender, UploadStringCompletedEventArgs e)
{
Stream stream = new MemoryStream(Encoding.Unicode.GetBytes(e.Result));
DataContractJsonSerializer obj = new DataContractJsonSerializer(typeof(VerifyLead));
VerifyLead slResponse = (VerifyLead)obj.ReadObject(stream);
if (string.IsNullOrEmpty(slResponse.error) == false)
{
MessageBox.Show("Error: " + slResponse.error);
return;
}
else
{
BoothLeadGlobalAccess.ScanVerifyLead = slResponse;
NavigationService.Navigate(new Uri(string.Format("/UserProfile.xaml"), UriKind.Relative));
}
}
}
}