Beispiel #1
0
		public string GetJson(User user)
		{
			ShippingName = string.Format ("{0} {1}",user.FirstName, user.LastName);
			SsoToken = user.Token;
			Email = user.Email;
			Address1 = user.Address;
			Address2 = user.Address2;
			City = user.City;
			State = user.State;
			ZipCode = user.ZipCode;
			Phone = user.Phone;
			Country = user.Country;

			return Newtonsoft.Json.JsonConvert.SerializeObject (this);
		}
		public string GetJson(User user)
		{
			#if __IOS__
			DeviceType = "iOS";
			#elif __ANDROID__
			DeviceType = "Android";
			#endif
			ShippingName = string.Format ("{0} {1}",user.FirstName, user.LastName);
			SsoToken = user.Token;
			Email = user.Email;
			Address1 = user.Address;
			Address2 = user.Address2;
			City = user.City;
			State = user.State;
			ZipCode = user.ZipCode;
			Phone = user.Phone;
			Country = user.Country;

			return Newtonsoft.Json.JsonConvert.SerializeObject (this);
		}
		public ShippingAddressViewController (User user)
		{
			Title = "Shipping";
			//This hides the back button text when you leave this View Controller
			NavigationItem.BackBarButtonItem = new UIBarButtonItem ("", UIBarButtonItemStyle.Plain, handler: null);
			this.user = user;
			TableView.SeparatorStyle = UITableViewCellSeparatorStyle.None;


			Cells.Add (new CustomViewCell (FirstNameField = new TextEntryView {
				PlaceHolder = "First Name",
				Value = user.FirstName,
			}));

			Cells.Add (new CustomViewCell (LastNameField = new TextEntryView {
				PlaceHolder = "Last Name",
				Value = user.LastName,
			}));

			Cells.Add (new CustomViewCell (PhoneNumberField = new TextEntryView {
				PlaceHolder = "Phone Number",
				Value = user.Phone,
				KeyboardType = UIKeyboardType.NumberPad,
			}));

			Cells.Add (new CustomViewCell (AddressField = new TextEntryView {
				PlaceHolder = "Address",
				Value = user.Address,
				AutocapitalizationType = UITextAutocapitalizationType.Words,
			}));

			Cells.Add (new CustomViewCell (Address2Field = new TextEntryView {
				PlaceHolder = "Address",
				Value = user.Address2,
				AutocapitalizationType = UITextAutocapitalizationType.Words,
			}));
			Cells.Add (new CustomViewCell (CityField = new TextEntryView {
				PlaceHolder = "City",
				Value = user.City,
				AutocapitalizationType = UITextAutocapitalizationType.Words,
			}));

			Cells.Add (new CustomViewCell (PostalField = new TextEntryView {
				PlaceHolder = "Postal Code",
				Value = user.ZipCode,
				KeyboardType = UIKeyboardType.NumbersAndPunctuation,
			}));

			Cells.Add (new CustomViewCell (CountryField = new AutoCompleteTextEntry {
				PlaceHolder = "Country",
				Title = "Select your Country",
				Value = user.Country,
				ValueChanged = (v) => GetStates (),
				PresenterView = this,
			}));

			Cells.Add (new CustomViewCell (StateField = new AutoCompleteTextEntry {
				PlaceHolder = "State",
				Value = user.State,
				Title = "Select your state",
				PresenterView = this,
			}));


			GetCountries ();
			GetStates ();

			TableView.Source = new ShippingAddressPageSource { Cells = Cells };
			TableView.TableFooterView = new UIView (new RectangleF (0, 0, 0, BottomButtonView.Height));
			TableView.ReloadData ();

			View.AddSubview (BottomView = new BottomButtonView () {
				ButtonText = "Place Order",
				ButtonTapped = PlaceOrder,
			});

		}
		public ShippingDetailsFragment(User user)
		{
			this.user = user;
		}
		public ShippingDetailsFragment(User user)
		{
			this.user = user;
			this.user.StateCorrected += UpdateState;
		}