コード例 #1
0
ファイル: BookingEntry.cs プロジェクト: avantidesai/EmpireCLS
		public LocationFinderItem (CustomerProfile person, LocationInfo address)
		{
			this.Type = LocationFinderItemType.Contact;
			this.DataItem = address;

			//this.Text = string.Format ("{0} {1}", person.FirstName, person.LastName);
			this.Detail = address.StreetAddress;			

			this.FormattedAddress = address.FormattedAddress;
			this.Lat = address.Lat;
			this.Lng = address.Lng;
		}
コード例 #2
0
		public AccountClient ProfileNew (CustomerProfile profile, bool async = false)
		{
			/*profile.IsSurveyOptOut = !profile.IsSurveyOptOut;
			profile.Name = string.Format ("{0},{1}", profile.LastName, profile.FirstName);
			return InvokeStrategy<AccountClient> (() => {
				if (async) {
					if (base.PostObjectAsync (UrlPaths.ProfileNew, profile, this.ProfileNewCompleted).HasErrors)
						return;
				} else {
					if (base.PostObject (UrlPaths.ProfileNew, profile).HasErrors)
						return;
					ProfileNewCompleted ();
				}
			});*/
			return null;
		}
コード例 #3
0
		private void ProfileUpdateCompleted ()
		{
			if (this.HasErrors)
				return;

			this.ProfileUpdateResult = this.Model as CustomerProfile;
			if (_newLoginInfo != null)
				UpdateCredentialCache (_newLoginInfo);
               
			ApplicationContext.Current.CurrentUser.Person = this.ProfileUpdateResult;
			// ChangePassword(this.ProfileUpdateResult, true);  // the profile update will also update the password, don't need to call separately
			LogContext.Current.Log<AccountClient> ("ProfileUpdateCompleted");
			NotifyCompleted ();
		}
コード例 #4
0
		private void ChangePassword (CustomerProfile profile, bool async = false)
		{
			/*if (profile.OldRegistrationPassword.IsEmpty () || profile.RegistrationPassword.IsEmpty ())
				return;

			ChangePassword (new CustomerPasswordChange {
				OldRegistrationPassword = profile.OldRegistrationPassword,
				NewRegistrationPassword = profile.RegistrationPassword 
			}, async
			);*/
		}
コード例 #5
0
		public AccountClient ProfileUpdate (CustomerProfile profile, bool async = false)
		{
			/*profile.Name = string.Format ("{0},{1}", profile.LastName, profile.FirstName);
			profile.IsSurveyOptOut = !profile.IsSurveyOptOut;

			// see if login cred's changed
			AccountLogonInfo existing = ApplicationContext.Current.RememberedUser;
			if (existing != null) {
				if (!existing.IsEmpty) {
					// since an existing user cannot change their userID, all we have to worry about is if their password changes
					if (existing.Password != profile.RegistrationPassword && profile.RegistrationPassword != null) {
						// need to update remembered user for persisting to cache
						this._newLoginInfo = new AccountLogonInfo () {
							UserName = existing.UserName,
							RememberMe = true,
							Password = profile.RegistrationPassword

						};
					}

				}
			}*/

			return InvokeStrategy<AccountClient> (() => {
				if (async) {
					if (base.PostObjectAsync (UrlPaths.ProfileUpdate, profile, this.ProfileUpdateCompleted).HasErrors)
						return;
				} else {
					if (base.PostObject (UrlPaths.ProfileUpdate, profile).HasErrors)
						return;

					ProfileUpdateCompleted ();
				}
			});
		}
コード例 #6
0
		private void ProfileNewCompleted ()
		{
			if (this.HasErrors)
				return;
			this.ProfileNewResult = this.Model as CustomerProfile;
			ApplicationContext.Current.CurrentUser.Person = this.ProfileNewResult;
			LogContext.Current.Log<AccountClient> ("ProfileNewCompleted");
			NotifyCompleted ();
		}
コード例 #7
0
ファイル: BookingEntry.cs プロジェクト: avantidesai/EmpireCLS
		public void PreLoadTrip (CustomerProfile person)
		{
			if (person == null)
				return;

			if (!person.Name.IsEmpty ()) {
				// format of name is last, first
				string parseName = person.Name.Replace (" ", "").Trim (); //remove all spaces, including between names
				int separatorLocation = parseName.IndexOf (",");

				if (this.PassengerLastName.IsEmpty ())
					this.PassengerLastName = parseName.Substring (0, separatorLocation);

				if (this.PassengerFirstName.IsEmpty ())
					this.PassengerFirstName = parseName.Substring (separatorLocation + 1);

				if (this.BillingName.IsEmpty ())
					this.BillingName = this.PassengerFirstName + " " + this.PassengerLastName;

				if (this.BookedBy.IsEmpty ())
					this.BookedBy = person.Name;


			}
			if (this.CustomerNumber.IsEmpty ())
				this.CustomerNumber = person.CustomerNumber;

			if (this.ContactPhoneNumber.IsEmpty ()) {
				//if (!person.WorkPhone.IsEmpty ())
				//		this.ContactPhoneNumber = person.WorkPhone;
				//	else 
				if (!person.CustomerNumber.IsEmpty ())
					this.ContactPhoneNumber = person.CustomerNumber;
			}
			if (!person.AdminEmail.IsEmpty () && this.GuestEmail.IsEmpty ())
				this.GuestEmail = person.AdminEmail;

			if (!person.Address.IsEmpty () && this.BillingAddress.IsEmpty ())
				this.BillingAddress = person.Address;

			if (!person.City.IsEmpty () && this.BillingTown.IsEmpty ())
				this.BillingTown = person.City;

			if (!person.State.IsEmpty () && this.BillingState.IsEmpty ())
				this.BillingState = person.State;

			if (!person.ZipCode.IsEmpty () && this.BillingZip.IsEmpty ())
				this.BillingZip = person.ZipCode;

			// For Notifications:
			// if the mobile app allows for it, and the profile allows for it, set the "enabled" setting to the value stored in the customer profile.  this is our default setting
			var defaultSettingsCache = ApplicationContext.Current.DefaultSettingsCache;
			if (defaultSettingsCache.Value.IsDriverInfoNotificationsEligible && person.IsDriverInfoNotificationsEligible)
				this.IsDriverInfoNotificationsEnabled = person.IsDriverInfoNotificationsEnabled;
			else
				this.IsDriverInfoNotificationsEnabled = false;

			if (defaultSettingsCache.Value.IsDriverOnLocationNotificationsEligible && person.IsDriverOnLocationNotificationsEligible)
				this.IsDriverOnLocationNotificationsEnabled = person.IsDriverOnLocationNotificationsEnabled;
			else
				this.IsDriverOnLocationNotificationsEnabled = false;

		}