コード例 #1
0
        /// <summary>
        /// Sends current dbutton info to Disc View and creates an upscaled
        /// split image of the disc contents.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void DButton_Click(object sender, EventArgs e)
        {
            Caller.popContentPane();
            SetClick();
            DataTable temp = DB_Handle.GetDataTable(string.Format(
                                                        @"SELECT * FROM contents JOIN disc_contents on contents.content_id =
                disc_contents.content_id WHERE disc_id='{0}' and location_id='{1}';",
                                                        Disc, Location_ID));

            if (temp.Rows.Count > 0)
            {
                Caller.isNewRecord = false;
                Caller.setData(Disc, Page, Slot);
                for (int i = 0; i <= temp.Rows.Count - 1; i++)
                {
                    Caller.getContentsGrid().Rows.Add(temp.Rows[i][1], temp.Rows[i][2],
                                                      temp.Rows[i][3], temp.Rows[i][4], temp.Rows[i][0]);
                }
            }
            else
            {
                Caller.isNewRecord = true;
                Caller.setData(string.Empty, Page, Slot);
            }
            Caller.setImagebox(Image_IO.generateDiscImage(Disc, Location_ID, Caller.getImagebox()));
        }
コード例 #2
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (!ValidateFields())
            {
                return;
            }
            string filename = string.Empty;

            try
            {
                DataTable dt = DB_Handle.GetDataTable(
                    string.Format(@"SELECT * from DISCS WHERE disc_id='{0}' and location_id='{1}'",
                                  txtDisc.Text, ddLocation.Text));
                if (dt.Rows.Count < 1)
                {
                    Error_Handle.TipError("No Results Found.", toolTip, imgError);
                }
                else
                {
                    Disc         = dt.Rows[0][0].ToString();
                    Page         = dt.Rows[0][1].ToString();
                    Slot         = Convert.ToInt32(dt.Rows[0][2]);
                    Location     = ddLocation.Text;
                    DialogResult = DialogResult.OK;
                    Close();
                }
            }
            catch (Exception ex)
            {
                Error_Handle.TipError("Error Finding Disc : " + ex.Message, toolTip, imgError);
            }
        }
コード例 #3
0
 /// <summary>
 /// Loads max pages for active location and sets scroll limit.
 /// </summary>
 private void loadView()
 {
     dtView              = DB_Handle.GetDataTable(string.Format(@"select max_storage from locations
         where location_id='{0}'", ddLocation.Text));
     max_pages           = Convert.ToInt32(dtView.Rows[0][0].ToString()) / DISCS_PER_PAGE;
     scrlPage.Maximum    = max_pages + scrlPage.LargeChange - 1;
     DButton.Location_ID = ddLocation.Text;
     txtJump.Text        = "1";
     loadPage();
 }
コード例 #4
0
        /// <summary>
        /// Loads txtTitle dropdown with all existing titles.
        /// </summary>
        private void populateDropDownTitles()
        {
            titles = DB_Handle.GetDataTable(string.Format(
                                                @"Select title_id FROM titles order by title_id"));
            AutoCompleteStringCollection acCollection = new AutoCompleteStringCollection();

            for (int i = 0; i < titles.Rows.Count; i++)
            {
                acCollection.Add(titles.Rows[i][0].ToString());
            }
            txtTitle.AutoCompleteCustomSource = acCollection;
        }
コード例 #5
0
        public discView()
        {
            InitializeComponent();
            DoubleBuffered = true;
            gvContents.AlternatingRowsDefaultCellStyle = null;
            worker.WorkerReportsProgress      = true;
            worker.WorkerSupportsCancellation = true;
            worker.DoWork             += new DoWorkEventHandler(worker_DoWork);
            worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_Completed);
            imgTitle.Image             = Image_IO.generateDiscImage("", "", imgTitle);

            for (int i = 0, slot = 1; i <= (PAGES_PER_VIEW * DISCS_PER_PAGE) - 1; i++, slot++)
            {
                if (slot > DISCS_PER_PAGE)
                {
                    slot = 1;
                }
                dbuttons.Add(new DButton(slot, copyLabel,
                                         Controls["btn" + (i + 1)].Location, this));
                Controls.Add(dbuttons[i]);
                Controls.Add(dbuttons[i].vlbl);
            }

            DataTable locations = DB_Handle.GetDataTable(string.Format(
                                                             @"Select location_id from locations order by location_id"));

            ddLocation.DisplayMember = "location_id";
            ddLocation.DataSource    = locations;

            DataTable titles = DB_Handle.GetDataTable(string.Format(
                                                          @"Select title_id from titles order by title_id"));

            ddInsTitle.DataSource    = titles;
            ddInsTitle.DisplayMember = "title_id";

            this.DoubleBuffered = true;
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            UpdateStyles();

            txtDisc.ReadOnly = AllowDiscEdit;
            loadView();
            foreach (Control c in panel1.Controls)
            {
                c.Enter += new EventHandler(c_Enter);
            }
            foreach (Control c in gbContents.Controls)
            {
                c.Enter += new EventHandler(c_Enter);
            }
        }
コード例 #6
0
        private DiscFinderDialog(string curLocation)
        {
            InitializeComponent();
            MainForm.Main.WindowState = FormWindowState.Normal;
            this.WindowState          = MainForm.Main.WindowState;
            this.TopMost = MainForm.Main.TopMost;

            DataTable locations = DB_Handle.GetDataTable(string.Format(
                                                             @"Select location_id from locations order by location_id"));

            ddLocation.DisplayMember = "location_id";
            ddLocation.DataSource    = locations;
            ddLocation.Text          = curLocation;
        }
コード例 #7
0
        public void Enable()
        {
            loadPage();
            DataTable titles = DB_Handle.GetDataTable(string.Format(
                                                          @"Select title_id from titles order by title_id"));

            ddInsTitle.DataSource    = titles;
            ddInsTitle.DisplayMember = "title_id";
            ddInsTitle.Text          = "";
            if (lastControlEntered != null)
            {
                lastControlEntered.Focus();
            }
        }
コード例 #8
0
        /// <summary>
        /// Populate gridview with titles.
        /// </summary>
        public void populateList()
        {
            dvTitles = DB_Handle.GetDataTable(string.Format(
                                                  @"SELECT title_id 
                FROM titles 
                WHERE language ='{0}' AND category='{1}'
                ORDER BY title_id",
                                                  MainForm.Lmode, filterCategory));
            gvTitles.DataSource = dvTitles;

            if (txtSearch.Text.Length >= 1)
            {
                txtSearch_TextChanged(null, null);
            }
        }
コード例 #9
0
        /// <summary>
        /// Public interface to load Edit Pane.
        /// </summary>
        public void load_editPane()
        {
            Control saveControl = lastControlEntered;

            contentPane.Disable();
            infoPane.Disable();
            gvTitles.Enabled = false;
            panel1.Enabled   = false;
            editPane.Clear_Fields();
            editPane.SetFilter(filterCategory);
            editPane.load_data(DB_Handle.GetDataTable(string.Format(
                                                          @"SELECT * FROM titles 
                WHERE title_id={0}",
                                                          "\"" + gvTitles.SelectedCells[0].Value.ToString() + "\"")));
            editPane.Enable();
            editPane.Focus();
            lastControlEntered = saveControl;
        }
コード例 #10
0
 /// <summary>
 /// Generates the next available disc_id from discs table.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnGenerate_Click(object sender, EventArgs e)
 {
     try
     {
         DataTable dt = DB_Handle.GetDataTable(string.Format(
                                                   @"select max(disc_id) from discs 
             where location_id = '{0}'", ddLocation.Text));
         if (dt.Rows[0][0] is DBNull)
         {
             txtDisc.Text = "001";
         }
         else
         {
             txtDisc.Text = (Convert.ToInt32(dt.Rows[0][0]) + 1).ToString("000");
         }
     }
     catch (Exception ex)
     {
         BetterDialog.ShowDialog("DiscID Generation", "Error : " + ex.Message, "", "", "OK", null, BetterDialog.ImageStyle.Icon);
     }
 }
コード例 #11
0
 /// <summary>
 /// Load Info Pane with data for selected gridview title.
 /// or
 /// Load Disc Pane with data for selected gridview title.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void gvTitles_RowEnter(object sender, DataGridViewCellEventArgs e)
 {
     if (gvTitles.SelectedCells.Count > 0)
     {
         if (gvTitles.SelectedCells[0].Value != null)
         {
             savedRow      = gvTitles.SelectedCells[0].RowIndex;
             lblTitle.Text = gvTitles.SelectedCells[0].Value.ToString();
             if (infoPane.active)
             {
                 infoPane.load_data(DB_Handle.GetDataTable(string.Format(
                                                               @"SELECT * FROM titles WHERE title_id={0}",
                                                               "\"" + gvTitles.SelectedCells[0].Value.ToString() + "\"")));
             }
             else
             {
                 contentPane.load_data(gvTitles.SelectedCells[0].Value.ToString());
             }
         }
     }
 }
コード例 #12
0
        /// <summary>
        /// Prompt to delete record.
        /// Deletes disc and all content records on disc.
        /// </summary>
        /// <remarks>
        /// no foreign_key support in sqlite version so
        /// records are manually deleted from each table.
        /// </remarks>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void deleteMenuItem_Click(object sender, EventArgs e)
        {
            DialogResult dlg = BetterDialog.ShowDialog("Delete Disc",
                                                       "Disc will be deleted permanently. Are you Sure?",
                                                       Location_ID + Disc, "Yes", "No", Image, BetterDialog.ImageStyle.Image);

            if (dlg == DialogResult.OK)
            {
                try
                {
                    DB_Handle.UpdateTable(string.Format(
                                              @"DELETE FROM DISCS WHERE disc_id='{0}' and location_id='{1}'",
                                              Disc, Location_ID));

                    DataTable dt = DB_Handle.GetDataTable(string.Format(
                                                              @"SELECT content_id from disc_contents WHERE disc_id='{0}' and location_id='{1}'",
                                                              Disc, Location_ID));

                    for (int i = 0; i <= dt.Rows.Count - 1; i++)
                    {
                        DB_Handle.UpdateTable(string.Format(
                                                  @"DELETE FROM CONTENTS WHERE content_id='{0}'", dt.Rows[i][0]));
                    }

                    DB_Handle.UpdateTable(string.Format(
                                              @"DELETE FROM DISC_CONTENTS WHERE disc_id='{0}' and location_id='{1}'",
                                              Disc, Location_ID));
                }
                catch (Exception ex)
                {
                    BetterDialog.ShowDialog("Disc Delete", "Error : " + ex.Message, "", "", "OK", null, BetterDialog.ImageStyle.Icon);
                }
                finally
                {
                    DButton.SelBtn.PerformClick();
                    Caller.loadPage();
                    OnClick(null);
                }
            }
        }
コード例 #13
0
        public void load_data(string sel)
        {
            gvDisc.Rows.Clear();
            try
            {
                DataTable temp = DB_Handle.GetDataTable(string.Format(
                                                            @"Select 
                        disc_contents.location_id, 
                        disc_contents.disc_id, 
                        discs.page_number,
                        discs.slot_number, 
                        contents.season, 
                        contents.rangeStart,
                        contents.rangeEnd 
                    FROM contents 
                    INNER JOIN disc_contents ON contents.content_id = disc_contents.content_id
                    INNER JOIN discs ON discs.disc_id = disc_contents.disc_id 
                    WHERE contents.title_id={0} AND discs.location_id=disc_contents.location_id",
                                                            "\"" + sel + "\""));

                if (temp.Rows.Count > 0)
                {
                    for (int i = 0; i <= temp.Rows.Count - 1; i++)
                    {
                        for (int k = 0; k <= temp.Columns.Count - 1; k++)
                        {
                            Console.WriteLine(temp.Rows[i][k].ToString());
                        }
                        gvDisc.Rows.Add(temp.Rows[i][0],
                                        temp.Rows[i][1], temp.Rows[i][2], temp.Rows[i][3],
                                        temp.Rows[i][4], temp.Rows[i][5], temp.Rows[i][6]);
                    }
                }
            }
            catch (Exception ex)
            {
                BetterDialog.ShowDialog("DB Error", ex.Message, "", "", "OK", null, BetterDialog.ImageStyle.Icon);
            }
        }
コード例 #14
0
        /// <summary>
        /// Get contents of a disc_id and generate a merged image for it.
        /// </summary>
        /// <param name="discid"></param>
        /// <param name="locationid"></param>
        /// <param name="btn"></param>
        /// <returns></returns>
        public static Image generateDiscImage(string discid, string locationid, Control btn)
        {
            Image     img  = resize_Image(LFI.Properties.Resources.border, 245, 345);
            DataTable temp = DB_Handle.GetDataTable(string.Format(
                                                        @"SELECT * FROM contents JOIN disc_contents on contents.content_id =
                disc_contents.content_id WHERE disc_id='{0}' and location_id='{1}';",
                                                        discid, locationid));

            if (temp.Rows.Count > 0)
            {
                List <string> disc_titles = new List <string>();
                if (temp.Rows.Count > 0)
                {
                    for (int i = 0; i <= temp.Rows.Count - 1; i++)
                    {
                        disc_titles.Add(temp.Rows[i][1].ToString());
                    }
                }
                img = Image_IO.createMergedImage(disc_titles, btn);
            }
            return(img);
        }
コード例 #15
0
        /// <summary>
        /// Load dbutton information based on Location, Page, Slot.
        /// Set selection data if currently selected.
        /// </summary>
        /// <param name="page">page_number.</param>
        public void load(int page)
        {
            DataTable dt = DB_Handle.GetDataTable(string.Format(@"select * from discs
                where location_id='{0}' and page_number='{1}' and slot_number='{2}'",
                                                                Location_ID, page, Slot));

            if (dt.Rows.Count != 0)
            {
                setData(dt.Rows[0][0], dt.Rows[0][1]);
            }
            else
            {
                setData(string.Empty, page);
            }
            Image = Image_IO.generateDiscImage(Disc, Location_ID, this);
            if (selDisc != string.Empty)
            {
                if (selSlot == Slot && selPage == Page)
                {
                    SetClick();
                }
            }
        }