示例#1
0
        public async Task <ActionResult <PointsType> > PostPointsType(PointsType pointsType)
        {
            _context.PointsType.Add(pointsType);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetPointsType", new { id = pointsType.PtId }, pointsType));
        }
示例#2
0
        public static void OnLoad()
        {
            Persistence.Deserialize(
                FilePath,
                reader =>
            {
                int version = reader.ReadInt();

                if (version < 2)
                {
                    reader.ReadBool();
                }

                PointsType loaded = PointsType.None;

                int count = reader.ReadInt();
                for (int i = 0; i < count; i++)
                {
                    try
                    {
                        PointsType type = (PointsType)reader.ReadInt();
                        loaded          = type;
                        PointsSystem s  = GetSystemInstance(type);

                        s.Deserialize(reader);
                    }
                    catch
                    {
                        throw new Exception(string.Format("Points System Failed Load: {0} Last Loaded...", loaded.ToString()));
                    }
                }
            });
        }
示例#3
0
        public async Task <IActionResult> PutPointsType(Guid id, PointsType pointsType)
        {
            if (id != pointsType.PtId)
            {
                return(BadRequest());
            }

            _context.Entry(pointsType).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PointsTypeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
 public Vertex(int number, double x, double y, double z, PointsType pointType)
 {
     Number    = number;
     X         = x;
     Y         = y;
     Z         = z;
     PointType = pointType;
 }
示例#5
0
 public PointsTransaction(XmlRpcStruct pointsTransaction)
 {
     userId = Convert.ToInt32(pointsTransaction["USER"]);
     timestamp = Convert.ToDateTime(pointsTransaction["TIMESTAMP"]);
     type = (PointsType)Enum.Parse(typeof(PointsType), (string)pointsTransaction["TYPE"]);
     delta = Convert.ToInt32(pointsTransaction["DELTA"]);
     comments = (string)pointsTransaction["COMMENTS"];
 }
        public async Task <ActionResult <PointsTypeAll> > GetPointsTypeAllDetail(Guid id)
        {
            PointsType pt = await _context.PointsType.FindAsync(id);

            PointsTypeAll ptAll = new PointsTypeAll();

            ptAll.PtId       = pt.PtId;
            ptAll.PointsType = pt;
            ptAll.PtAttr     = await _context.PointsTypeAttr.Where(p => p.PtId == pt.PtId).ToListAsync();

            return(ptAll);
        }
示例#7
0
        public static PointsSystem GetSystemInstance(PointsType t)
        {
            for (var index = 0; index < Systems.Count; index++)
            {
                var s = Systems[index];

                if (s.Loyalty == t)
                {
                    return(s);
                }
            }

            return(null);
        }
        public async Task <ActionResult <PointsTypeAll> > DeletePointsTypeAll(Guid id)
        {
            PointsType pt = await _context.PointsType.FindAsync(id);

            PointsTypeAll ptAll = new PointsTypeAll();

            ptAll.PtId       = pt.PtId;
            ptAll.PointsType = pt;
            ptAll.PtAttr     = await _context.PointsTypeAttr.Where(p => p.PtId == pt.PtId).ToListAsync();

            if (ptAll.PtId == null)
            {
                return(NotFound());
            }
            return(ptAll);
        }
示例#9
0
        public static void OnLoad()
        {
            Persistence.Deserialize(
                FilePath,
                reader =>
            {
                int version = reader.ReadInt();

                if (version < 2)
                {
                    reader.ReadBool();
                }

                List <PointsType> loaded = new List <PointsType>();

                int count = reader.ReadInt();
                for (int i = 0; i < count; i++)
                {
                    try
                    {
                        PointsType type = (PointsType)reader.ReadInt();
                        PointsSystem s  = GetSystemInstance(type);

                        s.Deserialize(reader);

                        if (!loaded.Contains(type))
                        {
                            loaded.Add(type);
                        }
                    }
                    catch (Exception e)
                    {
                        foreach (var success in loaded)
                        {
                            Console.WriteLine("[Points System] Successfully Loaded: {0}", success.ToString());
                        }

                        loaded.Clear();

                        throw new Exception(String.Format("[Points System]: {0}", e));
                    }
                }

                loaded.Clear();
            });
        }
示例#10
0
        public static void OnLoad()
        {
            Persistence.Deserialize(
                FilePath,
                reader =>
            {
                int version = reader.ReadInt();

                int count = reader.ReadInt();
                for (int i = 0; i < count; i++)
                {
                    PointsType type = (PointsType)reader.ReadInt();
                    PointsSystem s  = GetSystemInstance(type);
                    s.Deserialize(reader);
                }
            });
        }
示例#11
0
 public static PointsSystem GetSystemInstance(PointsType t)
 {
     return(Systems.FirstOrDefault(s => s.Loyalty == t));
 }
示例#12
0
 /// <summary>
 /// Add new points to the view model
 /// </summary>
 /// <param name="newPoints">points to add</param>
 public void AddPoints(PointsType newPoints)
 {
     MobTrophyPoints.Add(newPoints);
 }
 private static IEnumerable <IFacet> GetsUpOrDownFaces(IEnumerable <IFacet> faces, PointsType point)
 {
     return((from allFace in faces
             from fItem in allFace.ArristCollection
             where fItem.FirstVertex.PointType == point
             select allFace).ToList());
 }
示例#14
0
文件: All.cs 项目: BorisFR/Cauldron
        // *********************************************************************

        public static void AddPoints(PointsType points)
        {
            Score    += (int)points;
            ScoreText = String.Format("{0:0000000}", Score);
        }
示例#15
0
 /// <summary>
 /// Add new points to the view model
 /// </summary>
 /// <param name="newPoints">points to add</param>
 public void AddPoints(PointsType newPoints)
 {
     ClubPoints.Add(newPoints);
 }