Exemplo n.º 1
0
        protected void lbImportUsers_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(ddlDomains.SelectedValue))
            {
                try
                {
                    AppsService service = new AppsService(ddlDomains.SelectedValue, UserContext.Current.Organization.GoogleAdminAuthToken);

                    int count  = 0;
                    int failed = 0;

                    GoogleProvider.ImportUsers(UserContext.Current.OrganizationId, service, out count, out failed);

                    lbImportUsers.Enabled = false;
                    lbImportUsers.Enabled = false;

                    lbImportUsers.Text = string.Format(CultureInfo.CurrentCulture, Resources.GoogleIntegrationControl_ImportUsers_Result_Text, count - failed, failed);
                }
                catch (AppsException a)
                {
                    lblStep1Error.Text = string.Format(CultureInfo.CurrentCulture, Resources.GoogleIntegrationControl_GoogleAppsError_Text, a.ErrorCode, a.InvalidInput, a.Reason);
                    mvStep1.SetActiveView(vwStep1Error);
                }
                catch (Exception ex)
                {
                    ShowError(ex, lblStep1Error, mvStep1, vwStep1Error);
                }
            }
            else
            {
                lblStep1Error.Text = Resources.GoogleIntegrationControl_DomainMisingError_Text;
                mvStep1.SetActiveView(vwStep1Error);
            }
        }