예제 #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
파일: pageBase.cs 프로젝트: ichynul/vowstag
 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);