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); }
public JsonResult GetClientInfo(string card) { LCManager.Infrastructure.Request.GetClientInfoRequest clientInfoRequest = new LCManager.Infrastructure.Request.GetClientInfoRequest(); if (!string.IsNullOrEmpty(card)) { try { clientInfoRequest.Card = Convert.ToInt64(card); } catch { } } else { return(Json(new LCManager.Infrastructure.Response.GetClientInfoResponse { ErrorCode = 10, Message = "Не указана карта клиента" })); } try { clientInfoRequest.Operator = Convert.ToInt16(JwtProps.GetOperator()); } catch { } HttpResponseMessage response = HttpClientService.PostAsync("api/values/ClientInfo", clientInfoRequest).Result; if (response.IsSuccessStatusCode) { LCManager.Infrastructure.Response.GetClientInfoResponse clientInfoResponse = response.Content.ReadAsAsync <LCManager.Infrastructure.Response.GetClientInfoResponse>().Result; if (clientInfoResponse.ErrorCode == 0) { CardInfoResponse response2 = new CardInfoResponse(); CardStatisticsRequest request2 = new CardStatisticsRequest { Card = clientInfoResponse.Card }; HttpResponseMessage responseMessage2 = HttpClientService.PostAsync("api/card/GetCard", request2).Result; if (responseMessage2.IsSuccessStatusCode) { response2 = responseMessage2.Content.ReadAsAsync <CardInfoResponse>().Result; if (response2.ErrorCode == 0) { return(Json(new { data1 = clientInfoResponse, data2 = response2 })); } } return(Json(new DefaultResponse { ErrorCode = 11, Message = "Ошибка запроса к ClientInfo" })); } } return(Json(new DefaultResponse { ErrorCode = 11, Message = "Ошибка запроса к ClientInfo" })); }