Esempio n. 1
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;
     }
 }
Esempio n. 2
0
        public ActionResult Edit(Ticket tk, FormCollection collection)
        {
            tk.CustomerId = CustomerBusiness.SelectIdbyName(collection["SearchCustomer"]);
            IFormatProvider iFP = new System.Globalization.CultureInfo("vi-VN", true);

            tk.StartTime = DateTime.Parse(collection["StartTime"], iFP);
            tk.EndTime = DateTime.Parse(collection["EndTime"], iFP);

            tk.MotorbikePlate = collection["SearchPlate"];
            tk.TypeId = Int64.Parse(collection["ticketType"]);
            tk.CustomerId = CustomerBusiness.SelectIdbyName(collection["Customer.FullName"]);
            TicketBusiness.Update(tk);
            ViewBag.ticketType = new SelectList(TicketTypeBusiness.ListTicketTypes(), "Id", "Description", tk.TypeId);
            return PartialView("Edit", tk);
        }
Esempio n. 3
0
        public ActionResult Create(Ticket tk, FormCollection collection)
        {
            tk.CustomerId = CustomerBusiness.SelectIdbyName(collection["SearchCustomer"]);
            IFormatProvider iFP = new System.Globalization.CultureInfo("vi-VN", true);

            tk.StartTime = DateTime.Parse(collection["StartTime"], iFP);
            tk.EndTime = DateTime.Parse(collection["EndTime"], iFP);
            tk.Price = 0;
            tk.MotorbikePlate = collection["SearchPlate"];
            tk.TypeId = Int64.Parse(collection["ticketType"]);
            TicketBusiness.Insert(tk);
            IEnumerable<SelectListItem> sList = new SelectList(TicketTypeBusiness.ListTicketTypes(), "Id", "Description");
            ViewBag.TicketType = sList;
            return PartialView("Create");
        }
Esempio n. 4
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;
     }
 }