コード例 #1
0
ファイル: Form1.cs プロジェクト: starik222/AnimeManager
 public void DeleteRecord(string name, string season)
 {
     Anime_ArchiveDataSetTableAdapters.Spisok_aTableAdapter da_spisok = new Anime_ArchiveDataSetTableAdapters.Spisok_aTableAdapter();
     Anime_ArchiveDataSetTableAdapters.files_aTableAdapter da_files = new Anime_ArchiveDataSetTableAdapters.files_aTableAdapter();
     Anime_ArchiveDataSetTableAdapters.info_aTableAdapter da_info = new Anime_ArchiveDataSetTableAdapters.info_aTableAdapter();
     int id_spisok = (int)da_spisok.GetIdByNameAndSeason(name, season);
     int id_info = (int)da_spisok.GetInfoEntry(id_spisok);
     da_files.Delete(id_spisok);
     da_info.Delete(id_info);
     da_spisok.Delete(id_spisok);
     da_files.Update(anime_ArchiveDataSet.files_a);
     da_info.Update(anime_ArchiveDataSet.info_a);
     da_spisok.Update(anime_ArchiveDataSet.Spisok_a);
 }
コード例 #2
0
ファイル: Form_add.cs プロジェクト: starik222/AnimeManager
        private void button5_Click(object sender, EventArgs e)
        {
            MemoryStream ms = new MemoryStream();
            Bitmap bmp;
            Anime_ArchiveDataSet anim_DataSet = new Anime_ArchiveDataSet();
            DataRow dr_spis = anim_DataSet.Spisok_a.NewRow();
            dr_spis["name"] = textBox1.Text;
            dr_spis["season"] = textBox5.Text;
            dr_spis["series"] = textBox3.Text;
            DataRow dr_info = anim_DataSet.info_a.NewRow();
            dr_info["Zhanr"] = GetZhanr();
            dr_info["Opisanie"] = textBox4.Text;
            bmp = new Bitmap(pictureBox1.Image);
            bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
            dr_info["img"] = ReadBytesFromImage(ms);
            dr_info["god"] = textBox2.Text;
               //  dr_info.ItemArray
            anim_DataSet.info_a.Rows.Add(dr_info);
            Anime_ArchiveDataSetTableAdapters.info_aTableAdapter info_ta = new Anime_ArchiveDataSetTableAdapters.info_aTableAdapter();
            Anime_ArchiveDataSetTableAdapters.files_aTableAdapter files_ta = new Anime_ArchiveDataSetTableAdapters.files_aTableAdapter();
            Anime_ArchiveDataSetTableAdapters.Spisok_aTableAdapter spis_ta = new Anime_ArchiveDataSetTableAdapters.Spisok_aTableAdapter();
            info_ta.Update(anim_DataSet.info_a);
            int Id_info = Convert.ToInt32(info_ta.GetLastID());
            dr_spis["info"] = Id_info;
            anim_DataSet.Spisok_a.Rows.Add(dr_spis);
            spis_ta.Update(anim_DataSet.Spisok_a);
            int id_spisok = Convert.ToInt32(spis_ta.GetLastIdForSpisok());

            for (int i = 0; i < s_video.Length; i++)
            {
                DataRow dr_files = anim_DataSet.files_a.NewRow();
                dr_files["gruppa"] = id_spisok;
                dr_files["Nomer_s"] = s_video[i].seria;
                dr_files["name_s"] = s_video[i].filename;
                dr_files["path_s"] = s_video[i].filepath;
                anim_DataSet.files_a.Rows.Add(dr_files);
            }

               // anim_DataSet.AcceptChanges();

            //    Anime_ArchiveDataSetTableAdapters.TableAdapterManager ta = new Anime_ArchiveDataSetTableAdapters.TableAdapterManager();
            //int aaa = ta.UpdateAll(anim_DataSet);
            files_ta.Update(anim_DataSet.files_a);
            if (From_all)
            {
                Form_add_all_catalog f_add_all = (Form_add_all_catalog)this.Owner;
                f_add_all.progress = true;
            }
            else
            {
                Form1 f_owner = (Form1)this.Owner;
                f_owner.LoadDataToListView();
            }

            Close();
        }