Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Threading.Tasks;
- using Microsoft.Owin;
- using Owin;
- [assembly: OwinStartup(typeof(MvcMasterPrueba.Startup))]
- namespace MvcMasterPrueba
- {
- public class Startup
- {
- public void Configuration(IAppBuilder app)
- {
- //ConfigureAuth(app);
- app.MapSignalR();
- }
- }
- }
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using Microsoft.AspNet.SignalR;
- namespace MvcMasterPrueba
- {
- public class MyHub : Hub
- {
- public void Send(string name, string message)
- {
- Clients.All.broadcastMessage(name, message);
- }
- public void BroadcastMessageToAll(string nombreImpresora, String divHTML)
- {
- //Clients.All.newMessageReceived(message);
- Clients.All.imprimeDiv(nombreImpresora, divHTML);
- }
- public void BroadcastMessageToPrinter(string nombreImpresora, String divHTML)
- {
- Clients.All.imprimeDiv(nombreImpresora, divHTML);
- }
- public void JoinAGroup(string group)
- {
- Groups.Add(Context.ConnectionId, group);
- }
- public void RemoveFromAGroup(string group)
- {
- Groups.Remove(Context.ConnectionId, group);
- }
- }
- }
- public ActionResult Acceder(string User, string Pass)
- {
- string estado = "0";
- string ip = "";
- string db = "";
- string user = "";
- string pass = "";
- string password = "";
- string sql = "SELECT ip,db,user,CONVERT(AES_DECRYPT(`pass`,'1234444444') USING UTF8) AS pass,password " +
- "FROM usuarios " +
- "WHERE email='" + User + "' and password='" + Pass + "' limit 1";
- conexion.conectar();
- MySqlDataAdapter datos = new MySqlDataAdapter(sql, conexion.conlogin);
- conexion.cerrar();
- DataTable dt = new DataTable();
- datos.Fill(dt);
- foreach (DataRow row in dt.Rows)
- {
- ip = row[0].ToString();
- db = row[1].ToString();
- user = row[2].ToString();
- pass = row[3].ToString();
- password = row[4].ToString();
- }
- if (Pass == password)
- {
- Session["Session_User"] = User;
- Session["ip"] = ip;
- Session["db"] = db;
- Session["user"] = user;
- Session["pass"] = pass;
- estado = "1";
- Session["ss_nro_caja"] = obtieneNroCaja();
- }
- switch (estado)
- {
- case "0":
- ViewData["Mensaje"] = "Usuario o Password invalido..!!";
- return View("Login");
- case "1":
- FormsAuthentication.SetAuthCookie(User, false);
- return RedirectToAction("Home", "Acceso");
- default:
- return View("Login");
- }
- }
- case "1":
- FormsAuthentication.SetAuthCookie(User, false);
- return RedirectToAction("Principal", "Acceso");
Add Comment
Please, Sign In to add comment