示例#1
0
 public static void Update(Customer Customer)
 {
     {
         using (ISession session = NHibernateHelper.OpenSession())
         using (ITransaction transaction = session.BeginTransaction())
         {
             session.Update(Customer);
             transaction.Commit();
         }
     }
 }
 public static bool CreateNewCustomer(Customer Customer)
 {
     try
     {
         return CustomerDAO.Add(Customer);
     }
     catch (Exception ex)
     {
         Logger.getInstance().log(ex.ToString());
         return false;
     }
 }
示例#3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Customer newCust = new Customer();
     newCust.Address = "";
     newCust.CreatedDate = DateTime.Today;
     newCust.Email = "*****@*****.**";
     newCust.Name = "Example";
     newCust.Password = Encrypt.EncodePassword("123456");
     newCust.Phone = "0123456";
     newCust.Usename = "dang";
     lbError.Text = CustomerHandler.CreateNewCustomer(newCust).ToString();
     // Logger.getInstance().log("dang");
 }
示例#4
0
 public static bool Add(Customer Customer)
 {
     {
         using (ISession session = NHibernateHelper.OpenSession())
         using (ITransaction transaction = session.BeginTransaction())
         {
             try
             {
                 session.SaveOrUpdate(Customer);
                 transaction.Commit();
                 return true;
             }
             catch (Exception e)
             {
                 Logger.getInstance().log(e.ToString());
                 return false;
             }
         }
     }
 }