Example #1
0
        private bool CheckPhoneOrCardNumberIsFree(string phone, string card)
        {
            if (string.IsNullOrEmpty(phone) && string.IsNullOrEmpty(card))
            {
                return(false);
            }
            LCManager.Infrastructure.Request.GetClientInfoRequest request = new LCManager.Infrastructure.Request.GetClientInfoRequest();
            if (!string.IsNullOrEmpty(card))
            {
                try { request.Card = Convert.ToInt64(card); } catch { }
            }
            if (!string.IsNullOrEmpty(phone))
            {
                try { request.Phone = Convert.ToInt64(PhoneService.GetPhoneFromStr(phone)); } catch { }
            }
            try { request.Operator = Convert.ToInt16(JwtProps.GetOperator()); } catch { }
            HttpResponseMessage response = HttpClientService.PostAsync("api/values/ClientInfo", request).Result;

            if (response.IsSuccessStatusCode)
            {
                LCManager.Infrastructure.Response.GetClientInfoResponse data = response.Content.ReadAsAsync <LCManager.Infrastructure.Response.GetClientInfoResponse>().Result;
                if (data.ErrorCode == 0)
                {
                    return
                        (string.IsNullOrEmpty(data.Name) &&
                         string.IsNullOrEmpty(data.Surname) &&
                         string.IsNullOrEmpty(data.Patronymic) &&
                         data.Id == 0 &&
                         data.Card == 0);
                }
                return(true);
            }
            return(false);
        }