Ejemplo n.º 1
0
        public GetCardInfoResult GetCardInfo()
        {
            var res = new GetCardInfoResult();

            try
            {
                var privateData = new PrivateData();
                privateData.Init();
                res.Result = ReadPrivateData(ref privateData);
                if (res.Result == 0)
                {
                    res.FirstName  = privateData.FirstName;
                    res.LastName   = privateData.LastName;
                    res.MiddleName = privateData.MiddleName;
                    if (privateData.BirthDate != null)
                    {
                        res.Birthday = DateTime.ParseExact(privateData.BirthDate, "yyyyMMdd", CultureInfo.InvariantCulture).ToString("dd.MM.yyyy");
                    }

                    res.Birthplace = privateData.BirthPlace;
                    res.Gender     = (privateData.Gender == "М" ? 273 : 274).GetHashCode().ToString(CultureInfo.InvariantCulture);
                    var ss0 = privateData.SNILS.Substring(0, 3);
                    var ss1 = privateData.SNILS.Substring(3, 3);
                    var ss2 = privateData.SNILS.Substring(6, 3);
                    var ss3 = privateData.SNILS.Substring(9, 2);
                    res.Snils = string.Format("{0}-{1}-{2} {3}", ss0, ss1, ss2, ss3);

                    // todo сменить фейк после показа
                    ////res.PolisNumber = privateData.PolicyNumberOMS;
                    res.PolisNumber = "7855310843003223";

                    res.DocumentType           = privateData.DocumentType;
                    res.DocumentSeries         = privateData.DocumentSeries;
                    res.DocumentNumber         = privateData.DocumentNumber;
                    res.DocumentIssueAuthority = privateData.DocumentIssueAuthority;

                    if (privateData.DocumentIssueDate != null)
                    {
                        res.DocumentIssueDate = DateTime.ParseExact(privateData.DocumentIssueDate, "yyyyMMdd", CultureInfo.InvariantCulture).ToString("dd.MM.yyyy");
                    }
                    else
                    {
                        res.DocumentIssueDate = string.Empty;
                    }
                }

                res.ErrorString = GetErrorString(res.Result);
            }
            catch (Exception ex)
            {
                res.ErrorString = ex.Message;
            }

            return(res);
        }
Ejemplo n.º 2
0
 public static extern uint ReadPrivateData([In][Out] ref PrivateData privateData);