/// <summary> /// Проверяет принадлежит ли email какому-либо участнику ПЛ /// </summary> /// <param name="request"></param> /// <returns></returns> public ClientEmailIsFreeResponse CheckEmailForFree(ClientEmailIsFreeRequest request) { ClientEmailIsFreeResponse returnValue = new ClientEmailIsFreeResponse(); _cnn.Open(); SqlCommand cmd = _cnn.CreateCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "ClientEmailIsFree"; cmd.Parameters.AddWithValue("@email", request.Email); cmd.Parameters.AddWithValue("@operator", request.Operator); cmd.Parameters.Add("@errormessage", SqlDbType.NVarChar, 100); cmd.Parameters["@errormessage"].Direction = ParameterDirection.Output; cmd.Parameters.Add("@result", SqlDbType.Int); cmd.Parameters["@result"].Direction = ParameterDirection.ReturnValue; try { cmd.ExecuteNonQuery(); returnValue.ErrorCode = Convert.ToInt32(cmd.Parameters["@result"].Value); returnValue.IsFree = Convert.ToInt32(cmd.Parameters["@result"].Value) == 1; returnValue.Message = Convert.ToString(cmd.Parameters["@errormessage"].Value); } catch (Exception ex) { returnValue.Message = ex.Message; } _cnn.Close(); return(returnValue); }
private bool CheckEmailIsFree(string email) { if (string.IsNullOrEmpty(email)) { return(false); } ClientEmailIsFreeRequest request = new ClientEmailIsFreeRequest(); if (!string.IsNullOrEmpty(email)) { try { request.Email = email; } catch { } } try { request.Operator = Convert.ToInt16(JwtProps.GetOperator()); } catch { } HttpResponseMessage response = HttpClientService.PostAsync("api/client/CheckEmailForFree", request).Result; if (response.IsSuccessStatusCode) { ClientEmailIsFreeResponse data = response.Content.ReadAsAsync <ClientEmailIsFreeResponse>().Result; if (string.IsNullOrEmpty(data.Message)) { return(data.IsFree); } } return(false); }
public ClientEmailIsFreeResponse CheckEmailForFree(ClientEmailIsFreeRequest request) { Log.Information("LCManagerPartner ClientEmailIsFree {email}", request.Email); return(_clientService.CheckEmailForFree(request)); }