public ActionResult Get_7_StudentRegister(int numberSkip)
        {
            ArrayList dl = new ArrayList();

            List <Model.EF.User> dsuser = (new Model.Dao.UserDao().ListNonActiveStatus(numberSkip));

            foreach (var item in dsuser)
            {
                Model.EF.User motuser = new Model.EF.User();
                motuser.FullName    = item.FullName;
                motuser.UserName    = item.UserName;
                motuser.RoleID      = item.RoleID;
                motuser.userAddress = item.userAddress;
                motuser.UserID      = item.UserID;
                motuser.University  = item.University;
                motuser.Stat        = item.Stat;
                motuser.specialized = item.specialized;
                motuser.Passwords   = item.Passwords;
                motuser.imagecover  = item.imagecover;
                motuser.imagelogin  = item.imagelogin;

                dl.Add(motuser);
            }

            return(Json(dl, JsonRequestBehavior.AllowGet));
        }
Exemple #2
0
        internal static User getUserById(int userId)
        {
            IQueryable <Model.EF.User> data = Model.Dao.UI.UserDao.getUserById(userId);

            if (data.Count() > 0)
            {
                Model.EF.User userData = data.First();
                User          user     = fromDBDataToObject(userData);
                return(user);
            }
            return(null);
        }
Exemple #3
0
 private static Model.EF.User toDBObject(User obj)
 {
     Model.EF.User user = new Model.EF.User();
     user.email    = obj.email;
     user.userName = obj.userName;
     user.password = obj.password;
     user.phoneNum = obj.phoneNum;
     user.address  = obj.address;
     user.money    = obj.money;
     user.userAva  = obj.userAva;
     return(user);
 }
Exemple #4
0
        public static User getUserByEmail(String email)
        {
            IQueryable <Model.EF.User> data = Model.Dao.UI.UserDao.getUserByEmail(email);

            if (data.Count() > 0)
            {
                Model.EF.User userData = data.First();
                User          user     = fromDBDataToObject(userData);
                return(user);
            }
            return(null);
        }
Exemple #5
0
        private static User fromDBDataToObject(Model.EF.User obj)
        {
            User user = new User();

            user.userId   = obj.userId;
            user.email    = obj.email;
            user.userName = obj.userName;
            user.password = obj.password;
            user.phoneNum = obj.phoneNum;
            user.address  = obj.address;
            user.money    = (decimal)obj.money;
            user.userAva  = obj.userAva;
            return(user);
        }
        public JsonResult AddRegiterByStudent(string username, string fullname, string password, string pc, string university, string userdes, string address, string specialized)
        {
            //đổi tên hình trong thư mục ~/Asset/Images/pc

            UserDao dao = new UserDao();

            Model.EF.User entity = new Model.EF.User();
            entity.UserName = username;
            entity.FullName = fullname;

            int    vt      = pc.LastIndexOf('.');
            string duoianh = pc.Substring(vt);

            entity.imagecover  = pc;
            entity.imagelogin  = pc;
            entity.RoleID      = 4;
            entity.Stat        = false;
            entity.userAddress = address;
            entity.University  = university;
            entity.Passwords   = password;
            entity.specialized = specialized;
            entity.userdes     = userdes;
            int userID = dao.RegisterByStudent(entity);


            if (userID != -1 && userID != 0)
            {
                string path = Server.MapPath("~/Asset/ImagesTemp/") + pc;

                renamePicture(path, userID.ToString());
            }

            entity.imagecover = userID.ToString() + duoianh;
            entity.imagelogin = userID.ToString() + duoianh;
            dao.Update(entity);
            return(Json(dao.RegisterByStudent(entity)));
        }
 public JsonResult Update(Model.EF.User entity)
 {
     return(Json(new UserAdminDAO().Update(entity), JsonRequestBehavior.AllowGet));
 }
Exemple #8
0
 public async Task <JsonResult> Update(Model.EF.User entity)
 {
     return(Json(await _dao.Update(entity), JsonRequestBehavior.AllowGet));
 }
Exemple #9
0
 internal static void update(User inputUser)
 {
     Model.EF.User user = toDBObject(inputUser);
     Model.Dao.UI.UserDao.updateUser(user);
 }
Exemple #10
0
 public static void insert(User inputUser)
 {
     Model.EF.User user = toDBObject(inputUser);
     Model.Dao.UI.UserDao.insertUser(user);
 }