Exemple #1
0
        // GET: Application/Create
        /// Reference: Varsity Project by Christine Bittle - Player Data Controllers
        //[Authorize(Roles = "Applicant, Admin, Patient")]
        public ActionResult Create()
        {
            //Using an Update Application View Model
            UpdateApplication ModelView = new UpdateApplication();

            //Get Jobs from the Job Data controllers in order to create a dropdown menu
            //Jobs options to link the application
            string url = "JobData/GetJobs";
            HttpResponseMessage response = client.GetAsync(url).Result;

            IEnumerable <JobDto> SelectedJobs = response.Content.ReadAsAsync <IEnumerable <JobDto> >().Result;

            ModelView.Jobs = SelectedJobs;

            //Get all the Users from the UserData controllers to create a dropdown menu
            //Users to link the application
            url      = "UserData/GetUsers";
            response = client.GetAsync(url).Result;

            IEnumerable <ApplicationUserDto> SelectedUsers = response.Content.ReadAsAsync <IEnumerable <ApplicationUserDto> >().Result;

            ModelView.ApplicationUsers = SelectedUsers;

            return(View(ModelView));
        }
Exemple #2
0
        public static int Run(string[] args)
        {
            SetupLoggers();

            Log.InfoFormat("Starting setup...");
            Log.InfoFormat("Commandline arguments: {0}", string.Join(" ", args));

            try
            {
                var arguments = Arguments.Parse(args);
                switch (arguments.Mode)
                {
                case Mode.Install:
                    return(InstallApplication.Run(arguments));

                case Mode.SilentInstall:
                    return(SilentInstallApplication.Run(arguments));

                case Mode.Update:
                    return(UpdateApplication.Run(arguments));

                case Mode.Uninstall:
                    return(UninstallApplication.Run(arguments));

                default:
                    throw new Exception($"Unknown mode: {arguments.Mode}");
                }
            }
            catch (Exception e)
            {
                Log.ErrorFormat("Error: {0}", e.Message);
                return(-1);
            }
        }
Exemple #3
0
        public ActionResult Edit(int id)
        {
            UpdateApplication ModelView = new UpdateApplication();

            //Get the selected application from the database
            string url = "ApplicationData/FindApplication/" + id;
            HttpResponseMessage response = client.GetAsync(url).Result;

            if (response.IsSuccessStatusCode)
            {
                ApplicationDto SelectedApplication = response.Content.ReadAsAsync <ApplicationDto>().Result;
                ModelView.Application = SelectedApplication;

                url      = "UserData/GetUsers";
                response = client.GetAsync(url).Result;
                IEnumerable <ApplicationUserDto> SelectedUsers = response.Content.ReadAsAsync <IEnumerable <ApplicationUserDto> >().Result;
                ModelView.ApplicationUsers = SelectedUsers;

                url      = "JobData/GetJobs";
                response = client.GetAsync(url).Result;
                IEnumerable <JobDto> SelectedJobs = response.Content.ReadAsAsync <IEnumerable <JobDto> >().Result;
                ModelView.Jobs = SelectedJobs;

                return(View(ModelView));
            }
            else
            {
                return(RedirectToAction("Error"));
            }
        }
Exemple #4
0
        public async Task <ActionResult> Edit(EditViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var cmd = new UpdateApplication(model.ApplicationId, model.Name);
            await _cmdBus.ExecuteAsync(cmd);

            var dict = new RouteValueDictionary {
                { "usernote", "Application was updated" }
            };

            return(RedirectToAction("Index", dict));
        }
Exemple #5
0
        // At start-up
        private void FrmMain_Load(object sender, EventArgs e)
        {
            //==============================AtStartUp===================================================
            lblDescription2.Visible = false;                                                   //Hidden label
            _sck = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); //Socket creation
            _sck.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
            lblIPPersonnel.Text        = GetLocalIp();                                         //Show personnal Ip
            tbxMessageEnvoit.MaxLength = 72;                                                   //Limit max lenght
            pbxLogoPetit.Visible       = false;                                                //Don't show logo
            NomDestinataireToolStripMenuItem.Visible = false;
            NomDestinataireToolStripMenuItem.Text    = lblIPPersonnel.Text;
            iPPersonnelToolStripMenuItem.Visible     = false;
            MaximizeBox = false;             //Don't show maximize button on form
            //GESTIONFOCUS====================================================================================
            timContrôleFocus.Enabled = true; //Start timer focus
            lblNomPCDest.Visible     = false;
            lblEtatPing.Visible      = false;

            //==============SearchUpdate================================================================
            UpdateApplication.VersionVerification(AppInfo.GetChainFormattedVersion());//ApplicationVersionWeb
            //================================================================================================
            //UpdateAppYear===================================================================================
            lblDescription.Text  = $"Kubeah! {DateTime.Now.Year.ToString()}";
            lblDescription2.Text = $"Kubeah! {DateTime.Now.Year.ToString()}";
            //Create and read config==========================================================================
            var recipientIp = XmlManipulation.GetValue("LastIpConnexion");

            if (recipientIp != "")
            {
                IpSeparationString(recipientIp, true);
            }
            else
            {
                IpSeparationString(lblIPPersonnel.Text, false);
            }
            var focusState = XmlManipulation.GetValue("FocusActivate");

            if (focusState != "ON")
            {
                timContrôleFocus.Enabled = false;
            }
            if (XmlManipulation.GetValue("EnableLastIpConnexion") != "ON")
            {
                XmlManipulation.ModifyElementXml("LastIpConnexion", "");
            }
            //================================================================================================
        }
        public ActionResult Update(int id)
        {
            UpdateApplication viewmodel = new UpdateApplication();

            //get the application
            //Include(application=>application.postings) => join on the application, applicationsxpostings, postings bridging table
            viewmodel.Application =
                db.Applications
                .Include(volunteerapplication => volunteerapplication.VolunteerPosting)
                .FirstOrDefault(volunteerapplication => volunteerapplication.ApplicationID == id);

            //get all the volunteers
            viewmodel.Volunteers = db.Volunteers.ToList();

            //get all the volunteer postings
            viewmodel.VolunteerPostings = db.VolunteerPostings.ToList();

            return(View(viewmodel));
        }
Exemple #7
0
        public static int Run(string[] args)
        {
            SetupLoggers();

            Log.InfoFormat("Starting setup...");
            Log.InfoFormat("Commandline arguments: {0}", string.Join(" ", args));

            var arguments = Arguments.Parse(args);

            switch (arguments.Mode)
            {
            case Mode.Install:
                return(InstallApplication.Run(arguments));

            case Mode.SilentInstall:
                return(SilentInstallApplication.Run(arguments));

            case Mode.Update:
                return(UpdateApplication.Run(arguments));

            default:
                return(-1);
            }
        }
        public ActionResult Update(UpdateApplication command)
        {
            CommandDispatcher.Dispatch(command);

            return(NoContent());
        }
Exemple #9
0
        public Startup(IHostingEnvironment env)
        {
            // Before we load the custom library (at: "ADefHelpDeskApp\ADefHelpDeskApp.dll")
            // (and potentially lock it)
            // Determine if we have files in the Upgrade directory and process them first
            // Copy all files from ProcessDirectory to the final location
            UpdateApplication objUpdateApplication = new UpdateApplication(env);

            objUpdateApplication.ProcessDirectory("");
            // Delete files in Process Directory so they wont be processed again
            objUpdateApplication.DeleteProcessDirectory();

            var builder = new ConfigurationBuilder()
                          .SetBasePath(env.ContentRootPath)
                          .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
                          .AddJsonFile($"appsettings{env.EnvironmentName}.json", optional: true)
                          .AddEnvironmentVariables();

            Configuration = builder.Build();

            // **** JWT Token Configuration
            string SecurityKey = "tempKey*****************##############";

            try
            {
                SecurityKey =
                    TokenValidate.GetSecretKey(Configuration.GetSection("ConnectionStrings:DefaultConnection").Value);
            }
            catch
            {
                // Do nothing
                // The database is just not set up yet
            }

            _signingKey =
                new SymmetricSecurityKey(
                    Encoding.ASCII.GetBytes(SecurityKey));

            _tokenValidationParameters = new TokenValidationParameters
            {
                // The signing key must match!
                ValidateIssuerSigningKey = true,
                IssuerSigningKey         = _signingKey,
                // Validate the JWT Issuer (iss) claim
                ValidateIssuer = true,
                ValidIssuer    = Configuration.GetSection("TokenAuthentication:Issuer").Value,
                // Validate the JWT Audience (aud) claim
                ValidateAudience = true,
                ValidAudience    = Configuration.GetSection("TokenAuthentication:Audience").Value,
                // Validate the token expiry
                ValidateLifetime = true,
                // If you want to allow a certain amount of clock drift, set that here:
                ClockSkew = TimeSpan.Zero
            };

            _tokenProviderOptions = new TokenProviderOptions
            {
                Path               = Configuration.GetSection("TokenAuthentication:TokenPath").Value,
                Audience           = Configuration.GetSection("TokenAuthentication:Audience").Value,
                Issuer             = Configuration.GetSection("TokenAuthentication:Issuer").Value,
                SigningCredentials = new SigningCredentials(_signingKey, SecurityAlgorithms.HmacSha256),
                IdentityResolver   = GetIdentity
            };
        }
Exemple #10
0
 private async void TSB_UpdateApplication_Click(object sender, EventArgs e)
 {
     await UpdateApplication?.Invoke();
 }
Exemple #11
0
        private void UpdateAdministration_Load(object sender, EventArgs e)
        {
            if (!System.IO.File.Exists("releasekey.xml"))
            {
                if (MessageBox.Show("Signature key does not exist, create it?", Application.ProductName, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) != DialogResult.Yes)
                {
                    Application.Exit();
                    return;
                }

                System.Security.Cryptography.RSACryptoServiceProvider rsa = new System.Security.Cryptography.RSACryptoServiceProvider();
                using (System.IO.StreamWriter sw = new System.IO.StreamWriter("releasekey.xml", false))
                    sw.Write(rsa.ToXmlString(true));
            }

            using (System.IO.StreamReader rd = new System.IO.StreamReader("releasekey.xml"))
                m_privateKey = rd.ReadToEnd();

            List <Update> updates = new List <Update>();

            System.Xml.Serialization.XmlSerializer sr = new System.Xml.Serialization.XmlSerializer(typeof(UpdateList));

            UpdateList lst = null;

            if (System.IO.File.Exists(UpdateFile))
            {
                using (System.IO.FileStream fs = new System.IO.FileStream(UpdateFile, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.Read))
                    lst = (UpdateList)sr.Deserialize(fs);
            }

            SortedList <string, string> applicationNames = new SortedList <string, string>();
            SortedList <string, string> architectures    = new SortedList <string, string>();

            if (lst != null && lst.Updates != null)
            {
                foreach (Update u in lst.Updates)
                {
                    listBox1.Items.Add(u);
                    if (!string.IsNullOrEmpty(u.ApplicationName))
                    {
                        applicationNames[u.ApplicationName.ToLower().Trim()] = u.ApplicationName;
                    }
                    if (!string.IsNullOrEmpty(u.Architecture))
                    {
                        architectures[u.Architecture.ToLower().Trim()] = u.Architecture;
                    }
                }
            }

            foreach (string s in architectures.Values)
            {
                if (UpdateArchitecture.FindString(s) < 0)
                {
                    UpdateArchitecture.Items.Add(s);
                }
            }

            foreach (string s in applicationNames.Values)
            {
                if (UpdateApplication.FindString(s) < 0)
                {
                    UpdateApplication.Items.Add(s);
                }
            }
        }