public static void SaveListOrder(string[] ids)
        {
            UK_Film_Location_Class.UKFilmLocation objUKFilmLocation = new UK_Film_Location_Class.UKFilmLocation();

            MySqlConnection DBConnection;
            MySqlCommand DBCommand;

            DBConnection = new MySqlConnection(objUKFilmLocation.DBConnect);
            DBCommand = DBConnection.CreateCommand();

            for (int i = 0; i < ids.Length; i++)
            {

                DBConnection.Open();

                // Update Record
                DBCommand.CommandText = "update LocationImages set ImageOrder = " + i + " where Image = '" + ids[i] + "';";

                DBCommand.ExecuteNonQuery();

                DBConnection.Close();

            }

            DBConnection.Dispose();
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            UK_Film_Location_Class.UKFilmLocation objUKFilmLocation = new UK_Film_Location_Class.UKFilmLocation();

            // Check if user logged in?

            HttpCookie myTestCookie = new HttpCookie("UKFilmLocation");
            myTestCookie = Request.Cookies["UKFilmLocation"];

            MySqlConnection DBConnection;
            MySqlCommand DBCommand;
            MySqlDataReader DBResult;

            // Read the cookie information and display it.
            if (myTestCookie != null)
            {
                // Check details against DB

                DBConnection = new MySqlConnection(objUKFilmLocation.DBConnect);
                DBCommand = DBConnection.CreateCommand();
                DBConnection.Open();

                DBCommand.CommandText = "select count(*) as numrecs from Contacts where ContactID = '" + myTestCookie.Value + "';";

                DBResult = DBCommand.ExecuteReader();

                int NoRecs = 0;

                if (DBResult.Read())
                {
                    NoRecs = Convert.ToInt32(DBResult["numrecs"].ToString());
                }

                DBResult.Close();

                DBConnection.Close();

                DBConnection.Open();

                DBCommand.CommandText = "select * from UserDetails where Email = '" + myTestCookie.Value + "';";

                DBResult = DBCommand.ExecuteReader();

                if (DBResult.Read())
                {
               //             UserLabel.Text = DBResult["FirstName"].ToString() + " " + DBResult["LastName"].ToString();
                }

                DBResult.Close();

                DBConnection.Close();
                DBConnection.Dispose();

                if (NoRecs == 0)
                {
                    // Create cookie and proceed
                    DateTime now = DateTime.Now;

                    // Set the cookie value.
                    myTestCookie.Value = "";
                    // Set the cookie expiration date.
                    myTestCookie.Expires = now.AddDays(-1);

                    // Add the cookie.
                    Response.Cookies.Add(myTestCookie);
                }

            }
        }