private void Button1_Click_1(object sender, EventArgs e) { if (txtbookname.Text == "" || txtnamefile.Text == "" || comitems.Text == "" || txtprise.Text == "") { Dialuge_Add DF = new Dialuge_Add(); DF.gunaLinePanel1.LineColor = Color.FromArgb(232, 30, 99); DF.Title_Label.Text = "اكمل عملية الادخال اولاً"; Transition.ShowSync(DF); // DF.Show(); } else { if (BunAdd.Text == "اضافة") { pic.Image = picbook.Image; if (File.Exists("book.txt")) { File.Delete("book.txt"); } if (!Directory.Exists("photo Books")) { Directory.CreateDirectory("photo Books"); } else { picbook.Image.Save("photo Books\\" + txtbookname.Text + ".png"); } Grid.DATAGRID.Rows.Add(txtbookname.Text, txtnamefile.Text, comitems.Text, txtprise.Text, Data.Value, RatingBooks.Value, pic.Image); for (int x = 0; x < Grid.DATAGRID.Rows.Count; x++) { for (int y = 0; y < Grid.DATAGRID.ColumnCount - 1; y++) { read += Grid.DATAGRID.Rows[x].Cells[y].Value.ToString() + ";"; } StreamWriter sw = new StreamWriter("book.txt", true); sw.WriteLine(read); read = ""; sw.Close(); } Dialuge_Add DF = new Dialuge_Add(); DF.gunaLinePanel1.LineColor = Color.FromArgb(232, 30, 99); DF.Title_Label.Text = "تمت عملية الاضافه بنجاح"; Transition.ShowSync(DF); // DF.Show(); this.Close(); } else { Grid.DATAGRID.CurrentRow.Cells[0].Value = txtbookname.Text; Grid.DATAGRID.CurrentRow.Cells[1].Value = txtnamefile.Text; Grid.DATAGRID.CurrentRow.Cells[2].Value = comitems.Text; Grid.DATAGRID.CurrentRow.Cells[3].Value = txtprise.Text; Grid.DATAGRID.CurrentRow.Cells[4].Value = Data.Value; Grid.DATAGRID.CurrentRow.Cells[5].Value = RatingBooks.Value; Grid.DATAGRID.CurrentRow.Cells[6].Value = picbook.Image; if (!File.Exists("photo Books//" + txtbookname.Text + ".png")) { pic.Image = picbook.Image; pic.Image.Save("photo Books//" + txtbookname.Text + ".png"); } this.Close(); File.Delete("book.txt"); for (int x = 0; x < Grid.DATAGRID.Rows.Count; x++) { for (int y = 0; y < Grid.DATAGRID.ColumnCount - 1; y++) { read += Grid.DATAGRID.Rows[x].Cells[y].Value.ToString() + ";"; } StreamWriter sw = new StreamWriter("book.txt", true); sw.WriteLine(read); read = ""; sw.Close(); } Dialuge_Add DF = new Dialuge_Add(); DF.gunaLinePanel1.LineColor = Color.FromArgb(232, 30, 99); DF.Title_Label.Text = " تمت عملية التعديل بنجاح"; Transition.ShowSync(DF); // DF.Show(); } } }
private void ButtonAddtion2_Click(object sender, EventArgs e) { if (txtnamestudent.Text == "" || nameuser.Text == "" || txtpassword.Text == "" || gunaComboBox1.Text == "") { Dialuge_Add DF = new Dialuge_Add(); DF.Title_Label.Text = "اكمل عملية الادخال اولاً"; Transition.ShowSync(DF); //DF.Show(); } if (ButtonAddtion2.Text == "اضـافـة") { string read = ""; if (File.Exists("user.txt")) { File.Delete("user.txt"); } if (gunaComboBox1.Text == "مدير") { PictureBox.Image = Properties.Resources.Manager; } else { PictureBox.Image = Properties.Resources.User; } Grid.gunaDataGridView2.Rows.Add(txtpassword.Text, nameuser.Text, txtnamestudent.Text, gunaComboBox1.Text, PictureBox.Image); for (int x = 0; x < Grid.gunaDataGridView2.Rows.Count; x++) { for (int y = 0; y < Grid.gunaDataGridView2.ColumnCount - 1; y++) { read += Grid.gunaDataGridView2.Rows[x].Cells[y].Value.ToString() + ";"; } StreamWriter sw = new StreamWriter("user.txt", true); sw.WriteLine(read); read = ""; sw.Close(); } Dialuge_Add DF = new Dialuge_Add(); DF.Title_Label.Text = "تمت عملية الاضافه بنجاح"; Transition.ShowSync(DF); this.Close(); // DF.Show(); } else { Grid.gunaDataGridView2.CurrentRow.Cells[0].Value = txtpassword.Text; Grid.gunaDataGridView2.CurrentRow.Cells[1].Value = nameuser.Text; Grid.gunaDataGridView2.CurrentRow.Cells[2].Value = txtnamestudent.Text; Grid.gunaDataGridView2.CurrentRow.Cells[3].Value = gunaComboBox1.Text; if (gunaComboBox1.Text == "مدير") { PictureBox.Image = Properties.Resources.Manager; } else { PictureBox.Image = Properties.Resources.User; } this.Close(); File.Delete("user.txt"); string read = ""; for (int x = 0; x < Grid.gunaDataGridView2.Rows.Count; x++) { for (int y = 0; y < Grid.gunaDataGridView2.ColumnCount - 1; y++) { read += Grid.gunaDataGridView2.Rows[x].Cells[y].Value.ToString() + ";"; } StreamWriter sw = new StreamWriter("user.txt", true); sw.WriteLine(read); read = ""; sw.Close(); } Dialuge_Add DF = new Dialuge_Add(); DF.gunaLinePanel1.LineColor = Color.FromArgb(66, 58, 170); DF.Title_Label.Text = " تمت عملية التعديل بنجاح"; Transition.ShowSync(DF); // // DF.Show(); } }
private void ButtonAddtion2_Click(object sender, EventArgs e) { if (DatagridName.RowCount == 0 || Datagridbook.RowCount == 0) { Dialuge_Add DF = new Dialuge_Add(); DF.gunaLinePanel1.LineColor = Color.FromArgb(52, 152, 219); DF.Title_Label.Text = "اكمل عملية الادخال اولاً"; Transition.ShowSync(DF); // DF.Show(); } else { if (butok.Text == "اضافة") { string Name = DatagridName.CurrentRow.Cells[0].Value.ToString(); string book = Datagridbook.CurrentRow.Cells[0].Value.ToString(); Grid.DataGridSala.Rows.Add(Name, book, txtprise.Text, txtData.Text); Dialuge_Add DF = new Dialuge_Add(); DF.gunaLinePanel1.LineColor = Color.FromArgb(52, 152, 219); DF.Title_Label.Text = "تمت عملية الاضافه بنجاح"; Transition.ShowSync(DF); // DF.Show(); this.Close(); string read = ""; File.Delete("AddSala.txt"); for (int x = 0; x < Grid.DataGridSala.Rows.Count; x++) { for (int y = 0; y < Grid.DataGridSala.ColumnCount; y++) { read += Grid.DataGridSala.Rows[x].Cells[y].Value.ToString() + ";"; } StreamWriter sw = new StreamWriter("AddSala.txt", true); sw.WriteLine(read); read = ""; sw.Close(); } } else { Grid.DataGridSala.CurrentRow.Cells[0].Value = DatagridName.CurrentRow.Cells[0].Value.ToString(); Grid.DataGridSala.CurrentRow.Cells[1].Value = Datagridbook.CurrentRow.Cells[0].Value.ToString(); Grid.DataGridSala.CurrentRow.Cells[2].Value = txtprise.Text; Grid.DataGridSala.CurrentRow.Cells[3].Value = txtData.Value; this.Close(); string read = ""; File.Delete("AddSala.txt"); for (int x = 0; x < Grid.DataGridSala.Rows.Count; x++) { for (int y = 0; y < Grid.DataGridSala.ColumnCount; y++) { read += Grid.DataGridSala.Rows[x].Cells[y].Value.ToString() + ";"; } StreamWriter sw = new StreamWriter("AddSala.txt", true); sw.WriteLine(read); read = ""; sw.Close(); } Dialuge_Add DF = new Dialuge_Add(); DF.gunaLinePanel1.LineColor = Color.FromArgb(52, 152, 219); DF.Title_Label.Text = " تمت عملية التعديل بنجاح"; Transition.ShowSync(DF); // DF.Show(); } } }
private void ButtonAddtion2_Click_1(object sender, EventArgs e) { PictureBox pic = new PictureBox(); string read = ""; if (TextBoxName.Text == "" || TextBoxHome.Text == "" || TextBoxPhone.Text == "") { Dialuge_Add DF = new Dialuge_Add(); DF.gunaLinePanel1.LineColor = Color.FromArgb(66, 58, 170); DF.Title_Label.Text = "اكمل عملية الادخال اولاً"; Transition.ShowSync(DF); // DF.Show(); } if (ButtonAddtion2.Text == "اضافة") { pic.Image = PictureBoxStudent.Image; if (File.Exists("student.txt")) { File.Delete("student.txt"); } if (!Directory.Exists("photo Books")) { Directory.CreateDirectory("photo Books"); } else { if (!File.Exists("photo Books\\" + TextBoxName.Text + ".png")) { PictureBoxStudent.Image.Save("photo Books\\" + TextBoxName.Text + ".png"); } } Grid.DataGridStudent.Rows.Add(TextBoxName.Text, TextBoxHome.Text, TextBoxPhone.Text, TextBoxCollage.Text, TextBoxSection.Text, pic.Image); for (int x = 0; x < Grid.DataGridStudent.Rows.Count; x++) { for (int y = 0; y < Grid.DataGridStudent.ColumnCount - 1; y++) { read += Grid.DataGridStudent.Rows[x].Cells[y].Value.ToString() + ";"; } StreamWriter sw = new StreamWriter("student.txt", true); sw.WriteLine(read); read = ""; sw.Close(); } Dialuge_Add DF = new Dialuge_Add(); DF.gunaLinePanel1.LineColor = Color.FromArgb(66, 58, 170); DF.Title_Label.Text = "تمت عملية الاضافه بنجاح"; Transition.ShowSync(DF); // DF.Show(); this.Close(); } else { Grid.DataGridStudent.CurrentRow.Cells[0].Value = TextBoxName.Text; Grid.DataGridStudent.CurrentRow.Cells[1].Value = TextBoxHome.Text; Grid.DataGridStudent.CurrentRow.Cells[2].Value = TextBoxPhone.Text; Grid.DataGridStudent.CurrentRow.Cells[3].Value = TextBoxCollage.Text; Grid.DataGridStudent.CurrentRow.Cells[4].Value = TextBoxSection.Text; Grid.DATAGRID.CurrentRow.Cells[5].Value = PictureBoxStudent; if (!File.Exists("photo Books//" + TextBoxName.Text + ".png")) { PictureBoxStudent.Image.Save("photo Books//" + TextBoxName.Text + ".png"); } this.Close(); File.Delete("student.txt"); for (int x = 0; x < Grid.DataGridStudent.Rows.Count; x++) { for (int y = 0; y < Grid.DataGridStudent.ColumnCount - 1; y++) { read += Grid.DataGridStudent.Rows[x].Cells[y].Value.ToString() + ";"; } StreamWriter sw = new StreamWriter("student.txt", true); sw.WriteLine(read); read = ""; sw.Close(); } Dialuge_Add DF = new Dialuge_Add(); DF.gunaLinePanel1.LineColor = Color.FromArgb(66, 58, 170); DF.Title_Label.Text = " تمت عملية التعديل بنجاح"; Transition.ShowSync(DF); // DF.Show(); } }