public ResponseModel Login(LOGON logon) { try { using (BIGCCEntities ctx = new BIGCCEntities()) { var user = ctx.LOGON.Where(o => o.USERNAME == logon.USERNAME && o.PASSWORD == logon.PASSWORD).FirstOrDefault(); if (user != null) { resp.STATUS = true; resp.RESULT = user; } else { resp.STATUS = false; resp.ERROR_MESSAGE = "ไม่พบผู้ใช้งาน"; } } } catch (Exception ex) { resp.ERROR_MESSAGE = ex.Message; } return(resp); }
private void button1_Click(object sender, EventArgs e) { LOGON temp = new LOGON() //发送一个登入数据包 { username = this.textBox1.Text, password = this.textBox2.Text }; SocketManager.client.SendTo(BufferFormatV2.FormatFCA(temp)); }
public JsonResult Login(LOGON logon) { var service = new LoginServices(); var resp = service.Login(logon); if (resp.STATUS) { Session["User"] = resp.RESULT; } return(Json(resp, JsonRequestBehavior.AllowGet)); }
public ActionResult News() { if (Session["User"] == null) { return(RedirectToAction("loginpage", "admin")); } else { LOGON user = (LOGON)Session["User"]; return(View(user)); } }
public void WriteLogin(int iCounterId, int iStaffId, DateTime dLoginTime) { db = new QMSEntities(); var obj = new LOGON(); obj.MATB = (Int16)iCounterId; obj.MANV = (Int16)iStaffId; obj.NGAY = dLoginTime; obj.GIO = dLoginTime; obj.MATT = eStatus.Login; db.LOGONs.Add(obj); db.SaveChanges(); WriteRequired(iCounterId, "LOGIN", "0", DateTime.Now); }