void OnListViewItemSelected(object sender, SelectedItemChangedEventArgs e)
 {
     selectedItemEmail    = e.SelectedItem as ProfileEmail;
     selectedProfilePhone = e.SelectedItem as ProfilePhone;
     selectedItemSM       = e.SelectedItem as ProfileSM;
     selectedItemWhatsapp = e.SelectedItem as ProfileWhatsapp;
 }
Пример #2
0
 void OnCollectionViewSelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     //string previous = (e.PreviousSelection.FirstOrDefault() as ProfileLocal)?.Name;
     selectedItem = e.CurrentSelection.FirstOrDefault() as ProfileLocal;
     ProfilesSelected.Add(selectedItem);
     if (selectedItem.Logo == "mail3")
     {
         ProfileEmail E = Converter.ToProfileEmail(selectedItem);
         MainViewModel.GetInstance().DetailsBoxEdith.removeProfileEmail(E);
     }
     else if (selectedItem.Logo == "tel3")
     {
         ProfilePhone P = Converter.ToProfilePhone(selectedItem);
         MainViewModel.GetInstance().DetailsBoxEdith.removeProfilePhone(P);
     }
     else if (selectedItem.Logo == "whatsapp3")
     {
         ProfileWhatsapp W = Converter.ToProfileWhatsapp(selectedItem);
         MainViewModel.GetInstance().DetailsBoxEdith.removeProfileW(W);
     }
     else if (selectedItem.Logo != "mail3" && selectedItem.Logo != "tel3" && selectedItem.Logo != "whatsapp3")
     {
         ProfileSM SM = Converter.ToProfileSM(selectedItem);
         MainViewModel.GetInstance().DetailsBoxEdith.removeProfileSM(SM);
     }
 }
        void OnListViewItemTapped(object sender, ItemTappedEventArgs e)
        {
            ProfileWhatsapp tappedItem = e.Item as ProfileWhatsapp;

            MainViewModel.GetInstance().EditProfileWhatsApp = new EditProfileWhatsAppViewModel(tappedItem.ProfileWhatsappId);
            Navigation.PushAsync(new EditProfileWhatsAppPage());
        }
Пример #4
0
        public void addProfileWhatsapp(ProfileWhatsapp _profileW)
        {
            var W = Converter.ToProfileLocalW(_profileW);

            ProfilePerfiles.Add(W);
            IsEmpty = false;
        }
Пример #5
0
        public async Task <IHttpActionResult> PutProfileWhatsapp(int id, ProfileWhatsapp profileWhatsapp)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != profileWhatsapp.ProfileWhatsappId)
            {
                return(BadRequest());
            }

            db.Entry(profileWhatsapp).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProfileWhatsappExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public void updateProfileWhatsapp(ProfileWhatsapp _profileWhatsapp)
        {
            int newIndex = ProfileWhatsapp.IndexOf(selectedProfileWhatsapp);

            ProfileWhatsapp.Remove(selectedProfileWhatsapp);

            ProfileWhatsapp.Insert(newIndex, _profileWhatsapp);
        }
 public void removeProfileWhatsapp()
 {
     ProfileWhatsapp.Remove(selectedProfileWhatsapp);
     if (ProfileWhatsapp.Count == 0)
     {
         EmptyList = true;
     }
 }
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            ProfileWhatsapp profileWhatsapp = await db.ProfileWhatsapps.FindAsync(id);

            db.ProfileWhatsapps.Remove(profileWhatsapp);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
        public void updateProfile(ProfileWhatsapp _profileWhatsapp)
        {
            int newIndex = profileWhatsApp.IndexOf(selectedProfile);

            profileWhatsApp.Remove(selectedProfile);

            profileWhatsApp.Insert(newIndex, _profileWhatsapp);
            selectedProfile = null;
        }
Пример #10
0
 public static ProfileLocal ToProfileLocalW1(ProfileWhatsapp profile)
 {
     return(new ProfileLocal
     {
         ProfileName = profile.Name,
         value = profile.Number,
         Logo = "whatsapp3",
         Exist = profile.Exist,
         UserId = profile.UserId,
         ProfileId = profile.ProfileWhatsappId
     });
 }
Пример #11
0
        public async Task <IHttpActionResult> PostProfileWhatsapp(ProfileWhatsapp profileWhatsapp)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.ProfileWhatsapps.Add(profileWhatsapp);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = profileWhatsapp.ProfileWhatsappId }, profileWhatsapp));
        }
        public async Task <ActionResult> Edit([Bind(Include = "ProfileWhatsappId,Name,Number,UserId,Exist")] ProfileWhatsapp profileWhatsapp)
        {
            if (ModelState.IsValid)
            {
                db.Entry(profileWhatsapp).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.UserId = new SelectList(db.Users, "UserId", "FirstName", profileWhatsapp.UserId);
            return(View(profileWhatsapp));
        }
        private async Task <ProfileWhatsapp> GetProfile(int _ProfileMSId)
        {
            var apiSecurity = Application.Current.Resources["APISecurity"].ToString();

            profileWhats = new ProfileWhatsapp();
            profileWhats = await this.apiService.GetProfileWhatsApp(
                apiSecurity,
                "/api",
                "/ProfileWhatsapps/GetProfileWhatsApp",
                _ProfileMSId);

            return(profileWhats);
        }
        // GET: ProfileWhatsapps/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ProfileWhatsapp profileWhatsapp = await db.ProfileWhatsapps.FindAsync(id);

            if (profileWhatsapp == null)
            {
                return(HttpNotFound());
            }
            return(View(profileWhatsapp));
        }
Пример #15
0
        public async Task <IHttpActionResult> DeleteProfileWhatsapp(int id)
        {
            ProfileWhatsapp profileWhatsapp = await db.ProfileWhatsapps.FindAsync(id);

            if (profileWhatsapp == null)
            {
                return(NotFound());
            }

            db.ProfileWhatsapps.Remove(profileWhatsapp);
            await db.SaveChangesAsync();

            return(Ok(profileWhatsapp));
        }
        // GET: ProfileWhatsapps/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ProfileWhatsapp profileWhatsapp = await db.ProfileWhatsapps.FindAsync(id);

            if (profileWhatsapp == null)
            {
                return(HttpNotFound());
            }
            ViewBag.UserId = new SelectList(db.Users, "UserId", "FirstName", profileWhatsapp.UserId);
            return(View(profileWhatsapp));
        }
Пример #17
0
        public void removeProfileW(ProfileWhatsapp _profileW)
        {
            ProfileLocal W   = Converter.ToProfileLocalW(_profileW);
            ProfileLocal Aux = new ProfileLocal();

            foreach (ProfileLocal PLocal in ProfilePerfiles)
            {
                if (W.ProfileName == PLocal.ProfileName && W.value == PLocal.value)
                {
                    Aux = PLocal;
                }
            }
            ProfilePerfiles.Remove(Aux);
            var A = ProfilePerfiles.Count;
        }
Пример #18
0
        public void updateProfileWhatsapp(ProfileWhatsapp _profileW)
        {
            ProfileLocal W        = Converter.ToProfileLocalW(_profileW);
            ProfileLocal Aux      = new ProfileLocal();
            int          newIndex = 0;

            foreach (ProfileLocal PLocal in ProfilePerfiles)
            {
                if (W.ProfileName == PLocal.ProfileName && W.value == PLocal.value)
                {
                    Aux      = PLocal;
                    newIndex = ProfilePerfiles.IndexOf(PLocal);
                }
            }

            ProfilePerfiles.Remove(Aux);

            ProfilePerfiles.Insert(newIndex, W);
        }
Пример #19
0
        public async Task <IHttpActionResult> PutProfileWhatsapp(ProfileWhatsapp form)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            int     id;
            dynamic jsonObject = form;

            try
            {
                id = jsonObject.ProfileWhatsappId;
            }
            catch
            {
                return(BadRequest("Missing parameter."));
            }


            db.Entry(form).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProfileWhatsappExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
            var profileWhatsapp = await GetProfileWhatsapps().
                                  Where(u => u.ProfileWhatsappId == id).FirstOrDefaultAsync();

            return(Ok(profileWhatsapp));
        }
Пример #20
0
        private async void UpdateBoxName(object sender, EventArgs e, int _BoxId, string _name, int _UserId, bool disabled)
        {
            //Actualizar el nombre de la Box
            var apiSecurity = Application.Current.Resources["APISecurity"].ToString();

            Box = await this.apiService.GetBox(
                apiSecurity,
                "/api",
                "/Boxes",
                _BoxId);

            var box3 = new Box();

            box3 = new Box
            {
                BoxId      = Box.BoxId,
                BoxDefault = Box.BoxDefault,
                Name       = NameEntry.Text,
                UserId     = Box.UserId,
                Time       = Box.Time,
                ColorBox   = Box.ColorBox
            };

            /*if (ColorH == "")
             * {
             *  box3 = new Box
             *  {
             *      BoxId = Box.BoxId,
             *      BoxDefault = Box.BoxDefault,
             *      Name = NameEntry.Text,
             *      UserId = Box.UserId,
             *      Time = Box.Time,
             *      ColorBox = Box.ColorBox
             *  };
             * }
             * else
             * {
             *  box3 = new Box
             *  {
             *      BoxId = Box.BoxId,
             *      BoxDefault = Box.BoxDefault,
             *      Name = NameEntry.Text,
             *      UserId = Box.UserId,
             *      Time = Box.Time,
             *      ColorBox = ColorH
             *  };
             * }*/

            await MainViewModel.GetInstance().DetailsBoxEdith.EdithBox(box3);

            //BoxName = _name;

            foreach (ProfileLocal Prof in ProfilesSelected)
            {
                if (Prof.Logo == "mail3")
                {
                    DeleteProfileEmail(_BoxId, Prof.ProfileId);
                    ProfileEmail E = Converter.ToProfileEmail(Prof);
                    MainViewModel.GetInstance().DetailsBox.removeProfileEmail(E);
                }
                else if (Prof.Logo == "tel3")
                {
                    DeleteProfilePhone(_BoxId, Prof.ProfileId);
                    ProfilePhone P = Converter.ToProfilePhone(Prof);
                    MainViewModel.GetInstance().DetailsBox.removeProfilePhone(P);
                }
                else if (Prof.Logo == "whatsapp3")
                {
                    DeleteProfileWhatsapp(_BoxId, Prof.ProfileId);
                    ProfileWhatsapp W = Converter.ToProfileWhatsapp(Prof);
                    MainViewModel.GetInstance().DetailsBox.removeProfileW(W);
                }
                else if (Prof.Logo != "mail3" && Prof.Logo != "tel3" && Prof.Logo != "whatsapp3")
                {
                    DeleteProfileSM(_BoxId, Prof.ProfileId);
                    ProfileSM SM = Converter.ToProfileSM(Prof);
                    MainViewModel.GetInstance().DetailsBox.removeProfileSM(SM);
                }
            }

            await Navigation.PopPopupAsync();
        }
 void OnListViewItemSelected(object sender, SelectedItemChangedEventArgs e)
 {
     ProfileWhatsapp selectedItem = e.SelectedItem as ProfileWhatsapp;
 }
Пример #22
0
        private async void Register()
        {
            if (string.IsNullOrEmpty(this.Email))
            {
                await Application.Current.MainPage.DisplayAlert(
                    Languages.Error,
                    Languages.EmailValidation,
                    Languages.Accept);

                return;
            }
            if (!RegexUtilities.IsValidEmail(this.Email))
            {
                await Application.Current.MainPage.DisplayAlert(
                    Languages.Error,
                    Languages.EmailValidation2,
                    Languages.Accept);

                return;
            }

            if (string.IsNullOrEmpty(this.Password))
            {
                await Application.Current.MainPage.DisplayAlert(
                    Languages.Error,
                    Languages.PasswordValidation,
                    Languages.Accept);

                return;
            }

            if (this.Password.Length < 6)
            {
                await Application.Current.MainPage.DisplayAlert(
                    Languages.Error,
                    Languages.PasswordValidation2,
                    Languages.Accept);

                return;
            }

            if (string.IsNullOrEmpty(this.Confirm))
            {
                await Application.Current.MainPage.DisplayAlert(
                    Languages.Error,
                    Languages.ConfirmValidation,
                    Languages.Accept);

                return;
            }
            if (this.Password != this.Confirm)
            {
                await Application.Current.MainPage.DisplayAlert(
                    Languages.Error,
                    Languages.ConfirmValidation2,
                    Languages.Accept);

                return;
            }
            if (string.IsNullOrEmpty(this.Number))
            {
                await Application.Current.MainPage.DisplayAlert(
                    Languages.Error,
                    Languages.NumberValidation,
                    Languages.Accept);

                return;
            }

            /* if (Xamarin.Forms.Device.RuntimePlatform == Xamarin.Forms.Device.iOS)
             * {*/
            if (this.Number.ToCharArray().All(Char.IsLetter))
            {
                await Application.Current.MainPage.DisplayAlert(
                    Languages.Error,
                    Languages.NumberValidation,
                    Languages.Accept);

                return;
            }

            /* }
             * else if (Xamarin.Forms.Device.RuntimePlatform == Xamarin.Forms.Device.Android)
             * {
             *   if (!this.Number.ToCharArray().All(Char.IsLetter))
             *   {
             *       await Application.Current.MainPage.DisplayAlert(
             *           Languages.Error,
             *           Languages.NumberValidation,
             *           Languages.Accept);
             *       return;
             *   }
             * }*/

            if (this.Number.Length != 10)
            {
                await Application.Current.MainPage.DisplayAlert(
                    Languages.Error,
                    Languages.PhoneValidation2,
                    Languages.Accept);

                return;
            }

            this.IsRunning = true;
            this.IsEnabled = false;

            var checkConnetion = await this.apiService.CheckConnection();

            if (!checkConnetion.IsSuccess)
            {
                this.IsRunning = false;
                this.IsEnabled = true;
                await Application.Current.MainPage.DisplayAlert(
                    Languages.Error,
                    checkConnetion.Message,
                    Languages.Accept);

                return;
            }

            var user2 = new User
            {
                Email      = this.Email,
                FirstName  = user1.FirstName,
                LastName   = user1.LastName,
                ImageArray = user1.ImageArray,
                UserTypeId = user1.UserTypeId,
                Password   = this.Password
            };
            var apiSecurity = Application.Current.Resources["APISecurity"].ToString();

            var exists = await this.apiService.GetUserByEmail(
                apiSecurity,
                "/api",
                "/Users/GetUserByEmail",
                this.Email);

            if (exists != null)
            {
                this.IsRunning = false;
                this.IsEnabled = true;
                await Application.Current.MainPage.DisplayAlert(
                    Languages.Error,
                    Languages.WrongEmail,
                    Languages.Accept);

                return;
            }

            var response = await this.apiService.Post2(
                apiSecurity,
                "/api",
                "/Users",
                user2);

            if (!response.IsSuccess)
            {
                this.IsRunning = false;
                this.IsEnabled = true;
                await Application.Current.MainPage.DisplayAlert(
                    Languages.Error,
                    response.Message,
                    Languages.Accept);

                return;
            }
            var exists2 = await this.apiService.GetUserByEmail(
                apiSecurity,
                "/api",
                "/Users/GetUserByEmail",
                this.Email);

            if (IsCheck == false)
            {
                var ProfileP = new ProfilePhone
                {
                    Exist  = false,
                    Name   = user2.FirstName,
                    Number = Number,
                    UserId = exists2.UserId
                };
                var profilephone = await this.apiService.Post(
                    apiSecurity,
                    "/api",
                    "/ProfilePhones",
                    ProfileP);

                if (profilephone == default)
                {
                    this.IsRunning = false;
                    this.IsEnabled = true;
                    await Application.Current.MainPage.DisplayAlert(
                        Languages.Error,
                        Languages.ErrorAddProfile,
                        Languages.Accept);

                    return;
                }
            }
            else
            {
                var profileWhatsApp = new ProfileWhatsapp
                {
                    Name   = user2.FirstName,
                    Number = this.Number,
                    UserId = exists2.UserId,
                    Exist  = false
                };

                var profileWhatsapp = await this.apiService.Post(
                    apiSecurity,
                    "/api",
                    "/ProfileWhatsapps",
                    profileWhatsApp);

                if (profileWhatsapp == default)
                {
                    this.IsRunning = false;
                    this.IsEnabled = true;
                    await Application.Current.MainPage.DisplayAlert(
                        Languages.Error,
                        Languages.ErrorAddProfile,
                        Languages.Accept);

                    return;
                }
            }
            var response3 = await apiService.LoginMessage(
                apiSecurity,
                "/api",
                "/Users/LoginMessage",
                Email);

            this.IsRunning = false;
            this.IsEnabled = true;

            await Application.Current.MainPage.DisplayAlert(
                Languages.ConfirmLabel,
                Languages.UserRegisteredMessage,
                Languages.Accept);

            MainViewModel.GetInstance().Login = new LoginViewModel();
            Application.Current.MainPage = new LoginPage();
        }
Пример #23
0
        async void OnListViewItemTapped(object sender, ItemTappedEventArgs e)
        {
            ProfileEmail    tappedItemEmail    = e.Item as ProfileEmail;
            ProfilePhone    tappedItemPhone    = e.Item as ProfilePhone;
            ProfileSM       tappedItemSM       = e.Item as ProfileSM;
            ProfileWhatsapp tappedItemWhatsapp = e.Item as ProfileWhatsapp;

            if (tappedItemEmail != null)
            {
                MainViewModel.GetInstance().EditProfileEmail = new EditProfileEmailViewModel(tappedItemEmail.ProfileEmailId);
                await App.Navigator.PushAsync(new EditProfileEmailPage());
            }

            else if (tappedItemPhone != null)
            {
                MainViewModel.GetInstance().EditProfilePhone = new EditProfilePhoneViewModel(tappedItemPhone.ProfilePhoneId);
                await App.Navigator.PushAsync(new EditProfilePhonePage(tappedItemPhone.ProfilePhoneId));
            }

            else if (tappedItemSM != null)
            {
                switch (tappedItemSM.RedSocialId)
                {
                case 1:
                    MainViewModel.GetInstance().EdithProfile = new EdithProfileViewModel(tappedItemSM.ProfileMSId);
                    await App.Navigator.PushAsync(new EditProfileFacebookPage());

                    break;

                case 2:
                    MainViewModel.GetInstance().EdithProfile = new EdithProfileViewModel(tappedItemSM.ProfileMSId);
                    await App.Navigator.PushAsync(new EditProfileInstagramPage());

                    break;

                case 3:
                    MainViewModel.GetInstance().EdithProfile = new EdithProfileViewModel(tappedItemSM.ProfileMSId);
                    await App.Navigator.PushAsync(new EditProfileTwitterPage());

                    break;

                case 4:
                    MainViewModel.GetInstance().EdithProfile = new EdithProfileViewModel(tappedItemSM.ProfileMSId);
                    await App.Navigator.PushAsync(new EditProfileSnapchatPage());

                    break;

                case 5:
                    MainViewModel.GetInstance().EdithProfile = new EdithProfileViewModel(tappedItemSM.ProfileMSId);
                    await App.Navigator.PushAsync(new EditProfileLinkedinPage());

                    break;

                case 6:
                    MainViewModel.GetInstance().EdithProfile = new EdithProfileViewModel(tappedItemSM.ProfileMSId);
                    await App.Navigator.PushAsync(new EditProfileTiktokPage());

                    break;

                case 7:
                    MainViewModel.GetInstance().EdithProfile = new EdithProfileViewModel(tappedItemSM.ProfileMSId);
                    await App.Navigator.PushAsync(new EditProfileYoutubePage());

                    break;

                case 8:
                    MainViewModel.GetInstance().EdithProfile = new EdithProfileViewModel(tappedItemSM.ProfileMSId);
                    await App.Navigator.PushAsync(new EditProfileSpotifyPage());

                    break;

                case 9:
                    MainViewModel.GetInstance().EdithProfile = new EdithProfileViewModel(tappedItemSM.ProfileMSId);
                    await App.Navigator.PushAsync(new EditProfileTwitchPage());

                    break;

                case 10:
                    MainViewModel.GetInstance().EdithProfile = new EdithProfileViewModel(tappedItemSM.ProfileMSId);
                    await App.Navigator.PushAsync(new EditProfileWebPagePage());

                    break;

                case 11:
                    MainViewModel.GetInstance().EdithProfile = new EdithProfileViewModel(tappedItemSM.ProfileMSId);
                    await App.Navigator.PushAsync(new EditProfileTelegramPage());

                    break;

                default:
                    break;
                }
            }

            else if (tappedItemWhatsapp != null)
            {
                MainViewModel.GetInstance().EditProfileWhatsApp = new EditProfileWhatsAppViewModel(tappedItemWhatsapp.ProfileWhatsappId);
                await App.Navigator.PushAsync(new EditProfileWhatsAppPage());
            }
        }
        private async void SaveProfileWhatsApp()
        {
            if (string.IsNullOrEmpty(this.Name))
            {
                await Application.Current.MainPage.DisplayAlert(
                    Languages.Error,
                    Languages.NameValidation,
                    Languages.Accept);

                return;
            }
            if (string.IsNullOrEmpty(this.Number))
            {
                await Application.Current.MainPage.DisplayAlert(
                    Languages.Error,
                    Languages.NumberValidation,
                    Languages.Accept);

                return;
            }
            if (!(this.Number).ToCharArray().All(Char.IsDigit))
            {
                await Application.Current.MainPage.DisplayAlert(
                    Languages.Error,
                    Languages.NumberValidation,
                    Languages.Accept);

                return;
            }
            if (this.Number.Length != 10)
            {
                await Application.Current.MainPage.DisplayAlert(
                    Languages.Error,
                    Languages.PhoneValidation2,
                    Languages.Accept);

                return;
            }

            this.IsRunning = true;
            this.IsEnabled = false;

            var checkConnetion = await this.apiService.CheckConnection();

            if (!checkConnetion.IsSuccess)
            {
                this.IsRunning = false;
                this.IsEnabled = true;
                await Application.Current.MainPage.DisplayAlert(
                    Languages.Error,
                    checkConnetion.Message,
                    Languages.Accept);

                return;
            }

            var mainViewModel = MainViewModel.GetInstance();


            var profileWhatsApp = new ProfileWhatsapp
            {
                Name   = this.Name,
                Number = this.Number,
                UserId = mainViewModel.User.UserId,
                Exist  = false
            };

            var apiSecurity     = Application.Current.Resources["APISecurity"].ToString();
            var profileWhatsapp = await this.apiService.Post(
                apiSecurity,
                "/api",
                "/ProfileWhatsapps",
                profileWhatsApp);

            if (profileWhatsapp == default)
            {
                this.IsRunning = false;
                this.IsEnabled = true;
                await Application.Current.MainPage.DisplayAlert(
                    Languages.Error,
                    Languages.ErrorAddProfile,
                    Languages.Accept);

                return;
            }
            var ProfileLocal = new Profile
            {
                UserId      = mainViewModel.User.UserId,
                ProfileName = profileWhatsApp.Name,
                value       = profileWhatsApp.Number,
                ProfileType = "Whatsapp",
                Logo        = "whatsapp2",
                ProfileId   = profileWhatsApp.ProfileWhatsappId,
            };

            using (var conn = new SQLite.SQLiteConnection(App.root_db))
            {
                conn.CreateTable <Profile>();
                conn.Insert(ProfileLocal);
            }
            this.IsRunning = false;
            this.IsEnabled = true;

            //Agregar a la lista
            if (mainViewModel.ProfilesBYPESM != null)
            {
                mainViewModel.ProfilesBYPESM.addProfileWhatsapp(profileWhatsapp);
                mainViewModel.ListOfNetworks.addProfileWhatsapp(profileWhatsapp);
            }
            else
            {
                mainViewModel.Profiles.addProfileWhatsapp(profileWhatsapp);
            }

            this.Name   = string.Empty;
            this.Number = string.Empty;

            if (mainViewModel.ProfilesBYPESM != null)
            {
                await PopupNavigation.Instance.PopAsync();
            }
            else
            {
                await App.Navigator.PopAsync();
            }
        }
 //Actualizar listas Whatsapp
 public void addProfileWhatsapp(ProfileWhatsapp _profileWhatsapp)
 {
     ProfileWhatsapp.Add(_profileWhatsapp);
     EmptyList = false;
 }
Пример #26
0
        void OnListViewItemTapped(object sender, ItemTappedEventArgs e)
        {
            ProfileLocal tappedItemProfile = e.Item as ProfileLocal;

            switch (tappedItemProfile.Logo)
            {
            case "mail2":
                ProfileEmail E = Converter.ToProfileEmail(tappedItemProfile);
                if (E.Exist == false)
                {
                    PostProfileEmail(Box.BoxId, E.ProfileEmailId);
                    E.Exist = true;
                    MainViewModel.GetInstance().ListOfNetworks.updateProfileEmail(E);
                    MainViewModel.GetInstance().DetailsBox.addProfileEmail(E);
                }
                else
                {
                    DeleteProfileEmail(Box.BoxId, E.ProfileEmailId);
                    E.Exist = false;
                    MainViewModel.GetInstance().ListOfNetworks.updateProfileEmail(E);
                    MainViewModel.GetInstance().DetailsBox.removeProfileEmail(E);
                }
                break;

            case "tel2":
                ProfilePhone P = Converter.ToProfilePhone(tappedItemProfile);
                if (P.Exist == false)
                {
                    PostProfilePhone(Box.BoxId, P.ProfilePhoneId);
                    P.Exist = true;
                    MainViewModel.GetInstance().ListOfNetworks.updateProfilePhone(P);
                    MainViewModel.GetInstance().DetailsBox.addProfilePhone(P);
                }
                else
                {
                    DeleteProfilePhone(Box.BoxId, P.ProfilePhoneId);
                    P.Exist = false;
                    MainViewModel.GetInstance().ListOfNetworks.updateProfilePhone(P);
                    MainViewModel.GetInstance().DetailsBox.removeProfilePhone(P);
                }
                break;

            case "facebook2":
                ProfileSM SMfb = Converter.ToProfileSM(tappedItemProfile);
                if (SMfb.Exist == false)
                {
                    PostProfileSM(Box.BoxId, SMfb.ProfileMSId);
                    SMfb.Exist = true;
                    MainViewModel.GetInstance().ListOfNetworks.updateProfileSM(SMfb);
                    MainViewModel.GetInstance().DetailsBox.addProfileSM(SMfb);
                }
                else
                {
                    DeleteProfileSM(Box.BoxId, SMfb.ProfileMSId);
                    SMfb.Exist = false;
                    MainViewModel.GetInstance().ListOfNetworks.updateProfileSM(SMfb);
                    MainViewModel.GetInstance().DetailsBox.removeProfileSM(SMfb);
                }
                break;

            case "twitterlogo2":
                ProfileSM SMtwtt = Converter.ToProfileSM(tappedItemProfile);
                if (SMtwtt.Exist == false)
                {
                    PostProfileSM(Box.BoxId, SMtwtt.ProfileMSId);
                    SMtwtt.Exist = true;
                    MainViewModel.GetInstance().ListOfNetworks.updateProfileSM(SMtwtt);
                    MainViewModel.GetInstance().DetailsBox.addProfileSM(SMtwtt);
                }
                else
                {
                    DeleteProfileSM(Box.BoxId, SMtwtt.ProfileMSId);
                    SMtwtt.Exist = false;
                    MainViewModel.GetInstance().ListOfNetworks.updateProfileSM(SMtwtt);
                    MainViewModel.GetInstance().DetailsBox.removeProfileSM(SMtwtt);
                }
                break;

            case "instagramlogo2":
                ProfileSM SMIns = Converter.ToProfileSM(tappedItemProfile);
                if (SMIns.Exist == false)
                {
                    PostProfileSM(Box.BoxId, SMIns.ProfileMSId);
                    SMIns.Exist = true;
                    MainViewModel.GetInstance().ListOfNetworks.updateProfileSM(SMIns);
                    MainViewModel.GetInstance().DetailsBox.addProfileSM(SMIns);
                }
                else
                {
                    DeleteProfileSM(Box.BoxId, SMIns.ProfileMSId);
                    SMIns.Exist = false;
                    MainViewModel.GetInstance().ListOfNetworks.updateProfileSM(SMIns);
                    MainViewModel.GetInstance().DetailsBox.removeProfileSM(SMIns);
                }
                break;

            case "snapchat2":
                ProfileSM SMSnap = Converter.ToProfileSM(tappedItemProfile);
                if (SMSnap.Exist == false)
                {
                    PostProfileSM(Box.BoxId, SMSnap.ProfileMSId);
                    SMSnap.Exist = true;
                    MainViewModel.GetInstance().ListOfNetworks.updateProfileSM(SMSnap);
                    MainViewModel.GetInstance().DetailsBox.addProfileSM(SMSnap);
                }
                else
                {
                    DeleteProfileSM(Box.BoxId, SMSnap.ProfileMSId);
                    SMSnap.Exist = false;
                    MainViewModel.GetInstance().ListOfNetworks.updateProfileSM(SMSnap);
                    MainViewModel.GetInstance().DetailsBox.removeProfileSM(SMSnap);
                }
                break;

            case "linkedin2":
                ProfileSM SMSLink = Converter.ToProfileSM(tappedItemProfile);
                if (SMSLink.Exist == false)
                {
                    PostProfileSM(Box.BoxId, SMSLink.ProfileMSId);
                    SMSLink.Exist = true;
                    MainViewModel.GetInstance().ListOfNetworks.updateProfileSM(SMSLink);
                    MainViewModel.GetInstance().DetailsBox.addProfileSM(SMSLink);
                }
                else
                {
                    DeleteProfileSM(Box.BoxId, SMSLink.ProfileMSId);
                    SMSLink.Exist = false;
                    MainViewModel.GetInstance().ListOfNetworks.updateProfileSM(SMSLink);
                    MainViewModel.GetInstance().DetailsBox.removeProfileSM(SMSLink);
                }
                break;

            case "tiktok2":
                ProfileSM SMSTik = Converter.ToProfileSM(tappedItemProfile);
                if (SMSTik.Exist == false)
                {
                    PostProfileSM(Box.BoxId, SMSTik.ProfileMSId);
                    SMSTik.Exist = true;
                    MainViewModel.GetInstance().ListOfNetworks.updateProfileSM(SMSTik);
                    MainViewModel.GetInstance().DetailsBox.addProfileSM(SMSTik);
                }
                else
                {
                    DeleteProfileSM(Box.BoxId, SMSTik.ProfileMSId);
                    SMSTik.Exist = false;
                    MainViewModel.GetInstance().ListOfNetworks.updateProfileSM(SMSTik);
                    MainViewModel.GetInstance().DetailsBox.removeProfileSM(SMSTik);
                }
                break;

            case "youtube2":
                ProfileSM SMYou = Converter.ToProfileSM(tappedItemProfile);
                if (SMYou.Exist == false)
                {
                    PostProfileSM(Box.BoxId, SMYou.ProfileMSId);
                    SMYou.Exist = true;
                    MainViewModel.GetInstance().ListOfNetworks.updateProfileSM(SMYou);
                    MainViewModel.GetInstance().DetailsBox.addProfileSM(SMYou);
                }
                else
                {
                    DeleteProfileSM(Box.BoxId, SMYou.ProfileMSId);
                    SMYou.Exist = false;
                    MainViewModel.GetInstance().ListOfNetworks.updateProfileSM(SMYou);
                    MainViewModel.GetInstance().DetailsBox.removeProfileSM(SMYou);
                }
                break;

            case "spotify2":
                ProfileSM SMSP = Converter.ToProfileSM(tappedItemProfile);
                if (SMSP.Exist == false)
                {
                    PostProfileSM(Box.BoxId, SMSP.ProfileMSId);
                    SMSP.Exist = true;
                    MainViewModel.GetInstance().ListOfNetworks.updateProfileSM(SMSP);
                    MainViewModel.GetInstance().DetailsBox.addProfileSM(SMSP);
                }
                else
                {
                    DeleteProfileSM(Box.BoxId, SMSP.ProfileMSId);
                    SMSP.Exist = false;
                    MainViewModel.GetInstance().ListOfNetworks.updateProfileSM(SMSP);
                    MainViewModel.GetInstance().DetailsBox.removeProfileSM(SMSP);
                }
                break;

            case "twitch2":
                ProfileSM SMTwc = Converter.ToProfileSM(tappedItemProfile);
                if (SMTwc.Exist == false)
                {
                    PostProfileSM(Box.BoxId, SMTwc.ProfileMSId);
                    SMTwc.Exist = true;
                    MainViewModel.GetInstance().ListOfNetworks.updateProfileSM(SMTwc);
                    MainViewModel.GetInstance().DetailsBox.addProfileSM(SMTwc);
                }
                else
                {
                    DeleteProfileSM(Box.BoxId, SMTwc.ProfileMSId);
                    SMTwc.Exist = false;
                    MainViewModel.GetInstance().ListOfNetworks.updateProfileSM(SMTwc);
                    MainViewModel.GetInstance().DetailsBox.removeProfileSM(SMTwc);
                }
                break;

            case "gmail2":
                ProfileSM SMWeb = Converter.ToProfileSM(tappedItemProfile);
                if (SMWeb.Exist == false)
                {
                    PostProfileSM(Box.BoxId, SMWeb.ProfileMSId);
                    SMWeb.Exist = true;
                    MainViewModel.GetInstance().ListOfNetworks.updateProfileSM(SMWeb);
                    MainViewModel.GetInstance().DetailsBox.addProfileSM(SMWeb);
                }
                else
                {
                    DeleteProfileSM(Box.BoxId, SMWeb.ProfileMSId);
                    SMWeb.Exist = false;
                    MainViewModel.GetInstance().ListOfNetworks.updateProfileSM(SMWeb);
                    MainViewModel.GetInstance().DetailsBox.removeProfileSM(SMWeb);
                }
                break;

            case "whatsapp2":
                ProfileWhatsapp W = Converter.ToProfileWhatsapp(tappedItemProfile);
                if (W.Exist == false)
                {
                    PostProfileWhatsapp(Box.BoxId, W.ProfileWhatsappId);
                    W.Exist = true;
                    MainViewModel.GetInstance().ListOfNetworks.updateProfileWhatsapp(W);
                    MainViewModel.GetInstance().DetailsBox.addProfileW(W);
                }
                else
                {
                    DeleteProfileWhatsapp(Box.BoxId, W.ProfileWhatsappId);
                    W.Exist = false;
                    MainViewModel.GetInstance().ListOfNetworks.updateProfileWhatsapp(W);
                    MainViewModel.GetInstance().DetailsBox.removeProfileW(W);
                }
                break;

            case "telegram2":
                ProfileSM SMT = Converter.ToProfileSM(tappedItemProfile);
                if (SMT.Exist == false)
                {
                    PostProfileSM(Box.BoxId, SMT.ProfileMSId);
                    SMT.Exist = true;
                    MainViewModel.GetInstance().ListOfNetworks.updateProfileSM(SMT);
                    MainViewModel.GetInstance().DetailsBox.addProfileSM(SMT);
                }
                else
                {
                    DeleteProfileSM(Box.BoxId, SMT.ProfileMSId);
                    SMT.Exist = false;
                    MainViewModel.GetInstance().ListOfNetworks.updateProfileSM(SMT);
                    MainViewModel.GetInstance().DetailsBox.removeProfileSM(SMT);
                }
                break;

            default:
                break;
            }
        }
        void OnListViewItemTapped(object sender, ItemTappedEventArgs e)
        {
            ProfileEmail    tappedItemEmail    = e.Item as ProfileEmail;
            ProfilePhone    tappedItemPhone    = e.Item as ProfilePhone;
            ProfileSM       tappedItemSM       = e.Item as ProfileSM;
            ProfileWhatsapp tappedItemWhatsapp = e.Item as ProfileWhatsapp;

            if (tappedItemEmail != null)
            {
                if (tappedItemEmail.Exist == false)
                {
                    PostProfileEmail(Box.BoxId, tappedItemEmail.ProfileEmailId);
                    tappedItemEmail.Exist = true;
                    MainViewModel.GetInstance().ProfilesBYPESM.updateProfileEmail(tappedItemEmail);
                    MainViewModel.GetInstance().ListOfNetworks.updateProfileEmail(tappedItemEmail);
                    MainViewModel.GetInstance().DetailsBox.addProfileEmail(tappedItemEmail);
                }
                else
                {
                    DeleteProfileEmail(Box.BoxId, tappedItemEmail.ProfileEmailId);
                    tappedItemEmail.Exist = false;
                    MainViewModel.GetInstance().ProfilesBYPESM.updateProfileEmail(tappedItemEmail);
                    MainViewModel.GetInstance().ListOfNetworks.updateProfileEmail(tappedItemEmail);
                    MainViewModel.GetInstance().DetailsBox.removeProfileEmail(tappedItemEmail);
                }
            }

            else if (tappedItemPhone != null)
            {
                if (tappedItemPhone.Exist == false)
                {
                    PostProfilePhone(Box.BoxId, tappedItemPhone.ProfilePhoneId);
                    tappedItemPhone.Exist = true;
                    MainViewModel.GetInstance().ProfilesBYPESM.updateProfilePhone(tappedItemPhone);
                    MainViewModel.GetInstance().ListOfNetworks.updateProfilePhone(tappedItemPhone);
                    MainViewModel.GetInstance().DetailsBox.addProfilePhone(tappedItemPhone);
                }
                else
                {
                    DeleteProfilePhone(Box.BoxId, tappedItemPhone.ProfilePhoneId);
                    tappedItemPhone.Exist = false;
                    MainViewModel.GetInstance().ProfilesBYPESM.updateProfilePhone(tappedItemPhone);
                    MainViewModel.GetInstance().ListOfNetworks.updateProfilePhone(tappedItemPhone);
                    MainViewModel.GetInstance().DetailsBox.removeProfilePhone(tappedItemPhone);
                }
            }

            else if (tappedItemSM != null)
            {
                if (tappedItemSM.Exist == false)
                {
                    PostProfileSM(Box.BoxId, tappedItemSM.ProfileMSId);
                    tappedItemSM.Exist = true;
                    MainViewModel.GetInstance().ProfilesBYPESM.updateProfileSM(tappedItemSM);
                    MainViewModel.GetInstance().ListOfNetworks.updateProfileSM(tappedItemSM);
                    MainViewModel.GetInstance().DetailsBox.addProfileSM(tappedItemSM);
                }
                else
                {
                    DeleteProfileSM(Box.BoxId, tappedItemSM.ProfileMSId);
                    tappedItemSM.Exist = false;
                    MainViewModel.GetInstance().ProfilesBYPESM.updateProfileSM(tappedItemSM);
                    MainViewModel.GetInstance().ListOfNetworks.updateProfileSM(tappedItemSM);
                    MainViewModel.GetInstance().DetailsBox.removeProfileSM(tappedItemSM);
                }
            }

            else if (tappedItemWhatsapp != null)
            {
                if (tappedItemWhatsapp.Exist == false)
                {
                    PostProfileWhatsapp(Box.BoxId, tappedItemWhatsapp.ProfileWhatsappId);
                    tappedItemWhatsapp.Exist = true;
                    MainViewModel.GetInstance().ProfilesBYPESM.updateProfileWhatsapp(tappedItemWhatsapp);
                    MainViewModel.GetInstance().ListOfNetworks.updateProfileWhatsapp(tappedItemWhatsapp);
                    MainViewModel.GetInstance().DetailsBox.addProfileW(tappedItemWhatsapp);
                }
                else
                {
                    DeleteProfileWhatsapp(Box.BoxId, tappedItemWhatsapp.ProfileWhatsappId);
                    tappedItemWhatsapp.Exist = false;
                    MainViewModel.GetInstance().ProfilesBYPESM.updateProfileWhatsapp(tappedItemWhatsapp);
                    MainViewModel.GetInstance().ListOfNetworks.updateProfileWhatsapp(tappedItemWhatsapp);
                    MainViewModel.GetInstance().DetailsBox.removeProfileW(tappedItemWhatsapp);
                }
            }
        }
Пример #28
0
        public void addProfileW(ProfileWhatsapp _profileW)
        {
            var W = Converter.ToProfileLocalW(_profileW);

            ProfilePerfiles.Add(W);
        }