public string InsertUsuario(string Nombres, string Apellidos, string Correo, string Usuario, int PerfilId, int SedeId, string Telefono, int UsuarioId) { try { Cl_Usuarios clUsuarios = new Cl_Usuarios(); Ws_Generales wsGenerales = new Ws_Generales(); cn.Open(); SqlCommand Comando = new SqlCommand("Sp_Insert_Usuario", cn); Comando.CommandType = CommandType.StoredProcedure; Comando.Parameters.Add("@Nombres", SqlDbType.VarChar, 200).Value = Nombres; Comando.Parameters.Add("@Apellidos", SqlDbType.VarChar, 200).Value = Apellidos; Comando.Parameters.Add("@Correo", SqlDbType.VarChar, 200).Value = Correo; Comando.Parameters.Add("@Usuario", SqlDbType.VarChar, 200).Value = Usuario; Comando.Parameters.Add("@PerfilId", SqlDbType.Int).Value = PerfilId; Comando.Parameters.Add("@SedeId", SqlDbType.Int).Value = SedeId; Comando.Parameters.Add("@Telefono", SqlDbType.VarChar, 200).Value = Telefono; Comando.Parameters.Add("@UsuarioIdCrea", SqlDbType.Int).Value = UsuarioId; Comando.Parameters.Add("@Clave", SqlDbType.VarChar, 500).Value = wsGenerales.Encrypt(clUsuarios.GeneraClave()); Comando.ExecuteNonQuery(); cn.Close(); return(""); } catch (Exception ex) { return(ex.Message); } }
public List <DatosUsuario> GetDatosUsuario(string Usuario) { ds.Tables.Clear(); Cl_Login cllogin = new Cl_Login(); Ws_Generales wsGenerales = new Ws_Generales(); ds = cllogin.GetDatosUsuario(Usuario); List <DatosUsuario> Datos = new List <DatosUsuario>(); foreach (DataRow dr in ds.Tables["DATOS"].Rows) { DatosUsuario Registro = new DatosUsuario(); Registro.UsuarioId = Convert.ToInt32(dr["UsuarioId"]); Registro.Nombre = dr["Nombre"].ToString(); Registro.PerfilId = Convert.ToInt32(dr["PerfilId"]); Registro.CambiaClave = Convert.ToInt32(dr["CambiaClave"]); Registro.Correo = dr["Correo"].ToString(); Registro.Clave = wsGenerales.Decrypt(dr["Clave"].ToString()); Registro.EstatusUsuario = Convert.ToInt32(dr["EstatusUsuarioId"]); Datos.Add(Registro); } return(Datos); }
public string EditEstatus(int UsuarioId, int Estatus) { try { Ws_Generales wsGenerales = new Ws_Generales(); cn.Open(); SqlCommand Comando = new SqlCommand("Sp_ChangeEstatus", cn); Comando.CommandType = CommandType.StoredProcedure; Comando.Parameters.Add("@UsuarioId", SqlDbType.Int).Value = UsuarioId; Comando.Parameters.Add("@Estatus", SqlDbType.Int).Value = Estatus; Comando.ExecuteNonQuery(); cn.Close(); return(""); } catch (Exception ex) { return(ex.Message); } }
public string EditClave(int UsuarioId, string Clave, int CambiaClave) { try { Ws_Generales wsGenerales = new Ws_Generales(); cn.Open(); SqlCommand Comando = new SqlCommand("Sp_ChangeClave", cn); Comando.CommandType = CommandType.StoredProcedure; Comando.Parameters.Add("@UsuarioId", SqlDbType.Int).Value = UsuarioId; Comando.Parameters.Add("@Clave", SqlDbType.VarChar, 200).Value = wsGenerales.Encrypt(Clave); Comando.Parameters.Add("@CambiaClave", SqlDbType.Int).Value = CambiaClave; Comando.ExecuteNonQuery(); cn.Close(); return(""); } catch (Exception ex) { return(ex.Message); } }