GetLoginResponse ILoginService.LoginResponse(GetLoginRequest prmLoginRequest) { GetLoginResponse loginResponse = new GetLoginResponse(); try { ClientesDTO clientesDTO; ICustomerServiceBusiness iCSBusiness; clientesDTO = new ClientesDTO { User = prmLoginRequest.Login.User, Password = prmLoginRequest.Login.Password }; iCSBusiness = new CustomerServicesBusiness(); loginResponse = iCSBusiness.GetResultLoginDTOs(clientesDTO); } catch (Exception ex) { loginResponse.status.CodeResp = "01"; loginResponse.status.MessageResp = "Error en el Servicio"; Common.CreateTrace.WriteLog(Common.CreateTrace.LogLevel.Error, "ERROR EN EL SERVICIO CustomerService:LoginCustomer " + ex.Message); throw ex; } return(loginResponse); }
public async Task <JsonNetResult> Modal(LoginPostViewModel model) { var loginResponse = new GetLoginResponse(); if (string.IsNullOrWhiteSpace(model.Language) || string.IsNullOrEmpty(model.Language)) { loginResponse.Success = false; loginResponse.ResponseData = null; loginResponse.Message = "An error has occured."; if (_logger.IsErrorEnabled) { _logger.Error("Language is null or empty in Modal POST action of surface controller LoginController"); } return(ReturnJsonResponse(loginResponse)); } var culture = GetCultureInformationForLanguage(model.Language); string locale = culture.Locale; string countryCode = culture.CountryCode; if (ModelState.IsValid) { var syncResult = await _syncService.SynchroniseUmbracoMember(locale, countryCode, model.Username, model.Password); //differentiate between the back office users and website members if (_membershipService.ValidateUser(model.Username, model.Password) && _umbracoHelper.MemberExists(model.Username)) { _formsAuthenticationService.SignIn(model.Username, model.RememberMe); var umbracoMember = _umbracoHelper.RetrieveUmbracoMember(model.Username); var user = MapUser(umbracoMember); loginResponse.Success = true; loginResponse.ResponseData = user; return(ReturnJsonResponse(loginResponse)); } loginResponse.Success = false; loginResponse.ResponseData = null; loginResponse.Message = "Invalid credentials"; return(ReturnJsonResponse(loginResponse)); } loginResponse.Success = false; loginResponse.Message = GetErrorsFromModelState(ModelState).FirstOrDefault(); return(ReturnJsonResponse(loginResponse)); }
public GetLoginResponse1(GetLoginResponse GetLoginResponse) { this.GetLoginResponse = GetLoginResponse; }
GetLoginResponse ICustomerServiceBusiness.GetResultLoginDTOs(ClientesDTO prmloginClientesDTO) { GetLoginResponse loginResponse = new GetLoginResponse(); loginResponse.status = new Status(); try { //validar tipos de datos List <ClientesDTO> lstClientesDTO; lstClientesDTO = null; ClientesDAL ClientesDAL = new ClientesDAL(); lstClientesDTO = ClientesDAL.GetClientes(prmloginClientesDTO); if (lstClientesDTO != null) { if (lstClientesDTO.Count > 0) { List <GetCustomerResult> GetCustomerResult = new List <GetCustomerResult>(); foreach (ClientesDTO clientesDTO in lstClientesDTO) { GetCustomerResult lCustomer; List <CreditCardGet> lcreditCard = new List <CreditCardGet>(); lCustomer = new GetCustomerResult { IdType = clientesDTO.CodTypeIdent, FirstName = clientesDTO.FName, LastNames = clientesDTO.LName, IdNumber = clientesDTO.CustID, PhoneNumber = clientesDTO.PhoneNumber, Email = clientesDTO.Email, Address = clientesDTO.Address, Country = clientesDTO.Country, City = clientesDTO.City, User = clientesDTO.User, Password = clientesDTO.Password, StatusCustomer = clientesDTO.Status, IdUser = clientesDTO.ID }; if (clientesDTO.LCreditCard != null) { foreach (CreditCardDTO creditCardDTO in clientesDTO.LCreditCard) { CreditCardGet creditCard = new CreditCardGet { CardName = creditCardDTO.CardName, ExpirationDate = creditCardDTO.ExpirationDate, Type = creditCardDTO.Type, Number = creditCardDTO.Number, SecurityCode = creditCardDTO.SecurityCode, StatusCard = creditCardDTO.StatusCard }; lcreditCard.Add(creditCard); lCustomer.CreditCard = creditCard; } } GetCustomerResult.Add(lCustomer); } loginResponse.result = GetCustomerResult.ToArray(); loginResponse.status.CodeResp = "0"; loginResponse.status.MessageResp = ""; } else { loginResponse.status.CodeResp = "01"; loginResponse.status.MessageResp = "Datos Incorrectos"; } } else { loginResponse.status.CodeResp = "01"; loginResponse.status.MessageResp = "Error al Procesar Datos"; } } catch (Exception ex) { loginResponse.status.CodeResp = "01"; loginResponse.status.MessageResp = "Error en la capa de negocio"; Common.CreateTrace.WriteLog(Common.CreateTrace.LogLevel.Error, "ERROR EN LA CAPA DE NEGOCIO CustomerService:Login"); Common.CreateTrace.WriteLog(Common.CreateTrace.LogLevel.Error, " :: " + ex.Message); throw ex; } return(loginResponse); }