예제 #1
0
        async Task <bool> CreateCompany()
        {
            if (CompanyObject != null && CompanyObject is Record)
            {
                // Create a new company and insert it
                var obj = CompanyObject as Record;

                var company = new Company()
                {
                    Name            = obj.Name,
                    Latitude        = obj.geometry.coordinates[0],
                    Longitude       = obj.geometry.coordinates[1],
                    Email           = CompanyDetails[1].Text,
                    Phone           = CompanyDetails[2].Text,
                    Mobile          = CompanyDetails[3].Text,
                    Web             = CompanyDetails[4].Text,
                    Siret           = CompanyDetails[5].Text,
                    StatutJuridique = CompanyDetails[6].Text,
                    Ape             = CompanyDetails[7].Text,
                    ApeLibelle      = CompanyDetails[8].Text,
                    ApeSousClasse   = CompanyDetails[9].Text,
                    Effectif        = CompanyDetails[10].Text
                };

                ToastService.ShowLoading(AppResources.CreatingCompany);

                var isadded = await StoreManager.CompanyStore.InsertAsync(company);

                ToastService.HideLoading();

                if (isadded)
                {
                    CompanyObject = company;
                    return(true);
                }
                else
                {
                    ShowErrorMessage();
                }
                //

                return(false);
            }

            return(true);
        }