예제 #1
0
        public ActionResult InsertSeatStatus()
        {
            int      ID       = Convert.ToInt32(Request.Form["ID"]);//SeatID
            String   TicketID = ID.ToString();
            string   User     = d.getStringByQuery("select * from CustomerTicket where SeatID=" + ID, "Name");
            string   Phone    = d.getStringByQuery("select * from CustomerTicket where SeatID=" + ID, "Phone");
            string   SeatName = d.getStringByQuery("select * from Seat where ID=" + ID, "Name");
            int      EID      = d.getIntByQuery("select * from Seat where ID=" + ID, "EID");
            string   Name     = d.getStringByQuery("select * from Event where ID=" + EID, "Name");
            DateTime dbDate   = d.getDateByQuery("select * from Event where ID=" + EID, "EDate");
            string   Date     = dbDate.ToString("dd/MM/yyyy");
            string   Time     = d.getStringByQuery("select * from Event where ID=" + EID, "Time");
            string   Status   = Request.Form["Status"];

            if (Status.Equals("Free"))
            {
                //Delete Book Detail first. Then update seat status
                d.ChangeByQuery("delete from CustomerTicket where SeatID=" + ID);
                d.ChangeByQuery("update Seat set Status='" + Status + "' where ID=" + ID);

                string url = Session["url"].ToString();
                Response.Redirect(url);
            }
            else
            {
                //if (SendSeatInfo(TicketID, Name, User, Phone, SeatName, Date, Time) == "OK")
                //{
                d.ChangeByQuery("update Seat set Status='" + Status + "' where ID=" + ID);
                //}
            }
            string url1 = Session["url"].ToString();

            Response.Redirect(url1);
            return(View());
        }