Exemplo n.º 1
0
        public ActionResult Launch()
        {
            IPublishInvoiceService _PubIn = IoC.Resolve <IPublishInvoiceService>();
            Company     currentCom        = ((EInvoiceContext)FXContext.Current).CurrentCompany;
            LaunchModel model             = new LaunchModel();

            try
            {
                //lstpattern
                List <string> lstpattern = _PubIn.LstByPattern(currentCom.id, 1);
                if (lstpattern.Count == 0)
                {
                    Messages.AddErrorFlashMessage("Cần tạo thông báo phát hành.");
                    return(RedirectToAction("Index", "Publish"));
                }
                model.Listpattern = new SelectList(lstpattern);
                //lstserial
                List <string> oserial = (from s in _PubIn.Query where ((s.ComId == currentCom.id) && (s.Status == 1 || s.Status == 2)) select s.InvSerial).ToList <string>();
                model.Listserial = new SelectList(oserial);
            }
            catch (Exception ex)
            {
                Messages.AddErrorFlashMessage("Có lỗi xảy ra, vui lòng thực hiện lại.");
                log.Error(" Launch -" + ex.Message);
                return(RedirectToAction("Index", "Home"));
            }
            return(View(model));
        }
Exemplo n.º 2
0
        public async Task <ActionResult> Launch(LaunchModel model)
        {
            if (ModelState.IsValid == false)
            {
                return(View(model));
            }

            if (await _warheadsService.IsOffline())
            {
                model.LaunchResult     = WarheadLaunchResultFactory.Fail(ServiceIsOffline);
                model.ServiceIsOffline = true;
                return(View(model));
            }

            try
            {
                model.LaunchResult = await _warheadsService.Launch(model.Passphrase);
            }
            catch (WrongPassphraseException)
            {
                ModelState.AddModelError(nameof(model.Passphrase), WrongPassphrase);
                return(View(model));
            }
            catch (AlreadyLaunchedException)
            {
                model.LaunchResult = WarheadLaunchResultFactory.Fail(AlreadyLaunchedErrorMessage);
                return(View(model));
            }

            return(View(model));
        }
Exemplo n.º 3
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            // Launcher: Falcon 9
            // Apaceport: Cape Canaveral
            // Orbit: LEO
            var model = new LaunchModel
            {
                Launcher = new Launcher
                {
                    Payload = 24040,
                    Stages  = new List <LauncherStage>
                    {
                        new LauncherStage {
                            Number = 1, FullMass = 425353, EmptyMass = 26530, IspAtm = 286, IspVac = 312, ThrustVac = 838.9, Sx = 12, Sy = 256, Cx = 0.3, Cy = 0.3
                        },
                        new LauncherStage {
                            Number = 2, FullMass = 111560, EmptyMass = 5135, IspAtm = 250, IspVac = 348, ThrustVac = 95.24, Sx = 12, Sy = 100, Cx = 0.3, Cy = 0.3
                        }
                    },
                    FairingMass      = 1750,
                    FairingJettision = 239
                },
                Spaceport = new Spaceport {
                    Latitude = 28.5, Altitude = 3, Velocity = 0, Angle = 0
                },
                Orbit = new OrbitInput {
                    Perigee = 200, Apogee = 200, Inclination = 28.5
                },
                PitchProgram = new PitchProgram {
                    T0 = 0.0, Tmax = 540.0, Theta0 = 50.7359012901344, ThetaMax = -3.75814564514969
                },
                Restrictions = new Restrictions {
                    LaunchPosition = 90.0, ClearingTower = 10.0, MaxTurn = 2.0, QAlpha = 12000.0
                },
                DeltaT = 1.0
            };

            log.Clear();
            model.LogMessage += new Action <string>(model_LogMessage);
            model.Start();

            rtbLog.Text = log.ToString();
        }
        /// <summary>
        /// Used to launch a lab in LOD. The API is used here to call Launch, which returns a URL that will connect the
        /// user to the lab instance. It is possible to automatically open the window for the user, but be weary of popup blockers
        /// because any window open call on the browser without the direct action of a user (clicking a link) will be blocked by popup
        /// blockers
        /// </summary>
        /// <param name="model">Launches a lab in LOD</param>
        /// <returns>Returns a model contianing the link to the lab instance</returns>
        public IActionResult Launch(LaunchModel model)
        {
            if (!ModelState.IsValid)
            {
                var modelToRebind = model;
                ModelState.Clear();
                return(View("Launch", modelToRebind));
            }

            var apiUrl   = _Settings.APIURL;
            var apiKey   = _Settings.APIKey;
            var client   = new LabOnDemandApiClient(apiUrl, apiKey);
            var response = client.Launch(LAB_PROFILE_TO_LAUNCH, $"{model.FirstName}{model.LastName}", model.FirstName, model.LastName, model.Email);

            model.LabLaunchURL = response.Url;
            if (string.IsNullOrEmpty(model.LabLaunchURL))
            {
                return(View(nameof(StartLaunch), model));
            }
            return(View("LaunchPad", model));
        }
Exemplo n.º 5
0
        //
        // GET: /Assignment/Launch/5
        public ActionResult Launch(string returnUrl, int id = 0)
        {
            //return new RedirectResult("../LtiLaunch/2");
            var assignment = ConsumerContext.Assignments.Find(id);

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

            var model = new LaunchModel
            {
                AssignmentId    = id,
                AssignmentTitle = assignment.Name,
                CourseTitle     = assignment.Course.Name,
                IsLtiLink       = assignment.IsLtiLink,
                ReturnUrl       = returnUrl,
                Url             = assignment.Url
            };

            return(View(model));
        }