/// <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())); }
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); } }
/// <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(); } } }