//פונקציית (אימות) כניסה של משתמש רשום לאפליקציה public Common.User Login(int id, string pass) { var users = get.GetUsers(); Dal.User u = users.FirstOrDefault(user => user.Id == id && user.Password == pass && !user.Is_Deleted); if (u != null) { return(Converters.ConvertToCommon.U(u)); } return(null); }
public static Dto.User ToDto(this Dal.User user) { return(new Dto.User { Id = user.Id, FirstName = user.FirstName, LastName = user.LastName, CreditLimit = user.CreditLimit, Balance = user.Balance, AvailableFunds = user.AvailableFunds, }); }
public static bool CreateUser(Dal.User user) { using (FoodOrganizationsEntities context = new FoodOrganizationsEntities()) try { context.Users.Add(user); context.SaveChanges(); return(true); } catch (Exception e) { return(false); } }
public static Common.User U(Dal.User u) { return(new Common.User { Id = u.Id, Password = u.Password, FirstName = u.FirstName, LastName = u.LastName, Phone = u.Phone, Email = u.Email, Job = u.Job, Is_Deleted = u.Is_Deleted, Create_Date = u.Create_Date }); }
public static DTO.UserDTO userDTO(Dal.User user) { DTO.UserDTO userDTO = new DTO.UserDTO(); userDTO.User_Type = user.User_Type; userDTO.User_kod = user.User_kod; userDTO.Telephone = user.Telephone; userDTO.Password = user.Password; userDTO.Last_Name = user.Last_Name; userDTO.Is_Active = user.Is_Active; userDTO.HomeTown = user.HomeTown; userDTO.First_Name = user.First_Name; userDTO.Email = user.Email; return(userDTO); }
private void DelUser(int id) { using (club = new ClubEntities()){ BaWuClub.Web.Dal.User user = new Dal.User(); user = club.Users.Where(u => u.Id == id).FirstOrDefault(); if (user != null) { club.Users.Remove(user); } if (club.SaveChanges() > 0) ViewBag.StatusStr = "删除成功!"; else ViewBag.StatusStr = "删除失败,请稍后重试"; } }
public User() { dal = new Dal.User(); }