public Disk(IDBLayer idb, long id, string name, Image image, DiskType type, Box box) : base(idb, id) { this.name = name; this.image = image; this.type = type; this.box = box; }
public FormNewDisk(DisksDB.DataBase.DataBase db, DataBase.Box box) { this.box = box; InitializeComponent(); FillDrives(); this.comboBoxDiskType.DataSource = db.DiskTypes; this.controlNewCover1.FillImages(db.DiskImages); this.textBoxName.Text = box.Name; this.diskType = (DiskType)db.DiskTypes[0]; try { this.Icon = new System.Drawing.Icon(MyResources.GetStream("dvdbox.ico")); this.pictureBox1.Image = new System.Drawing.Bitmap(MyResources.GetStream("wellcomeImage.png")); } catch (Exception ex) { Logger.LogException(ex); } }
private void DiskTypeSelectedIndexChanged(object sender, EventArgs e) { this.diskType = (DiskType)this.comboBoxDiskType.SelectedItem; }
public Disk AddDisk(String name, DiskType type, Image image, string driveLetter, IAddDiskProgress prog, bool addFiles) { CheckDeleted(); Disk d = this.idb.AddDisk(name, type, image, this, driveLetter, prog, addFiles); if (d != null) { OnChildAdded(d); } return d; }
public void UpdateDisk(Disk disk, String name, DiskType type, Image image, Box box) { DBUtils.UpdateSQL(this.DBConString, "UPDATE [Disks] SET [DiskImage] = ?, [Name] = ?, [Type] = ?, [CDBox] = ?, [LastUpdate] = NOW() WHERE [id] = ?", new object[] {image.Id, name, type.Id, box.Id, disk.Id}); }
public Disk AddDisk(String name, DiskType type, Image image, Box box, String driveLetter, IAddDiskProgress prog, bool addFiles) { try { long files = 0; if (true == addFiles) { AddFolder(driveLetter, prog, true, ref files, true, null, 0, 0); } prog.Total(files); using (OleDbConnection sqlCon = new OleDbConnection(this.DBConString)) { sqlCon.Open(); OleDbTransaction sqlTran = sqlCon.BeginTransaction(); OleDbCommand sqlCmd = new OleDbCommand("INSERT INTO [Disks] ([DiskImage], [CDBox], [Name], [Type], [Description]) VALUES(?, ?, ?, ?, ?)", sqlCon, sqlTran); sqlCmd.Parameters.AddWithValue("@image", image.Id); sqlCmd.Parameters.AddWithValue("@box", box.Id); sqlCmd.Parameters.AddWithValue("@name", name); sqlCmd.Parameters.AddWithValue("@type", type.Id); sqlCmd.Parameters.AddWithValue("@desc", "/* TBD */"); sqlCmd.ExecuteNonQuery(); OleDbCommand oleCmdIdentity = new OleDbCommand("SELECT @@IDENTITY", sqlCon, sqlTran); int rez = (int)oleCmdIdentity.ExecuteScalar(); if (true == addFiles) { long diskId = rez; files = 0; prog.Started(); AddFolder(driveLetter, prog, true, ref files, false, sqlTran, -1, diskId); } sqlTran.Commit(); prog.Finished(); return new Disk(this, rez, name, image, type, box); } } catch (Exception ex) { prog.Failed(ex.Message); } return null; }