public void Create(PerfomanceDto request)
        {
            using (var context = mDbContextFactory.CreateContext())
            {
                var perfomance = new Perfomance
                {
                    Id          = Guid.NewGuid(),
                    Name        = request.Name,
                    Description = request.Description
                };

                if (request.PlayPeriods != null && request.PlayPeriods.Any())
                {
                    foreach (var playPeriodDto in request.PlayPeriods)
                    {
                        var playPeriod = new PlayPeriod
                        {
                            Id              = Guid.NewGuid(),
                            StartDate       = playPeriodDto.StartDate,
                            EndDate         = playPeriodDto.EndDate,
                            TicketsCapacity = playPeriodDto.TicketsCapacity
                        };

                        perfomance.PlayPeriods.Add(playPeriod);
                    }
                }


                context.Set <Perfomance>().Add(perfomance);
                context.SaveChanges();
            }
        }
示例#2
0
        public double Execute(ISecurity sec, int barNum)
        {
            var testBar = (int)(sec.Bars.Count * TestCoefficient);

            if (!Context.IsOptimization || barNum != sec.Bars.Count - 1)
            {
                return(0);
            }
            var perf = new Perfomance(new[] { (ISecurity2)sec }, sec.InitDeposit);

            try
            {
                var positions = new List <IPosition>();
                foreach (var position in sec.Positions)
                {
                    if (position.EntryBarNum < testBar)
                    {
                        continue;
                    }
                    perf.AddPosition(position);
                    positions.Add(position);
                }

                var value = perf.RecoveryFactor;
                Context.ScriptResult = value;
                positions.ForEach(p => ((PositionsList)sec.Positions).Remove(p));
                return(value);
            }
            finally
            {
                perf.RemoveTempData();
            }
        }
示例#3
0
        public ActionResult DeleteConfirmed(int id)
        {
            Perfomance perfomance = db.Perfomances.Find(id);

            db.Perfomances.Remove(perfomance);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#4
0
 public ActionResult Edit([Bind(Include = "Id,IdStudent,IdDiscipline,Evalution,DateOfDelivery")] Perfomance perfomance)
 {
     if (ModelState.IsValid)
     {
         db.Entry(perfomance).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.IdDiscipline = new SelectList(db.Disciplines, "Id", "Title", perfomance.IdDiscipline);
     ViewBag.IdStudent    = new SelectList(db.Students, "Id", "FirstName", perfomance.IdStudent);
     return(View(perfomance));
 }
示例#5
0
        // GET: Perfomances/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Perfomance perfomance = db.Perfomances.Find(id);

            if (perfomance == null)
            {
                return(HttpNotFound());
            }
            return(View(perfomance));
        }
示例#6
0
        // GET: Perfomances/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Perfomance perfomance = db.Perfomances.Find(id);

            if (perfomance == null)
            {
                return(HttpNotFound());
            }
            ViewBag.IdDiscipline = new SelectList(db.Disciplines, "Id", "Title", perfomance.IdDiscipline);
            ViewBag.IdStudent    = new SelectList(db.Students, "Id", "FirstName", perfomance.IdStudent);
            return(View(perfomance));
        }
示例#7
0
 public Startup(Perfomance perfomance)
 {
     Perfomance = perfomance;
 }
示例#8
0
 protected void Application_Start()
 {
     GlobalConfiguration.Configure(WebApiConfig.Register);
     Perfomance.Init();
 }