예제 #1
0
        public bool delete(Prepaid g)
        {
            string        sql  = "delete Prepaid where bookingID = @ID and BookingTypeID = @bookingTypeID";
            SqlConnection conn = dp.getConnection();

            cmd = new SqlCommand(sql, conn);
            try
            {
                cmd = new SqlCommand(sql, conn);
                conn.Open();
                cmd.Parameters.Add("@ID", SqlDbType.Char).Value            = g.BookingID;
                cmd.Parameters.Add("@bookingTypeID", SqlDbType.Char).Value = g.BookingTypeID;
                cmd.ExecuteNonQuery();
                conn.Close();
            }
            catch (Exception e)
            {
                return(false);
            }
            return(true);
        }
예제 #2
0
        public bool insert(Prepaid g)
        {
            string        sql  = "insert into Consume values (@ID,@bookingTypeID,@amount,@Dates,@nvID)";
            SqlConnection conn = dp.getConnection();

            cmd = new SqlCommand(sql, conn);
            try
            {
                cmd = new SqlCommand(sql, conn);
                conn.Open();
                cmd.Parameters.Add("@ID", SqlDbType.Char).Value            = g.BookingID;
                cmd.Parameters.Add("@bookingTypeID", SqlDbType.Char).Value = g.BookingTypeID;
                cmd.Parameters.Add("@amount", SqlDbType.Char).Value        = g.Amount;
                cmd.Parameters.Add("@Dates", SqlDbType.Char).Value         = g.DateReceive;
                cmd.Parameters.Add("@nvID", SqlDbType.Char).Value          = g.NhanvienID;
                cmd.ExecuteNonQuery();
                conn.Close();
            }
            catch (Exception e)
            {
                return(false);
            }
            return(true);
        }