private SessionData GetSessionData(string pIde) { try { WSWebApps.WebAppsSoapClient wsClient = new WSWebApps.WebAppsSoapClient(); wsClient.Open(); DataSet ds = wsClient.GetSessionData(pIde); wsClient.Close(); var session = new SessionData(ds.Tables[0].Rows[0]); Session["UsuarioExtranetId"] = session.UsuarioExtranetId; //new session. Session["usr_id"] = session.UsuarioExtranetId; Session["UsuarioShamanId"] = session.UsuarioShamanId; Session["Identificacion"] = session.Identificacion; Session["Nombre"] = session.Nombre; Session["Email"] = session.Email; Session.Timeout = Convert.ToInt32(System.Web.Configuration.WebConfigurationManager.AppSettings.Get("SessionTimeOut")); return(session); } catch (Exception ex) { logger.Error("Fallo el GetSessionData. " + ex.Message); throw; } }
public async System.Threading.Tasks.Task <JsonResult> Login(string pUsr, string pPass) { try { WSWebApps.WebAppsSoapClient wsClient = new WSWebApps.WebAppsSoapClient(); wsClient.Open(); DataSet ds = wsClient.Login(pUsr, pPass); wsClient.Close(); LoginSession loginSession = new LoginSession(); loginSession.LoginUsuarios = new List <LoginUsuario>(); foreach (DataRow dr in ds.Tables[0].Rows) { loginSession.LoginUsuarios.Add( new LoginUsuario { Jerarquia = dr["Jerarquia"].ToString(), Titulo = dr["Titulo"].ToString(), #if DEBUG URL = (dr["URL"].ToString().Contains("token") ? dr["URL"].ToString().Replace("?token", "").Replace("http://remote.omnisaludsa.com.ar:5567", "http://localhost:4200") + await GetToken(pUsr, pPass, dr["Jerarquia"].ToString()) : dr["URL"].ToString()), #else URL = (dr["URL"].ToString().Contains("token") ? dr["URL"].ToString().Replace("?token", "") + await GetToken(pUsr, pPass, dr["Jerarquia"].ToString()) : dr["URL"].ToString()), #endif UsuarioNombre = dr["UsuarioNombre"].ToString() }); } if (loginSession.LoginUsuarios.Count > 0) { loginSession.MySessionData = GetSessionData(pUsr); } return(Json(loginSession, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { logger.Error("Fallo el Login. " + ex.Message); throw; } }
public JsonResult GetAlertas() { try { WSWebApps.WebAppsSoapClient wsClient = new WSWebApps.WebAppsSoapClient(); wsClient.Open(); DataSet ds = wsClient.GetAlertas(Convert.ToInt64(Session["UsuarioExtranetId"])); wsClient.Close(); List <Alerta> lstAlertas = new List <Alerta>(); foreach (DataRow dr in ds.Tables[0].Rows) { lstAlertas.Add(new Alerta(dr)); } return(Json(lstAlertas, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { logger.Error("Fallo el Login. " + ex.Message); throw; } }
public JsonResult ChangeSettings(long pUsrExtId, string pEmail) { try { if (pUsrExtId != Convert.ToInt64(Session["UsuarioExtranetId"])) { return(Json("Session invalida", JsonRequestBehavior.AllowGet)); } WSWebApps.WebAppsSoapClient wsClient = new WSWebApps.WebAppsSoapClient(); wsClient.Open(); DataSet ds = wsClient.SetPersonals(pUsrExtId, pEmail); wsClient.Close(); ChangePasswordOrEmail changePassword = new ChangePasswordOrEmail(ds.Tables[0].Rows[0]); //var json = JsonConvert.SerializeObject(new { status = (ds.Tables[0].Rows[0]["Resultado"].ToString() == "1"? "OK":"Error"), message = ds.Tables[0].Rows[0]["DescripcionError"].ToString()}); return(Json(changePassword, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { logger.Error("Fallo ChangeSettings. " + ex.Message); throw; } }
public JsonResult ForgotPassword(string pIde) { string mensaje = "No se pudo recuperar la clave"; try { WSWebApps.WebAppsSoapClient wsClient = new WSWebApps.WebAppsSoapClient(); wsClient.Open(); DataSet ds = wsClient.ForgotPassword(pIde); wsClient.Close(); if (ds.Tables != null && ds.Tables.Count > 0 && ds.Tables[0].Rows != null) { if (SendMailPassword(ds.Tables[0].Rows[0])) { mensaje = "Ok"; } else { mensaje = "Fallo el envio de Email"; } } else { mensaje = "No se pudo recuperar la clave"; } return(Json(mensaje, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { logger.Error(mensaje + ex.Message); throw; } }