static Local() { session_schedule = new SessionSchedule(); session_info = new SessionSalesInfo(); image_items = new List <ListViewItem>(); imageList1 = new System.Windows.Forms.ImageList(); imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit; imageList1.ImageSize = new Size(80, 120); imageList1.TransparentColor = System.Drawing.Color.Transparent; imageList_small = new ImageList(); imageList_small.ColorDepth = ColorDepth.Depth32Bit; imageList_small.ImageSize = new Size(75, 90); imageList_small.TransparentColor = Color.Transparent; foreach (DataRow row in Local.session_info.images.Rows) { MemoryStream s = new MemoryStream((byte[])row["FileData"]); try { Bitmap bm; Local.imageList1.Images.Add((string)row[1], bm = new Bitmap((Stream)s)); Local.imageList_small.Images.Add((string)row[1], bm); ListViewItem lvi = new ListViewItem((string)row[1], Local.imageList1.Images.Count - 1); image_items.Add(lvi); s.Dispose(); } catch (Exception e2) { Console.WriteLine(e2.Message); } } }
public void UpdateTable(SessionSalesPages pages, SessionSalesInfo sessions, DataRow current) { this.Clear(); filling = true; if (current != null) { DataRow[] pagerows = pages.Select(null, "Page"); foreach (DataRow page in pagerows) { bool found = false; DataRow[] rows = page.GetChildRows(pages.ChildRelations[0]); DataRow myrow = NewRow(); myrow[0] = current[1]; myrow[1] = page[1]; myrow[2] = page[2]; myrow[3] = page[3]; foreach (DataRow row in rows) { DataRow session = row.GetParentRow(sessions.ChildRelations[0]); // compare session ID with stuff. if (Convert.ToInt32(session[0]) == Convert.ToInt32(current[0])) { found = true; break; } } myrow[4] = found; myrow[5] = page; Rows.Add(myrow); } } filling = false; AcceptChanges(); }
public SessionImageTable(SessionSalesInfo parent) : base("session_sales_images", false) { Columns.Add("FileName", typeof(string)); Columns.Add("FileData", typeof(byte[])); Columns.Add(parent.Columns[0].ColumnName, typeof(int)); Create(null, "UNIQUE KEY image_label('" + Columns[1].ColumnName + "')"); Fill(); }
public SessionSalesPages(SessionSalesInfo info) : base("session_sales_pages", false) { _info = info; Columns.Add("page", typeof(int)); Columns.Add("session_number", typeof(int)); Columns.Add("page_name", typeof(String)); Create(); Fill(); this.RowChanged += new DataRowChangeEventHandler(SessionSalesPages_RowChanged); }