Ejemplo n.º 1
0
            public async Task <Response> Handle(Request request)
            {
                var tenant = await _context.Tenants.SingleOrDefaultAsync(x => x.UniqueId == request.TenantUniqueId);

                if (tenant != null)
                {
                    return(new Response());
                }

                var httpRequestMessage = new HttpRequestMessage()
                {
                    RequestUri = new Uri("http://localhost:62233/api/tenants/exists"),
                    Method     = HttpMethod.Get,
                };

                httpRequestMessage.Headers.Add("Tenant", $"{request.UniqueId}");

                var httpResponseMessage = await _client.SendAsync(httpRequestMessage);

                var response = await httpResponseMessage.Content.ReadAsAsync <TenantExistsResponse>();

                if (response.Exists)
                {
                    tenant = new Model.Tenant()
                    {
                        UniqueId = request.UniqueId, Name = $"{request.UniqueId}"
                    };
                    _context.Tenants.Add(tenant);
                    await _context.SaveChangesAsync();

                    return(new Response());
                }

                throw new Exception("Tenant doesn't exist");
            }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                _ReportName = Request.QueryString["name"].ToString();
                this.Title  = _ReportName;

                string taxauthority = ConfigurationManager.AppSettings["TaxAuthority"];

                Model.Tenant _tenant = _context.Tenants.Single(i => i.TenantId == taxauthority);

                string reportserver = _tenant.ReportServer;
                string reportfolder = _tenant.ReportFolder;

                string _userName     = _tenant.ReportUser;
                string _Password     = _tenant.ReportPassword;
                string _reportDomain = _tenant.ReportDomain;

                Uri uri = new Uri(reportserver);
                rptViewer.ServerReport.ReportServerUrl = uri;
                rptViewer.ServerReport.ReportPath      = reportfolder + _ReportName;

                rptViewer.ServerReport.ReportServerCredentials = new CustomReportCredentials(_userName, _Password, _reportDomain);
                rptViewer.ServerReport.Refresh();
            }
        }
Ejemplo n.º 3
0
            public async Task <Response> Handle(Request request)
            {
                var tenant = await _context.Tenants.SingleOrDefaultAsync(x => x.UniqueId == request.TenantUniqueId);

                if (tenant != null)
                {
                    return(new Response());
                }

                var httpRequestMessage = new HttpRequestMessage()
                {
                    RequestUri = new Uri($"http://identity.quinntynebrown.com/api/tenants/exists?uniqueId={request.UniqueId}"),
                    Method     = HttpMethod.Get,
                };

                httpRequestMessage.Headers.Add("Tenant", $"{request.UniqueId}");

                var httpResponseMessage = await _client.SendAsync(httpRequestMessage);

                var response = await httpResponseMessage.Content.ReadAsAsync <JObject>();

                if (Convert.ToBoolean(response["exists"]))
                {
                    tenant = new Model.Tenant()
                    {
                        UniqueId = request.UniqueId, Name = $"{request.UniqueId}"
                    };
                    _context.Tenants.Add(tenant);
                    await _context.SaveChangesAsync();

                    return(new Response());
                }

                throw new Exception("Tenant doesn't exist");
            }
 private void AddTenant(Model.Tenant item)
 {
     Add(
         new Owner
     {
         Item = item,
         AuthenticationProfiles = new ObservableCollection <Model.AuthenticationProfile>
                                  (
             Model.Context.Current.AuthenticationProfiles.Where(x => x.ParentId == item.Id)
                                  )
     }
         );
 }
        private void RemoveTenant(Model.Tenant item)
        {
            var toRemove = this
                           .SingleOrDefault(x => typeof(Model.Tenant)
                                            .IsAssignableFrom(x.Item.GetType()) && (x.Item as Model.Tenant).Id == item.Id);

            // The tenant wasn't found. This is normal since the tenant removal can be recursive.
            if (toRemove == null)
            {
                return;
            }

            Remove(toRemove);
        }
Ejemplo n.º 6
0
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            Model.Tenant tenant = context.Tenants.Single(i => i.TenantId == "FCT-IRS");

            tenant.EmailServer       = (string)formlayout.GetNestedControlValueByFieldName("EmailServer");
            tenant.EmailSender       = (string)formlayout.GetNestedControlValueByFieldName("EmailSender");
            tenant.EmailUser         = (string)formlayout.GetNestedControlValueByFieldName("EmailUser");
            tenant.EmailUserPassword = (string)formlayout.GetNestedControlValueByFieldName("EmailUserPassword");
            tenant.ReportServer      = (string)formlayout.GetNestedControlValueByFieldName("ReportServer");
            tenant.ReportDomain      = (string)formlayout.GetNestedControlValueByFieldName("ReportDomain");
            tenant.ReportFolder      = (string)formlayout.GetNestedControlValueByFieldName("ReportFolder");
            tenant.ReportUser        = (string)formlayout.GetNestedControlValueByFieldName("ReportUser");
            tenant.ReportPassword    = (string)formlayout.GetNestedControlValueByFieldName("ReportPassword");

            tenant.PasswordExpiration  = int.Parse(formlayout.GetNestedControlValueByFieldName("PasswordExpiration").ToString());
            tenant.FailedLoginAttempts = int.Parse(formlayout.GetNestedControlValueByFieldName("FailedLoginAttempts").ToString());
            tenant.SessionTimeout      = int.Parse(formlayout.GetNestedControlValueByFieldName("SessionTimeout").ToString());

            context.SaveChanges();

            string message = "Record Saved Successfully";

            DisplayAlert("Success", "Tax Authority Settings", message);
        }