예제 #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="moto"></param>
 /// <returns></returns>
 public static bool Insert(Motorbike moto)
 {
     try
     {
         entity.Motorbikes.Add(moto);
         entity.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
예제 #2
0
 public static user Add(user user)
 {
     try
     {
         user.password = UserService.EncodePass(user.password);
         user.roleName = RoleConstant.Member;
         user.status   = "active";
         db.users.Add(user);
         //endcode pass word
         db.SaveChanges();
     }
     catch (Exception)
     {
         return(null);
     }
     return(user);
 }
예제 #3
0
        public static bool ChangPass(string userName, string oldPass, string newPass)
        {
            user currentUser = ValidateUser(userName, oldPass);

            if (currentUser != null)
            {
                currentUser.password = EncodePass(newPass);
                entities.SaveChanges();
                return(true);
            }
            return(false);
        }
예제 #4
0
 public static bool Insert(Customer customer)
 {
     try
     {
         QLNXeEntities entities = new QLNXeEntities();
         entities.Customers.Add(customer);
         entities.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
예제 #5
0
 /// <summary>
 /// Insert Ticket
 /// </summary>
 /// <param name="tk"></param>
 /// <returns></returns>
 public static bool Insert(Ticket tk)
 {
     try
     {
         QLNXeEntities entities = new QLNXeEntities();
         entities.Tickets.Add(tk);
         entities.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
예제 #6
0
 public static bool Update(Customer customer)
 {
     try
     {
         QLNXeEntities entities  = new QLNXeEntities();
         var           customers = entities.Customers.Find(customer.Id);
         entities.Entry(customers).CurrentValues.SetValues(customer);
         entities.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
예제 #7
0
 /// <summary>
 /// Delete Ticket
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public static bool Delete(Int64 id)
 {
     try
     {
         QLNXeEntities entities = new QLNXeEntities();
         var           ticket   = entities.Tickets.First(ob => ob.TicketId == id);
         entities.Entry(ticket).State = EntityState.Deleted;
         entities.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
예제 #8
0
 /// <summary>
 /// Update Ticket
 /// </summary>
 /// <param name="tk"></param>
 /// <returns></returns>
 public static bool Update(Ticket tk)
 {
     try
     {
         QLNXeEntities entities = new QLNXeEntities();
         var           ticket   = entities.Tickets.Find(tk.TicketId);
         entities.Entry(ticket).CurrentValues.SetValues(tk);
         entities.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }