public async Task <IActionResult> List(int productId, KeyPointType keyPoint)
        {
            ViewBag.ProductId = productId;
            ViewBag.Keypoint  = keyPoint;

            var model = await _keypointRepo.KeyPointsAsync(null, productId, null, keyPoint);

            var             keyPointList = new List <KeyPointViewViewModel>();
            PersianCalendar persian      = new PersianCalendar();

            foreach (var item in model)
            {
                keyPointList.Add(new KeyPointViewViewModel
                {
                    Creator         = $"{item.Creator.FirstName} {item.Creator.LastName}",
                    CreatorDateTime = persian.PersianDate(item.CreateDate),
                    Title           = item.Title,
                    Id                   = item.Id,
                    KeyPoint             = item.Type,
                    LastModifier         = item.LastModifier?.FirstName + "" + item.LastModifier?.LastName,
                    LastModifierDateTime = item.LastModifyDate.HasValue? persian.PersianDate(item.LastModifyDate.Value) :null,
                    Product              = item.Product,
                    ProductId            = item.ProductId,
                    State                = item.State.GetAttribute <DisplayAttribute>().Description
                });
            }
            return(View(keyPointList));
        }
Example #2
0
 public override Point2D GetKeyPoint(KeyPointType type)
 {
     switch(type)
     {
         case KeyPointType.Start: return new Point2D(Point);
         default: return null;
     }
 }
		public ReplayKeyPoint(Entity[] data, KeyPointType type, int id, ActivePlayer player)
		{
			if(data != null)
				Data = Helper.DeepClone(data);
			Type = type;
			Id = id;
			Player = player;
		}
 public void ProposeKeyPoint(KeyPointType type, int id, ActivePlayer player)
 {
     if (ProposedKeyPoint != null)
     {
         ReplayMaker.Generate(ProposedKeyPoint.Type, ProposedKeyPoint.Id, ProposedKeyPoint.Player, _game);
     }
     ProposedKeyPoint = new ReplayKeyPoint(null, type, id, player);
 }
 private void ProposeKeyPoint(KeyPointType type, int id, ActivePlayer player)
 {
     if (_proposedKeyPoint != null)
     {
         ReplayMaker.Generate(_proposedKeyPoint.Type, _proposedKeyPoint.Id, _proposedKeyPoint.Player);
     }
     _proposedKeyPoint = new ReplayKeyPoint(null, type, id, player);
 }
        public IActionResult Add(int productId, KeyPointType type)
        {
            ViewBag.ProductId = productId;
            ViewBag.Type      = type;


            return(View());
        }
Example #7
0
 //public override IList<Point> Intersection(IIntersectable shape)
 //{
 //    throw new NotImplementedException();
 //}
 public override Point2D GetKeyPoint(KeyPointType type)
 {
     switch(type)
     {
         case KeyPointType.Center: return Points2D[0];
         default: return null;
     }
 }
Example #8
0
        public override Point2D GetKeyPoint(KeyPointType type)
        {
            switch (type)
            {
            case KeyPointType.Start: return(Points2D[0]);

            default: return(null);
            }
        }
Example #9
0
 public override Point2D GetKeyPoint(KeyPointType type)
 {
     switch(type)
     {
         case KeyPointType.Start: return Points2D[0];
         case KeyPointType.End: return Points2D[1];
         case KeyPointType.Middle: return new Point2D(Points2D[0].Point.Middle(Points2D[1].Point)); //todo Musi byt Invisible + doriesit Parent atd...
         default: return null;
     }
 }
Example #10
0
 public ReplayKeyPoint(Entity[] data, KeyPointType type, int id, ActivePlayer player)
 {
     if (data != null)
     {
         Data = Helper.DeepClone(data);
     }
     Type   = type;
     Id     = id;
     Player = player;
 }
 /// <summary>
 /// Plays a voiceline belonging to a type in <see cref="directionalVoicelines"/>.
 /// </summary>
 /// <param name="type">The type of keypoint that the voiceline should belong to.</param>
 public void PlayVoiceline(KeyPointType type)
 {
     foreach (AudioDirection direction in directionalVoicelines)
     {
         if (direction.Type == type)
         {
             audioSource.PlayOneShot(direction.Voiceline);
             return;
         }
     }
 }
Example #12
0
 public override Point2D GetKeyPoint(KeyPointType type)
 {
     switch(type)
     {
         case KeyPointType.Start: return new Point2D(Point);
         // Just in case you need 3 points
         case KeyPointType.Middle: return new Point2D(this.Point + (this.Vector / 2));
         case KeyPointType.End: return new Point2D(this.Point + this.Vector);
         default: return null;
     }
 }
Example #13
0
        public override Point2D GetKeyPoint(KeyPointType type)
        {
            switch (type)
            {
            case KeyPointType.Start: return(Points2D[0]);

            case KeyPointType.End: return(Points2D[1]);

            case KeyPointType.Middle: return(new Point2D(Points2D[0].Point.Middle(Points2D[1].Point)));    //todo Musi byt Invisible + doriesit Parent atd...

            default: return(null);
            }
        }
Example #14
0
        public override Point2D GetKeyPoint(KeyPointType type)
        {
            switch (type)
            {
            case KeyPointType.Start: return(new Point2D(Point));

            // Just in case you need 3 points
            case KeyPointType.Middle: return(new Point2D(this.Point + (this.Vector / 2)));

            case KeyPointType.End: return(new Point2D(this.Point + this.Vector));

            default: return(null);
            }
        }
        public async Task <IActionResult> Save(int?id, int productId, KeyPointType type, string title, State state)
        {
            if (id == null)
            {
                // add keypoint
                var keypoint = new KeyPoint
                {
                    Type       = type,
                    Title      = title,
                    CreateDate = DateTime.UtcNow,
                    Creator    = Operator,
                    ProductId  = productId,
                    State      = state
                };

                await _keypointRepo.AddAsync(keypoint);

                await _keypointRepo.SaveAsync();

                return(RedirectToAction("list", new { productId = productId, keyPoint = type }));
            }

            else
            {
                //edit keypoint
                var model = await _keypointRepo.KeyPointAsync(id.Value);

                model.LastModifier   = Operator;
                model.LastModifyDate = DateTime.UtcNow;
                model.Title          = title;
                model.State          = state;

                _keypointRepo.Update(model);
                await _keypointRepo.SaveAsync();

                return(RedirectToAction("list", new { productId = productId, keyPoint = type }));
            }
            return(RedirectToAction("List"));
        }
		public static void Generate(KeyPointType type, int id, ActivePlayer player)
		{
			Points.Add(new ReplayKeyPoint(Game.Entities.Values.ToArray(), type, id, player));
		}
 public IActionResult Delete(int id, int productId, KeyPointType type)
 {
     _keypointRepo.RemoveAsync(id);
     return(RedirectToAction("list", new { productId = productId, type = type }));
 }
 public void ProposeKeyPoint(KeyPointType type, int id, ActivePlayer player)
 {
     if (ProposedKeyPoint != null)
         ReplayMaker.Generate(ProposedKeyPoint.Type, ProposedKeyPoint.Id, ProposedKeyPoint.Player, _game);
     ProposedKeyPoint = new ReplayKeyPoint(null, type, id, player);
 }
 public static void Generate(KeyPointType type, int id, ActivePlayer player, IGame game) => Points.Add(new ReplayKeyPoint(game.Entities.Values.ToArray(), type, id, player));
Example #20
0
 public abstract Point2D GetKeyPoint(KeyPointType type);
		private void ProposeKeyPoint(KeyPointType type, int id, ActivePlayer player)
		{
			if(_proposedKeyPoint != null)
				ReplayMaker.Generate(_proposedKeyPoint.Type, _proposedKeyPoint.Id, _proposedKeyPoint.Player);
			_proposedKeyPoint = new ReplayKeyPoint(null, type, id, player);
		}
Example #22
0
 public abstract Point2D GetKeyPoint(KeyPointType type);