private async Task <ProfileSM> GetProfile(int _ProfileMSId)
        {
            var apiSecurity = Application.Current.Resources["APISecurity"].ToString();

            profileSM = new ProfileSM();
            profileSM = await this.apiService.GetProfileSM(
                apiSecurity,
                "/api",
                "/ProfileSMs/GetProfileSM",
                _ProfileMSId);

            return(profileSM);
        }
Beispiel #2
0
        public async Task <IHttpActionResult> DeleteProfileSM(int id)
        {
            ProfileSM profileSM = await db.ProfileSMs.FindAsync(id);

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

            db.ProfileSMs.Remove(profileSM);
            await db.SaveChangesAsync();

            return(Ok(profileSM));
        }
Beispiel #3
0
        // GET: ProfileSMs/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ProfileSM profileSM = await db.ProfileSMs.FindAsync(id);

            if (profileSM == null)
            {
                return(HttpNotFound());
            }
            return(View(profileSM));
        }
Beispiel #4
0
        public async Task <ActionResult> Create([Bind(Include = "ProfileMSId,link,ProfileName,UserId,RedSocialId")] ProfileSM profileSM)
        {
            if (ModelState.IsValid)
            {
                db.ProfileSMs.Add(profileSM);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            ViewBag.RedSocialId = new SelectList(db.RedSocials, "RedSocialId", "Name", profileSM.RedSocialId);
            ViewBag.UserId      = new SelectList(db.Users, "UserId", "FirstName", profileSM.UserId);
            return(View(profileSM));
        }
        public void removeProfileSM(ProfileSM _profileSM)
        {
            ProfileLocal SM  = Converter.ToProfileLocalSM(_profileSM);
            ProfileLocal Aux = new ProfileLocal();

            foreach (ProfileLocal PLocal in ProfilePerfiles)
            {
                if (SM.ProfileName == PLocal.ProfileName && SM.value == PLocal.value)
                {
                    Aux = PLocal;
                }
            }
            ProfilePerfiles.Remove(Aux);
            var A = ProfilePerfiles.Count;
        }
Beispiel #6
0
        // GET: ProfileSMs/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ProfileSM profileSM = await db.ProfileSMs.FindAsync(id);

            if (profileSM == null)
            {
                return(HttpNotFound());
            }
            ViewBag.RedSocialId = new SelectList(db.RedSocials, "RedSocialId", "Name", profileSM.RedSocialId);
            ViewBag.UserId      = new SelectList(db.Users, "UserId", "FirstName", profileSM.UserId);
            return(View(profileSM));
        }
Beispiel #7
0
        public void updateProfileSM(ProfileSM _profileSM)
        {
            ProfileLocal SM       = Converter.ToProfileLocalSM(_profileSM);
            ProfileLocal Aux      = new ProfileLocal();
            int          newIndex = 0;

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

            ProfilePerfiles.Remove(Aux);

            ProfilePerfiles.Insert(newIndex, SM);
        }
Beispiel #8
0
        public async Task <IHttpActionResult> PutProfileSM(ProfileSM form)
        {
            int     id;
            dynamic jsonObject = form;

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

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

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProfileSMExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
            var profileSM = await GetProfileSMs().
                            Where(u => u.ProfileMSId == id).FirstOrDefaultAsync();

            return(Ok(profileSM));
        }
Beispiel #9
0
        void OnListViewItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            ProfileSM selectedItem = e.SelectedItem as ProfileSM;

            selectedItem = null;
        }
        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);
                }
            }
        }
Beispiel #11
0
        public static ProfileLocal ToProfileLocalSM1(ProfileSM profile)
        {
            string LogoSM = null;

            switch (profile.RedSocialId)
            {
            case 1:
                LogoSM = "facebook3";
                break;

            case 2:
                LogoSM = "instagram3";
                break;

            case 3:
                LogoSM = "twitter3";
                break;

            case 4:
                LogoSM = "snapchat3";
                break;

            case 5:
                LogoSM = "linkedin3";
                break;

            case 6:
                LogoSM = "tiktok3";
                break;

            case 7:
                LogoSM = "youtube3";
                break;

            case 8:
                LogoSM = "spotify3";
                break;

            case 9:
                LogoSM = "twitch3";
                break;

            case 10:
                LogoSM = "gmail3";
                break;

            case 11:
                LogoSM = "telegram3";
                break;

            default:
                break;
            }

            return(new ProfileLocal
            {
                ProfileName = profile.ProfileName,
                value = profile.link,
                RedSocialId = profile.RedSocialId,
                Logo = LogoSM,
                Exist = profile.Exist,
                UserId = profile.UserId,
                ProfileId = profile.ProfileMSId
            });
        }
Beispiel #12
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();
        }
        public void addProfileSM(ProfileSM _profileSM)
        {
            var SM = Converter.ToProfileLocalSM(_profileSM);

            ProfilePerfiles.Add(SM);
        }
Beispiel #14
0
        private async void SaveProfile()
        {
            if (string.IsNullOrEmpty(this.Name))
            {
                await Application.Current.MainPage.DisplayAlert(
                    Languages.Error,
                    Languages.NameValidation,
                    Languages.Accept);

                return;
            }
            if (string.IsNullOrEmpty(this.Link))
            {
                await Application.Current.MainPage.DisplayAlert(
                    Languages.Error,
                    Languages.LinkValidation,
                    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    Profile       = new ProfileSM();
            string ProfileType1  = string.Empty;
            string Logo1         = string.Empty;

            switch (Type)
            {
            case "Facebook":
                Profile = new ProfileSM
                {
                    ProfileName = this.Name,
                    link        = this.Link,
                    UserId      = mainViewModel.User.UserId,
                    Exist       = false,
                    RedSocialId = 1
                };
                ProfileType1 = "Facebook";
                Logo1        = "facebook2";
                break;

            case "Instagram":
                Profile = new ProfileSM
                {
                    ProfileName = this.Name,
                    link        = "https://www.instagram.com/" + this.Link,
                    UserId      = mainViewModel.User.UserId,
                    Exist       = false,
                    RedSocialId = 2
                };
                ProfileType1 = "Instagram";
                Logo1        = "instagramlogo2";
                break;

            case "Twitter":
                Profile = new ProfileSM
                {
                    ProfileName = this.Name,
                    link        = "https://twitter.com/" + this.Link,
                    UserId      = mainViewModel.User.UserId,
                    Exist       = false,
                    RedSocialId = 3
                };
                ProfileType1 = "Twitter";
                Logo1        = "twitterlogo2";
                break;

            case "Snapchat":
                Profile = new ProfileSM
                {
                    ProfileName = this.Name,
                    link        = "https://www.snapchat.com/add/" + this.Link,
                    UserId      = mainViewModel.User.UserId,
                    Exist       = false,
                    RedSocialId = 4
                };
                ProfileType1 = "Snapchat";
                Logo1        = "snapchat2";
                break;

            case "Linkedin":
                Profile = new ProfileSM
                {
                    ProfileName = this.Name,
                    link        = this.Link,
                    UserId      = mainViewModel.User.UserId,
                    Exist       = false,
                    RedSocialId = 5
                };
                ProfileType1 = "LinkedIn";
                Logo1        = "linkedin2";
                break;

            case "Tiktok":
                Profile = new ProfileSM
                {
                    ProfileName = this.Name,
                    link        = "https://tiktok.com/@" + this.Link,
                    UserId      = mainViewModel.User.UserId,
                    Exist       = false,
                    RedSocialId = 6
                };
                ProfileType1 = "TikTok";
                Logo1        = "tiktok2";
                break;

            case "Youtube":
                Profile = new ProfileSM
                {
                    ProfileName = this.Name,
                    link        = this.Link,
                    UserId      = mainViewModel.User.UserId,
                    Exist       = false,
                    RedSocialId = 7
                };
                ProfileType1 = "Youtube";
                Logo1        = "youtube2";
                break;

            case "Spotify":
                Profile = new ProfileSM
                {
                    ProfileName = this.Name,
                    link        = this.Link,
                    UserId      = mainViewModel.User.UserId,
                    Exist       = false,
                    RedSocialId = 8
                };
                ProfileType1 = "Spotify";
                Logo1        = "spotify2";
                break;

            case "Twitch":
                Profile = new ProfileSM
                {
                    ProfileName = this.Name,
                    link        = "https://www.twitch.tv/" + this.Link,
                    UserId      = mainViewModel.User.UserId,
                    Exist       = false,
                    RedSocialId = 9
                };
                ProfileType1 = "Twitch";
                Logo1        = "twitch2";
                break;

            case "WebPage":
                Profile = new ProfileSM
                {
                    ProfileName = this.Name,
                    link        = this.Link,
                    UserId      = mainViewModel.User.UserId,
                    Exist       = false,
                    RedSocialId = 10
                };
                ProfileType1 = "WebPage";
                Logo1        = "gmail2";
                break;

            case "Telegram":
                if (!(this.Link).ToCharArray().All(Char.IsDigit))
                {
                    await Application.Current.MainPage.DisplayAlert(
                        Languages.Error,
                        Languages.NumberValidation,
                        Languages.Accept);

                    this.IsRunning = false;
                    this.IsEnabled = true;
                    return;
                }
                if (this.Link.Length != 10)
                {
                    await Application.Current.MainPage.DisplayAlert(
                        Languages.Error,
                        Languages.PhoneValidation2,
                        Languages.Accept);

                    this.IsRunning = false;
                    this.IsEnabled = true;
                    return;
                }
                Profile = new ProfileSM
                {
                    ProfileName = this.Name,
                    link        = this.Link,
                    UserId      = mainViewModel.User.UserId,
                    Exist       = false,
                    RedSocialId = 11
                };
                ProfileType1 = "Telegram";
                Logo1        = "telegram2";
                break;

            default:
                break;
            }

            var apiSecurity = Application.Current.Resources["APISecurity"].ToString();
            var profileSM   = await this.apiService.Post(
                apiSecurity,
                "/api",
                "/ProfileSMs",
                Profile);

            if (profileSM == 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 = profileSM.ProfileName,
                value       = profileSM.link,
                ProfileType = ProfileType1,
                Logo        = Logo1,
                ProfileId   = profileSM.ProfileMSId,
            };

            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.addProfileSM(profileSM);
                mainViewModel.ListOfNetworks.addProfileSM(profileSM);
            }
            else
            {
                mainViewModel.Profiles.addProfileSM(profileSM);
            }


            this.Name = string.Empty;
            this.Link = string.Empty;

            if (mainViewModel.ProfilesBYPESM != null)
            {
                await PopupNavigation.Instance.PopAsync();
            }
            else
            {
                await App.Navigator.PopAsync();
            }
        }
Beispiel #15
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;
            }
        }
Beispiel #16
0
 public void addProfile(ProfileSM _profileSM)
 {
     profileSM.Add(_profileSM);
     EmptyList = false;
 }
Beispiel #17
0
        private async void SaveProfileYouTube()
        {
            if (string.IsNullOrEmpty(this.Name))
            {
                await Application.Current.MainPage.DisplayAlert(
                    Languages.Error,
                    Languages.NameValidation,
                    Languages.Accept);

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

                return;
            }
            if (!RegexUtilities.IsValidURL(this.Link))
            {
                await Application.Current.MainPage.DisplayAlert(
                    Languages.Error,
                    Languages.LinkValidation,
                    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 profileYoutube = new ProfileSM
            {
                ProfileName = this.Name,
                link        = this.Link,
                UserId      = mainViewModel.User.UserId,
                Exist       = false,
                RedSocialId = 7
            };

            var apiSecurity = Application.Current.Resources["APISecurity"].ToString();
            var profileSM   = await this.apiService.Post(
                apiSecurity,
                "/api",
                "/ProfileSMs",
                profileYoutube);

            if (profileSM == 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 = profileSM.ProfileName,
                value       = profileSM.link,
                ProfileType = "Youtube",
                Logo        = "youtube2",
                ProfileId   = profileSM.ProfileMSId,
            };

            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.addProfileSM(profileSM);
                mainViewModel.ListOfNetworks.addProfileSM(profileSM);
            }
            else
            {
                mainViewModel.ProfilesByYoutube.addProfile(profileSM);
            }


            this.Name = string.Empty;
            this.Link = string.Empty;

            if (mainViewModel.ProfilesBYPESM != null)
            {
                await PopupNavigation.Instance.PopAsync();
            }
            else
            {
                await App.Navigator.PopAsync();
            }
        }
Beispiel #18
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());
            }
        }