public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; Users_Model usermodel = new Users_Model(); usermodel.LoginPwd = context.Request.Form["txtpwd"]; usermodel.NickName = context.Request.Form["txtnick"]; usermodel.Sex = context.Request.Form["txtsex"]; usermodel.Age = Convert.ToInt32(context.Request.Form["txtage"]); usermodel.FaceId = Convert.ToInt32(context.Request.Form["txtface"]); usermodel.Friend = Convert.ToInt32(context.Request.Form["txtfriend"]); usermodel.Name = context.Request.Form["txtname"]; usermodel.StarId = Convert.ToInt32(context.Request.Form["txtstar"]); usermodel.BloodId = Convert.ToInt32(context.Request.Form["txtblood"]); Users_Service userservice = new Users_Service(); if (userservice.AddUser(usermodel)) { context.Response.Redirect("Index.ashx"); } else { context.Response.Redirect("Error.ashx"); } }
public PartialViewResult _DanhSach(string keyText = "", string type = "", string status = "A", int pageNumber = 1, int pageSize = 10) { List <TB_USERS> list = new List <TB_USERS>(); int count = 0; try { keyText = keyText.Trim(); list = Users_Service.GetAll() .Where(x => (string.IsNullOrEmpty(keyText) || x.Username.IndexOf(keyText) >= 0 || x.UserPhone.IndexOf(keyText) >= 0 || x.UserAddress.IndexOf(keyText) >= 0 || x.UserNote.IndexOf(keyText) >= 0 || x.UserEmail.IndexOf(keyText) >= 0 || x.UserFullName.IndexOf(keyText) >= 0) && x.UserStatus.Equals(status) && (string.IsNullOrEmpty(type) ? true : x.UserType.Equals(type)) ) .ToList(); count = list.Count; list = list .Skip((pageNumber - 1) * pageSize).Take(pageSize) .ToList(); } catch (Exception ex) { CORE.Helpers.IOHelper.WriteLog(StartUpPath, IpAddress, "Sliders/_List :", ex.Message, ex.ToString()); } ViewBag.maxNumber = Math.Ceiling((double)count / pageSize); ViewBag.pageNumber = pageNumber; ViewBag.pageSize = pageSize; return(PartialView(list)); }
public JsonResult InsertUser(TB_USERS user) { AjaxResultModel Result = new AjaxResultModel(); try { if (Users_Service.Insert(user)) { Result.Code = 00; Result.Result = "Thành công"; } else { Result.Code = 1; Result.Result = "Thao tác không thành công"; } } catch (Exception Ex) { Result.Code = 2000; Result.Result = "Có lỗi xảy ra. Vui lòng thử lại sau hoặc liên hệ với người quản trị."; CORE.Helpers.IOHelper.WriteLog(StartUpPath, IpAddress, "UpdatePassword :", Ex.Message, Ex.ToString()); } return(Json(Result)); }
public ActionResult Login(string username, string password, string url, string remember) { ViewBag.url = url; if (Session[AppSessionKeys.USER_INFO] == null) { if (string.IsNullOrEmpty(username)) { ViewBag.error = "Chưa nhập Tên đăng nhập"; return(View()); } if (string.IsNullOrEmpty(password)) { ViewBag.error = "Chưa nhập Mật khẩu"; return(View()); } string newPass = GetMD5Hash(password); // pass MD5 VIEW_INFO_USER_LOGIN user = Users_Service.CheckLogin(username, password); if (user == null) { ViewBag.error = "Đăng nhập sai hoặc bạn không có quyền vào"; return(View()); } else { Session[AppSessionKeys.USER_INFO] = user; if (remember == "on") { AppCookieInfo.UserID = username; AppCookieInfo.HashedPassword = password; } else { AppCookieInfo.RemoveAllCookies(); } //OK } } if (string.IsNullOrEmpty(url)) { return(RedirectToAction("Index")); } else { return(RedirectPermanent(url)); } }
public PartialViewResult _ChiTiet(int userId = 0) { int height = (int)(Request.Browser.ScreenPixelsHeight * 0.85); TB_USERS b = new TB_USERS(); try { b = Users_Service.GetById(userId); } catch (Exception ex) { CORE.Helpers.IOHelper.WriteLog(StartUpPath, IpAddress, "Blogs/_List :", ex.Message, ex.ToString()); } ViewBag.Slider = b; return(PartialView(height)); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/html"; Users_Service userService = new Users_Service(); List <Users_Model> list = userService.GetList(); StringBuilder sbu = new StringBuilder(); foreach (var users in list) { sbu.AppendFormat("<tr><th>{0}</th><th>{1}</th><th>{2}</th><th>{3}</th><th>{4}</th><th>{5}</th><th>{6}</th><th>{7}</th><th>{8}</th><th>{9}</th><th><a href='DeleteUser.ashx?id={0}' class='del'>删除</a></th><th><a href='UpdateUser.ashx?id={0}'>修改</a></th></tr>", users.Id, users.LoginPwd, users.NickName, users.Sex, users.Age, users.FaceId, users.FaceId, users.Friend, users.Name, users.StarId, users.BloodId); } string filePath = context.Request.MapPath("Index.html"); string fileContent = File.ReadAllText(filePath); fileContent = fileContent.Replace("$tbody", sbu.ToString()); context.Response.Write(fileContent); }