private void button_EXPORT_Click(object sender, EventArgs e) { if (this.checkBox_EkspALLDB.Checked == true) { StreamWriter sw = new StreamWriter(this.textBox_Path.Text); String fn_buff; String FVal; String CVal; fn_buff = "Biblioteka Filmów NET Exported data http://mkalat.pl \n\r"; sw.WriteLine(fn_buff); // Eksportuj cała baz edanych if (this.checkBox_EkspFILM.Checked == true) { fn_buff = "Podstawowe dane o Filmie : "; sw.WriteLine(fn_buff); fn_buff = ""; frm1.filmBindingSource.Position = 0; for (Int32 y = 0; y < frm1.defaultDataSet.Film.Columns.Count; y++) { CVal = Convert.ToString(frm1.defaultDataSet.Film.Columns[y].Caption); fn_buff = fn_buff + "\"" + CVal + "\"" + ","; } sw.WriteLine(fn_buff); for (Int32 i = 0; i < frm1.filmBindingSource.Count; i++) { fn_buff = ""; frm1.filmBindingSource.Position = i; defaultDataSet.FilmRow flmrow = frm1.defaultDataSet.Film[frm1.filmBindingSource.Position]; for (Int32 y = 0; y < frm1.defaultDataSet.Film.Columns.Count; y++) { FVal = Convert.ToString(flmrow[y]); FVal.Replace("\n", " "); FVal.Replace("\r", " "); fn_buff = fn_buff + "\"" + FVal + "\"" + ","; } sw.WriteLine(fn_buff); } } if (this.checkBox_EkspOB.Checked == true) { fn_buff = "Dane Tabeli Obsada : "; sw.WriteLine(fn_buff); fn_buff = ""; frm1.fKFilmObsadaBindingSource.Position = 0; for (Int32 y = 0; y < frm1.defaultDataSet.Obsada.Columns.Count; y++) { CVal = Convert.ToString(frm1.defaultDataSet.Obsada.Columns[y].Caption); fn_buff = fn_buff + "\"" + CVal + "\"" + ","; } sw.WriteLine(fn_buff); for (Int32 i = 0; i < frm1.defaultDataSet.Obsada.Count; i++) { fn_buff = ""; defaultDataSet.ObsadaRow flmrow = frm1.defaultDataSet.Obsada[i]; for (Int32 y = 0; y < frm1.defaultDataSet.Obsada.Columns.Count; y++) { FVal = Convert.ToString(flmrow[y]); FVal.Replace("\n", " "); FVal.Replace("\r", " "); fn_buff = fn_buff + "\"" + FVal + "\"" + ","; } sw.WriteLine(fn_buff); } } if (this.checkBox_EkspOC.Checked == true) { fn_buff = "Dane Tabeli Ocena : "; sw.WriteLine(fn_buff); fn_buff = ""; for (Int32 y = 0; y < frm1.defaultDataSet.Ocena.Columns.Count; y++) { CVal = Convert.ToString(frm1.defaultDataSet.Ocena.Columns[y].Caption); fn_buff = fn_buff + "\"" + CVal + "\"" + ","; } sw.WriteLine(fn_buff); for (Int32 i = 0; i < frm1.defaultDataSet.Ocena.Count; i++) { fn_buff = ""; defaultDataSet.OcenaRow flmrow = frm1.defaultDataSet.Ocena[i]; for (Int32 y = 0; y < frm1.defaultDataSet.Ocena.Columns.Count; y++) { FVal = Convert.ToString(flmrow[y]); FVal.Replace("\n", " "); FVal.Replace("\r", " "); fn_buff = fn_buff + "\"" + FVal + "\"" + ","; } sw.WriteLine(fn_buff); } } if (this.checkBox_EkspLZ.Checked == true) { fn_buff = "Dane Tabeli Lokalizacje Zdjęciowe : "; sw.WriteLine(fn_buff); fn_buff = ""; for (Int32 y = 0; y < frm1.defaultDataSet.LokZdj.Columns.Count; y++) { CVal = Convert.ToString(frm1.defaultDataSet.LokZdj.Columns[y].Caption); fn_buff = fn_buff + "\"" + CVal + "\"" + ","; } sw.WriteLine(fn_buff); for (Int32 i = 0; i < frm1.defaultDataSet.LokZdj.Count; i++) { fn_buff = ""; defaultDataSet.LokZdjRow flmrow = frm1.defaultDataSet.LokZdj[i]; for (Int32 y = 0; y < frm1.defaultDataSet.LokZdj.Columns.Count; y++) { FVal = Convert.ToString(flmrow[y]); FVal.Replace("\n", " "); FVal.Replace("\r", " "); fn_buff = fn_buff + "\"" + FVal + "\"" + ","; } sw.WriteLine(fn_buff); } } if (this.checkBox_EkspPD.Checked == true) { fn_buff = "Dane Tabel : Producenci i Dystrybutorzy : "; sw.WriteLine(fn_buff); fn_buff = ""; for (Int32 y = 0; y < frm1.defaultDataSet.Produkcja.Columns.Count; y++) { CVal = Convert.ToString(frm1.defaultDataSet.Produkcja.Columns[y].Caption); fn_buff = fn_buff + "\"" + CVal + "\"" + ","; } sw.WriteLine(fn_buff); for (Int32 i = 0; i < frm1.defaultDataSet.Produkcja.Count; i++) { fn_buff = ""; defaultDataSet.ProdukcjaRow flmrow = frm1.defaultDataSet.Produkcja[i]; for (Int32 y = 0; y < frm1.defaultDataSet.Produkcja.Columns.Count; y++) { FVal = Convert.ToString(flmrow[y]); FVal.Replace("\n", " "); FVal.Replace("\r", " "); fn_buff = fn_buff + "\"" + FVal + "\"" + ","; } sw.WriteLine(fn_buff); } fn_buff = ""; for (Int32 y = 0; y < frm1.defaultDataSet.Dystrybucja.Columns.Count; y++) { CVal = Convert.ToString(frm1.defaultDataSet.Dystrybucja.Columns[y].Caption); fn_buff = fn_buff + "\"" + CVal + "\"" + ","; } sw.WriteLine(fn_buff); for (Int32 i = 0; i < frm1.defaultDataSet.Dystrybucja.Count; i++) { fn_buff = ""; defaultDataSet.DystrybucjaRow flmrow = frm1.defaultDataSet.Dystrybucja[i]; for (Int32 y = 0; y < frm1.defaultDataSet.Dystrybucja.Columns.Count; y++) { FVal = Convert.ToString(flmrow[y]); FVal.Replace("\n", " "); FVal.Replace("\r", " "); fn_buff = fn_buff + "\"" + FVal + "\"" + ","; } sw.WriteLine(fn_buff); } } if (this.checkBox_EkspWYP.Checked == true) { fn_buff = "Dane Tabel : Wypożyczenia Innym Osobom i Wypożyczenia od Innych Osób "; sw.WriteLine(fn_buff); fn_buff = ""; for (Int32 y = 0; y < frm1.defaultDataSet.WYPIN.Columns.Count; y++) { CVal = Convert.ToString(frm1.defaultDataSet.WYPIN.Columns[y].Caption); fn_buff = fn_buff + "\"" + CVal + "\"" + ","; } sw.WriteLine(fn_buff); for (Int32 i = 0; i < frm1.defaultDataSet.WYPIN.Count; i++) { fn_buff = ""; defaultDataSet.WYPINRow flmrow = frm1.defaultDataSet.WYPIN[i]; for (Int32 y = 0; y < frm1.defaultDataSet.WYPIN.Columns.Count; y++) { FVal = Convert.ToString(flmrow[y]); FVal.Replace("\n", " "); FVal.Replace("\r", " "); fn_buff = fn_buff + "\"" + FVal + "\"" + ","; } sw.WriteLine(fn_buff); } fn_buff = ""; for (Int32 y = 0; y < frm1.defaultDataSet.WYPODIN.Columns.Count; y++) { CVal = Convert.ToString(frm1.defaultDataSet.WYPODIN.Columns[y].Caption); fn_buff = fn_buff + "\"" + CVal + "\"" + ","; } sw.WriteLine(fn_buff); for (Int32 i = 0; i < frm1.defaultDataSet.WYPODIN.Count; i++) { fn_buff = ""; defaultDataSet.WYPODINRow flmrow = frm1.defaultDataSet.WYPODIN[i]; for (Int32 y = 0; y < frm1.defaultDataSet.WYPODIN.Columns.Count; y++) { FVal = Convert.ToString(flmrow[y]); FVal.Replace("\n", " "); FVal.Replace("\r", " "); fn_buff = fn_buff + "\"" + FVal + "\"" + ","; } sw.WriteLine(fn_buff); } } sw.Close(); } else { StreamWriter sw = new StreamWriter(this.textBox_Path.Text); String fn_buff; String FVal; String CVal; if (this.checkBox_EkspFILM.Checked == true) { fn_buff = "Podstawowe dane o Filmie : "; sw.WriteLine(fn_buff); fn_buff = ""; frm1.filmBindingSource.Position = 0; for (Int32 y = 0; y < frm1.defaultDataSet.Film.Columns.Count; y++) { CVal = Convert.ToString(frm1.defaultDataSet.Film.Columns[y].Caption); fn_buff = fn_buff + "\"" + CVal + "\"" + ","; } sw.WriteLine(fn_buff); fn_buff = ""; defaultDataSet.FilmRow flmrow = frm1.defaultDataSet.Film[frm1.filmBindingSource.Position]; for (Int32 y = 0; y < frm1.defaultDataSet.Film.Columns.Count; y++) { FVal = Convert.ToString(flmrow[y]); FVal.Replace("\n", " "); FVal.Replace("\r", " "); fn_buff = fn_buff + "\"" + FVal + "\"" + ","; } sw.WriteLine(fn_buff); } if (this.checkBox_EkspOB.Checked == true) { fn_buff = "Dane Tabeli Obsada : "; sw.WriteLine(fn_buff); fn_buff = ""; frm1.fKFilmObsadaBindingSource.Position = 0; for (Int32 y = 0; y < frm1.defaultDataSet.Obsada.Columns.Count; y++) { CVal = Convert.ToString(frm1.defaultDataSet.Obsada.Columns[y].Caption); fn_buff = fn_buff + "\"" + CVal + "\"" + ","; } sw.WriteLine(fn_buff); for (Int32 i = 0; i < frm1.fKFilmObsadaBindingSource.Count; i++) { fn_buff = ""; frm1.fKFilmObsadaBindingSource.Position = i; defaultDataSet.ObsadaRow flmrow = frm1.defaultDataSet.Obsada[frm1.fKFilmObsadaBindingSource.Position]; for (Int32 y = 0; y < frm1.defaultDataSet.Obsada.Columns.Count; y++) { FVal = Convert.ToString(flmrow[y]); FVal.Replace("\n", " "); FVal.Replace("\r", " "); fn_buff = fn_buff + "\"" + FVal + "\"" + ","; } sw.WriteLine(fn_buff); } } if (this.checkBox_EkspOC.Checked == true) { fn_buff = "Dane Tabeli Ocena : "; sw.WriteLine(fn_buff); fn_buff = ""; for (Int32 y = 0; y < frm1.defaultDataSet.Ocena.Columns.Count; y++) { CVal = Convert.ToString(frm1.defaultDataSet.Ocena.Columns[y].Caption); fn_buff = fn_buff + "\"" + CVal + "\"" + ","; } sw.WriteLine(fn_buff); for (Int32 i = 0; i < frm1.fKFilmOcenaBindingSource.Count; i++) { fn_buff = ""; frm1.fKFilmOcenaBindingSource.Position = i; defaultDataSet.OcenaRow flmrow = frm1.defaultDataSet.Ocena[frm1.fKFilmOcenaBindingSource.Position]; for (Int32 y = 0; y < frm1.defaultDataSet.Ocena.Columns.Count; y++) { FVal = Convert.ToString(flmrow[y]); FVal.Replace("\n", " "); FVal.Replace("\r", " "); fn_buff = fn_buff + "\"" + FVal + "\"" + ","; } sw.WriteLine(fn_buff); } } if (this.checkBox_EkspLZ.Checked == true) { fn_buff = "Dane Tabeli Lokalizacje Zdjęciowe : "; sw.WriteLine(fn_buff); fn_buff = ""; for (Int32 y = 0; y < frm1.defaultDataSet.LokZdj.Columns.Count; y++) { CVal = Convert.ToString(frm1.defaultDataSet.LokZdj.Columns[y].Caption); fn_buff = fn_buff + "\"" + CVal + "\"" + ","; } sw.WriteLine(fn_buff); for (Int32 i = 0; i < frm1.fKFilmLokZdjBindingSource.Count; i++) { fn_buff = ""; frm1.fKFilmLokZdjBindingSource.Position = i; defaultDataSet.LokZdjRow flmrow = frm1.defaultDataSet.LokZdj[frm1.fKFilmLokZdjBindingSource.Position]; for (Int32 y = 0; y < frm1.defaultDataSet.LokZdj.Columns.Count; y++) { FVal = Convert.ToString(flmrow[y]); FVal.Replace("\n", " "); FVal.Replace("\r", " "); fn_buff = fn_buff + "\"" + FVal + "\"" + ","; } sw.WriteLine(fn_buff); } } if (this.checkBox_EkspPD.Checked == true) { fn_buff = "Dane Tabel : Producenci i Dystrybutorzy : "; sw.WriteLine(fn_buff); fn_buff = ""; for (Int32 y = 0; y < frm1.defaultDataSet.Produkcja.Columns.Count; y++) { CVal = Convert.ToString(frm1.defaultDataSet.Produkcja.Columns[y].Caption); fn_buff = fn_buff + "\"" + CVal + "\"" + ","; } sw.WriteLine(fn_buff); for (Int32 i = 0; i < frm1.fKFilmProdukcjaBindingSource.Count; i++) { fn_buff = ""; frm1.fKFilmProdukcjaBindingSource.Position = i; defaultDataSet.ProdukcjaRow flmrow = frm1.defaultDataSet.Produkcja[frm1.fKFilmProdukcjaBindingSource.Position]; for (Int32 y = 0; y < frm1.defaultDataSet.Produkcja.Columns.Count; y++) { FVal = Convert.ToString(flmrow[y]); FVal.Replace("\n", " "); FVal.Replace("\r", " "); fn_buff = fn_buff + "\"" + FVal + "\"" + ","; } sw.WriteLine(fn_buff); } fn_buff = ""; for (Int32 y = 0; y < frm1.defaultDataSet.Dystrybucja.Columns.Count; y++) { CVal = Convert.ToString(frm1.defaultDataSet.Dystrybucja.Columns[y].Caption); fn_buff = fn_buff + "\"" + CVal + "\"" + ","; } sw.WriteLine(fn_buff); for (Int32 i = 0; i < frm1.fKFilmDystrybucjaBindingSource.Count; i++) { fn_buff = ""; frm1.fKFilmDystrybucjaBindingSource.Position = i; defaultDataSet.DystrybucjaRow flmrow = frm1.defaultDataSet.Dystrybucja[frm1.fKFilmDystrybucjaBindingSource.Position]; for (Int32 y = 0; y < frm1.defaultDataSet.Dystrybucja.Columns.Count; y++) { FVal = Convert.ToString(flmrow[y]); FVal.Replace("\n", " "); FVal.Replace("\r", " "); fn_buff = fn_buff + "\"" + FVal + "\"" + ","; } sw.WriteLine(fn_buff); } } if (this.checkBox_EkspWYP.Checked == true) { fn_buff = "Dane Tabel : Wypożyczenia Innym Osobom i Wypożyczenia od Innych Osób "; sw.WriteLine(fn_buff); fn_buff = ""; for (Int32 y = 0; y < frm1.defaultDataSet.WYPIN.Columns.Count; y++) { CVal = Convert.ToString(frm1.defaultDataSet.WYPIN.Columns[y].Caption); fn_buff = fn_buff + "\"" + CVal + "\"" + ","; } sw.WriteLine(fn_buff); for (Int32 i = 0; i < frm1.fKFilmWYPINBindingSource.Count; i++) { fn_buff = ""; frm1.fKFilmWYPINBindingSource.Position = i; defaultDataSet.WYPINRow flmrow = frm1.defaultDataSet.WYPIN[frm1.fKFilmWYPINBindingSource.Position]; for (Int32 y = 0; y < frm1.defaultDataSet.WYPIN.Columns.Count; y++) { FVal = Convert.ToString(flmrow[y]); FVal.Replace("\n", " "); FVal.Replace("\r", " "); fn_buff = fn_buff + "\"" + FVal + "\"" + ","; } sw.WriteLine(fn_buff); } fn_buff = ""; for (Int32 y = 0; y < frm1.defaultDataSet.WYPODIN.Columns.Count; y++) { CVal = Convert.ToString(frm1.defaultDataSet.WYPODIN.Columns[y].Caption); fn_buff = fn_buff + "\"" + CVal + "\"" + ","; } sw.WriteLine(fn_buff); for (Int32 i = 0; i < frm1.fKFilmWYPODINBindingSource.Count; i++) { fn_buff = ""; frm1.fKFilmWYPODINBindingSource.Position = i; defaultDataSet.WYPODINRow flmrow = frm1.defaultDataSet.WYPODIN[frm1.fKFilmWYPODINBindingSource.Position]; for (Int32 y = 0; y < frm1.defaultDataSet.WYPODIN.Columns.Count; y++) { FVal = Convert.ToString(flmrow[y]); FVal.Replace("\n", " "); FVal.Replace("\r", " "); fn_buff = fn_buff + "\"" + FVal + "\"" + ","; } sw.WriteLine(fn_buff); } } sw.Close(); } MessageBox.Show("Dane zostały wyeksportowane", "Biblioteka Filmów NET", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void button_PRINT_Click(object sender, EventArgs e) { if (this.checkBox_PrintALL.Checked == true) { StreamWriter sw = new StreamWriter(fn_path); String fn_buff; String FVal; String CVal; fn_buff = "Biblioteka Filmów NET Exported data http://mkalat.pl \n\r"; sw.WriteLine(fn_buff); // Eksportuj cała baz edanych if (this.checkBox_PrintFilm.Checked == true) { fn_buff = "Podstawowe dane o Filmie : "; sw.WriteLine(fn_buff); for (Int32 i = 0; i < frm1.filmBindingSource.Count; i++) { frm1.filmBindingSource.Position = i; defaultDataSet.FilmRow flmrow = frm1.defaultDataSet.Film[frm1.filmBindingSource.Position]; for (Int32 y = 0; y < frm1.defaultDataSet.Film.Columns.Count; y++) { CVal = Convert.ToString(frm1.defaultDataSet.Film.Columns[y].Caption); FVal = Convert.ToString(flmrow[y]); fn_buff = CVal + " : " + FVal; sw.WriteLine(fn_buff); } } } if (this.checkBox_PrintOB.Checked == true) { fn_buff = "Dane Tabeli Obsada : "; sw.WriteLine(fn_buff); for (Int32 i = 0; i < frm1.fKFilmObsadaBindingSource.Count; i++) { frm1.fKFilmObsadaBindingSource.Position = i; defaultDataSet.ObsadaRow flmrow = frm1.defaultDataSet.Obsada[frm1.fKFilmObsadaBindingSource.Position]; for (Int32 y = 0; y < frm1.defaultDataSet.Obsada.Columns.Count; y++) { CVal = Convert.ToString(frm1.defaultDataSet.Obsada.Columns[y].Caption); FVal = Convert.ToString(flmrow[y]); fn_buff = CVal + " : " + FVal; sw.WriteLine(fn_buff); } } } if (this.checkBox_PrintOC.Checked == true) { fn_buff = "Dane Tabeli Ocena : "; sw.WriteLine(fn_buff); for (Int32 i = 0; i < frm1.fKFilmOcenaBindingSource.Count; i++) { frm1.fKFilmOcenaBindingSource.Position = i; defaultDataSet.OcenaRow flmrow = frm1.defaultDataSet.Ocena[frm1.fKFilmOcenaBindingSource.Position]; for (Int32 y = 0; y < frm1.defaultDataSet.Ocena.Columns.Count; y++) { CVal = Convert.ToString(frm1.defaultDataSet.Ocena.Columns[y].Caption); FVal = Convert.ToString(flmrow[y]); fn_buff = CVal + " : " + FVal; sw.WriteLine(fn_buff); } } } if (this.checkBox_PrintP.Checked == true) { fn_buff = "Dane Tabeli Producenci : "; sw.WriteLine(fn_buff); for (Int32 i = 0; i < frm1.fKFilmProdukcjaBindingSource.Count; i++) { frm1.fKFilmProdukcjaBindingSource.Position = i; defaultDataSet.ProdukcjaRow flmrow = frm1.defaultDataSet.Produkcja[frm1.fKFilmProdukcjaBindingSource.Position]; for (Int32 y = 0; y < frm1.defaultDataSet.Produkcja.Columns.Count; y++) { CVal = Convert.ToString(frm1.defaultDataSet.Produkcja.Columns[y].Caption); FVal = Convert.ToString(flmrow[y]); fn_buff = CVal + " : " + FVal; sw.WriteLine(fn_buff); } } } if (this.checkBox_PrintD.Checked == true) { fn_buff = "Dane Tabeli Dystrybutorzy : "; sw.WriteLine(fn_buff); for (Int32 i = 0; i < frm1.fKFilmDystrybucjaBindingSource.Count; i++) { frm1.fKFilmDystrybucjaBindingSource.Position = i; defaultDataSet.DystrybucjaRow flmrow = frm1.defaultDataSet.Dystrybucja[frm1.fKFilmDystrybucjaBindingSource.Position]; for (Int32 y = 0; y < frm1.defaultDataSet.Dystrybucja.Columns.Count; y++) { CVal = Convert.ToString(frm1.defaultDataSet.Dystrybucja.Columns[y].Caption); FVal = Convert.ToString(flmrow[y]); fn_buff = CVal + " : " + FVal; sw.WriteLine(fn_buff); } } } if (this.checkBox_PrintLZ.Checked == true) { fn_buff = "Dane Tabeli Lokalizacje Zdjęciowe : "; sw.WriteLine(fn_buff); for (Int32 i = 0; i < frm1.fKFilmLokZdjBindingSource.Count; i++) { frm1.fKFilmLokZdjBindingSource.Position = i; defaultDataSet.LokZdjRow flmrow = frm1.defaultDataSet.LokZdj[frm1.fKFilmLokZdjBindingSource.Position]; for (Int32 y = 0; y < frm1.defaultDataSet.LokZdj.Columns.Count; y++) { CVal = Convert.ToString(frm1.defaultDataSet.LokZdj.Columns[y].Caption); FVal = Convert.ToString(flmrow[y]); fn_buff = CVal + " : " + FVal; sw.WriteLine(fn_buff); } } } if (this.checkBox_PrintWYP.Checked == true) { fn_buff = "Dane Tabeli Wypożyczenia Innym Osobom : "; sw.WriteLine(fn_buff); for (Int32 i = 0; i < frm1.fKFilmWYPINBindingSource.Count; i++) { frm1.fKFilmWYPINBindingSource.Position = i; defaultDataSet.WYPINRow flmrow = frm1.defaultDataSet.WYPIN[frm1.fKFilmWYPINBindingSource.Position]; for (Int32 y = 0; y < frm1.defaultDataSet.WYPIN.Columns.Count; y++) { CVal = Convert.ToString(frm1.defaultDataSet.WYPIN.Columns[y].Caption); FVal = Convert.ToString(flmrow[y]); fn_buff = CVal + " : " + FVal; sw.WriteLine(fn_buff); } } fn_buff = "Dane Tabeli Wypożyczenia Od Innych Osób : "; sw.WriteLine(fn_buff); for (Int32 i = 0; i < frm1.fKFilmWYPODINBindingSource.Count; i++) { frm1.fKFilmWYPODINBindingSource.Position = i; defaultDataSet.WYPODINRow flmrow = frm1.defaultDataSet.WYPODIN[frm1.fKFilmWYPODINBindingSource.Position]; for (Int32 y = 0; y < frm1.defaultDataSet.WYPODIN.Columns.Count; y++) { CVal = Convert.ToString(frm1.defaultDataSet.WYPODIN.Columns[y].Caption); FVal = Convert.ToString(flmrow[y]); fn_buff = CVal + " : " + FVal; sw.WriteLine(fn_buff); } } } sw.Close(); System.Drawing.Printing.PrintDocument docToPrint = new System.Drawing.Printing.PrintDocument(); PrintDialog prndial = new PrintDialog(); prndial.AllowSomePages = false; prndial.ShowHelp = true; prndial.Document = docToPrint; DialogResult res = prndial.ShowDialog(); if (res == DialogResult.OK) { docToPrint.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.document_PrintPage); docToPrint.Print(); } } else { StreamWriter sw = new StreamWriter(fn_path); String fn_buff; String FVal; String CVal; fn_buff = "Biblioteka Filmów NET Exported data http://mkalat.pl \n\r"; sw.WriteLine(fn_buff); // Eksportuj cała baz edanych if (this.checkBox_PrintFilm.Checked == true) { fn_buff = "Podstawowe dane o Filmie : "; sw.WriteLine(fn_buff); defaultDataSet.FilmRow flmrow = frm1.defaultDataSet.Film[frm1.filmBindingSource.Position]; for (Int32 y = 0; y < frm1.defaultDataSet.Film.Columns.Count; y++) { CVal = Convert.ToString(frm1.defaultDataSet.Film.Columns[y].Caption); FVal = Convert.ToString(flmrow[y]); fn_buff = CVal + " : " + FVal; sw.WriteLine(fn_buff); } } if (this.checkBox_PrintOB.Checked == true) { fn_buff = "Dane Tabeli Obsada : "; sw.WriteLine(fn_buff); for (Int32 i = 0; i < frm1.fKFilmObsadaBindingSource.Count; i++) { frm1.fKFilmObsadaBindingSource.Position = i; defaultDataSet.ObsadaRow flmrow = frm1.defaultDataSet.Obsada[frm1.fKFilmObsadaBindingSource.Position]; for (Int32 y = 0; y < frm1.defaultDataSet.Obsada.Columns.Count; y++) { CVal = Convert.ToString(frm1.defaultDataSet.Obsada.Columns[y].Caption); FVal = Convert.ToString(flmrow[y]); fn_buff = CVal + " : " + FVal; sw.WriteLine(fn_buff); } } } if (this.checkBox_PrintOC.Checked == true) { fn_buff = "Dane Tabeli Ocena : "; sw.WriteLine(fn_buff); for (Int32 i = 0; i < frm1.fKFilmOcenaBindingSource.Count; i++) { frm1.fKFilmOcenaBindingSource.Position = i; defaultDataSet.OcenaRow flmrow = frm1.defaultDataSet.Ocena[frm1.fKFilmOcenaBindingSource.Position]; for (Int32 y = 0; y < frm1.defaultDataSet.Ocena.Columns.Count; y++) { CVal = Convert.ToString(frm1.defaultDataSet.Ocena.Columns[y].Caption); FVal = Convert.ToString(flmrow[y]); fn_buff = CVal + " : " + FVal; sw.WriteLine(fn_buff); } } } if (this.checkBox_PrintP.Checked == true) { fn_buff = "Dane Tabeli Producenci : "; sw.WriteLine(fn_buff); for (Int32 i = 0; i < frm1.fKFilmProdukcjaBindingSource.Count; i++) { frm1.fKFilmProdukcjaBindingSource.Position = i; defaultDataSet.ProdukcjaRow flmrow = frm1.defaultDataSet.Produkcja[frm1.fKFilmProdukcjaBindingSource.Position]; for (Int32 y = 0; y < frm1.defaultDataSet.Produkcja.Columns.Count; y++) { CVal = Convert.ToString(frm1.defaultDataSet.Produkcja.Columns[y].Caption); FVal = Convert.ToString(flmrow[y]); fn_buff = CVal + " : " + FVal; sw.WriteLine(fn_buff); } } } if (this.checkBox_PrintD.Checked == true) { fn_buff = "Dane Tabeli Dystrybutorzy : "; sw.WriteLine(fn_buff); for (Int32 i = 0; i < frm1.fKFilmDystrybucjaBindingSource.Count; i++) { frm1.fKFilmDystrybucjaBindingSource.Position = i; defaultDataSet.DystrybucjaRow flmrow = frm1.defaultDataSet.Dystrybucja[frm1.fKFilmDystrybucjaBindingSource.Position]; for (Int32 y = 0; y < frm1.defaultDataSet.Dystrybucja.Columns.Count; y++) { CVal = Convert.ToString(frm1.defaultDataSet.Dystrybucja.Columns[y].Caption); FVal = Convert.ToString(flmrow[y]); fn_buff = CVal + " : " + FVal; sw.WriteLine(fn_buff); } } } if (this.checkBox_PrintLZ.Checked == true) { fn_buff = "Dane Tabeli Lokalizacje Zdjęciowe : "; sw.WriteLine(fn_buff); for (Int32 i = 0; i < frm1.fKFilmLokZdjBindingSource.Count; i++) { frm1.fKFilmLokZdjBindingSource.Position = i; defaultDataSet.LokZdjRow flmrow = frm1.defaultDataSet.LokZdj[frm1.fKFilmLokZdjBindingSource.Position]; for (Int32 y = 0; y < frm1.defaultDataSet.LokZdj.Columns.Count; y++) { CVal = Convert.ToString(frm1.defaultDataSet.LokZdj.Columns[y].Caption); FVal = Convert.ToString(flmrow[y]); fn_buff = CVal + " : " + FVal; sw.WriteLine(fn_buff); } } } if (this.checkBox_PrintWYP.Checked == true) { fn_buff = "Dane Tabeli Wypożyczenia Innym Osobom : "; sw.WriteLine(fn_buff); for (Int32 i = 0; i < frm1.fKFilmWYPINBindingSource.Count; i++) { frm1.fKFilmWYPINBindingSource.Position = i; defaultDataSet.WYPINRow flmrow = frm1.defaultDataSet.WYPIN[frm1.fKFilmWYPINBindingSource.Position]; for (Int32 y = 0; y < frm1.defaultDataSet.WYPIN.Columns.Count; y++) { CVal = Convert.ToString(frm1.defaultDataSet.WYPIN.Columns[y].Caption); FVal = Convert.ToString(flmrow[y]); fn_buff = CVal + " : " + FVal; sw.WriteLine(fn_buff); } } fn_buff = "Dane Tabeli Wypożyczenia Od Innych Osób : "; sw.WriteLine(fn_buff); for (Int32 i = 0; i < frm1.fKFilmWYPODINBindingSource.Count; i++) { frm1.fKFilmWYPODINBindingSource.Position = i; defaultDataSet.WYPODINRow flmrow = frm1.defaultDataSet.WYPODIN[frm1.fKFilmWYPODINBindingSource.Position]; for (Int32 y = 0; y < frm1.defaultDataSet.WYPODIN.Columns.Count; y++) { CVal = Convert.ToString(frm1.defaultDataSet.WYPODIN.Columns[y].Caption); FVal = Convert.ToString(flmrow[y]); fn_buff = CVal + " : " + FVal; sw.WriteLine(fn_buff); } } } sw.Close(); System.Drawing.Printing.PrintDocument docToPrint = new System.Drawing.Printing.PrintDocument(); PrintDialog prndial = new PrintDialog(); prndial.AllowSomePages = false; prndial.ShowHelp = true; prndial.Document = docToPrint; DialogResult res = prndial.ShowDialog(); if (res == DialogResult.OK) { docToPrint.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.document_PrintPage); docToPrint.Print(); } } }
private void button_Start_Click(object sender, EventArgs e) { if (File.Exists(this.textBox_SelPath.Text)) { this.wYPODINTableAdapter.Connection.ConnectionString = "Data Source=" + this.textBox_SelPath.Text + ";Max Database Size=4091"; this.wYPINTableAdapter.Connection.ConnectionString = "Data Source=" + this.textBox_SelPath.Text + ";Max Database Size=4091"; this.lokZdjTableAdapter.Connection.ConnectionString = "Data Source=" + this.textBox_SelPath.Text + ";Max Database Size=4091"; this.dystrybucjaTableAdapter.Connection.ConnectionString = "Data Source=" + this.textBox_SelPath.Text + ";Max Database Size=4091"; this.produkcjaTableAdapter.Connection.ConnectionString = "Data Source=" + this.textBox_SelPath.Text + ";Max Database Size=4091"; this.obsadaTableAdapter.Connection.ConnectionString = "Data Source=" + this.textBox_SelPath.Text + ";Max Database Size=4091"; this.ocenaTableAdapter.Connection.ConnectionString = "Data Source=" + this.textBox_SelPath.Text + ";Max Database Size=4091"; this.filmTableAdapter.Connection.ConnectionString = "Data Source=" + this.textBox_SelPath.Text + ";Max Database Size=4091"; this.wYPODINTableAdapter.Connection.Open(); this.wYPINTableAdapter.Connection.Open(); this.lokZdjTableAdapter.Connection.Open(); this.dystrybucjaTableAdapter.Connection.Open(); this.produkcjaTableAdapter.Connection.Open(); this.obsadaTableAdapter.Connection.Open(); this.ocenaTableAdapter.Connection.Open(); this.filmTableAdapter.Connection.Open(); this.wYPODINTableAdapter.Fill(this.defaultDataSet.WYPODIN); this.wYPINTableAdapter.Fill(this.defaultDataSet.WYPIN); this.lokZdjTableAdapter.Fill(this.defaultDataSet.LokZdj); this.dystrybucjaTableAdapter.Fill(this.defaultDataSet.Dystrybucja); this.produkcjaTableAdapter.Fill(this.defaultDataSet.Produkcja); this.obsadaTableAdapter.Fill(this.defaultDataSet.Obsada); this.ocenaTableAdapter.Fill(this.defaultDataSet.Ocena); this.filmTableAdapter.Fill(this.defaultDataSet.Film); //FILM foreach (defaultDataSet.FilmRow flm_src in this.defaultDataSet.Film.Rows) { flm_row = frm1.defaultDataSet.Film.NewFilmRow(); flm_row.Tytul = flm_src.Tytul; flm_row.TytulOrig = flm_src.TytulOrig; flm_row.Gatunek = flm_src.Gatunek; flm_row.pathtofront = flm_src.pathtofront; flm_row.pathtoback = flm_src.pathtoback; flm_row.OW_SD = flm_src.OW_SD; flm_row.OW_Obs = flm_src.OW_Obs; flm_row.OW_Zdj = flm_src.OW_Zdj; flm_row.OW_Wart = flm_src.OW_Wart; flm_row.OW_ALL = flm_src.OW_ALL; flm_row.DOE_Cena = flm_src.DOE_Cena; flm_row.DOE_WartAkt = flm_src.DOE_WartAkt; flm_row.DOE_DataZak = flm_src.DOE_DataZak; flm_row.DOE_DataUtr = flm_src.DOE_DataUtr; flm_row.DOE_DataSkat = flm_src.DOE_DataSkat; flm_row.DOE_Nośnik = flm_src.DOE_Nośnik; flm_row.DOE_NrKat = flm_src.DOE_NrKat; flm_row.DOE_Imie = flm_src.DOE_Imie; flm_row.DOE_Nazw = flm_src.DOE_Nazw; flm_row.DOE_Adres = flm_src.DOE_Adres; flm_row.DOE_MN_Nazwa = flm_src.DOE_MN_Nazwa; flm_row.DOE_MN_Adres = flm_src.DOE_MN_Adres; flm_row.DOE_MN_Tel = flm_src.DOE_MN_Tel; flm_row.DOE_MN_Email = flm_src.DOE_MN_Email; flm_row.DOE_MN_WWW = flm_src.DOE_MN_WWW; flm_row.DOE_MN_Fax = flm_src.DOE_MN_Fax; flm_row.IOF_RokProd = flm_src.IOF_RokProd; flm_row.IOF_DataPrem = flm_src.IOF_DataPrem; flm_row.IOF_CzasProj = flm_src.IOF_CzasProj; flm_row.IOF_JezykLekt = flm_src.IOF_JezykLekt; flm_row.IOF_JezykNap = flm_src.IOF_JezykNap; flm_row.IOF_FormWysw = flm_src.IOF_FormWysw; flm_row.IOF_SysKodObr = flm_src.IOF_SysKodObr; flm_row.IOF_KrajProd = flm_src.IOF_KrajProd; flm_row.IOF_KW_Nazwa = flm_src.IOF_KW_Nazwa; flm_row.IOF_KW_Typ = flm_src.IOF_KW_Typ; flm_row.IOF_KW_Wersja = flm_src.IOF_KW_Wersja; flm_row.IOF_ZAB_Nazwa = flm_src.IOF_ZAB_Nazwa; flm_row.IOF_ZAB_Typ = flm_src.IOF_ZAB_Typ; flm_row.IOF_ZAB_Wersja = flm_src.IOF_ZAB_Wersja; flm_row.IOF_KA_Nazwa = flm_src.IOF_KA_Nazwa; flm_row.IOF_KA_Typ = flm_src.IOF_KA_Typ; flm_row.IOF_KA_Wersja = flm_src.IOF_KA_Wersja; frm1.defaultDataSet.Film.Rows.Add(flm_row); Save_DS(); Flm_id = frm1.FindNewFilmID() - 1; foreach (defaultDataSet.OcenaRow oc_src in this.defaultDataSet.Ocena.Rows) { if (flm_src.ID == oc_src.IDPDB) { defaultDataSet.OcenaRow oc_row = frm1.defaultDataSet.Ocena.NewOcenaRow(); oc_row.IDPDB = Flm_id; oc_row.Nazwa = oc_src.Nazwa; oc_row.Tytul = oc_src.Tytul; oc_row.Autor = oc_src.Autor; oc_row.WWW = oc_src.WWW; oc_row.Ocena = oc_src.Ocena; frm1.defaultDataSet.Ocena.Rows.Add(oc_row); Save_DS(); } } foreach (defaultDataSet.ObsadaRow ob_src in this.defaultDataSet.Obsada.Rows) { if (flm_src.ID == ob_src.IDPDB) { defaultDataSet.ObsadaRow ob_row = frm1.defaultDataSet.Obsada.NewObsadaRow(); ob_row.IDPDB = Flm_id; ob_row.ImieNazw = ob_src.ImieNazw; ob_row.Rola = ob_src.Rola; frm1.defaultDataSet.Obsada.Rows.Add(ob_row); Save_DS(); } } foreach (defaultDataSet.ProdukcjaRow pp_src in this.defaultDataSet.Produkcja.Rows) { if (flm_src.ID == pp_src.IDPDB) { defaultDataSet.ProdukcjaRow pp_row = frm1.defaultDataSet.Produkcja.NewProdukcjaRow(); pp_row.IDPDB = Flm_id; pp_row.Nazwa = pp_src.Nazwa; pp_row.Adres = pp_src.Adres; pp_row.Tel = pp_src.Tel; pp_row.Fax = pp_src.Fax; pp_row.Email = pp_src.Email; pp_row.WWW = pp_src.WWW; pp_row.Narodowość = pp_src.Narodowość; frm1.defaultDataSet.Produkcja.Rows.Add(pp_row); Save_DS(); } } foreach (defaultDataSet.DystrybucjaRow pd_src in this.defaultDataSet.Dystrybucja.Rows) { if (flm_src.ID == pd_src.IDPDB) { defaultDataSet.DystrybucjaRow pd_row = frm1.defaultDataSet.Dystrybucja.NewDystrybucjaRow(); pd_row.IDPDB = Flm_id; pd_row.Nazwa = pd_src.Nazwa; pd_row.Adres = pd_src.Adres; pd_row.Tel = pd_src.Tel; pd_row.Fax = pd_src.Fax; pd_row.Email = pd_src.Email; pd_row.WWW = pd_src.WWW; pd_row.Narodowość = pd_src.Narodowość; frm1.defaultDataSet.Dystrybucja.Rows.Add(pd_row); Save_DS(); } } foreach (defaultDataSet.LokZdjRow lz_src in this.defaultDataSet.LokZdj.Rows) { if (flm_src.ID == lz_src.IDPDB) { defaultDataSet.LokZdjRow lz_row = frm1.defaultDataSet.LokZdj.NewLokZdjRow(); lz_row.IDPDB = Flm_id; lz_row.NazwaObiektu = lz_src.NazwaObiektu; lz_row.Kraj = lz_src.Kraj; lz_row.Miejscowość = lz_src.Miejscowość; lz_row.Region = lz_src.Region; lz_row.Pora_roku = lz_src.Pora_roku; lz_row.Data = lz_src.Data; //br_lz.ReadBytes(2); frm1.defaultDataSet.LokZdj.Rows.Add(lz_row); Save_DS(); } } foreach (defaultDataSet.WYPINRow wi_src in this.defaultDataSet.WYPIN.Rows) { if (flm_src.ID == wi_src.IDPDB) { defaultDataSet.WYPINRow wi_row = frm1.defaultDataSet.WYPIN.NewWYPINRow(); wi_row.IDPDB = Flm_id; wi_row.DataWyp = wi_src.DataWyp; wi_row.DataOdd = wi_src.DataOdd; wi_row.StanPWyp = wi_src.StanPWyp; wi_row.StanPOdd = wi_src.StanPOdd; wi_row.Osoba = wi_src.Osoba; frm1.defaultDataSet.WYPIN.Rows.Add(wi_row); Save_DS(); } } foreach (defaultDataSet.WYPODINRow wo_src in this.defaultDataSet.WYPODIN.Rows) { if (flm_src.ID == wo_src.IDPDB) { defaultDataSet.WYPODINRow wo_row = frm1.defaultDataSet.WYPODIN.NewWYPODINRow(); wo_row.IDPDB = Flm_id; wo_row.DataWyp = wo_src.DataWyp; wo_row.DataOdd = wo_src.DataOdd; wo_row.StanPWyp = wo_src.StanPWyp; wo_row.StanPOdd = wo_src.StanPOdd; wo_row.Osoba = wo_src.Osoba; frm1.defaultDataSet.WYPODIN.Rows.Add(wo_row); Save_DS(); } } } Save_DS(); MessageBox.Show("Dane zostały zaimportowane zgodnie z ustawieniami", "Biblioteka Filmów NET", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void button_IMP_Click(object sender, EventArgs e) { if (this.textBox_SelPath.Text != "") { if (this.checkBox_Film.Checked == true) { FileStream fn_film; Byte[] unibyte; if (File.Exists(this.textBox_SelPath.Text + "\\" + "BF_PDB.bf")) { fn_film = File.OpenRead(this.textBox_SelPath.Text + "\\" + "BF_PDB.bf"); BinaryReader br = new BinaryReader(fn_film, Encoding.Unicode); if (fn_film.Length > 0) { do { int flm_id = br.ReadInt32(); //Flm_id = frm1.FindNewFilmID(); flm_row = frm1.defaultDataSet.Film.NewFilmRow(); //flm_row.ID = Flm_id; flm_row.Tytul = Strymuj(Encoding.Unicode.GetString(br.ReadBytes(2 * 501))); flm_row.TytulOrig = Strymuj(Encoding.Unicode.GetString(br.ReadBytes(2 * 501))); flm_row.Gatunek = Strymuj(Encoding.Unicode.GetString(br.ReadBytes(2 * 201))); String path_pic = Strymuj(Encoding.Unicode.GetString(br.ReadBytes(2 * 241))); if (this.checkBox_Okl.Checked == true) { if (GetFileName(path_pic).Length > 0) { if (File.Exists(path_pic)) { File.Copy(path_pic, Form1.db_path + "covers" + GetFileName(path_pic), true); flm_row.pathtofront = Form1.db_path + "covers" + GetFileName(path_pic); } } } path_pic = Strymuj(Encoding.Unicode.GetString(br.ReadBytes(2 * 241))); if (this.checkBox_Okl.Checked == true) { if (GetFileName(path_pic).Length > 0) { if (File.Exists(path_pic)) { File.Copy(path_pic, Form1.db_path + "covers" + GetFileName(path_pic), true); flm_row.pathtoback = Form1.db_path + "covers" + GetFileName(path_pic); } } } flm_row.OW_SD = Strymuj(Encoding.Unicode.GetString(br.ReadBytes(2 * 201))); flm_row.OW_Obs = Strymuj(Encoding.Unicode.GetString(br.ReadBytes(2 * 201))); flm_row.OW_Zdj = Strymuj(Encoding.Unicode.GetString(br.ReadBytes(2 * 201))); flm_row.OW_Wart = Strymuj(Encoding.Unicode.GetString(br.ReadBytes(2 * 201))); flm_row.OW_ALL = Strymuj(Encoding.Unicode.GetString(br.ReadBytes(2 * 201))); br.ReadBytes((8 * 2 * 501)); flm_row.DOE_Cena = Strymuj(Encoding.Unicode.GetString(br.ReadBytes(2 * 101))); flm_row.DOE_WartAkt = Strymuj(Encoding.Unicode.GetString(br.ReadBytes(2 * 101))); flm_row.DOE_DataZak = Strymuj(Encoding.Unicode.GetString(br.ReadBytes(2 * 21))); flm_row.DOE_DataUtr = Strymuj(Encoding.Unicode.GetString(br.ReadBytes(2 * 21))); flm_row.DOE_DataSkat = Strymuj(Encoding.Unicode.GetString(br.ReadBytes(2 * 21))); flm_row.DOE_Nośnik = Strymuj(Encoding.Unicode.GetString(br.ReadBytes(2 * 201))); flm_row.DOE_NrKat = Strymuj(Encoding.Unicode.GetString(br.ReadBytes(2 * 501))); flm_row.DOE_Imie = Strymuj(Encoding.Unicode.GetString(br.ReadBytes(2 * 501))); flm_row.DOE_Nazw = Strymuj(Encoding.Unicode.GetString(br.ReadBytes(2 * 501))); flm_row.DOE_Adres = Strymuj(Encoding.Unicode.GetString(br.ReadBytes(2 * 501))); flm_row.DOE_MN_Nazwa = Strymuj(Encoding.Unicode.GetString(br.ReadBytes(2 * 501))); flm_row.DOE_MN_Adres = Strymuj(Encoding.Unicode.GetString(br.ReadBytes(2 * 501))); flm_row.DOE_MN_Tel = Strymuj(Encoding.Unicode.GetString(br.ReadBytes(2 * 31))); flm_row.DOE_MN_Email = Strymuj(Encoding.Unicode.GetString(br.ReadBytes(2 * 201))); flm_row.DOE_MN_WWW = Strymuj(Encoding.Unicode.GetString(br.ReadBytes(2 * 501))); flm_row.DOE_MN_Fax = Strymuj(Encoding.Unicode.GetString(br.ReadBytes(2 * 31))); flm_row.IOF_RokProd = Strymuj(Encoding.Unicode.GetString(br.ReadBytes(2 * 21))); flm_row.IOF_DataPrem = Strymuj(Encoding.Unicode.GetString(br.ReadBytes(2 * 21))); flm_row.IOF_CzasProj = Strymuj(Encoding.Unicode.GetString(br.ReadBytes(2 * 51))); flm_row.IOF_JezykLekt = Strymuj(Encoding.Unicode.GetString(br.ReadBytes(2 * 1001))); flm_row.IOF_JezykNap = Strymuj(Encoding.Unicode.GetString(br.ReadBytes(2 * 1001))); flm_row.IOF_FormWysw = Strymuj(Encoding.Unicode.GetString(br.ReadBytes(2 * 51))); flm_row.IOF_SysKodObr = Strymuj(Encoding.Unicode.GetString(br.ReadBytes(2 * 51))); flm_row.IOF_KrajProd = Strymuj(Encoding.Unicode.GetString(br.ReadBytes(2 * 1001))); flm_row.IOF_KW_Nazwa = Strymuj(Encoding.Unicode.GetString(br.ReadBytes(2 * 201))); flm_row.IOF_KW_Typ = Strymuj(Encoding.Unicode.GetString(br.ReadBytes(2 * 201))); flm_row.IOF_KW_Wersja = Strymuj(Encoding.Unicode.GetString(br.ReadBytes(2 * 201))); flm_row.IOF_ZAB_Nazwa = Strymuj(Encoding.Unicode.GetString(br.ReadBytes(2 * 201))); flm_row.IOF_ZAB_Typ = Strymuj(Encoding.Unicode.GetString(br.ReadBytes(2 * 201))); flm_row.IOF_ZAB_Wersja = Strymuj(Encoding.Unicode.GetString(br.ReadBytes(2 * 201))); flm_row.IOF_KA_Nazwa = Strymuj(Encoding.Unicode.GetString(br.ReadBytes(2 * 201))); flm_row.IOF_KA_Typ = Strymuj(Encoding.Unicode.GetString(br.ReadBytes(2 * 201))); flm_row.IOF_KA_Wersja = Strymuj(Encoding.Unicode.GetString(br.ReadBytes(2 * 201))); br.ReadBytes(2); if (this.checkBox_Okl.Checked == true) { if (flm_row.pathtofront != "") { String fn_pic; fn_pic = GetFileName(flm_row.pathtofront); File.Copy(this.textBox_SelPath.Text + "\\covers\\" + fn_pic, Form1.db_path + "\\covers\\" + fn_pic, true); } if (flm_row.pathtoback != "") { String fn_pic; fn_pic = GetFileName(flm_row.pathtoback); File.Copy(this.textBox_SelPath.Text + "\\covers\\" + fn_pic, Form1.db_path + "\\covers\\" + fn_pic, true); } frm1.defaultDataSet.Film.Rows.Add(flm_row); Save_DS(); } else { frm1.defaultDataSet.Film.Rows.Add(flm_row); Save_DS(); } if (this.checkBox_OC.Checked == true) { if (File.Exists(this.textBox_SelPath.Text + "\\" + "BF_OC.bf")) { Flm_id = frm1.FindNewFilmID() - 1; FileStream fn_OC; fn_OC = File.OpenRead(this.textBox_SelPath.Text + "\\" + "BF_OC.bf"); BinaryReader br_oc = new BinaryReader(fn_OC, Encoding.Unicode); if (fn_OC.Length > 0) { do { br_oc.ReadInt32(); int oc_idpdb = br_oc.ReadInt32(); if (oc_idpdb == flm_id) { defaultDataSet.OcenaRow oc_row = frm1.defaultDataSet.Ocena.NewOcenaRow(); oc_row.IDPDB = Flm_id; oc_row.Nazwa = Strymuj(Encoding.Unicode.GetString(br_oc.ReadBytes(2 * 201))); oc_row.Tytul = Strymuj(Encoding.Unicode.GetString(br_oc.ReadBytes(2 * 201))); oc_row.Autor = Strymuj(Encoding.Unicode.GetString(br_oc.ReadBytes(2 * 201))); oc_row.WWW = Strymuj(Encoding.Unicode.GetString(br_oc.ReadBytes(2 * 501))); oc_row.Ocena = Strymuj(Encoding.Unicode.GetString(br_oc.ReadBytes(2 * 201))); frm1.defaultDataSet.Ocena.Rows.Add(oc_row); Save_DS(); br_oc.ReadBytes(2); } else { br_oc.ReadBytes((2 * 501) + (2 * 201) + (2 * 201) + (2 * 201) + (2 * 201) + 2); } } while (fn_OC.Position < fn_OC.Length); } fn_OC.Close(); } } if (this.checkBox_OB.Checked == true) { if (File.Exists(this.textBox_SelPath.Text + "\\" + "BF_OB.bf")) { Flm_id = frm1.FindNewFilmID() - 1; FileStream fn_OB; fn_OB = File.OpenRead(this.textBox_SelPath.Text + "\\" + "BF_OB.bf"); BinaryReader br_ob = new BinaryReader(fn_OB, Encoding.Unicode); if (fn_OB.Length > 0) { do { br_ob.ReadInt32(); int ob_idpdb = br_ob.ReadInt32(); if (ob_idpdb == flm_id) { defaultDataSet.ObsadaRow ob_row = frm1.defaultDataSet.Obsada.NewObsadaRow(); ob_row.IDPDB = Flm_id; ob_row.ImieNazw = Strymuj(Encoding.Unicode.GetString(br_ob.ReadBytes(2 * 501))); ob_row.Rola = Strymuj(Encoding.Unicode.GetString(br_ob.ReadBytes(2 * 201))); frm1.defaultDataSet.Obsada.Rows.Add(ob_row); Save_DS(); } else { br_ob.ReadBytes((2 * 501) + (2 * 201)); } } while (fn_OB.Position < fn_OB.Length); } fn_OB.Close(); } } if (this.checkBox_PP.Checked == true) { if (File.Exists(this.textBox_SelPath.Text + "\\" + "BF_PRB.bf")) { Flm_id = frm1.FindNewFilmID() - 1; FileStream fn_PP; fn_PP = File.OpenRead(this.textBox_SelPath.Text + "\\" + "BF_PRB.bf"); BinaryReader br_pp = new BinaryReader(fn_PP, Encoding.Unicode); if (fn_PP.Length > 0) { do { br_pp.ReadInt32(); int pp_idpdb = br_pp.ReadInt32(); if (pp_idpdb == flm_id) { defaultDataSet.ProdukcjaRow pp_row = frm1.defaultDataSet.Produkcja.NewProdukcjaRow(); pp_row.IDPDB = Flm_id; pp_row.Nazwa = Strymuj(Encoding.Unicode.GetString(br_pp.ReadBytes(2 * 501))); pp_row.Adres = Strymuj(Encoding.Unicode.GetString(br_pp.ReadBytes(2 * 501))); pp_row.Tel = Strymuj(Encoding.Unicode.GetString(br_pp.ReadBytes(2 * 31))); pp_row.Fax = Strymuj(Encoding.Unicode.GetString(br_pp.ReadBytes(2 * 31))); pp_row.Email = Strymuj(Encoding.Unicode.GetString(br_pp.ReadBytes(2 * 201))); pp_row.WWW = Strymuj(Encoding.Unicode.GetString(br_pp.ReadBytes(2 * 501))); pp_row.Narodowość = Strymuj(Encoding.Unicode.GetString(br_pp.ReadBytes(2 * 201))); frm1.defaultDataSet.Produkcja.Rows.Add(pp_row); Save_DS(); br_pp.ReadBytes(2); } else { br_pp.ReadBytes((3 * (2 * 501)) + (2 * (2 * 201)) + (2 * (2 * 31)) + 2); } } while (fn_PP.Position < fn_PP.Length); } fn_PP.Close(); } } if (this.checkBox_PD.Checked == true) { if (File.Exists(this.textBox_SelPath.Text + "\\" + "BF_PRD.bf")) { Flm_id = frm1.FindNewFilmID() - 1; FileStream fn_PD; fn_PD = File.OpenRead(this.textBox_SelPath.Text + "\\" + "BF_PRD.bf"); BinaryReader br_pd = new BinaryReader(fn_PD, Encoding.Unicode); if (fn_PD.Length > 0) { do { br_pd.ReadInt32(); int pd_idpdb = br_pd.ReadInt32(); if (pd_idpdb == flm_id) { defaultDataSet.DystrybucjaRow pd_row = frm1.defaultDataSet.Dystrybucja.NewDystrybucjaRow(); pd_row.IDPDB = Flm_id; pd_row.Nazwa = Strymuj(Encoding.Unicode.GetString(br_pd.ReadBytes(2 * 501))); pd_row.Adres = Strymuj(Encoding.Unicode.GetString(br_pd.ReadBytes(2 * 501))); pd_row.Tel = Strymuj(Encoding.Unicode.GetString(br_pd.ReadBytes(2 * 31))); pd_row.Fax = Strymuj(Encoding.Unicode.GetString(br_pd.ReadBytes(2 * 31))); pd_row.Email = Strymuj(Encoding.Unicode.GetString(br_pd.ReadBytes(2 * 201))); pd_row.WWW = Strymuj(Encoding.Unicode.GetString(br_pd.ReadBytes(2 * 501))); pd_row.Narodowość = Strymuj(Encoding.Unicode.GetString(br_pd.ReadBytes(2 * 201))); frm1.defaultDataSet.Dystrybucja.Rows.Add(pd_row); Save_DS(); br_pd.ReadBytes(2); } else { br_pd.ReadBytes((3 * (2 * 501)) + (2 * (2 * 201)) + (2 * (2 * 31)) + 2); } } while (fn_PD.Position < fn_PD.Length); } fn_PD.Close(); } } if (this.checkBox_LZ.Checked == true) { if (File.Exists(this.textBox_SelPath.Text + "\\" + "BF_LZ.bf")) { Flm_id = frm1.FindNewFilmID() - 1; FileStream fn_LZ; fn_LZ = File.OpenRead(this.textBox_SelPath.Text + "\\" + "BF_LZ.bf"); BinaryReader br_lz = new BinaryReader(fn_LZ, Encoding.Unicode); if (fn_LZ.Length > 0) { do { br_lz.ReadInt32(); int lz_idpdb = br_lz.ReadInt32(); if (lz_idpdb == flm_id) { defaultDataSet.LokZdjRow lz_row = frm1.defaultDataSet.LokZdj.NewLokZdjRow(); lz_row.IDPDB = Flm_id; lz_row.NazwaObiektu = Strymuj(Encoding.Unicode.GetString(br_lz.ReadBytes(2 * 501))); lz_row.Kraj = Strymuj(Encoding.Unicode.GetString(br_lz.ReadBytes(2 * 501))); lz_row.Miejscowość = Strymuj(Encoding.Unicode.GetString(br_lz.ReadBytes(2 * 501))); lz_row.Region = Strymuj(Encoding.Unicode.GetString(br_lz.ReadBytes(2 * 501))); lz_row.Pora_roku = Strymuj(Encoding.Unicode.GetString(br_lz.ReadBytes(2 * 501))); lz_row.Data = Strymuj(Encoding.Unicode.GetString(br_lz.ReadBytes(2 * 21))); frm1.defaultDataSet.LokZdj.Rows.Add(lz_row); Save_DS(); //br_lz.ReadBytes(2); } else { br_lz.ReadBytes((5 * (2 * 501)) + (2 * 21)); } } while (fn_LZ.Position < fn_LZ.Length); } fn_LZ.Close(); } } if (this.checkBox_WIO.Checked == true) { if (File.Exists(this.textBox_SelPath.Text + "\\" + "BF_WI.bf")) { Flm_id = frm1.FindNewFilmID() - 1; FileStream fn_WI; fn_WI = File.OpenRead(this.textBox_SelPath.Text + "\\" + "BF_WI.bf"); BinaryReader br_wi = new BinaryReader(fn_WI, Encoding.Unicode); if (fn_WI.Length > 0) { do { br_wi.ReadInt32(); int wi_idpdb = br_wi.ReadInt32(); if (wi_idpdb == flm_id) { defaultDataSet.WYPINRow wi_row = frm1.defaultDataSet.WYPIN.NewWYPINRow(); wi_row.IDPDB = Flm_id; wi_row.DataWyp = Strymuj(Encoding.Unicode.GetString(br_wi.ReadBytes(2 * 21))); wi_row.DataOdd = Strymuj(Encoding.Unicode.GetString(br_wi.ReadBytes(2 * 21))); wi_row.StanPWyp = Strymuj(Encoding.Unicode.GetString(br_wi.ReadBytes(2 * 501))); wi_row.StanPOdd = Strymuj(Encoding.Unicode.GetString(br_wi.ReadBytes(2 * 501))); wi_row.Osoba = Strymuj(Encoding.Unicode.GetString(br_wi.ReadBytes(2 * 501))); Encoding.Unicode.GetString(br_wi.ReadBytes(2 * 501)); frm1.defaultDataSet.WYPIN.Rows.Add(wi_row); Save_DS(); //br_wi.ReadBytes(2); } else { br_wi.ReadBytes((3 * (2 * 501)) + (2 * (2 * 21))); } } while (fn_WI.Position < fn_WI.Length); } fn_WI.Close(); } } if (this.checkBox_WOI.Checked == true) { if (File.Exists(this.textBox_SelPath.Text + "\\" + "BF_WO.bf")) { Flm_id = frm1.FindNewFilmID() - 1; FileStream fn_WO; fn_WO = File.OpenRead(this.textBox_SelPath.Text + "\\" + "BF_WO.bf"); BinaryReader br_wo = new BinaryReader(fn_WO, Encoding.Unicode); if (fn_WO.Length > 0) { do { br_wo.ReadInt32(); int wo_idpdb = br_wo.ReadInt32(); if (wo_idpdb == flm_id) { defaultDataSet.WYPODINRow wo_row = frm1.defaultDataSet.WYPODIN.NewWYPODINRow(); wo_row.IDPDB = Flm_id; wo_row.DataWyp = Strymuj(Encoding.Unicode.GetString(br_wo.ReadBytes(2 * 21))); wo_row.DataOdd = Strymuj(Encoding.Unicode.GetString(br_wo.ReadBytes(2 * 21))); wo_row.StanPWyp = Strymuj(Encoding.Unicode.GetString(br_wo.ReadBytes(2 * 501))); wo_row.StanPOdd = Strymuj(Encoding.Unicode.GetString(br_wo.ReadBytes(2 * 501))); wo_row.Osoba = Strymuj(Encoding.Unicode.GetString(br_wo.ReadBytes(2 * 501))); Encoding.Unicode.GetString(br_wo.ReadBytes(2 * 501)); //br_wo.ReadBytes(2); frm1.defaultDataSet.WYPODIN.Rows.Add(wo_row); Save_DS(); } else { br_wo.ReadBytes((3 * (2 * 501)) + (2 * (2 * 21))); } } while (fn_WO.Position < fn_WO.Length); } fn_WO.Close(); } } } while (fn_film.Position < fn_film.Length); } fn_film.Close(); } MessageBox.Show("Dane zostały zaimportowane zgodnie z wybranymi ustawieniami", "Biblioteka Filmów NET", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }