public void RefreshParent() { ServiceWrapper svc = new ServiceWrapper(); int userId = Convert.ToInt32(CurrentUser.getUserId()); var output = svc.GetCustomerDetails(userId).Result; Bitmap imageBitmap = BlobWrapper.ProfileImages(userId); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Profile); try { ActionBar.SetHomeButtonEnabled(true); ActionBar.SetDisplayHomeAsUpEnabled(true); int userId = Convert.ToInt32(CurrentUser.getUserId()); ServiceWrapper sw = new ServiceWrapper(); var output = sw.GetCustomerDetails(userId).Result; ImageView propicimage = FindViewById <ImageView>(Resource.Id.propicview); ProfilePicturePickDialog pppd = new ProfilePicturePickDialog(); string path = pppd.CreateDirectoryForPictures(); //string path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); var filePath = System.IO.Path.Combine(path + "/" + userId + ".jpg"); if (System.IO.File.Exists(filePath)) { Bitmap imageBitmap = BitmapFactory.DecodeFile(filePath); if (imageBitmap == null) { propicimage.SetImageResource(Resource.Drawable.user1); //propicimage.SetImageBitmap(imageBitmap); } else { propicimage.SetImageBitmap(imageBitmap); } } else { Bitmap imageBitmap = BlobWrapper.ProfileImages(userId); if (imageBitmap == null) { propicimage.SetImageResource(Resource.Drawable.user1); } else { propicimage.SetImageBitmap(imageBitmap); } } ImageButton changepropic = FindViewById <ImageButton>(Resource.Id.btnChangePropic); //changepropic.SetImageResource(Resource.Drawable.dpreplacer); //changepropic.SetScaleType(ImageView.ScaleType.CenterCrop); changepropic.Click += delegate { Intent intent = new Intent(this, typeof(ProfilePicturePickDialog)); StartActivity(intent); }; //Button Btnlogout = FindViewById<Button>(Resource.Id.button1); //Btnlogout.Click += delegate //{ // Intent intent = new Intent(this, typeof(LoginActivity)); // StartActivity(intent); //}; EditText Firstname = FindViewById <EditText>(Resource.Id.txtFirstName); Firstname.Text = output.customer.FirstName; EditText Lastname = FindViewById <EditText>(Resource.Id.txtLastName); Lastname.Text = output.customer.LastName; EditText Mobilenumber = FindViewById <EditText>(Resource.Id.txtMobileNumber); string phno1 = output.customer.PhoneNumber; string phno2 = output.customer.Phone2; if (phno1 != null) { Mobilenumber.Text = phno1; } else { Mobilenumber.Text = phno2; } EditText Email = FindViewById <EditText>(Resource.Id.txtEmail); Email.Text = output.customer.Email; EditText Address = FindViewById <EditText>(Resource.Id.txtAddress); string Addres2 = output.customer.Address2; string Addres1 = output.customer.Address1; Address.Text = string.Concat(Addres1, Addres2); EditText City = FindViewById <EditText>(Resource.Id.txtCity); City.Text = output.customer.City; EditText State = FindViewById <EditText>(Resource.Id.txtState); State.Text = output.customer.State; Button updatebtn = FindViewById <Button>(Resource.Id.UpdateButton); //updatebtn.SetScaleType(ImageView.ScaleType.CenterCrop); updatebtn.Click += async delegate { Customer customer = new Customer(); customer.FirstName = Firstname.Text; customer.LastName = Lastname.Text; customer.PhoneNumber = Mobilenumber.Text; customer.Address1 = Address.Text; customer.Email = Email.Text; customer.CustomerID = userId; customer.State = State.Text; customer.City = City.Text; var x = await sw.UpdateCustomer(customer); if (x == 1) { Toast.MakeText(this, "Thank you your profile is Updated", ToastLength.Short).Show(); } }; } catch (Exception exe) { AlertDialog.Builder aler = new AlertDialog.Builder(this); aler.SetTitle("Sorry"); aler.SetMessage("We're under maintainence"); aler.SetNegativeButton("Ok", delegate { }); Dialog dialog = aler.Create(); dialog.Show(); } ProgressIndicator.Hide(); }
protected override void OnCreate(Bundle bundle) { CheckInternetConnection(); base.OnCreate(bundle); SetContentView(Resource.Layout.Profile); //st.Start(); try { ///LoggingClass.UploadErrorLogs(LoggingClass.CreateDirectoryForLogs()); LoggingClass.LogInfo("Entered into Profile Activity", screenid); ActionBar.SetHomeButtonEnabled(true); ActionBar.SetDisplayHomeAsUpEnabled(true); int userId = Convert.ToInt32(CurrentUser.getUserId()); ServiceWrapper sw = new ServiceWrapper(); var output = sw.GetCustomerDetails(userId).Result; propicimage = FindViewById <ImageView>(Resource.Id.propic); DownloadAsync(this, System.EventArgs.Empty); //ProfilePicturePickDialog pppd = new ProfilePicturePickDialog(); //string path = pppd.CreateDirectoryForPictures(); //string path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); //var filePath = System.IO.Path.Combine(path + "/" + userId + ".jpg"); //if (System.IO.File.Exists(filePath)) //{ // Bitmap imageBitmap = BitmapFactory.DecodeFile(filePath); // if (imageBitmap == null) // { // propicimage.SetImageResource(Resource.Drawable.user1); // propicimage.Dispose(); // } // else // { // propicimage.SetImageBitmap(imageBitmap); // propicimage.Dispose(); // } //} //else //{ // Bitmap imageBitmap = BlobWrapper.ProfileImages(userId); // if (imageBitmap == null) // { // propicimage.SetImageResource(Resource.Drawable.user1); // } // else // { // propicimage.SetImageBitmap(imageBitmap); // } //} InputMethodManager inputManager = (InputMethodManager)this.GetSystemService(Context.InputMethodService); ImageButton changepropic = FindViewById <ImageButton>(Resource.Id.btnChangePropic); changepropic.Click += delegate { LoggingClass.LogInfo("Clicked on change propic", screenid); Intent intent = new Intent(this, typeof(ProfilePicturePickDialog)); StartActivity(intent); }; changepropic.Dispose(); EditText Firstname = FindViewById <EditText>(Resource.Id.txtFirstName); Firstname.Text = output.customer.FirstName; EditText Lastname = FindViewById <EditText>(Resource.Id.txtLastName); Lastname.Text = output.customer.LastName; EditText Mobilenumber = FindViewById <EditText>(Resource.Id.txtMobileNumber); string phno1 = output.customer.PhoneNumber; string phno2 = output.customer.Phone2; if (phno1 != null) { Mobilenumber.Text = phno1; } else { Mobilenumber.Text = phno2; } EditText Email = FindViewById <EditText>(Resource.Id.txtEmail); Email.Text = output.customer.Email; EditText Address = FindViewById <EditText>(Resource.Id.txtAddress); string Addres2 = output.customer.Address2; string Addres1 = output.customer.Address1; Address.Text = string.Concat(Addres1, Addres2); //EditText City = FindViewById<EditText>(Resource.Id.txtCity); //City.Text = output.customer.CardNumber; //if (CurrentUser.getUserId() != null) //{ // City.Enabled = false; //} //else { City.Enabled = true; } EditText PinCode = FindViewById <EditText>(Resource.Id.txtZip); PinCode.Text = output.customer.Zip; Button updatebtn = FindViewById <Button>(Resource.Id.UpdateButton); Spinner spn = FindViewById <Spinner>(Resource.Id.spinner); Spinner Prefered = FindViewById <Spinner>(Resource.Id.spinner1); //spn.SetSelection(4); string state = output.customer.State; int Preferedstore = output.customer.PreferredStore; List <string> storelist = new List <string>(); storelist.Add("--select--"); storelist.Add("Wall"); storelist.Add("PointPleasent"); storelist.Add("Both"); gifImageView = FindViewById <ImageView>(Resource.Id.gifImageView1); //gifImageView.StartAnimation(); List <string> StateList = new List <string>(); StateList.Add("AL"); StateList.Add("AK"); StateList.Add("AZ"); StateList.Add("AR"); StateList.Add("CA"); StateList.Add("CO"); StateList.Add("CT"); StateList.Add("DE"); StateList.Add("FL"); StateList.Add("GA"); StateList.Add("HI"); StateList.Add("ID"); StateList.Add("IL"); StateList.Add("IN"); StateList.Add("IA"); StateList.Add("KS"); StateList.Add("KY"); StateList.Add("LA"); StateList.Add("ME"); StateList.Add("MD"); StateList.Add("MA"); StateList.Add("MI"); StateList.Add("MN"); StateList.Add("MS"); StateList.Add("MO"); StateList.Add("MT"); StateList.Add("NE"); StateList.Add("NV"); StateList.Add("NH"); StateList.Add("NJ"); StateList.Add("NM"); StateList.Add("NY"); StateList.Add("NC"); StateList.Add("ND"); StateList.Add("OH"); StateList.Add("OK"); StateList.Add("OR"); StateList.Add("PA"); StateList.Add("RI"); StateList.Add("SC"); StateList.Add("SD"); StateList.Add("TN"); StateList.Add("TX"); StateList.Add("UT"); StateList.Add("VT"); StateList.Add("VA"); StateList.Add("WA"); StateList.Add("WV"); StateList.Add("WI"); StateList.Add("WY"); int i = StateList.IndexOf(state.ToString()); spn.SetSelection(i); //int p = storelist.IndexOf(Prefered.SelectedItem.ToString()); Prefered.SetSelection(Preferedstore); inputManager.HideSoftInputFromWindow(Firstname.WindowToken, 0); inputManager.HideSoftInputFromWindow(Lastname.WindowToken, 0); inputManager.HideSoftInputFromWindow(Address.WindowToken, 0); inputManager.HideSoftInputFromWindow(PinCode.WindowToken, 0); inputManager.HideSoftInputFromWindow(Email.WindowToken, 0); if (CurrentUser.getUserId() == null) { AlertDialog.Builder aler = new AlertDialog.Builder(this, Resource.Style.MyDialogTheme); aler.SetTitle("Sorry"); aler.SetMessage("This feature is available only for VIP Users"); aler.SetNegativeButton("Ok", delegate { var intent = new Intent(this, typeof(TabActivity)); StartActivity(intent); }); Dialog dialog1 = aler.Create(); dialog1.Show(); } else { updatebtn.Click += async delegate { if ((Email.Text.Contains("@")) == false || (Email.Text.Contains(".")) == false) { AndHUD.Shared.ShowErrorWithStatus(this, "Email is invalid", MaskType.Clear, TimeSpan.FromSeconds(2)); } else if ((PinCode.Text.Length != 5)) { AndHUD.Shared.ShowErrorWithStatus(this, "Zipcode is invalid", MaskType.Clear, TimeSpan.FromSeconds(2)); } else { AndHUD.Shared.Show(this, "Please Wait", Convert.ToInt32(MaskType.Clear)); //int p = storelist.IndexOf(Prefered.SelectedItem.ToString()); //Prefered.SetSelection(p); Customer customer = new Customer() { FirstName = Firstname.Text, LastName = Lastname.Text, PhoneNumber = Mobilenumber.Text, Address1 = Address.Text, Email = Email.Text, CustomerID = userId, //State = State.Text, State = spn.SelectedItem.ToString(), //City = City.Text //CardNumber = City.Text, Zip = PinCode.Text, PreferredStore = Convert.ToInt32(Prefered.SelectedItemId) }; CurrentUser.SavePrefered(Convert.ToInt32(Prefered.SelectedItemId)); LoggingClass.LogInfo("Clicked on update info", screenid); var x = await sw.UpdateCustomer(customer); if (x == 1) { Toast.MakeText(this, "Thank you your profile is Updated", ToastLength.Short).Show(); } AndHUD.Shared.Dismiss(); AndHUD.Shared.ShowSuccess(this, "Profile Updated", MaskType.Clear, TimeSpan.FromSeconds(2)); // var intent = new Intent(this, typeof(TabActivity)); //StartActivity(intent); } }; } } catch (Exception exe) { LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString()); AlertDialog.Builder aler = new AlertDialog.Builder(this); aler.SetTitle("Sorry"); aler.SetMessage("We're under maintainence"); aler.SetNegativeButton("Ok", delegate { }); Dialog dialog = aler.Create(); dialog.Show(); } //st.Stop(); //LoggingClass.LogTime("Profile activity", st.Elapsed.TotalSeconds.ToString()); ProgressIndicator.Hide(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.ProfileCell); int userId = Convert.ToInt32(CurrentUser.getUserId()); ActionBar.SetHomeButtonEnabled(true); ActionBar.SetDisplayHomeAsUpEnabled(true); ServiceWrapper sw = new ServiceWrapper(); var output = sw.GetCustomerDetails(userId).Result; RefreshParent(); if (CurrentUser.getUserId() == "0" || CurrentUser.getUserId() == null) { AlertDialog.Builder aler = new AlertDialog.Builder(this, Resource.Style.MyDialogTheme); aler.SetTitle("Sorry"); aler.SetMessage("This feature is available only for VIP Users"); aler.SetPositiveButton("Log in", delegate { string str = null; CurrentUser.SaveGuestId(str); var intent = new Intent(this, typeof(LoginActivity)); StartActivity(intent); }); aler.SetNegativeButton("KnowMore", delegate { var uri = Android.Net.Uri.Parse("https://hangoutz.azurewebsites.net/index.html"); var intent = new Intent(Intent.ActionView, uri); StartActivity(intent); }); aler.SetNeutralButton("Cancel", delegate { var intent = new Intent(this, typeof(Login)); StartActivity(intent); }); Dialog dialog1 = aler.Create(); dialog1.Show(); } try { propicimage = FindViewById <ImageView>(Resource.Id.user_profile_photo); TextView Name = FindViewById <TextView>(Resource.Id.user_profile_name); TextView Email = FindViewById <TextView>(Resource.Id.user_profile_short_bio); TextView Mobile = FindViewById <TextView>(Resource.Id.user_mobile); TextView Address = FindViewById <TextView>(Resource.Id.user_Address); TextView PinCode = FindViewById <TextView>(Resource.Id.user_Zip); TextView Preferrd = FindViewById <TextView>(Resource.Id.user_Preferred); TextView State = FindViewById <TextView>(Resource.Id.user_State); TextView Card = FindViewById <TextView>(Resource.Id.user_Card); TextView Expiry = FindViewById <TextView>(Resource.Id.User_expiry); Button Drop = FindViewById <Button>(Resource.Id.drop_down_option_menu); ImageView ChangePRo = FindViewById <ImageView>(Resource.Id.add_friend); ChangePRo.Click += delegate { AlertDialog.Builder aler = new AlertDialog.Builder(this, Resource.Style.MyDialogTheme); aler.SetTitle("Please choose an option to upload profile picture"); aler.SetPositiveButton("Gallery", delegate { Intent = new Intent(); Intent.SetType("image/*"); Intent.SetAction(Intent.ActionGetContent); StartActivityForResult(Intent.CreateChooser(Intent, "Select Picture"), PickImageId); }); aler.SetNegativeButton("Camera", delegate { if (IsThereAnAppToTakePictures()) { CreateDirectoryForPictures(); TakeAPicture(); } }); aler.SetNeutralButton("Cancel", delegate { }); Dialog dialog1 = aler.Create(); dialog1.Show(); }; // Boolean indirect = true; if (indirect == true) { System.Threading.Timer timer = null; timer = new System.Threading.Timer((obj) => { DownloadAsync(this, System.EventArgs.Empty); timer.Dispose(); }, null, 2000, System.Threading.Timeout.Infinite); } else { DownloadAsync(this, System.EventArgs.Empty); } Drop.Click += (s, arg) => { Intent intent = new Intent(this, typeof(ProfileActivity)); ProgressIndicator.Show(this); StartActivity(intent); //PopupMenu menu = new PopupMenu(this, Drop); //menu.Inflate(Resource.Drawable.options_menu_1); //menu.Show(); }; string First = output.customer.FirstName; string Last = output.customer.LastName; Name.Text = string.Concat(First, Last); Card.Text = output.customer.CardNumber.ToString(); Email.Text = output.customer.Email; PinCode.Text = output.customer.Zip.ToString(); Preferrd.Text = output.customer.PreferredStore.ToString(); if (Preferrd.Text == "0") { Preferrd.Text = "-Select your preferred store-"; } else if (Preferrd.Text == "1") { Preferrd.Text = AppConstants.WallStore; } else if (Preferrd.Text == "2") { Preferrd.Text = AppConstants.PointPleasantStore; } else { Preferrd.Text = AppConstants.SecaucusStore; } State.Text = output.customer.State; Expiry.Text = output.customer.ExpireDate.ToString(); string Addres2 = output.customer.Address2; string Addres1 = output.customer.Address1; Address.Text = string.Concat(Addres1, Addres2); string phno1 = output.customer.PhoneNumber; string phno2 = output.customer.Phone2; if (phno1 != null) { Mobile.Text = phno1; } else { Mobile.Text = phno2; } } catch (Exception exe) { LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString()); } ProgressIndicator.Hide(); }
public void RefreshParent() { ServiceWrapper svc = new ServiceWrapper(); int userId = Convert.ToInt32(CurrentUser.getUserId()); var output = svc.GetCustomerDetails(userId).Result; }
protected override void OnCreate(Bundle bundle) { CheckInternetConnection(); base.OnCreate(bundle); SetContentView(Resource.Layout.Profile); //st.Start(); try { ///LoggingClass.UploadErrorLogs(LoggingClass.CreateDirectoryForLogs()); LoggingClass.LogInfo("Entered into Profile Activity", screenid); ActionBar.SetHomeButtonEnabled(true); ActionBar.SetDisplayHomeAsUpEnabled(true); int userId = Convert.ToInt32(CurrentUser.getUserId()); ServiceWrapper sw = new ServiceWrapper(); var output = sw.GetCustomerDetails(userId).Result; propicimage = FindViewById <ImageView>(Resource.Id.propic); //propicimage.SetImageResource(Resource.Drawable.ProfileEmpty); propicimage.SetImageResource(Resource.Drawable.Loading); RefreshParent(); if (indirect == true) { System.Threading.Timer timer = null; timer = new System.Threading.Timer((obj) => { DownloadAsync(this, System.EventArgs.Empty); timer.Dispose(); }, null, 4000, System.Threading.Timeout.Infinite); } else { DownloadAsync(this, System.EventArgs.Empty); } // DownloadAsync(this, System.EventArgs.Empty); ImageButton changepropic = FindViewById <ImageButton>(Resource.Id.btnChangePropic); changepropic.Click += delegate { LoggingClass.LogInfo("Clicked on change propic", screenid); Intent intent = new Intent(this, typeof(ProfilePicturePickDialog)); StartActivity(intent); }; changepropic.Dispose(); EditText Firstname = FindViewById <EditText>(Resource.Id.txtFirstName); Button updatebtn = FindViewById <Button>(Resource.Id.UpdateButton); Spinner spn = FindViewById <Spinner>(Resource.Id.spinner); Spinner Prefered = FindViewById <Spinner>(Resource.Id.spinner1); TextView card = FindViewById <TextView>(Resource.Id.txtcard1); TextView exp = FindViewById <TextView>(Resource.Id.txtexp); EditText Mobilenumber = FindViewById <EditText>(Resource.Id.txtMobileNumber); EditText Lastname = FindViewById <EditText>(Resource.Id.txtLastName); EditText Email = FindViewById <EditText>(Resource.Id.txtEmail); EditText Address = FindViewById <EditText>(Resource.Id.txtAddress); EditText PinCode = FindViewById <EditText>(Resource.Id.txtZip); if (CurrentUser.GetGuestId() != null || CurrentUser.getUserId() == "0") { AlertDialog.Builder aler = new AlertDialog.Builder(this, Resource.Style.MyDialogTheme); aler.SetTitle("Sorry"); aler.SetMessage("This feature is available only for VIP Users"); aler.SetPositiveButton("Login", delegate { var intent = new Intent(this, typeof(LoginActivity)); StartActivity(intent); }); aler.SetNegativeButton("KnowMore", delegate { var uri = Android.Net.Uri.Parse("https://hangoutz.azurewebsites.net/index.html"); var intent = new Intent(Intent.ActionView, uri); StartActivity(intent); }); aler.SetNeutralButton("Cancel", delegate { var intent = new Intent(this, typeof(TabActivity)); StartActivity(intent); }); Dialog dialog1 = aler.Create(); dialog1.Show(); } else { Firstname.Text = output.customer.FirstName; Firstname.FocusableInTouchMode = false; Firstname.Click += delegate { Firstname.FocusableInTouchMode = true; }; card.Text = output.customer.CardNumber; exp.Text = output.customer.ExpireDate.ToString(); if (exp.Text == null || exp.Text == "") { exp.Text = "--"; } else { exp.Text = output.customer.ExpireDate.ToString("yyyy/MM/dd"); } Lastname.Text = output.customer.LastName; Lastname.FocusableInTouchMode = false; Lastname.Click += delegate { Lastname.FocusableInTouchMode = true; }; Mobilenumber.FocusableInTouchMode = false; string phno1 = output.customer.PhoneNumber; string phno2 = output.customer.Phone2; if (phno1 != null) { Mobilenumber.Text = phno1; } else { Mobilenumber.Text = phno2; } Mobilenumber.Click += delegate { Mobilenumber.FocusableInTouchMode = true; }; Email.Text = output.customer.Email; Email.FocusableInTouchMode = false; Email.Click += delegate { Email.FocusableInTouchMode = true; }; string Addres2 = output.customer.Address2; string Addres1 = output.customer.Address1; Address.Text = string.Concat(Addres1, Addres2); Address.FocusableInTouchMode = false; Address.Click += delegate { Address.FocusableInTouchMode = true; }; //EditText City = FindViewById<EditText>(Resource.Id.txtCity); //City.Text = output.customer.CardNumber; //if (CurrentUser.getUserId() != null) //{ // City.Enabled = false; //} //else { City.Enabled = true; } PinCode.Text = output.customer.Zip; PinCode.FocusableInTouchMode = false; PinCode.Click += delegate { PinCode.FocusableInTouchMode = true; }; //spn.SetSelection(4); string state = output.customer.State; int Preferedstore = output.customer.PreferredStore; List <string> storelist = new List <string>(); storelist.Add("--Select your preferred store--"); storelist.Add("Wall"); storelist.Add("Point Pleasant"); storelist.Add("All"); gifImageView = FindViewById <ImageView>(Resource.Id.gifImageView1); //gifImageView.StartAnimation(); List <string> StateList = new List <string>(); StateList.Add("AL"); StateList.Add("AK"); StateList.Add("AZ"); StateList.Add("AR"); StateList.Add("CA"); StateList.Add("CO"); StateList.Add("CT"); StateList.Add("DE"); StateList.Add("FL"); StateList.Add("GA"); StateList.Add("HI"); StateList.Add("ID"); StateList.Add("IL"); StateList.Add("IN"); StateList.Add("IA"); StateList.Add("KS"); StateList.Add("KY"); StateList.Add("LA"); StateList.Add("ME"); StateList.Add("MD"); StateList.Add("MA"); StateList.Add("MI"); StateList.Add("MN"); StateList.Add("MS"); StateList.Add("MO"); StateList.Add("MT"); StateList.Add("NE"); StateList.Add("NV"); StateList.Add("NH"); StateList.Add("NJ"); StateList.Add("NM"); StateList.Add("NY"); StateList.Add("NC"); StateList.Add("ND"); StateList.Add("OH"); StateList.Add("OK"); StateList.Add("OR"); StateList.Add("PA"); StateList.Add("RI"); StateList.Add("SC"); StateList.Add("SD"); StateList.Add("TN"); StateList.Add("TX"); StateList.Add("UT"); StateList.Add("VT"); StateList.Add("VA"); StateList.Add("WA"); StateList.Add("WV"); StateList.Add("WI"); StateList.Add("WY"); int i = StateList.IndexOf(state.ToString()); spn.SetSelection(i); //int p = storelist.IndexOf(Prefered.SelectedItem.ToString()); Prefered.SetSelection(Preferedstore); updatebtn.Click += async delegate { if ((Email.Text.Contains("@")) == false || (Email.Text.Contains(".")) == false) { AndHUD.Shared.ShowErrorWithStatus(this, "Email is invalid", MaskType.Clear, TimeSpan.FromSeconds(2)); } else if ((PinCode.Text.Length != 5)) { AndHUD.Shared.ShowErrorWithStatus(this, "Zipcode is invalid", MaskType.Clear, TimeSpan.FromSeconds(2)); } else { AndHUD.Shared.Show(this, "Please Wait...", Convert.ToInt32(MaskType.Clear)); Customer customer = new Customer() { FirstName = Firstname.Text, LastName = Lastname.Text, PhoneNumber = Mobilenumber.Text, Address1 = Address.Text, Email = Email.Text, CustomerID = userId, //State = State.Text, State = spn.SelectedItem.ToString(), //City = City.Text //CardNumber = City.Text, Zip = PinCode.Text, PreferredStore = Convert.ToInt32(Prefered.SelectedItemId) }; CurrentUser.SavePrefered(Convert.ToInt32(Prefered.SelectedItemId)); LoggingClass.LogInfo("Clicked on update info", screenid); var x = await sw.UpdateCustomer(customer); if (x == 1) { // Toast.MakeText(this, "Thank you your profile is Updated", ToastLength.Short).Show(); } AndHUD.Shared.Dismiss(); AndHUD.Shared.ShowSuccess(this, "Profile Updated", MaskType.Clear, TimeSpan.FromSeconds(2)); //StartActivity(intent); } }; } } catch (Exception exe) { LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString()); AlertDialog.Builder aler = new AlertDialog.Builder(this); aler.SetTitle("Sorry"); aler.SetMessage("We're under maintainence"); aler.SetNegativeButton("Ok", delegate { }); Dialog dialog = aler.Create(); dialog.Show(); } ProgressIndicator.Hide(); }
protected override void OnCreate(Bundle bundle) { CheckInternetConnection(); base.OnCreate(bundle); SetContentView(Resource.Layout.Profile); try { GC.Collect(); LoggingClass.LogInfo("Entered into Profile Activity", screenid); ActionBar.SetHomeButtonEnabled(true); ActionBar.SetDisplayHomeAsUpEnabled(true); int userId = Convert.ToInt32(CurrentUser.getUserId()); ServiceWrapper sw = new ServiceWrapper(); var output = sw.GetCustomerDetails(userId).Result; EditText Firstname = FindViewById <EditText>(Resource.Id.txtFirstName); Button updatebtn = FindViewById <Button>(Resource.Id.UpdateButton); Spinner spn = FindViewById <Spinner>(Resource.Id.spinner); Spinner Prefered = FindViewById <Spinner>(Resource.Id.spinner1); EditText Mobilenumber = FindViewById <EditText>(Resource.Id.txtMobileNumber); EditText Lastname = FindViewById <EditText>(Resource.Id.txtLastName); EditText Email = FindViewById <EditText>(Resource.Id.txtEmail); EditText Address = FindViewById <EditText>(Resource.Id.txtAddress); EditText PinCode = FindViewById <EditText>(Resource.Id.txtZip); if (CurrentUser.getUserId() == "0" || CurrentUser.getUserId() == null) { AlertDialog.Builder aler = new AlertDialog.Builder(this, Resource.Style.MyDialogTheme); aler.SetTitle("Sorry"); aler.SetMessage("This feature is available only for VIP Users"); aler.SetPositiveButton("Log in", delegate { string str = null; CurrentUser.SaveGuestId(str); var intent = new Intent(this, typeof(LoginActivity)); StartActivity(intent); }); aler.SetNegativeButton("KnowMore", delegate { var uri = Android.Net.Uri.Parse("https://hangoutz.azurewebsites.net/index.html"); var intent = new Intent(Intent.ActionView, uri); StartActivity(intent); }); aler.SetNeutralButton("Cancel", delegate { var intent = new Intent(this, typeof(Login)); StartActivity(intent); }); Dialog dialog1 = aler.Create(); dialog1.Show(); } else { Firstname.Text = output.customer.FirstName; Lastname.Text = output.customer.LastName; string phno1 = output.customer.PhoneNumber; string phno2 = output.customer.Phone2; if (phno1 != null) { Mobilenumber.Text = phno1; } else { Mobilenumber.Text = phno2; } Email.Text = output.customer.Email; string Addres2 = output.customer.Address2; string Addres1 = output.customer.Address1; Address.Text = string.Concat(Addres1, Addres2); PinCode.Text = output.customer.Zip; string state = output.customer.State; int Preferedstore = output.customer.PreferredStore; List <string> storelist = new List <string>(); storelist.Add("--Select your preferred store--"); storelist.Add("Wall"); storelist.Add("Point Pleasant"); storelist.Add("Secaucus"); storelist.Add("All"); List <string> StateList = new List <string>(); StateList.Add("AL"); StateList.Add("AK"); StateList.Add("AZ"); StateList.Add("AR"); StateList.Add("CA"); StateList.Add("CO"); StateList.Add("CT"); StateList.Add("DE"); StateList.Add("FL"); StateList.Add("GA"); StateList.Add("HI"); StateList.Add("ID"); StateList.Add("IL"); StateList.Add("IN"); StateList.Add("IA"); StateList.Add("KS"); StateList.Add("KY"); StateList.Add("LA"); StateList.Add("ME"); StateList.Add("MD"); StateList.Add("MA"); StateList.Add("MI"); StateList.Add("MN"); StateList.Add("MS"); StateList.Add("MO"); StateList.Add("MT"); StateList.Add("NE"); StateList.Add("NV"); StateList.Add("NH"); StateList.Add("NJ"); StateList.Add("NM"); StateList.Add("NY"); StateList.Add("NC"); StateList.Add("ND"); StateList.Add("OH"); StateList.Add("OK"); StateList.Add("OR"); StateList.Add("PA"); StateList.Add("RI"); StateList.Add("SC"); StateList.Add("SD"); StateList.Add("TN"); StateList.Add("TX"); StateList.Add("UT"); StateList.Add("VT"); StateList.Add("VA"); StateList.Add("WA"); StateList.Add("WV"); StateList.Add("WI"); StateList.Add("WY"); try { int i = StateList.IndexOf(state.ToString()); spn.SetSelection(i); } catch { } int p = storelist.IndexOf(Prefered.SelectedItem.ToString()); Prefered.SetSelection(Preferedstore); updatebtn.Click += async delegate { if ((Email.Text.Contains("@")) == false || (Email.Text.Contains(".")) == false) { AndHUD.Shared.ShowErrorWithStatus(this, "Email is invalid", MaskType.Clear, TimeSpan.FromSeconds(2)); } else if ((PinCode.Text.Length != 5)) { AndHUD.Shared.ShowErrorWithStatus(this, "Zipcode is invalid", MaskType.Clear, TimeSpan.FromSeconds(2)); } else if ((Mobilenumber.Text == "") || (Mobilenumber.Text.Length != 10)) { AndHUD.Shared.ShowErrorWithStatus(this, "Enter valid mobile number", MaskType.Clear, TimeSpan.FromSeconds(2)); } else { AndHUD.Shared.Show(this, "Please Wait...", Convert.ToInt32(MaskType.Clear)); Customer customer = new Customer() { FirstName = Firstname.Text, LastName = Lastname.Text, PhoneNumber = Mobilenumber.Text, Address1 = Address.Text, Email = Email.Text, CustomerID = userId, State = spn.SelectedItem.ToString(), Zip = PinCode.Text, PreferredStore = Convert.ToInt32(Prefered.SelectedItemId) }; CurrentUser.SavePrefered(Convert.ToInt32(Prefered.SelectedItemId)); LoggingClass.LogInfo("Clicked on update info", screenid); var x = await sw.UpdateCustomer(customer); if (x == 1) { var intent = new Intent(this, typeof(PotraitActivity)); StartActivity(intent); } AndHUD.Shared.Dismiss(); AndHUD.Shared.ShowSuccess(this, "Profile Updated", MaskType.Clear, TimeSpan.FromSeconds(2)); } }; ProgressIndicator.Hide(); updatebtn.Dispose(); } } catch (Exception exe) { LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString()); AlertDialog.Builder aler = new AlertDialog.Builder(this); aler.SetTitle("Sorry"); aler.SetMessage("We're under maintainence"); aler.SetNegativeButton("Ok", delegate { }); Dialog dialog = aler.Create(); dialog.Show(); } ProgressIndicator.Hide(); }