public void ClearAll()
 {
     #region clearing tables, variables and photos
     var TaskA = new Task(async() =>
     {
         await RemovePersonalImages();
         await RemoveLogo();
         await RemoveOfflineCache();
         //var QRs_cache_dir = Path.Combine(docs, Constants.QRs_cache_dir);
     });
     TaskA.Start();
     databaseMethods.CleanPersonalNetworksTable();
     databaseMethods.ClearCompanyCardTable();
     databaseMethods.ClearUsersCardTable();
     //CropCompanyLogoViewController.currentImage = null;
     CompanyDataActivity.CroppedResult = null;
     //CompanyAddressMapViewController.lat = null;
     //CompanyAddressMapViewController.lng = null;
     CompanyAddressMapActivity.CompanyLat            = null;
     CompanyAddressMapActivity.CompanyLng            = null;
     CompanyAddressActivity.FullCompanyAddressStatic = null;
     CompanyAddressActivity.Country       = null;
     CompanyAddressActivity.Region        = null;
     CompanyAddressActivity.City          = null;
     CompanyAddressActivity.Index         = null;
     CompanyAddressActivity.Notation      = null;
     CompanyDataActivity.CompanyName      = null;
     CompanyDataActivity.LinesOfBusiness  = null;
     CompanyDataActivity.Position         = null;
     CompanyDataActivity.FoundationYear   = null;
     CompanyDataActivity.Clients          = null;
     CompanyDataActivity.CompanyPhone     = null;
     CompanyDataActivity.CorporativePhone = null;
     CompanyDataActivity.Fax             = null;
     CompanyDataActivity.CompanyEmail    = null;
     CompanyDataActivity.CorporativeSite = null;
     PersonalDataActivity.MySurname      = null;
     PersonalDataActivity.MyName         = null;
     PersonalDataActivity.MyMiddlename   = null;
     PersonalDataActivity.MyPhone        = null;
     PersonalDataActivity.MyEmail        = null;
     PersonalDataActivity.MyHomePhone    = null;
     PersonalDataActivity.MySite         = null;
     PersonalDataActivity.MyDegree       = null;
     PersonalDataActivity.MyCardName     = null;
     try { PersonalImageAdapter.Photos?.Clear(); } catch { }
     PersonalDataActivity.MyBirthdate = null;
     NativeMethods.ResetHomeAddress();
     NativeMethods.ResetCompanyAddress();
     EditCompanyDataActivity.Position = null;
     EditCompanyDataActivity.LogoId   = null;
     #endregion clearing tables, variables and photos
 }
Exemple #2
0
 private void reset_company_data()
 {
     CompanyDataActivity.CroppedResult    = null;
     CompanyDataActivity.CompanyName      = null;
     CompanyDataActivity.LinesOfBusiness  = null;
     CompanyDataActivity.Position         = null;
     CompanyDataActivity.FoundationYear   = null;
     CompanyDataActivity.Clients          = null;
     CompanyDataActivity.CompanyPhone     = null;
     CompanyDataActivity.CorporativePhone = null;
     CompanyDataActivity.Fax             = null;
     CompanyDataActivity.CompanyEmail    = null;
     CompanyDataActivity.CorporativeSite = null;
     NativeMethods.ResetCompanyAddress();
     EditCompanyDataActivity.Position = null;
     _databaseMethods.ClearCompanyCardTable();
     _nativeMethods.RemoveLogo();
 }
        void ClearAll()
        {
            var taskA = new Task(async() =>
            {
                await _nativeMethods.RemovePersonalImages();
                await _nativeMethods.RemoveLogo();
                //await nativeMethods.RemoveOfflineCache();
                //var QRs_cache_dir = Path.Combine(docs, Constants.QRs_cache_dir);
            });

            taskA.Start();
            _databaseMethods.CleanPersonalNetworksTable();
            _databaseMethods.ClearCompanyCardTable();
            _databaseMethods.ClearUsersCardTable();
            //CropCompanyLogoViewController.currentImage = null;
            CompanyDataActivity.CroppedResult = null;
            NativeMethods.ResetCompanyAddress();
            CompanyDataActivity.CompanyName      = null;
            CompanyDataActivity.LinesOfBusiness  = null;
            CompanyDataActivity.Position         = null;
            CompanyDataActivity.FoundationYear   = null;
            CompanyDataActivity.Clients          = null;
            CompanyDataActivity.CompanyPhone     = null;
            CompanyDataActivity.CorporativePhone = null;
            CompanyDataActivity.Fax             = null;
            CompanyDataActivity.CompanyEmail    = null;
            CompanyDataActivity.CorporativeSite = null;
            PersonalDataActivity.MySurname      = null;
            PersonalDataActivity.MyName         = null;
            PersonalDataActivity.MyMiddlename   = null;
            PersonalDataActivity.MyPhone        = null;
            PersonalDataActivity.MyEmail        = null;
            PersonalDataActivity.MyHomePhone    = null;
            PersonalDataActivity.MySite         = null;
            PersonalDataActivity.MyDegree       = null;
            PersonalDataActivity.MyCardName     = null;
            try { PersonalImageAdapter.Photos.Clear(); } catch { }
            PersonalDataActivity.MyBirthdate = null;

            NativeMethods.ResetHomeAddress();
            EditCompanyDataActivity.Position = null;
            EditCompanyDataActivity.LogoId   = null;
        }
        private async Task <bool> Clear()
        {
            await Task.Run(async() =>
            {
                await _nativeMethods.RemovePersonalImages();
                await _nativeMethods.RemoveLogo();
            });

            _databaseMethods.CleanPersonalNetworksTable();
            _databaseMethods.ClearCompanyCardTable();
            _databaseMethods.ClearUsersCardTable();
            NativeMethods.ResetSocialNetworkList();
            EditCompanyDataActivity.CroppedResult = null;
            CompanyDataActivity.CroppedResult     = null;
            NativeMethods.ResetCompanyAddress();
            CompanyDataActivity.CompanyName      = null;
            CompanyDataActivity.LinesOfBusiness  = null;
            CompanyDataActivity.Position         = null;
            CompanyDataActivity.FoundationYear   = null;
            CompanyDataActivity.Clients          = null;
            CompanyDataActivity.CompanyPhone     = null;
            CompanyDataActivity.CorporativePhone = null;
            CompanyDataActivity.Fax               = null;
            CompanyDataActivity.CompanyEmail      = null;
            CompanyDataActivity.CorporativeSite   = null;
            EditPersonalDataActivity.MySurname    = null;
            EditPersonalDataActivity.MyName       = null;
            EditPersonalDataActivity.MyMiddlename = null;
            EditPersonalDataActivity.MyPhone      = null;
            EditPersonalDataActivity.MyEmail      = null;
            EditPersonalDataActivity.MyHomePhone  = null;
            EditPersonalDataActivity.MySite       = null;
            EditPersonalDataActivity.MyDegree     = null;
            EditPersonalDataActivity.MyCardName   = null;
            try { EditPersonalImageAdapter.Photos.Clear(); } catch { }
            try { PersonalImageAdapter.Photos.Clear(); } catch { }
            EditPersonalDataActivity.MyBirthDate = null;
            NativeMethods.ResetCompanyAddress();
            EditCompanyDataActivity.Position = null;
            EditCompanyDataActivity.LogoId   = null;
            return(true);
        }
Exemple #5
0
        public static void log_out(Activity context)
        {
            //string dbPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "ormdemo.db3");
            //var db = new SQLiteConnection(dbPath);
            //var docs = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            //var cards_cache_dir = Path.Combine(docs, Constants.CardsPersonalImages);
            //var logo_cache_dir = Path.Combine(docs, Constants.CardsLogo);



            #region clearing tables, variables and photos
            var taskA = new Task(async() =>
            {
                await _nativeMethods.RemovePersonalImages();
                await _nativeMethods.RemoveLogo();
                await _nativeMethods.RemoveOfflineCache();
                //var QRs_cache_dir = Path.Combine(docs, Constants.QRs_cache_dir);
            });
            taskA.Start();
            NativeMethods.ResetSocialNetworkList();
            _databaseMethods.CleanPersonalNetworksTable();
            _databaseMethods.ClearCompanyCardTable();
            _databaseMethods.ClearUsersCardTable();
            _databaseMethods.ClearValidTillRepeatAfterTable();
            _databaseMethods.CleanCloudSynTable();
            _databaseMethods.CleanCardNames();
            _databaseMethods.CleanEtagTable();
            //clearing table
            try
            {
                _databaseMethods.CleanDifferentPurposesTable();
            }
            catch { }

            //clearing table
            try
            {
                _databaseMethods.CleanLoginAfterTable();
            }
            catch { }

            //clearing table
            try
            {
                _databaseMethods.CleanLoginedFromTable();
            }
            catch { }

            //CompanyDataActivity.currentImage = null;
            CompanyDataActivity.CroppedResult = null;
            //CompanyAddressMapViewController.lat = null;
            //CompanyAddressMapViewController.lng = null;
            CompanyAddressMapActivity.CompanyLat            = null;
            CompanyAddressMapActivity.CompanyLng            = null;
            CompanyAddressActivity.FullCompanyAddressStatic = null;
            CompanyAddressActivity.Country       = null;
            CompanyAddressActivity.Region        = null;
            CompanyAddressActivity.City          = null;
            CompanyAddressActivity.Index         = null;
            CompanyAddressActivity.Notation      = null;
            CompanyDataActivity.CompanyName      = null;
            CompanyDataActivity.LinesOfBusiness  = null;
            CompanyDataActivity.Position         = null;
            CompanyDataActivity.FoundationYear   = null;
            CompanyDataActivity.Clients          = null;
            CompanyDataActivity.CompanyPhone     = null;
            CompanyDataActivity.CorporativePhone = null;
            CompanyDataActivity.Fax             = null;
            CompanyDataActivity.CompanyEmail    = null;
            CompanyDataActivity.CorporativeSite = null;
            PersonalDataActivity.MySurname      = null;
            PersonalDataActivity.MyName         = null;
            PersonalDataActivity.MyMiddlename   = null;
            PersonalDataActivity.MyPhone        = null;
            PersonalDataActivity.MyEmail        = null;
            PersonalDataActivity.MyHomePhone    = null;
            PersonalDataActivity.MySite         = null;
            PersonalDataActivity.MyDegree       = null;
            PersonalDataActivity.MyCardName     = null;
            try { PersonalImageAdapter.Photos.Clear(); } catch { }
            PersonalDataActivity.MyBirthdate = null;
            NativeMethods.ResetHomeAddress();
            NativeMethods.ResetCompanyAddress();
            try { CreatingCardActivity.Datalist.Clear(); } catch { }
            try { QrActivity.CardNames.Clear(); } catch { }
            EditCompanyDataActivity.Position          = null;
            EditCompanyDataActivity.LogoId            = null;
            QrActivity.CardsRemaining                 = 0;
            QrActivity.IsPremium                      = false;
            QrActivity.ExtraPersonData                = null;
            QrActivity.ExtraEmploymentData            = null;
            QrActivity.CompanyLogoInQr                = null;
            WaitingEmailConfirmActivity.CameFromPurge = false;
            //clearing webView cookies
            CookieSyncManager.CreateInstance(context);
            CookieManager cookieManager = CookieManager.Instance;
            cookieManager.RemoveAllCookies(null);
            #endregion clearing tables, variables and photos
        }
Exemple #6
0
 private void ClearAll()
 {
     #region clearing tables, variables and photos
     var taskA = new Task(async() =>
     {
         await _nativeMethods.RemovePersonalImages();
         await _nativeMethods.RemoveLogo();
     });
     taskA.Start();
     _databaseMethods.CleanPersonalNetworksTable();
     _databaseMethods.ClearCompanyCardTable();
     _databaseMethods.ClearUsersCardTable();
     IdsOfAttachments.Clear();
     ImagesFromServerList.Clear();
     try
     {
         NativeMethods.ResetSocialNetworkList();
     }
     catch { }
     CompanyDataActivity.CompanyName      = null;
     CompanyDataActivity.LinesOfBusiness  = null;
     CompanyDataActivity.Position         = null;
     CompanyDataActivity.FoundationYear   = null;
     CompanyDataActivity.Clients          = null;
     CompanyDataActivity.CompanyPhone     = null;
     CompanyDataActivity.CorporativePhone = null;
     CompanyDataActivity.Fax             = null;
     CompanyDataActivity.CompanyEmail    = null;
     CompanyDataActivity.CorporativeSite = null;
     PersonalDataActivity.MySurname      = null;
     PersonalDataActivity.MyName         = null;
     PersonalDataActivity.MyMiddlename   = null;
     PersonalDataActivity.MyPhone        = null;
     PersonalDataActivity.MyEmail        = null;
     PersonalDataActivity.MyHomePhone    = null;
     PersonalDataActivity.MySite         = null;
     PersonalDataActivity.MyDegree       = null;
     PersonalDataActivity.MyCardName     = null;
     try { PersonalImageAdapter.Photos.Clear(); } catch { }
     PersonalDataActivity.MyBirthdate = null;
     NativeMethods.ResetHomeAddress();
     NativeMethods.ResetCompanyAddress();
     EditCompanyDataActivity.CompanyName      = null;
     EditCompanyDataActivity.LinesOfBusiness  = null;
     EditCompanyDataActivity.Position         = null;
     EditCompanyDataActivity.FoundationYear   = null;
     EditCompanyDataActivity.Clients          = null;
     EditCompanyDataActivity.CompanyPhone     = null;
     EditCompanyDataActivity.CorporativePhone = null;
     EditCompanyDataActivity.Fax             = null;
     EditCompanyDataActivity.CompanyEmail    = null;
     EditCompanyDataActivity.CorporativeSite = null;
     EditPersonalDataActivity.MySurname      = null;
     EditPersonalDataActivity.MyName         = null;
     EditPersonalDataActivity.MyMiddlename   = null;
     EditPersonalDataActivity.MyPhone        = null;
     EditPersonalDataActivity.MyEmail        = null;
     EditPersonalDataActivity.MyHomePhone    = null;
     EditPersonalDataActivity.MySite         = null;
     EditPersonalDataActivity.MyDegree       = null;
     EditPersonalDataActivity.MyCardName     = null;
     EditPersonalDataActivity.MyBirthDate    = null;
     EditCompanyDataActivity.LogoId          = null;
     EditCompanyDataActivity.CroppedResult   = null;
     #endregion clearing tables, variables and photos
 }
        void ClearData()
        {
            Task.Run(() =>
            {
                _nativeMethods.RemovePersonalImages();
                _nativeMethods.RemoveLogo();
                //await nativeMethods.RemoveOfflineCache();
            });
            _databaseMethods.CleanPersonalNetworksTable();
            _databaseMethods.ClearCompanyCardTable();
            _databaseMethods.ClearUsersCardTable();
            try { PersonalImageAdapter.Photos.Clear(); } catch { }
            //CompanyDataActivity.currentImage = null;
            CompanyDataActivity.CroppedResult = null;
            //CompanyAddressMapActivity.lat = null;
            //CompanyAddressMapActivity.lng = null;
            CompanyAddressMapActivity.CompanyLat            = null;
            CompanyAddressMapActivity.CompanyLng            = null;
            CompanyAddressActivity.FullCompanyAddressStatic = null;
            CompanyAddressActivity.Country       = null;
            CompanyAddressActivity.Region        = null;
            CompanyAddressActivity.City          = null;
            CompanyAddressActivity.Index         = null;
            CompanyAddressActivity.Notation      = null;
            CompanyDataActivity.CompanyName      = null;
            CompanyDataActivity.LinesOfBusiness  = null;
            CompanyDataActivity.Position         = null;
            CompanyDataActivity.FoundationYear   = null;
            CompanyDataActivity.Clients          = null;
            CompanyDataActivity.CompanyPhone     = null;
            CompanyDataActivity.CorporativePhone = null;
            CompanyDataActivity.Fax             = null;
            CompanyDataActivity.CompanyEmail    = null;
            CompanyDataActivity.CorporativeSite = null;
            PersonalDataActivity.MySurname      = null;
            PersonalDataActivity.MyName         = null;
            PersonalDataActivity.MyMiddlename   = null;
            PersonalDataActivity.MyPhone        = null;
            PersonalDataActivity.MyEmail        = null;
            PersonalDataActivity.MyHomePhone    = null;
            PersonalDataActivity.MySite         = null;
            PersonalDataActivity.MyDegree       = null;
            PersonalDataActivity.MyCardName     = null;
            //try { PersonalDataViewController.images_list.Clear(); } catch { }
            PersonalDataActivity.MyBirthdate      = null;
            HomeAddressActivity.FullAddressStatic = null;
            HomeAddressActivity.MyCountry         = null;
            HomeAddressActivity.MyRegion          = null;
            HomeAddressActivity.MyCity            = null;
            HomeAddressActivity.MyIndex           = null;
            HomeAddressActivity.MyNotation        = null;
            NewCardAddressMapActivity.Lat         = null;
            NewCardAddressMapActivity.Lng         = null;
            EditCompanyDataActivity.Position      = null;
            EditCompanyDataActivity.LogoId        = null;

            HomeAddressActivity.FullAddressTemp           = null;
            HomeAddressActivity.MyCountryTemp             = null;
            HomeAddressActivity.MyRegionTemp              = null;
            HomeAddressActivity.MyCityTemp                = null;
            HomeAddressActivity.MyIndexTemp               = null;
            HomeAddressActivity.MyNotationTemp            = null;
            CompanyAddressActivity.FullCompanyAddressTemp = null;
            CompanyAddressActivity.CountryTemp            = null;
            CompanyAddressActivity.RegionTemp             = null;
            CompanyAddressActivity.CityTemp               = null;
            CompanyAddressActivity.IndexTemp              = null;
            CompanyAddressActivity.NotationTemp           = null;
            try
            {
                NativeMethods.ResetSocialNetworkList();
            }
            catch { }
        }
        private void ClearAll()
        {
            _databaseMethods.CleanPersonalNetworksTable();
            _databaseMethods.ClearCompanyCardTable();
            _databaseMethods.ClearUsersCardTable();
            NativeMethods.ResetSocialNetworkList();
            CompanyDataActivity.CroppedResult     = null;
            EditCompanyDataActivity.CroppedResult = null;
            //CompanyAddressMapViewController.lat = null;
            //CompanyAddressMapViewController.lng = null;
            CompanyAddressMapActivity.CompanyLat            = null;
            CompanyAddressMapActivity.CompanyLng            = null;
            CompanyAddressActivity.FullCompanyAddressStatic = null;
            CompanyAddressActivity.Country       = null;
            CompanyAddressActivity.Region        = null;
            CompanyAddressActivity.City          = null;
            CompanyAddressActivity.Index         = null;
            CompanyAddressActivity.Notation      = null;
            CompanyDataActivity.CompanyName      = null;
            CompanyDataActivity.LinesOfBusiness  = null;
            CompanyDataActivity.Position         = null;
            CompanyDataActivity.FoundationYear   = null;
            CompanyDataActivity.Clients          = null;
            CompanyDataActivity.CompanyPhone     = null;
            CompanyDataActivity.CorporativePhone = null;
            CompanyDataActivity.Fax               = null;
            CompanyDataActivity.CompanyEmail      = null;
            CompanyDataActivity.CorporativeSite   = null;
            EditPersonalDataActivity.MySurname    = null;
            EditPersonalDataActivity.MyName       = null;
            EditPersonalDataActivity.MyMiddlename = null;
            EditPersonalDataActivity.MyPhone      = null;
            EditPersonalDataActivity.MyEmail      = null;
            EditPersonalDataActivity.MyHomePhone  = null;
            EditPersonalDataActivity.MySite       = null;
            EditPersonalDataActivity.MyDegree     = null;
            EditPersonalDataActivity.MyCardName   = null;
            try { PersonalImageAdapter.Photos.Clear(); } catch { }
            try { EditPersonalImageAdapter.Photos.Clear(); } catch { }
            EditPersonalDataActivity.MyBirthDate     = null;
            EditCompanyDataActivity.CompanyName      = null;
            EditCompanyDataActivity.LinesOfBusiness  = null;
            EditCompanyDataActivity.Position         = null;
            EditCompanyDataActivity.FoundationYear   = null;
            EditCompanyDataActivity.Clients          = null;
            EditCompanyDataActivity.CompanyPhone     = null;
            EditCompanyDataActivity.CorporativePhone = null;
            EditCompanyDataActivity.Fax             = null;
            EditCompanyDataActivity.CompanyEmail    = null;
            EditCompanyDataActivity.CorporativeSite = null;
            HomeAddressActivity.FullAddressStatic   = null;
            HomeAddressActivity.MyCountry           = null;
            HomeAddressActivity.MyRegion            = null;
            HomeAddressActivity.MyCity     = null;
            HomeAddressActivity.MyIndex    = null;
            HomeAddressActivity.MyNotation = null;
            NewCardAddressMapActivity.Lat  = null;
            NewCardAddressMapActivity.Lng  = null;
            EditCompanyDataActivity.LogoId = null;

            HomeAddressActivity.FullAddressTemp           = null;
            HomeAddressActivity.MyCountryTemp             = null;
            HomeAddressActivity.MyRegionTemp              = null;
            HomeAddressActivity.MyCityTemp                = null;
            HomeAddressActivity.MyIndexTemp               = null;
            HomeAddressActivity.MyNotationTemp            = null;
            CompanyAddressActivity.FullCompanyAddressTemp = null;
            CompanyAddressActivity.CountryTemp            = null;
            CompanyAddressActivity.RegionTemp             = null;
            CompanyAddressActivity.CityTemp               = null;
            CompanyAddressActivity.IndexTemp              = null;
            CompanyAddressActivity.NotationTemp           = null;
        }
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.LoadingLayout);
            clientName = Android.OS.Build.Manufacturer + " " + Android.OS.Build.Model;
            InitElements();
            if (!_methods.IsConnected())
            {
                NoConnectionActivity.ActivityName = this;
                StartActivity(typeof(NoConnectionActivity));
                Finish();
                return;
            }

            if (!EditCompanyDataActivity.ChangedCompanyData)
            {
                goto DoPersonalStuff;
            }

            #region uploading photos
            bool photosExist    = true;
            var  personalImages = await _nativeMethods.GetPersonalImages();

            if (personalImages == null)
            {
                photosExist = false;
            }
            else
            {
                photosExist = true;
            }
            var documentsLogo = await _nativeMethods.GetDocumentsLogo();

            if (documentsLogo != null)
            {
                photosExist = true;
            }
            int?       logoId             = null;
            List <int> attachmentsIdsList = new List <int>();
            if (photosExist)
            {
                _mainTextTv.Text = TranslationHelper.GetString("photosAreBeingUploaded", _ci);
                AttachmentsUploadModel resPhotos = null;
                try
                {
                    resPhotos = await _attachments.UploadAndroid(_databaseMethods.GetAccessJwt(), clientName, personalImages, documentsLogo);
                }
                catch (Exception ex)
                {
                    if (!_methods.IsConnected())
                    {
                        NoConnectionActivity.ActivityName = this;
                        StartActivity(typeof(NoConnectionActivity));
                        Finish();
                        return;
                    }
                }
                if (resPhotos == null)
                {
                    if (!_methods.IsConnected())
                    {
                        NoConnectionActivity.ActivityName = this;
                        StartActivity(typeof(NoConnectionActivity));
                        Finish();
                        return;
                    }
                }
                if (resPhotos != null)
                {
                    //var deserialized_logo = JsonConvert.DeserializeObject<CompanyLogoModel>(res_photos);
                    logoId             = resPhotos.logo_id;
                    attachmentsIdsList = resPhotos.attachments_ids;
                    if (logoId == Constants.image_upload_status_code401)
                    {
                        ShowSeveralDevicesRestriction();
                        return;
                    }
                }
            }
            _mainTextTv.Text = TranslationHelper.GetString("cardIsSynchronizing", _ci);
            #endregion uploading photos
            string resCompany = null;
            try
            {
                if (logoId != null)
                {
                    if (EditPersonalProcessActivity.CompanyId != null)
                    {
                        resCompany = await _companies.UpdateCompanyCard(_databaseMethods.GetAccessJwt(), clientName, _databaseMethods.GetDataFromCompanyCard(), EditPersonalProcessActivity.CompanyId, logoId);
                    }
                    else
                    {
                        resCompany = await _companies.CreateCompanyCard(_databaseMethods.GetAccessJwt(), clientName, _databaseMethods.GetDataFromCompanyCard(), logoId);
                    }
                }
                else
                {
                    if (EditPersonalProcessActivity.CompanyId != null)
                    {
                        resCompany = await _companies.UpdateCompanyCard(_databaseMethods.GetAccessJwt(), clientName, _databaseMethods.GetDataFromCompanyCard(), EditPersonalProcessActivity.CompanyId);
                    }
                    else
                    {
                        resCompany = await _companies.CreateCompanyCard(_databaseMethods.GetAccessJwt(), clientName, _databaseMethods.GetDataFromCompanyCard());
                    }
                }
            }
            catch (Exception ex)
            {
                if (!_methods.IsConnected())
                {
                    NoConnectionActivity.ActivityName = this;
                    StartActivity(typeof(NoConnectionActivity));
                    Finish();
                    return;
                }
            }
            if (String.IsNullOrEmpty(resCompany))
            {
                if (!_methods.IsConnected())
                {
                    NoConnectionActivity.ActivityName = this;
                    StartActivity(typeof(NoConnectionActivity));
                    Finish();
                    return;
                }
            }
            if (resCompany == Constants.image_upload_status_code401.ToString())
            {
                ShowSeveralDevicesRestriction();
                return;
            }
            try
            {
                var deserialized = JsonConvert.DeserializeObject <CompanyCardResponse>(resCompany);
            }
            catch
            {
                _databaseMethods.ClearCompanyCardTable();
                var deserializedError = JsonConvert.DeserializeObject <List <CreateCompanyErrorModel> >(resCompany);
                Toast.MakeText(this, TranslationHelper.GetString("errorInCompanyData", _ci), ToastLength.Long).Show();
                base.OnBackPressed();
                return;
            }

            if (resCompany.Contains("id") && resCompany.Length < 12)
            {
                EditPersonalProcessActivity.CompanyId = Convert.ToInt32(JsonConvert.DeserializeObject <CompanyCardResponse>(resCompany).id);
            }
DoPersonalStuff:
            //caching card to db
            _databaseMethods.InsertUsersCard(
                EditPersonalDataActivity.MyName,
                EditPersonalDataActivity.MySurname,
                EditPersonalDataActivity.MyMiddlename,
                EditPersonalDataActivity.MyPhone,
                EditPersonalDataActivity.MyEmail,
                EditPersonalDataActivity.MyHomePhone,
                EditPersonalDataActivity.MySite,
                EditPersonalDataActivity.MyDegree,
                EditPersonalDataActivity.MyCardName,
                EditPersonalDataActivity.MyBirthDate,
                HomeAddressActivity.MyCountry,
                HomeAddressActivity.MyRegion,
                HomeAddressActivity.MyCity,
                HomeAddressActivity.FullAddressStatic,
                HomeAddressActivity.MyIndex,
                HomeAddressActivity.MyNotation,
                NewCardAddressMapActivity.Lat,
                NewCardAddressMapActivity.Lng,
                true
                );
            HttpResponseMessage res = null;
            try
            {
                res = await _cards.CardUpdate(_databaseMethods.GetAccessJwt(),
                                              EditActivity.CardId,
                                              _databaseMethods.GetDataFromUsersCard(EditPersonalProcessActivity.CompanyId,
                                                                                    _databaseMethods.GetLastSubscription(),
                                                                                    EditCompanyDataActivity.Position, EditCompanyDataActivity.CorporativePhone),
                                              EditPersonalDataActivity.IsPrimary,
                                              GetPersonalNetworks(),
                                              EditActivity.IdsOfAttachments,
                                              clientName);
            }
            catch (Exception ex)
            {
                if (!_methods.IsConnected())
                {
                    NoConnectionActivity.ActivityName = this;
                    StartActivity(typeof(NoConnectionActivity));
                    Finish();
                    return;
                }
            }
            if (res == null)
            {
                if (!_methods.IsConnected())
                {
                    NoConnectionActivity.ActivityName = this;
                    StartActivity(typeof(NoConnectionActivity));
                    Finish();
                    return;
                }
            }
            if (res.StatusCode.ToString().Contains("401") || res.StatusCode.ToString().ToLower().Contains(Constants.status_code401))
            {
                ShowSeveralDevicesRestriction();
                return;
            }

            await Clear();

            try
            {
                StartActivity(typeof(QrActivity));
                //var vc_list = this.NavigationController.ViewControllers.ToList();
                //try { vc_list.RemoveAt(vc_list.Count - 2); } catch { }
                //this.NavigationController.ViewControllers = vc_list.ToArray();
            }
            catch { }
        }