private void buttonAdd_Click(object sender, EventArgs e) { string newLocation = ""; try { if (string.IsNullOrWhiteSpace(textBoxLocation.Text)) { TextboxLocationDoubleClick(null, null); } foreach (var item in textBoxLocation.Text.Split('+').ToList()) { newLocation = ""; string[] fragment = item.Split('\\').ToArray(); if (!File.Exists(Lingkungan.getDataBaru() + fragment[fragment.Length - 1]) && db.tbInformasis.Where(x => x.Judul.ToString() == fragment[fragment.Length - 1].ToString()).FirstOrDefault() == null) { tbInformasi baru = new tbInformasi(); baru.Judul = fragment[fragment.Length - 1]; baru.Indexed = 0; baru.Lokasi = Lingkungan.getDataBaru() + fragment[fragment.Length - 1]; current.tbInformasis.Add(baru); newLocation = Lingkungan.getDataBaru() + fragment[fragment.Length - 1]; LokasilamaData.Add(item); LokasibaruData.Add(newLocation); DataBaru.Add(baru); // File.Copy(item, newLocation); // db.SubmitChanges(); // MessageBox.Show("Data " + fragment[fragment.Length - 1] + " berhasil ditambahkan"); } else { //MessageBox.Show("Data " + fragment[fragment.Length - 1] + " sudah ada"); } } } catch (Exception ex) { if (ex is FileNotFoundException) { MessageBox.Show("Masukkan data"); } else { MessageBox.Show("Error! " + ex.Message); } } finally { textBoxLocation.Text = ""; IndexChange(null, null); } }
partial void DeletetbInformasi(tbInformasi instance);
partial void InserttbInformasi(tbInformasi instance);
partial void UpdatetbInformasi(tbInformasi instance);
private void detach_tbInformasis(tbInformasi entity) { this.SendPropertyChanging(); entity.tbDomain = null; }