Пример #1
0
 public object MapRow(System.Data.IDataReader reader, int rowNum)
 {
     User model = new User();
     model.id = reader.GetInt32(0);
     model.name = reader.GetString(1);
     model.pwd = reader.GetString(2);
     return model;
 }
Пример #2
0
 protected void login()
 {
     user = new User();
     user.ID = 1;
     user.Name = "小明";
     user.Gender = "男";
     //
     Session["uid="] = 1;
     Session["uname="] = "小明";
     //
     WriteCookie("uid", "1");
     WriteCookie("uname", "小明");
 }
Пример #3
0
        public void test()
        {
            User t1 = new User();
            t1.id = 123;
            t1.name = "zhuzhen";
            t1.pwd = "321";
            dao.save(t1);

            User t2 = new User();
            t2.id = 321;
            t2.name = "guolili";
            t2.pwd = "123";
            dao.save(t2);

            foreach (User model in dao.getAll())
            {
                string name = model.name;
            }
        }
Пример #4
0
        //[Transaction(Spring.Transaction.TransactionPropagation.Required, ReadOnly = false)]
        //[Transaction]
        public void save(User model)
        {
            //setHibernateTemplate();
            //sf.GetCurrentSession().Save(person);
            //ht.Save(person);
            //ISession s = sf.OpenSession();
            //ITransaction t = s.BeginTransaction();
            //s.FlushMode = FlushMode.Auto;
            //s.Save(person);
            //t.Commit();
            //HibernateTemplate.TemplateFlushMode = TemplateFlushMode.Auto;
            HibernateTemplate.Save(model);

            //ISession s = HibernateTemplate.SessionFactory.OpenSession();
            //ITransaction t = s.BeginTransaction();
            //s.Save(model);
            //t.Commit();
            //s.Close();
        }
Пример #5
0
        public ActionResult Index()
        {
            User user = new User();
            user.name = "zhuzhen";
            user.pwd = "123";
            userService.save(user);

            IList<User> userList = userService.getAll();
            System.Console.WriteLine(userList.Count);

            user = userService.getById(user.id);
            System.Console.WriteLine(user.name);

            user.pwd = "123456";
            userService.update(user);

            userService.delete(user);

            ViewBag.Message = messageSource.GetMessage("name", CultureInfo.CurrentUICulture);

            return View();
        }
Пример #6
0
 //private HibernateTemplate ht;
 //public ISessionFactory sf { set; get; }
 //private void setHibernateTemplate()
 //{
 //    if (null == ht)
 //    {
 //        ht = new HibernateTemplate(this.sf);
 //        ht.TemplateFlushMode = TemplateFlushMode.Auto;
 //        ht.CacheQueries = true;
 //    }
 //}
 public void delete(User model)
 {
     //sf.GetCurrentSession().Delete(tb_user);
     HibernateTemplate.Delete(model);
 }
Пример #7
0
 public void update(User model)
 {
     dao.update(model);
 }
Пример #8
0
 public void save(User model)
 {
     dao.save(model);
 }
Пример #9
0
 public void delete(User model)
 {
     dao.delete(model);
 }
Пример #10
0
 /// <summary>
 /// 用于向 User EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddToUser(User user)
 {
     base.AddObject("User", user);
 }
Пример #11
0
 partial void InsertUser(User instance);
Пример #12
0
		private void detach_Users(User entity)
		{
			this.SendPropertyChanging();
			entity.Account = null;
		}
Пример #13
0
		private void attach_Users(User entity)
		{
			this.SendPropertyChanging();
			entity.Account = this;
		}
Пример #14
0
 public void update(User model)
 {
     userDao.update(model);
 }
Пример #15
0
 public void save(User model)
 {
     userDao.save(model);
 }
Пример #16
0
 public void delete(User model)
 {
     userDao.delete(model);
 }
Пример #17
0
 public void update(User model)
 {
     //setHibernateTemplate();
     //HibernateTemplate.Update(person);
     HibernateTemplate.Update(model);
 }
Пример #18
0
 partial void UpdateUser(User instance);
Пример #19
0
 /// <summary>
 /// 创建新的 User 对象。
 /// </summary>
 /// <param name="id">ID 属性的初始值。</param>
 public static User CreateUser(global::System.Int64 id)
 {
     User user = new User();
     user.ID = id;
     return user;
 }
Пример #20
0
 partial void DeleteUser(User instance);