Card.cs
1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Script.Serialization;
namespace MoyaAdminLib
{
public class Card
{
public static string CARD_STATE_PRINTED = "PRINTED";
public static string CARD_BARCODE_PREFIX = "277";
//{"cardId":3990,"state":"PENDING_VALIDATION","cardTemplate":"pelaaja","username":"Miketzu","wholeName":"Mirco Renko"}
public int cardId;
public string state;
public string cardTemplate;
public string username;
public string wholeName;
public String Label()
{
return cardId + ", " + username + ", " + wholeName;
}
public static bool ParseCardId(string data, out int id)
{
id = 0;
if (data.Length == 13 && data.Substring(0, 3) == CARD_BARCODE_PREFIX)
{
int.TryParse(data.Substring(3, 9), out id);
if (id > 0)
return true;
}
return false;
}
}
}