Esempio n. 1
0
        private void btnEditSelected_Click(object sender, EventArgs e)
        {
            // data row: title, condition, count, id, holds, price

            if (dgvData.SelectedRows.Count > 0)
            {
                string title     = dgvData.SelectedCells[0].Value.ToString();
                string id        = dgvData.SelectedCells[3].Value.ToString();
                string condition = dgvData.SelectedCells[1].Value.ToString();
                int    count     = int.Parse(dgvData.SelectedCells[2].Value.ToString());
                double price     = double.Parse(dgvData.SelectedCells[5].Value.ToString());

                Console.WriteLine(title);
                Console.WriteLine(condition);
                Console.WriteLine(count.ToString());
                Console.WriteLine(id);


                frmInfo info = new Postro2.frmInfo(title, Poster.StringToCondition(condition), id, count, price);

                if (info.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                Poster poster = info._Poster;

                Console.WriteLine(poster.ToString());

                // PosterTitle, Condition, Count, ID, Holds, Price
                DatabaseManager.Command(string.Format("UPDATE Posters SET PosterTitle=\"{0}\", Condition=\"{1}\", Count={2}, Price={4} WHERE ID=\"{3}\";",
                                                      poster.Title, Poster.ConditionToString(poster.PosterCondition), poster.Count, poster.ID, (poster.Pricing * 100)));

                DisplayAllRows();
            }
        }
Esempio n. 2
0
        // =======================================================================================================
        // PROPRIETARY DATABASE MANAGER STUFF INVOLVING POSTERS
        // =======================================================================================================

        public bool AddPosterToDB(Poster poster)
        {
            try
            {
                Command(string.Format("INSERT INTO Posters (PosterTitle, Condition, Count, ID, Holds, Price) VALUES ('{0}', '{1}', {2}, '{3}', {4}, {5});", poster.Title, Poster.ConditionToString(poster.PosterCondition), poster.Count.ToString(), poster.ID, poster.Holds.ToString(), poster.Pricing * 100));
            }
            catch (Exception)
            {
                return(false);
            }

            return(true);
        }
Esempio n. 3
0
        private void btnAddNew_Click(object sender, EventArgs e)
        {
            if (connected)
            {
                frmInfo infoWindow = new frmInfo();

                var    result = infoWindow.ShowDialog();
                Poster poster = infoWindow._Poster;

                if ((poster = infoWindow._Poster) == null && result != DialogResult.OK)
                {
                    return;
                }

                DatabaseManager.AddPosterToDB(poster);

                DisplayAllRows();
            }
        }