Exemplo n.º 1
0
        public virtual void BindData(Applications applicationsWithWindow)
        {
            applications.DataSource = applicationsWithWindow;
            applications.DisplayMember = CodePath.Get(CodePath.New<Application>().Name);

            windows.DisplayMember = CodePath.Get(CodePath.New<DummyWindow>().Title);
            windowTabs.DisplayMember = CodePath.Get(CodePath.New<Tab>().PrimaryIdentification);
        }
 public SolutionExplorer(Applications.MainWindowViewModel supVM)
 {
     this._supVM = supVM;
     InitializeComponent();
     this.ViewModel = new SolutionExplorerViewModel(this);
     this.Title = "Solution Explorer";
     this.AutoHideWidth = 200;
 }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            Console.WriteLine("************************************");
            Console.WriteLine("*************** Menu ***************");
            Console.WriteLine("************************************");

            Applications applications = new Applications();
            applications.StartMenu();

            Console.WriteLine();
            Console.WriteLine("----------");
            Console.ReadLine();
            
        }
Exemplo n.º 4
0
        protected internal async T.Task <Applications> FetchFullRegistryAsync()
        {
            long startingCounter = _registryFetchCounter;
            EurekaHttpResponse <Applications> resp = null;
            Applications fetched = null;

            if (string.IsNullOrEmpty(ClientConfig.RegistryRefreshSingleVipAddress))
            {
                resp = await HttpClient.GetApplicationsAsync();
            }
            else
            {
                resp = await HttpClient.GetVipAsync(ClientConfig.RegistryRefreshSingleVipAddress);
            }

            _logger?.LogDebug(
                "FetchFullRegistry returned: {StatusCode}, {Response}",
                resp.StatusCode,
                (resp.Response != null) ? resp.Response.ToString() : "null");
            if (resp.StatusCode == HttpStatusCode.OK)
            {
                fetched = resp.Response;
            }

            if (fetched != null && Interlocked.CompareExchange(ref _registryFetchCounter, (startingCounter + 1) % long.MaxValue, startingCounter) == startingCounter)
            {
                // Log
                LastGoodFullRegistryFetchTimestamp = DateTime.UtcNow.Ticks;
                return(fetched);
            }
            else
            {
                _logger?.LogWarning("FetchFullRegistry discarding fetch, race condition");
            }

            _logger?.LogDebug("FetchFullRegistry failed");
            return(null);
        }
Exemplo n.º 5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     intProfile   = Int32.Parse(Request.Cookies["profileid"].Value);
     oSupport     = new Supports(intProfile, dsn);
     oPage        = new Pages(intProfile, dsn);
     oAppPage     = new AppPages(intProfile, dsn);
     oApplication = new Applications(intProfile, dsn);
     oUser        = new Users(intProfile, dsn);
     if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "")
     {
         intPage = Int32.Parse(Request.QueryString["pageid"]);
     }
     if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
     {
         intApplication = Int32.Parse(Request.Cookies["application"].Value);
     }
     strRedirect   = oPage.GetFullLink(intViewPage);
     lblTitle.Text = oPage.Get(intPage, "title");
     lblPage.Text  = "1";
     lblSort.Text  = "";
     if (Request.QueryString["page"] != null && Request.QueryString["page"] != "")
     {
         lblPage.Text = Request.QueryString["page"];
     }
     if (Request.QueryString["sort"] != null && Request.QueryString["sort"] != "")
     {
         lblSort.Text = Request.QueryString["sort"];
     }
     lblTopPaging.Text = "";
     //try
     //{
     LoadPaging(Int32.Parse(lblPage.Text), lblSort.Text);
     //}
     //catch
     //{
     //    LoadPaging(1, "");
     //}
 }
Exemplo n.º 6
0
        /// <summary>
        /// Creates a new <see cref="Patch"/> at the specified address.
        /// </summary>
        /// <param name="address">The address to begin the patch.</param>
        /// <param name="patchWith">The bytes to be written as the patch.</param>
        /// <param name="name">The name of the patch.</param>
        /// <returns>A patch object that exposes the required methods to apply and remove the patch.</returns>
        public Patch Create(IntPtr address, byte[] patchWith, string name)
        {
#if !NOEXCEPTIONS
            if (address == IntPtr.Zero)
            {
                throw new ArgumentException("Address cannot be 0!", "address");
            }
            if (patchWith == null || patchWith.Length == 0)
            {
                throw new ArgumentNullException("patchWith", "Patch bytes cannot be null, or 0 bytes long!");
            }
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException("name");
            }
#endif

            if (!Applications.ContainsKey(name))
            {
                return(new Patch(address, patchWith, name, Win32));
            }
            return(null);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="host"></param>
        /// <param name="controller"></param>
        public ProfilesModel(ControllerBase controller, IWebHostEnvironment host) : base(controller)
        {
            if (host != null)
            {
                var fileName = Path.Combine(host.WebRootPath, Icon.TrimStart('~', '/').Replace('/', Path.DirectorySeparatorChar));

                // 数据库存储的个人图片有后缀 default.jpg?v=1234567
                fileName = fileName.Split('?').FirstOrDefault();
                if (File.Exists(fileName))
                {
                    Size     = new FileInfo(fileName).Length;
                    FileName = Path.GetFileName(fileName);
                }
            }

            if (controller.User.Identity.AuthenticationType != CookieAuthenticationDefaults.AuthenticationScheme)
            {
                External = true;
            }

            // 设置 当前用户默认应用名称
            AppName = Applications.FirstOrDefault(app => app.Key == AppId).Value;
        }
Exemplo n.º 8
0
        private void InstallOnRootWeb()
        {
            SPSecurity.RunWithElevatedPrivileges(delegate
            {
                using (var site = new SPSite(oWeb.Site.ID))
                {
                    var list = Applications.GetApplicationList(site.RootWeb);
                    if (list != null)
                    {
                        var li           = list.Items.Add();
                        li["Title"]      = appDef.Title;
                        li["EXTID"]      = appDef.Id;
                        li["AppVersion"] = appDef.Version;
                        li["Icon"]       = appDef.Icon;
                        li["Status"]     = "Not Installed";
                        li["InstallXML"] = appDef.ApplicationXml.OuterXml;
                        li["AppUrl"]     = appDef.fullurl;

                        li.Update();
                    }
                }
            });
        }
        /// <summary>
        /// Exports configured data for this session, if it is an application we care about
        /// </summary>
        public void Process(ISession session)
        {
            // Validate that we have work to do for the application that generated this session
            if (!Applications.Contains(session.Summary.FullApplicationName()))
            {
                return;
            }

            var metrics         = session.MetricDefinitions.Where(md => Metrics.Contains(md.FullMetricName())).ToList();
            var metricFileCount = 0;

            foreach (var metric in metrics)
            {
                if (metric.SampleType == SampleType.Sampled)
                {
                    ExportSampledMetric(session, metric, ref metricFileCount);
                }
                else
                {
                    ExportEventMetric(session, (IEventMetricDefinition)metric, ref metricFileCount);
                }
            }
        }
Exemplo n.º 10
0
        public void ComputeHashCode_ReturnsExpected()
        {
            Application app1 = new Application("app1");
            app1.Add(new InstanceInfo() { AppName = "app1", InstanceId = "id1", VipAddress = "vapp1", SecureVipAddress = "svapp1", Status = InstanceStatus.DOWN });
            app1.Add(new InstanceInfo() { AppName = "app1", InstanceId = "id2", VipAddress = "vapp1", SecureVipAddress = "svapp1", Status = InstanceStatus.DOWN });

            Application app2 = new Application("app2");
            app2.Add(new InstanceInfo() { AppName = "app2", InstanceId = "id1", VipAddress = "vapp2", SecureVipAddress = "svapp2", Status = InstanceStatus.UP });
            app2.Add(new InstanceInfo() { AppName = "app2", InstanceId = "id2", VipAddress = "vapp2", SecureVipAddress = "svapp2", Status = InstanceStatus.OUT_OF_SERVICE });

            var apps = new Applications();
            apps.Add(app1);
            apps.Add(app2);

            var delta = new Applications();
            Application app3 = new Application("app3");
            app3.Add(new InstanceInfo() { AppName = "app3", InstanceId = "id1", VipAddress = "vapp3", SecureVipAddress = "svapp3", Actiontype = ActionType.ADDED, Status = InstanceStatus.STARTING });
            delta.Add(app3);
            apps.UpdateFromDelta(delta);

            string hashcode = apps.ComputeHashCode();
            Assert.Equal("DOWN_2_OUT_OF_SERVICE_1_STARTING_1_UP_1_", hashcode);
        }
Exemplo n.º 11
0
        public override async Task ValidateLogoutRequest([NotNull] ValidateLogoutRequestContext context)
        {
            // If an optional post_logout_redirect_uri was provided, validate it.
            if (!string.IsNullOrEmpty(context.PostLogoutRedirectUri))
            {
                var application = await Applications.FindByLogoutRedirectUri(context.PostLogoutRedirectUri, context.HttpContext.RequestAborted);

                if (application == null)
                {
                    Logger.LogError("The logout request was rejected because the client application corresponding " +
                                    "to the specified post_logout_redirect_uri was not found in the database: " +
                                    "'{PostLogoutRedirectUri}'.", context.PostLogoutRedirectUri);

                    context.Reject(
                        error: OpenIdConnectConstants.Errors.InvalidClient,
                        description: "Invalid post_logout_redirect_uri.");

                    return;
                }
            }

            context.Validate();
        }
Exemplo n.º 12
0
        public async Task <RegisteredApplication> UpdateClientSecret(string clientid)
        {
            RegisteredApplication old = await Applications.FindAsync(clientid);

            if (old == null)
            {
                return(null); // No such entity
            }
            old.ClientSecret = await RegisteredApplication.CreateClientSecret(old.ApplicationName);

            Applications.Update(old);
            try {
                await SaveChangesAsync();

                return(old);
            }
            catch (DbUpdateException dbue) {
                return(null);
            }
            catch (Exception e) {
                return(null);
            }
        }
Exemplo n.º 13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Cookies["loginreferrer"].Value   = "/admin/categories.aspx";
            Response.Cookies["loginreferrer"].Expires = DateTime.Now.AddDays(30);
            if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
            {
                intProfile = Int32.Parse(Request.Cookies["adminid"].Value);
            }
            else
            {
                Response.Redirect("/admin/login.aspx");
            }
            oCustomized  = new Customized(intProfile, dsn);
            oApplication = new Applications(intProfile, dsn);
            if (!IsPostBack)
            {
                LoopRepeater();
            }

            btnOrder.Attributes.Add("onclick", "return OpenWindow('SUPPORTORDER','" + hdnId.ClientID + "','" + hdnOrder.ClientID + "&type=CATEGORY" + "',false,400,400);");
            btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');");
            btnCancel.Attributes.Add("onclick", "return Cancel();");
        }
Exemplo n.º 14
0
        public MainViewModel()
        {
            if (IsInDesignMode)
            {
                CreateDesignTimeData();
            }
            else
            {
                Profiles = Settings.Default.Profiles ?? new ObservableCollection <ProfileViewModel>();

                Applications = Settings.Default.Applications ?? new ObservableCollection <MyApplicationViewModel>();;

                StartWithWindowsEnabled = Settings.Default.StartWithWindows;

                if (Settings.Default.FirstRun)
                {
                    LookForExistingApplications();
                }
            }

            AddProfile    = new RelayCommand(AddProfileCommand);
            RemoveProfile = new RelayCommand(() => Profiles.Remove(SelectedProfile), () => SelectedProfile != null);
            EditProfile   = new RelayCommand(EditProfileCommand, () => SelectedProfile != null);

            AddApplication    = new RelayCommand(AddApplicationCommand);
            RemoveApplication = new RelayCommand(() => Applications.Remove(SelectedApplicationViewModel), () => SelectedApplicationViewModel != null);
            EditApplication   = new RelayCommand(EditApplicationCommand, () => SelectedApplicationViewModel != null);

            StartWithWindows = new RelayCommand(StartWithWindowsCommand);

            MenuItems = new ObservableCollection <MenuItemViewModel>();

            BuildMenuItems();

            Profiles.CollectionChanged     += CollectionChanged;
            Applications.CollectionChanged += CollectionChanged;
        }
Exemplo n.º 15
0
        protected void Initialize()
        {
            _localRegionApps = new Applications
            {
                ReturnUpInstancesOnly = ClientConfig.ShouldFilterOnlyUpInstances
            };

            if (!ClientConfig.ShouldRegisterWithEureka && !ClientConfig.ShouldFetchRegistry)
            {
                return;
            }

            if (ClientConfig.ShouldRegisterWithEureka && _appInfoManager.InstanceInfo != null)
            {
                var result = RegisterAsync();
                if (!result.GetAwaiter().GetResult())
                {
                    _logger?.LogInformation("Initial Registration failed.");
                }

                _logger?.LogInformation("Starting HeartBeat");
                var intervalInMilli = _appInfoManager.InstanceInfo.LeaseInfo.RenewalIntervalInSecs * 1000;
                _heartBeatTimer = StartTimer("HeartBeat", intervalInMilli, HeartBeatTaskAsync);
                if (ClientConfig.ShouldOnDemandUpdateStatusChange)
                {
                    _appInfoManager.StatusChangedEvent += Instance_StatusChangedEvent;
                }
            }

            if (ClientConfig.ShouldFetchRegistry)
            {
                var result = FetchRegistryAsync(true);
                result.GetAwaiter().GetResult();
                var intervalInMilli = ClientConfig.RegistryFetchIntervalSeconds * 1000;
                _cacheRefreshTimer = StartTimer("Query", intervalInMilli, CacheRefreshTaskAsync);
            }
        }
Exemplo n.º 16
0
        public void GetRegisteredApplication_ReturnsExpected()
        {
            Application app1 = new Application("app1");

            app1.Add(new InstanceInfo()
            {
                InstanceId = "id1"
            });
            app1.Add(new InstanceInfo()
            {
                InstanceId = "id2"
            });

            Application app2 = new Application("app2");

            app2.Add(new InstanceInfo()
            {
                InstanceId = "id1"
            });
            app2.Add(new InstanceInfo()
            {
                InstanceId = "id2"
            });

            var apps = new Applications(new List <Application>()
            {
                app1, app2
            });

            var registered = apps.GetRegisteredApplication("app1");

            Assert.NotNull(registered);
            Assert.Equal("app1", registered.Name);

            registered = apps.GetRegisteredApplication("foobar");
            Assert.Null(registered);
        }
Exemplo n.º 17
0
 protected void Page_Load(object sender, EventArgs e)
 {
     intProfile   = Int32.Parse(Request.Cookies["profileid"].Value);
     oApplication = new Applications(intProfile, dsn);
     oPage        = new Pages(intProfile, dsn);
     oPageControl = new PageControls(intProfile, dsn);
     if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
     {
         intApplication = Int32.Parse(Request.QueryString["applicationid"]);
     }
     if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "")
     {
         intPage = Int32.Parse(Request.QueryString["pageid"]);
     }
     if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
     {
         intApplication = Int32.Parse(Request.Cookies["application"].Value);
     }
     AddPages(intApplication);
     if (strMenu != "")
     {
         strMenu = "<div id=\"mainscroll\"><table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"default\">" + strMenu + "</table></div>";
     }
 }
Exemplo n.º 18
0
        private IList <string> GetServices()
        {
            Applications applications = _httpClient.GetApplicationsAsync().ConfigureAwait(false).GetAwaiter().GetResult().Response;

            if (applications == null)
            {
                return(new List <string>());
            }

            IList <Application> registered = applications.GetRegisteredApplications();
            List <string>       names      = new List <string>();

            foreach (Application app in registered)
            {
                if (app.Instances.Count == 0)
                {
                    continue;
                }

                names.Add(app.Name.ToLowerInvariant());
            }

            return(names);
        }
Exemplo n.º 19
0
        /// <summary>
        /// Creates a new Opus encoder.
        /// </summary>
        /// <param name="inputSamplingRate">Sampling rate of the input signal (Hz). This must be one of 8000, 12000, 16000, 24000, or 48000.</param>
        /// <param name="inputChannels">Number of channels (1 or 2) in input signal.</param>
        /// <param name="application">Coding mode.</param>
        /// <returns>A new <c>OpusEncoder</c></returns>
        public static OpusEncoder Create(int inputSamplingRate, int inputChannels, Applications application)
        {
            if (inputSamplingRate != 8000 &&
                inputSamplingRate != 12000 &&
                inputSamplingRate != 16000 &&
                inputSamplingRate != 24000 &&
                inputSamplingRate != 48000)
            {
                throw new ArgumentOutOfRangeException("inputSamplingRate");
            }
            if (inputChannels != 1 && inputChannels != 2)
            {
                throw new ArgumentOutOfRangeException("inputChannels");
            }

            IntPtr error;
            IntPtr encoder = API.opus_encoder_create(inputSamplingRate, inputChannels, (int)application, out error);

            if ((Errors)error != Errors.OK)
            {
                throw new Exception("Exception occured while creating encoder");
            }
            return(new OpusEncoder(encoder, inputSamplingRate, inputChannels, application));
        }
Exemplo n.º 20
0
 protected void Page_Load(object sender, EventArgs e)
 {
     intProfile   = Int32.Parse(Request.Cookies["profileid"].Value);
     oPage        = new Pages(intProfile, dsn);
     oAppPage     = new AppPages(intProfile, dsn);
     oApplication = new Applications(intProfile, dsn);
     oUser        = new Users(intProfile, dsn);
     oServerName  = new ServerName(intProfile, dsn);
     if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "")
     {
         intPage = Int32.Parse(Request.QueryString["pageid"]);
     }
     if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
     {
         intApplication = Int32.Parse(Request.Cookies["application"].Value);
     }
     strRedirect   = oPage.GetFullLink(Int32.Parse(oPage.Get(intPage, "related")));
     lblTitle.Text = oPage.Get(intPage, "title");
     oPage.LoadPaging(oServerName.GetMine(intProfile), Request, intPage, lblPage, lblSort, lblTopPaging, lblBottomPaging, txtPage, lblPages, lblRecords, rptView, lblNone);
     foreach (RepeaterItem ri in rptView.Items)
     {
         ((Button)ri.FindControl("btnRelease")).Attributes.Add("onclick", "return confirm('Are you sure you want to release this item?');");
     }
 }
Exemplo n.º 21
0
        // GET: AdminPanel/Applications/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Applications applications = db.Applications.Find(id);

            if (applications == null)
            {
                return(HttpNotFound());
            }

            ApplicationViewModel viewModel = new ApplicationViewModel();
            var user = db.AspNetUsers.Find(applications.UserID);

            viewModel.ApplicationID  = applications.ApplicationId;
            viewModel.Email          = user.Email;
            viewModel.SocialClubName = user.SocialClubName;
            viewModel.RegisterDate   = (DateTime)applications.RegisterDate;
            viewModel.IsApproved     = applications.IsApproved;
            foreach (var item in applications.Answers)
            {
                viewModel.Answers.Add(new AnswerField {
                    AnswerSelection = (int)item.Answer,
                    AnswerText      = item.AnswerText,
                    QuestionId      = item.QuestionId,
                    QuestionText    = item.Questions.QuestionText,
                    Selection_A     = item.Questions.Selection_A,
                    Selection_B     = item.Questions.Selection_B,
                    Selection_C     = item.Questions.Selection_C,
                    IsTextArea      = item.Questions.IsTextArea,
                });
            }
            return(View(viewModel));
        }
Exemplo n.º 22
0
        async Task SaveChangesAdd()
        {
            if (string.IsNullOrEmpty(PasswordAlias))
            {
                return;
            }

            if (string.IsNullOrEmpty(Username))
            {
                return;
            }

            if (string.IsNullOrEmpty(Password))
            {
                return;
            }

            PasswordCreateModel passwordCreateModel = new PasswordCreateModel()
            {
                ApplicationId = SelectedApplicationAlias.Id,
                Encrypted     = false,
                Password      = Password,
                PasswordAlias = PasswordAlias,
                Username      = Username
            };

            int applicationId = passwordCreateModel.ApplicationId;
            int newPasswordId = await _passwordsEndPoint.CreateNewPassword(passwordCreateModel);

            await LoadPasswords();

            SelectedApplication = Applications.First(a => a.Id == applicationId);
            SelectedPassword    = Passwords.First(p => p.Id == newPasswordId);

            IsAdding = false;
        }
Exemplo n.º 23
0
        public void TestNzbGetConnection(string ipAddress, int port, string username, string password)
        {
            Logger.Trace(string.Format("Started TestNzbGetConnection with {0}:{1}, {2}", ipAddress, port, username));
            const Applications selectedApp = Applications.NzbGet;

            var tester = new EndpointTester(Service);

            Logger.Trace("Converting IP Address into URI");
            var uri = UrlHelper.ReturnUri(ipAddress, port);

            if (uri == null)
            {
                Logger.Trace("Conversion failed");
                Clients.All.failed(string.Format("Incorrect IP Address"));
                return;
            }
            Logger.Trace("Conversion success");
            try
            {
                Logger.Trace("Testing application connectivity");
                var result = tester.TestApplicationConnectivity(selectedApp, string.Empty, uri.ToString(), password, username);
                if (!result)
                {
                    Logger.Trace("result False");
                    Clients.All.failed(string.Format("Could not connect to {0}", selectedApp));
                    return;
                }
                Logger.Trace("Connected successfully");
                Clients.All.message(string.Format("Connection to {0} is successful", selectedApp));
            }
            catch (Exception e)
            {
                Logger.Warn(string.Format("Test connection to NZBGet failed: {0}", e.Message));
                Clients.All.failed(string.Format("{0}", e.Message));
            }
        }
        }//end Save_Application_Click

        /// <summary>
        /// this method will be used to delete the item based on selectedlist
        /// </summary>
        /// <param name="sender">sender object</param>
        /// <param name="e">arguments e</param>

        private void Delete_Application_Click(object sender, EventArgs e)
        {
            Applications applications = new Applications();
            App          selectedApp  = (App)AppList.SelectedValue;

            try
            {
                int appId = Int32.Parse(AppID.Text);
                if (selectedApp.ApplicationID != 0)
                {
                    applications.DeleteApplication(appId);
                    DisplayErrorMessage("Application has been Deleted");
                }
                LoadApplicationList();
            }
            catch (SqlException sqlex)
            {
                DisplayErrorMessage(sqlex.Message);
            }
            catch (Exception sqlex)
            {
                DisplayErrorMessage(sqlex.Message);
            }
        }//end Delete_Application_Click
Exemplo n.º 25
0
        public IApplication AddApplication <TApp>(TApp app, string executablefilePath) where TApp : IApplication
        {
            var versionInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(executablefilePath);

            app.Name        = string.IsNullOrWhiteSpace(versionInfo.ProductName) ? Path.GetFileNameWithoutExtension(executablefilePath) : versionInfo.ProductName;
            app.MatchUsing  = MatchUsing.ExecutableFilename;
            app.MatchString = Path.GetFileName(executablefilePath);

            var matchApplications = FindMatchApplications <TApp>(app.MatchUsing, app.MatchString);

            if (matchApplications.Length != 0)
            {
                return(matchApplications[0]);
            }
            var existingApp = Applications.Find(a => a.Name == app.Name && a is TApp);

            if (existingApp != null)
            {
                return(existingApp);
            }
            AddApplication(app);
            SaveApplications();
            return(app);
        }
Exemplo n.º 26
0
        public void GetRegisteredApplications_ReturnsExpected()
        {
            Application app1 = new Application("app1");

            app1.Add(new InstanceInfo()
            {
                InstanceId = "id1"
            });
            app1.Add(new InstanceInfo()
            {
                InstanceId = "id2"
            });

            Application app2 = new Application("app2");

            app2.Add(new InstanceInfo()
            {
                InstanceId = "id1"
            });
            app2.Add(new InstanceInfo()
            {
                InstanceId = "id2"
            });

            var apps = new Applications(new List <Application>()
            {
                app1, app2
            });

            var registered = apps.GetRegisteredApplications();

            Assert.NotNull(registered);
            Assert.Equal(2, registered.Count);
            Assert.True(registered[0].Name.Equals("app1") || registered[0].Name.Equals("app2"));
            Assert.True(registered[1].Name.Equals("app1") || registered[1].Name.Equals("app2"));
        }
Exemplo n.º 27
0
        public IList <string> GetServices()
        {
            Applications applications = Applications;

            if (applications == null)
            {
                return(new List <string>());
            }

            IList <Application> registered = applications.GetRegisteredApplications();
            List <string>       names      = new List <string>();

            foreach (Application app in registered)
            {
                if (app.Instances.Count == 0)
                {
                    continue;
                }

                names.Add(app.Name.ToLowerInvariant());
            }

            return(names);
        }
Exemplo n.º 28
0
        public async Task <bool> DeleteRegisteredApplication(string clientId)
        {
            RegisteredApplication ra = await Applications.Include(x => x.RedirectURIs).FirstAsync(x => x.ClientId.Equals(clientId));

            if (ra == null)
            {
                return(false); // No such element
            }
            else
            {
                Applications.Remove(ra);
                try {
                    await SaveChangesAsync();

                    return(true);
                }
                catch (DbUpdateException dbue) {
                    return(false);
                }
                catch (Exception e) {
                    return(false);
                }
            }
        }
 /// <summary>
 /// Gets the scope URI in Google's format.
 /// </summary>
 /// <param name="scope">The scope, which may include one or several Google applications.</param>
 /// <returns>A space-delimited list of URIs for the requested Google applications.</returns>
 public static string GetScopeUri(Applications scope)
 {
     return string.Join(" ", Util.GetIndividualFlags(scope).Select(app => DataScopeUris[(Applications)app]).ToArray());
 }
Exemplo n.º 30
0
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile       = Int32.Parse(Request.Cookies["profileid"].Value);
            oPage            = new Pages(intProfile, dsn);
            oRequestItem     = new RequestItems(intProfile, dsn);
            oServiceRequest  = new ServiceRequests(intProfile, dsn);
            oApplication     = new Applications(intProfile, dsn);
            oVariable        = new Variables(intEnvironment);
            oRequestField    = new RequestFields(intProfile, dsn);
            oService         = new Services(intProfile, dsn);
            oUser            = new Users(intProfile, dsn);
            oCustomized      = new Customized(intProfile, dsn);
            oRequest         = new Requests(intProfile, dsn);
            oResourceRequest = new ResourceRequest(intProfile, dsn);
            oProject         = new Projects(intProfile, dsn);
            oProjectsPending = new ProjectsPending(intProfile, dsn, intEnvironment);
            oCustom          = new Customized(intProfile, dsn);
            if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
            {
                intApplication = Int32.Parse(Request.QueryString["applicationid"]);
            }
            if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "")
            {
                intPage = Int32.Parse(Request.QueryString["pageid"]);
            }
            if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
            {
                intApplication = Int32.Parse(Request.Cookies["application"].Value);
            }
            if (Request.QueryString["rid"] != "" && Request.QueryString["rid"] != null)
            {
                int intRequest = Int32.Parse(Request.QueryString["rid"]);
                LoadValues();
                // Vijay -- Added Validation Check
                btnNext.Attributes.Add("onclick", "return ValidateDates('" + txtStart.ClientID + "','" + txtEnd.ClientID + "','The estimated start date must occur before the estimated end date');");
                imgStart.Attributes.Add("onclick", "return ShowCalendar('" + txtStart.ClientID + "');");
                imgEnd.Attributes.Add("onclick", "return ShowCalendar('" + txtEnd.ClientID + "');");

                // Vijay -- Added onclick attributes to followup and date engaged fields
                imgDate.Attributes.Add("onclick", "return ShowCalendar('" + txtDateEngaged.ClientID + "');");
                imgFollowUpDate.Attributes.Add("onclick", "return ShowCalendar('" + txtFollowupDate.ClientID + "');");


                // Custom Loads
                int    intItem        = Int32.Parse(lblItem.Text);
                int    intApp         = oRequestItem.GetItemApplication(intItem);
                string strDeliverable = oApplication.Get(intApp, "deliverables_doc");
                if (strDeliverable != "")
                {
                    panDeliverable.Visible = true;
                    btnDeliverable.Attributes.Add("onclick", "return OpenWindow('NEW_WINDOW','" + strDeliverable + "');");
                }
                int intNumber = Int32.Parse(lblNumber.Text);
                rptAssets.DataSource = oCustom.GetTechAssets(intRequest, intItem, intNumber);
                rptAssets.DataBind();
                rptResource.DataSource = oCustom.GetResourceAssignments(intRequest, intItem, intNumber);
                rptResource.DataBind();
                lblNoAsset.Visible = rptAssets.Items.Count == 0;
                lblNoRes.Visible   = rptResource.Items.Count == 0;
                foreach (RepeaterItem ri in rptAssets.Items)
                {
                    Panel      panEdit   = (Panel)ri.FindControl("panEditable");
                    LinkButton btnDelete = (LinkButton)panEdit.FindControl("btnDelete");

                    btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this asset?');");
                    panEdit.Visible = true;
                }
                if (IsPostBack)
                {
                    int intInvestigatedBy = 0;
                    if (Request.Form[hdnInvestigatedBy.UniqueID] != "")
                    {
                        intInvestigatedBy = Int32.Parse(Request.Form[hdnInvestigatedBy.UniqueID]);
                    }
                    int intIDCSPOC = 0;
                    if (Request.Form[hdnIDCSPOC.UniqueID] != "")
                    {
                        intIDCSPOC = Int32.Parse(Request.Form[hdnIDCSPOC.UniqueID]);
                    }
                    oCustomized.AddIDCDetails(intRequest, intItem, intNumber, drpInvestigated.SelectedItem.Text, intInvestigatedBy, txtFollowupDate.Text, txtDateEngaged.Text, drpPhase.SelectedItem.Text, drpEffortSize.SelectedItem.Text, drpInvolvement.SelectedItem.Text, drpEIT.SelectedItem.Text, drpProjectClass.SelectedItem.Text, drpEnterprise.SelectedItem.Text, drpNoInvolve.SelectedItem.Text, intIDCSPOC, txtComment.Text);
                    try
                    {
                        oRequest.UpdateStartDate(intRequest, DateTime.Parse(txtStart.Text));
                        oRequest.UpdateEndDate(intRequest, DateTime.Parse(txtEnd.Text));
                    }
                    catch { }
                }
                else
                {
                    DataSet dsInvestigation = oCustom.GetIDCDetails(intRequest, intItem, intNumber);
                    if (dsInvestigation.Tables[0].Rows.Count > 0)
                    {
                        int intSPOC = 0;
                        if (dsInvestigation.Tables[0].Rows[0]["idc_spoc"].ToString() != "0")
                        {
                            intSPOC         = Int32.Parse(dsInvestigation.Tables[0].Rows[0]["idc_spoc"].ToString());
                            txtIDCSPOC.Text = oUser.GetFullName(intSPOC) + " (" + oUser.GetName(intSPOC) + ")";
                        }
                        hdnIDCSPOC.Value = intSPOC.ToString();
                        int intInvestigatedBy = 0;
                        if (dsInvestigation.Tables[0].Rows[0]["investigated_by"].ToString() != "0")
                        {
                            intInvestigatedBy      = Int32.Parse(dsInvestigation.Tables[0].Rows[0]["investigated_by"].ToString());
                            txtInvestigatedBy.Text = oUser.GetFullName(intInvestigatedBy) + " (" + oUser.GetName(intInvestigatedBy) + ")";
                        }
                        hdnInvestigatedBy.Value       = intInvestigatedBy.ToString();
                        drpInvestigated.SelectedValue = dsInvestigation.Tables[0].Rows[0]["investigated"].ToString();
                        if (dsInvestigation.Tables[0].Rows[0]["followup_date"].ToString() != "")
                        {
                            txtFollowupDate.Text = DateTime.Parse(dsInvestigation.Tables[0].Rows[0]["followup_date"].ToString()).ToShortDateString();
                        }
                        if (dsInvestigation.Tables[0].Rows[0]["date_engaged"].ToString() != "")
                        {
                            txtDateEngaged.Text = DateTime.Parse(dsInvestigation.Tables[0].Rows[0]["date_engaged"].ToString()).ToShortDateString();
                        }
                        drpPhase.SelectedValue       = dsInvestigation.Tables[0].Rows[0]["phase_engaged"].ToString();
                        drpEffortSize.SelectedValue  = dsInvestigation.Tables[0].Rows[0]["effort_size"].ToString();
                        drpInvolvement.SelectedValue = dsInvestigation.Tables[0].Rows[0]["involvement"].ToString();
                        if (drpInvolvement.SelectedItem.Value == "No")
                        {
                            divInvolvement.Style["display"] = "inline";
                        }
                        drpEIT.SelectedValue          = dsInvestigation.Tables[0].Rows[0]["eit_testing"].ToString();
                        drpProjectClass.SelectedValue = dsInvestigation.Tables[0].Rows[0]["project_class"].ToString();
                        drpEnterprise.SelectedValue   = dsInvestigation.Tables[0].Rows[0]["enterprise_release"].ToString();
                        drpNoInvolve.SelectedValue    = dsInvestigation.Tables[0].Rows[0]["no_involve"].ToString();
                        txtComment.Text = dsInvestigation.Tables[0].Rows[0]["comments"].ToString();
                    }
                }



                foreach (RepeaterItem ri in rptResource.Items)
                {
                    int   id = Int32.Parse(((Label)ri.FindControl("lblResID")).Text);
                    Label lblResourceType  = (Label)ri.FindControl("lblResourceType");
                    Label lblRequestedDate = (Label)ri.FindControl("lblRequestedDate");
                    Label lblFulfillDate   = (Label)ri.FindControl("lblFulfillDate");
                    lblRequestedDate.Text = Convert.ToDateTime(lblRequestedDate.Text).ToShortDateString();
                    lblFulfillDate.Text   = Convert.ToDateTime(lblFulfillDate.Text).ToShortDateString();
                    lblResourceType.Text  = oCustom.GetResourceTypeName(id, "name");
                    Panel      panEdit   = (Panel)ri.FindControl("panEditable");
                    LinkButton btnDelete = (LinkButton)panEdit.FindControl("btnDelete");
                    btnDelete.Attributes.Add("onclick", " return confirm('Are you sure you want to delete this resource?') ;");
                    panEdit.Visible = true;
                }
                btnAddRes.Attributes.Add("onclick", "return EditResource('" + intRequest + "','" + intItem + "','" + intNumber + "','0');");
                btnAddAsset.Attributes.Add("onclick", "return EditAsset('" + intRequest + "','" + intItem + "','" + intNumber + "','0');");
            }
            txtInvestigatedBy.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'200','195','" + divAJAX.ClientID + "','" + lstAJAX.ClientID + "','" + hdnInvestigatedBy.ClientID + "','" + oVariable.URL() + "/frame/users.aspx',2);");
            lstAJAX.Attributes.Add("ondblclick", "AJAXClickRow();");
            txtIDCSPOC.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'200','195','" + divIDCSPOC.ClientID + "','" + lstIDCSPOC.ClientID + "','" + hdnIDCSPOC.ClientID + "','" + oVariable.URL() + "/frame/users.aspx',2);");
            lstIDCSPOC.Attributes.Add("ondblclick", "AJAXClickRow();");
            drpInvolvement.Attributes.Add("onchange", "ShowInvolvementReason(this,'" + divInvolvement.ClientID + "');");
            btnCancel1.Attributes.Add("onclick", "return confirm('Are you sure you want to cancel this service request?');");
        }
        public override async Task ValidateIntrospectionRequest([NotNull] ValidateIntrospectionRequestContext context)
        {
            // Note: the OpenID Connect server middleware supports unauthenticated introspection requests
            // but OpenIddict uses a stricter policy preventing unauthenticated/public applications
            // from using the introspection endpoint, as required by the specifications.
            // See https://tools.ietf.org/html/rfc7662#section-2.1 for more information.
            if (string.IsNullOrEmpty(context.ClientId) || string.IsNullOrEmpty(context.ClientSecret))
            {
                context.Reject(
                    error: OpenIdConnectConstants.Errors.InvalidRequest,
                    description: "The mandatory 'client_id' and/or 'client_secret' parameters are missing.");

                return;
            }

            // Retrieve the application details corresponding to the requested client_id.
            var application = await Applications.FindByClientIdAsync(context.ClientId);

            if (application == null)
            {
                Logger.LogError("The introspection request was rejected because the client " +
                                "application was not found: '{ClientId}'.", context.ClientId);

                context.Reject(
                    error: OpenIdConnectConstants.Errors.InvalidClient,
                    description: "The specified 'client_id' parameter is invalid.");

                return;
            }

            // Store the application entity as a request property to make it accessible
            // from the other provider methods without having to call the store twice.
            context.Request.SetProperty($"{OpenIddictConstants.Properties.Application}:{context.ClientId}", application);

            // Reject the request if the application is not allowed to use the introspection endpoint.
            if (!await Applications.HasPermissionAsync(application, OpenIddictConstants.Permissions.Endpoints.Introspection))
            {
                Logger.LogError("The introspection request was rejected because the application '{ClientId}' " +
                                "was not allowed to use the introspection endpoint.", context.ClientId);

                context.Reject(
                    error: OpenIdConnectConstants.Errors.UnauthorizedClient,
                    description: "This client application is not allowed to use the introspection endpoint.");

                return;
            }

            // Reject introspection requests sent by public applications.
            if (await Applications.IsPublicAsync(application))
            {
                Logger.LogError("The introspection request was rejected because the public application " +
                                "'{ClientId}' was not allowed to use this endpoint.", context.ClientId);

                context.Reject(
                    error: OpenIdConnectConstants.Errors.InvalidClient,
                    description: "This client application is not allowed to use the introspection endpoint.");

                return;
            }

            // Validate the client credentials.
            if (!await Applications.ValidateClientSecretAsync(application, context.ClientSecret))
            {
                Logger.LogError("The introspection request was rejected because the confidential or hybrid application " +
                                "'{ClientId}' didn't specify valid client credentials.", context.ClientId);

                context.Reject(
                    error: OpenIdConnectConstants.Errors.InvalidClient,
                    description: "The specified client credentials are invalid.");

                return;
            }

            context.Validate();
        }
Exemplo n.º 32
0
 public SaveAsCommand(Applications.MainWindowViewModel vm)
 {
     this._vm = vm;
 }
Exemplo n.º 33
0
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile       = Int32.Parse(Request.Cookies["profileid"].Value);
            oFunction        = new Functions(intProfile, dsn, intEnvironment);
            oUser            = new Users(intProfile, dsn);
            oPage            = new Pages(intProfile, dsn);
            oResourceRequest = new ResourceRequest(intProfile, dsn);
            oRequestItem     = new RequestItems(intProfile, dsn);
            oRequest         = new Requests(intProfile, dsn);
            oApplication     = new Applications(intProfile, dsn);
            oAccountRequest  = new AccountRequest(intProfile, dsn);
            oDelegate        = new Delegates(intProfile, dsn);
            oService         = new Services(intProfile, dsn);
            if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
            {
                intApplication = Int32.Parse(Request.QueryString["applicationid"]);
            }
            if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "")
            {
                intPage = Int32.Parse(Request.QueryString["pageid"]);
            }
            if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
            {
                intApplication = Int32.Parse(Request.Cookies["application"].Value);
            }
            string strAttributes  = "";
            bool   boolIncomplete = false;

            if (Request.QueryString["rrid"] != null && Request.QueryString["rrid"] != "")
            {
                intResourceWorkflow = Int32.Parse(Request.QueryString["rrid"]);
                int     intResourceParent = oResourceRequest.GetWorkflowParent(intResourceWorkflow);
                DataSet ds = oResourceRequest.Get(intResourceParent);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    intRequest = Int32.Parse(ds.Tables[0].Rows[0]["requestid"].ToString());
                    intItem    = Int32.Parse(ds.Tables[0].Rows[0]["itemid"].ToString());
                    intNumber  = Int32.Parse(ds.Tables[0].Rows[0]["number"].ToString());
                    // Workflow start
                    bool   boolComplete = (oResourceRequest.GetWorkflow(intResourceWorkflow, "status") == "3");
                    int    intUser      = Int32.Parse(oResourceRequest.GetWorkflow(intResourceWorkflow, "userid"));
                    double dblAllocated = double.Parse(oResourceRequest.GetWorkflow(intResourceWorkflow, "allocated"));
                    // Workflow end
                    intService = Int32.Parse(ds.Tables[0].Rows[0]["serviceid"].ToString());
                    int intApp = oRequestItem.GetItemApplication(intItem);

                    if (Request.QueryString["save"] != null && Request.QueryString["save"] != "")
                    {
                        Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "saved", "<script type=\"text/javascript\">alert('Information Saved Successfully');<" + "/" + "script>");
                    }
                    if (oService.Get(intService, "sla") != "")
                    {
                        oFunction.ConfigureToolButton(btnSLA, "/images/tool_sla");
                        int intDays = oResourceRequest.GetSLA(intResourceParent);
                        if (intDays < 1)
                        {
                            btnSLA.Style["border"] = "solid 2px #FF0000";
                        }
                        else if (intDays < 3)
                        {
                            btnSLA.Style["border"] = "solid 2px #FF9999";
                        }
                        btnSLA.Attributes.Add("onclick", "return OpenWindow('RESOURCE_REQUEST_SLA','?rrid=" + intResourceParent.ToString() + "');");
                    }
                    else
                    {
                        btnSLA.ImageUrl = "/images/tool_sla_dbl.gif";
                        btnSLA.Enabled  = false;
                    }
                    if (!IsPostBack)
                    {
                        if (intResourceWorkflow > 0)
                        {
                            ds = oRequest.Get(intRequest);
                            if (ds.Tables[0].Rows.Count > 0)
                            {
                                ds = oAccountRequest.GetMaintenance(intRequest, intItem, intNumber);
                                if (ds.Tables[0].Rows.Count > 0)
                                {
                                    if (ds.Tables[0].Rows[0]["completed"].ToString() == "")
                                    {
                                        boolIncomplete = true;
                                    }
                                    else
                                    {
                                        lblComplete.Text    = ds.Tables[0].Rows[0]["completed"].ToString();
                                        panComplete.Visible = true;
                                    }
                                    lblRequestBy.Text = oUser.GetFullName(oRequest.GetUser(intRequest));
                                    lblRequestOn.Text = DateTime.Parse(oRequest.Get(intRequest, "created")).ToLongDateString();
                                    int     intDomain = Int32.Parse(ds.Tables[0].Rows[0]["domain"].ToString());
                                    Domains oDomain   = new Domains(intProfile, dsn);
                                    intDomain = Int32.Parse(oDomain.Get(intDomain, "environment"));
                                    AD      oAD          = new AD(intProfile, dsn, intDomain);
                                    DataSet dsParameters = oAccountRequest.GetMaintenanceParameters(intRequest, intItem, intNumber);
                                    switch (ds.Tables[0].Rows[0]["maintenance"].ToString())
                                    {
                                    case "DISABLE":
                                        lblType.Text = "Account Disable";
                                        strDetails  += "<tr><td><b>Account:</b></td><td>" + ds.Tables[0].Rows[0]["username"].ToString() + " (" + oAD.GetUserFullName(ds.Tables[0].Rows[0]["username"].ToString()) + ")</td>";
                                        strDetails  += "<tr><td><b>Domain:</b></td><td>" + oDomain.Get(Int32.Parse(ds.Tables[0].Rows[0]["domain"].ToString()), "name") + "</td>";
                                        break;

                                    case "UNLOCK":
                                        lblType.Text = "Account Unlock";
                                        strDetails  += "<tr><td><b>Account:</b></td><td>" + ds.Tables[0].Rows[0]["username"].ToString() + " (" + oAD.GetUserFullName(ds.Tables[0].Rows[0]["username"].ToString()) + ")</td>";
                                        strDetails  += "<tr><td><b>Domain:</b></td><td>" + oDomain.Get(Int32.Parse(ds.Tables[0].Rows[0]["domain"].ToString()), "name") + "</td>";
                                        break;

                                    case "ENABLE":
                                        lblType.Text = "Account Enable";
                                        strDetails  += "<tr><td><b>Account:</b></td><td>" + ds.Tables[0].Rows[0]["username"].ToString() + " (" + oAD.GetUserFullName(ds.Tables[0].Rows[0]["username"].ToString()) + ")</td>";
                                        strDetails  += "<tr><td><b>Domain:</b></td><td>" + oDomain.Get(Int32.Parse(ds.Tables[0].Rows[0]["domain"].ToString()), "name") + "</td>";
                                        break;

                                    case "EMAIL":
                                        lblType.Text = "Email Enable an Account";
                                        strDetails  += "<tr><td><b>Account:</b></td><td>" + ds.Tables[0].Rows[0]["username"].ToString() + " (" + oAD.GetUserFullName(ds.Tables[0].Rows[0]["username"].ToString()) + ")</td>";
                                        strDetails  += "<tr><td><b>Domain:</b></td><td>" + oDomain.Get(Int32.Parse(ds.Tables[0].Rows[0]["domain"].ToString()), "name") + "</td>";
                                        break;

                                    case "MOVE":
                                        lblType.Text = "Account Move";
                                        strDetails  += "<tr><td><b>Account:</b></td><td>" + ds.Tables[0].Rows[0]["username"].ToString() + " (" + oAD.GetUserFullName(ds.Tables[0].Rows[0]["username"].ToString()) + ")</td>";
                                        strDetails  += "<tr><td><b>Domain:</b></td><td>" + oDomain.Get(Int32.Parse(ds.Tables[0].Rows[0]["domain"].ToString()), "name") + "</td>";
                                        strDetails  += "<tr><td><b>New Location:</b></td><td>" + dsParameters.Tables[0].Rows[0]["value"].ToString() + "</td>";
                                        break;

                                    case "PASSWORD":
                                        lblType.Text = "Account Password Change";
                                        strDetails  += "<tr><td><b>Account:</b></td><td>" + ds.Tables[0].Rows[0]["username"].ToString() + " (" + oAD.GetUserFullName(ds.Tables[0].Rows[0]["username"].ToString()) + ")</td>";
                                        strDetails  += "<tr><td><b>Domain:</b></td><td>" + oDomain.Get(Int32.Parse(ds.Tables[0].Rows[0]["domain"].ToString()), "name") + "</td>";
                                        break;

                                    case "COPY":
                                        lblType.Text        = "Account Copy";
                                        panPassword.Visible = true;
                                        strAttributes      += "ValidateText('" + txtPassword.ClientID + "','Please enter a password') && ";
                                        strDetails         += "<tr><td><b>Account:</b></td><td>" + ds.Tables[0].Rows[0]["username"].ToString() + " (" + oAD.GetUserFullName(ds.Tables[0].Rows[0]["username"].ToString()) + ")</td>";
                                        strDetails         += "<tr><td><b>Domain:</b></td><td>" + oDomain.Get(Int32.Parse(ds.Tables[0].Rows[0]["domain"].ToString()), "name") + "</td>";
                                        panID.Visible       = true;
                                        txtID.Text          = dsParameters.Tables[0].Rows[0]["value"].ToString();
                                        panFirst.Visible    = true;
                                        txtFirst.Text       = dsParameters.Tables[0].Rows[1]["value"].ToString();
                                        panLast.Visible     = true;
                                        txtLast.Text        = dsParameters.Tables[0].Rows[2]["value"].ToString();
                                        panGroups.Visible   = true;
                                        string[] strGroups;
                                        char[]   strSplit = { ';' };
                                        strGroups = dsParameters.Tables[0].Rows[3]["value"].ToString().Split(strSplit);
                                        for (int ii = 0; ii < strGroups.Length; ii++)
                                        {
                                            if (strGroups[ii].Trim() != "")
                                            {
                                                ListItem oList = new ListItem(strGroups[ii].Trim());
                                                chkGroups.Items.Add(oList);
                                                oList.Selected = true;
                                            }
                                        }
                                        break;

                                    case "DELETE":
                                        lblType.Text = "Account Deletion";
                                        strDetails  += "<tr><td><b>Account:</b></td><td>" + ds.Tables[0].Rows[0]["username"].ToString() + " (" + oAD.GetUserFullName(ds.Tables[0].Rows[0]["username"].ToString()) + ")</td>";
                                        strDetails  += "<tr><td><b>Domain:</b></td><td>" + oDomain.Get(Int32.Parse(ds.Tables[0].Rows[0]["domain"].ToString()), "name") + "</td>";
                                        break;

                                    case "RENAME":
                                        lblType.Text     = "Account Rename";
                                        strDetails      += "<tr><td><b>Account:</b></td><td>" + ds.Tables[0].Rows[0]["username"].ToString() + " (" + oAD.GetUserFullName(ds.Tables[0].Rows[0]["username"].ToString()) + ")</td>";
                                        strDetails      += "<tr><td><b>Domain:</b></td><td>" + oDomain.Get(Int32.Parse(ds.Tables[0].Rows[0]["domain"].ToString()), "name") + "</td>";
                                        panID.Visible    = true;
                                        txtID.Text       = dsParameters.Tables[0].Rows[0]["value"].ToString();
                                        panFirst.Visible = true;
                                        txtFirst.Text    = dsParameters.Tables[0].Rows[1]["value"].ToString();
                                        panLast.Visible  = true;
                                        txtLast.Text     = dsParameters.Tables[0].Rows[2]["value"].ToString();
                                        break;

                                    default:
                                        lblType.Text = "Unavailable";
                                        strDetails  += "<tr><td colspan=\"2\"><b>Invalid Maintenance Code!</b></td>";
                                        break;
                                    }
                                    panWorkload.Visible = true;
                                }
                                else
                                {
                                    panDenied.Visible = true;
                                }
                            }
                            else
                            {
                                panDenied.Visible = true;
                            }
                        }
                        else
                        {
                            panDenied.Visible = true;
                        }

                        btnDenied.Attributes.Add("onclick", "return CloseWindow();");
                        oFunction.ConfigureToolButton(btnApprove, "/images/tool_approve");
                        oFunction.ConfigureToolButton(btnDeny, "/images/tool_deny");
                        if (boolIncomplete == true)
                        {
                            btnApprove.Attributes.Add("onclick", "return " + strAttributes + "confirm('Are you sure you want to APPROVE this request?');");
                            btnDeny.Attributes.Add("onclick", "return ValidateText('" + txtComments.ClientID + "','Please enter a reason') && confirm('Are you sure you want to DENY this request?');");
                        }
                        else
                        {
                            btnApprove.Attributes.Add("onclick", "alert('This request has already been completed.\\n\\nIf this request continues to appear in your work queue, please contact a ClearView administrator.');return false;");
                            btnDeny.Attributes.Add("onclick", "alert('This request has already been completed.\\n\\nIf this request continues to appear in your work queue, please contact a ClearView administrator.');return false;");
                        }
                        oFunction.ConfigureToolButton(btnPrint, "/images/tool_print");
                        btnPrint.Attributes.Add("onclick", "return PrintWindow();");
                        oFunction.ConfigureToolButton(btnClose, "/images/tool_close");
                        btnClose.Attributes.Add("onclick", "return ExitWindow();");
                        // 6/1/2009 - Load ReadOnly View
                        if (oResourceRequest.CanUpdate(intProfile, intResourceWorkflow, false) == false)
                        {
                            oFunction.ConfigureToolButtonRO(btnApprove, btnDeny);
                            //panDenied.Visible = true;
                        }
                    }
                }
                else
                {
                    panDenied.Visible = true;
                }
            }
            else
            {
                panDenied.Visible = true;
            }
        }
Exemplo n.º 34
0
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile   = Int32.Parse(Request.Cookies["profileid"].Value);
            oPage        = new Pages(intProfile, dsn);
            oRequestItem = new RequestItems(intProfile, dsn);
            oRequest     = new Requests(intProfile, dsn);
            oServer      = new Servers(intProfile, dsn);
            oClass       = new Classes(intProfile, dsn);
            oApplication = new Applications(intProfile, dsn);
            oForecast    = new Forecast(intProfile, dsn);
            oFunction    = new Functions(intProfile, dsn, intEnvironment);
            oUser        = new Users(intProfile, dsn);
            oDNS         = new DNS(intProfile, dsn);
            Variables oVariableUser = new Variables(intEnvironment);

            if (intEnvironment < 3)
            {
                intEnvironment = 3;
            }
            oVariable       = new Variables(intEnvironment);
            oSetting        = new Settings(0, dsn);
            boolDNS_QIP     = oSetting.IsDNS_QIP();
            boolDNS_Bluecat = oSetting.IsDNS_Bluecat();
            trQIP.Visible   = boolDNS_QIP;

            if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
            {
                intApplication = Int32.Parse(Request.QueryString["applicationid"]);
            }
            if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "")
            {
                intPage = Int32.Parse(Request.QueryString["pageid"]);
            }
            if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
            {
                intApplication = Int32.Parse(Request.Cookies["application"].Value);
            }
            if (Request.QueryString["rid"] != "" && Request.QueryString["rid"] != null)
            {
                int intRequest = Int32.Parse(Request.QueryString["rid"]);
                LoadValues();
                int    intItem        = Int32.Parse(lblItem.Text);
                int    intNumber      = Int32.Parse(lblNumber.Text);
                int    intApp         = oRequestItem.GetItemApplication(intItem);
                string strDeliverable = oApplication.Get(intApp, "deliverables_doc");
                if (strDeliverable != "")
                {
                    panDeliverable.Visible = true;
                    btnDeliverable.Attributes.Add("onclick", "return OpenWindow('NEW_WINDOW','" + strDeliverable + "');");
                }
                DataSet ds = oDNS.GetDNS(intRequest, intItem, intNumber);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (!IsPostBack)
                    {
                        LoadServer(ds.Tables[0].Rows[0]);
                    }
                }
                else
                {
                    panSearch.Visible  = true;
                    btnReset.Enabled   = false;
                    btnConfirm.Visible = false;
                    btnNext.Visible    = false;
                }
                btnContinue.Attributes.Add("onclick", "return EnsureDNS('" + txtSearchName.ClientID + "','" + txtSearchIP.ClientID + "','" + txtSearchAlias.ClientID + "')" +
                                           " && ProcessButton(this)" +
                                           ";");
                btnReset.Attributes.Add("onclick", "return ProcessButton(this)" +
                                        ";");
            }
            txtSearchName.Attributes.Add("onkeydown", "if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {document.getElementById('" + btnContinue.ClientID + "').click();return false;}} else {return true}; ");
            txtSearchIP.Attributes.Add("onkeydown", "if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {document.getElementById('" + btnContinue.ClientID + "').click();return false;}} else {return true}; ");
            txtSearchAlias.Attributes.Add("onkeydown", "if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {document.getElementById('" + btnContinue.ClientID + "').click();return false;}} else {return true}; ");
            txtAlias.Attributes.Add("onkeydown", "if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {document.getElementById('" + btnAdd.ClientID + "').click();return false;}} else {return true}; ");
            btnCancel1.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this service request?');");
        }
Exemplo n.º 35
0
 private long CheckAppId(string appname)
 {
     var reg = ApplicationsIds.FirstOrDefault(x => x.AppName == appname);
     if (reg != null)
     {
         return reg.Id;
     }
     else
     {
         // create new appid
         var apps = new Applications();
         long newId = (long)apps.Insert(new { AppName=appname});
         ApplicationsIds.Add(new { Id = newId, AppName = appname });
         return newId;
     }
 }
Exemplo n.º 36
0
 public DataAccess()
 {
     var tb=new Applications();
     ApplicationsIds = tb.All().ToList();
 }
Exemplo n.º 37
0
 public bool TestApplicationConnectivity(Applications application, string apiKey, string ipAddress, string password, string userName)
 {
     _logger.Trace(string.Format("Testing application {0}", application));
     switch (application)
     {
         case Applications.SabNZBD:
             return SabNzbConnection(ipAddress, apiKey);
         case Applications.Sickbeard:
             throw new NotImplementedException();
         case Applications.CouchPotato:
             return CouchPotatoConnection(ipAddress, apiKey);
         case Applications.Kodi:
             throw new NotImplementedException();
         case Applications.Sonarr:
             return SonarrConnection(ipAddress, apiKey);
         case Applications.Plex:
             return PlexConnection(ipAddress);
         case Applications.NzbGet:
             return NzbGetConnection(ipAddress, userName, password);
         case Applications.Headphones:
             throw new NotImplementedException();
         default:
             throw new ArgumentOutOfRangeException("application");
     }
 }
Exemplo n.º 38
0
		/// <summary>
		/// Requests authorization from Google to access data from a set of Google applications.
		/// </summary>
		/// <param name="requestedAccessScope">The requested access scope.</param>
		/// <param name="cancellationToken">The cancellation token.</param>
		/// <returns>
		/// A task that completes with the asynchronous operation.
		/// </returns>
		public Task<Uri> RequestUserAuthorizationAsync(Applications requestedAccessScope, CancellationToken cancellationToken = default(CancellationToken)) {
			var extraParameters = new Dictionary<string, string> {
				{ "scope", GetScopeUri(requestedAccessScope) },
			};
			Uri callback = Util.GetCallbackUrlFromContext();
			return this.RequestUserAuthorizationAsync(callback, extraParameters, cancellationToken);
		}
        /// <summary>
        /// Requests authorization from Google to access data from a set of Google applications.
        /// </summary>
        /// <param name="consumer">The Google consumer previously constructed using <see cref="CreateWebConsumer"/> or <see cref="CreateDesktopConsumer"/>.</param>
        /// <param name="requestedAccessScope">The requested access scope.</param>
        public static void RequestAuthorization(WebConsumer consumer, Applications requestedAccessScope)
        {
            if (consumer == null) {
                throw new ArgumentNullException("consumer");
            }

            var extraParameters = new Dictionary<string, string> {
                { "scope", GetScopeUri(requestedAccessScope) },
            };
            Uri callback = Util.GetCallbackUrlFromContext();
            var request = consumer.PrepareRequestUserAuthorization(callback, extraParameters, null);
            consumer.Channel.Send(request);
        }
Exemplo n.º 40
0
 /// <summary>
 /// 构造函数 Blazor 页面调用
 /// </summary>
 public ProfilesModel(string?userName) : base(userName)
 {
     // 设置 当前用户默认应用名称
     AppName = Applications.FirstOrDefault(app => app.Key == AppId).Value;
 }
        /// <summary>
        /// Requests authorization from Google to access data from a set of Google applications.
        /// </summary>
        /// <param name="consumer">The Google consumer previously constructed using <see cref="CreateWebConsumer"/> or <see cref="CreateDesktopConsumer"/>.</param>
        /// <param name="requestedAccessScope">The requested access scope.</param>
        /// <param name="requestToken">The unauthorized request token assigned by Google.</param>
        /// <returns>The request token</returns>
        public static Uri RequestAuthorization(DesktopConsumer consumer, Applications requestedAccessScope, out string requestToken)
        {
            if (consumer == null) {
                throw new ArgumentNullException("consumer");
            }

            var extraParameters = new Dictionary<string, string> {
                { "scope", GetScopeUri(requestedAccessScope) },
            };

            return consumer.RequestUserAuthorization(extraParameters, null, out requestToken);
        }
        /// <summary>
        /// Saving the applications table 
        /// </summary>
        /// <param action="Data"></param>
        /// <returns></returns>
        public int Save(Applications Data)
        {
            int result = 0;
            try
            {
                TopContractsV01Entities context = new TopContractsV01Entities(Utilities.getTestEnvName());
                TopContractsEntities.Application efApplication = null;

                //to avoid duplicacy of application action
                if (Data.Entries.Where(ent => ent.Deleted == false).Select(ent => ent.ApplicationName).Distinct().Count() < Data.Entries.Where(ent => ent.Deleted == false).Select(ent => ent.ApplicationName).Count())
                    throw new ExceptionDataAdminSaveDuplicateApplicationName();

                foreach (TopContractsDAL10.Application Application in Data.Entries)
                {
                    if (Application.New)
                        efApplication = new TopContractsEntities.Application();
                    else
                        efApplication = context.Applications.Where(c => c.ApplicationID == Application.ApplicationID).SingleOrDefault();

                    if (Application.Deleted == false)
                    {
                        efApplication.InitCommonFields(efApplication, Application, this.organizationIdentifier);
                        efApplication.ApplicationID = Application.ApplicationID;
                        efApplication.ApplicationName = Application.ApplicationName;
                        efApplication.URLContract = Application.URLContract;
                        efApplication.URLContractActivity = Application.URLContractActivity;
                        efApplication.URLContractDoc = Application.URLContractDoc;
                        efApplication.URLContractField = Application.URLContractField;
                        efApplication.URLContractTodo = Application.URLContractTodo;
                        efApplication.URLContractUser = Application.URLContractUser;
                        efApplication.OrganizationIdentifier = this.organizationIdentifier;
                    }
                    if (Application.New)
                        context.Applications.Add(efApplication);
                    else
                    {
                        if (Application.Deleted && efApplication != null)
                        {
                            context.Applications.Remove(efApplication);
                        }
                    }
                }
                result = context.SaveChanges();
            }
            catch (Exception ex)
            {
                if (ex.InnerException.ToString().Contains("FK_ContractApplications_Applications"))
                    throw new ExceptionDataAdminSaveDeleteApplicationWithContract();
            }
            return result;
        }