private void flatButton1_Click(object sender, EventArgs e) { this.Close(); Bills1 b = new Bills1(); b.Show(); }
private void pictureBox1_Click(object sender, EventArgs e) { this.Close(); Bills1 cc = new Bills1(); cc.Show(); }
private void قائمةالفواتيرToolStripMenuItem_Click(object sender, EventArgs e) { this.Close(); Bills1 bl = new Bills1(); bl.Show(); }
private void pictureBox1_Click(object sender, EventArgs e) { string sql = "data source = Data.db"; SQLiteConnection conn = new SQLiteConnection(sql); conn.Open(); string query_del = "delete from Bills_Bills"; SQLiteCommand cmd = new SQLiteCommand(query_del, conn); cmd.ExecuteNonQuery(); conn.Close(); this.Close(); Bills1 b = new Bills1(); b.Show(); }
private void flatButton4_Click(object sender, EventArgs e) { if (metroTextBox7.Text == string.Empty) { MessageBox.Show("لم يتم تحديد تاريخ للفاتورة يرجى التحديد وشكرا", "خطأ", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { string sql = "data source = Data.db"; SQLiteConnection conn = new SQLiteConnection(sql); conn.Open(); string query_save1 = "insert into Bills2 (Bills_id,Bills_members_name,Bills_date,Bills_sum) values(@Bills_id,@Bills_members_name,@Bills_date,@Bills_sum)"; SQLiteCommand cmd1 = new SQLiteCommand(query_save1, conn); cmd1.Parameters.AddWithValue("@Bills_id", Convert.ToInt64(metroTextBox6.Text)); cmd1.Parameters.AddWithValue("@Bills_members_name", metroComboBox1.Text); cmd1.Parameters.AddWithValue("@Bills_date", metroTextBox7.Text); cmd1.Parameters.AddWithValue("@Bills_sum", Convert.ToInt64(metroTextBox8.Text)); cmd1.ExecuteNonQuery(); conn.Close(); for (int i = 0; i < dataGridView1.Rows.Count; i++) { conn.Open(); string query_save2 = "insert into Bills (Bills_id,Bills_members_name,Bills_pharm_name,Bills_pharm_ghram,Bills_pharm_quan,Bills_unit,Bills_pharm_price,Bills_count,Bills_date,Bills_sum) values(@Bills_id,@Bills_members_name,@Bills_pharm_name,@Bills_pharm_ghram,@Bills_pharm_quan,@Bills_unit,@Bills_pharm_price,@Bills_count,@Bills_date,@Bills_sum)"; SQLiteCommand cmd2 = new SQLiteCommand(query_save2, conn); cmd2.Parameters.AddWithValue("@Bills_id", Convert.ToInt64(metroTextBox6.Text)); cmd2.Parameters.AddWithValue("@Bills_members_name", metroComboBox1.Text); cmd2.Parameters.AddWithValue("@Bills_pharm_name", dataGridView1.Rows[i].Cells[0].Value.ToString()); cmd2.Parameters.AddWithValue("@Bills_pharm_ghram", dataGridView1.Rows[i].Cells[1].Value.ToString()); cmd2.Parameters.AddWithValue("@Bills_pharm_quan", Convert.ToInt64(dataGridView1.Rows[i].Cells[2].Value.ToString())); cmd2.Parameters.AddWithValue("@Bills_unit", dataGridView1.Rows[i].Cells[3].Value.ToString()); cmd2.Parameters.AddWithValue("@Bills_pharm_price", Convert.ToInt64(dataGridView1.Rows[i].Cells[4].Value)); cmd2.Parameters.AddWithValue("@Bills_count", Convert.ToInt64(dataGridView1.Rows[i].Cells[5].Value.ToString())); cmd2.Parameters.AddWithValue("@Bills_date", metroTextBox7.Text); cmd2.Parameters.AddWithValue("@Bills_sum", Convert.ToInt64(metroTextBox8.Text)); cmd2.ExecuteNonQuery(); conn.Close(); } MessageBox.Show("/تم الحفظ دون الطباعة/اذا اردت الطباعة راجع الفواتير وشكرا", "حفظ", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); Bills1 b = new Bills1(); b.Show(); } }
private void flatButton5_Click(object sender, EventArgs e) { if (metroTextBox4.Text == "0") { MessageBox.Show("لايمكن الحفظ لأن مبلغ الفاتورة= 0 /n هناك تغييرات لم تقم بحفظها يرجى التحديث ثم معاودة الحفظ", "خطأ", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (metroTextBox3.Text == string.Empty) { MessageBox.Show("يرجى أدخال تاريخ التعديل وشكرا", "خطأ", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { string sql1 = "data source = Data.db"; SQLiteConnection conn1 = new SQLiteConnection(sql1); conn1.Open(); string query_save1 = "update Bills2 set Bills_date=@Bills_date,Bills_date_update=@Bills_date_update,Bills_sum=@Bills_sum where Bills_id = '" + Convert.ToInt64(metroTextBox1.Text) + "'"; SQLiteCommand cmd1 = new SQLiteCommand(query_save1, conn1); cmd1.Parameters.AddWithValue("@Bills_date", metroTextBox5.Text); cmd1.Parameters.AddWithValue("@Bills_date_update", metroTextBox3.Text); cmd1.Parameters.AddWithValue("@Bills_sum", Convert.ToInt64(metroTextBox4.Text)); cmd1.ExecuteNonQuery(); string query_save3 = "update Bills set Bills_date_update=@Bills_date_update,Bills_sum=@Bills_sum,Bills_date=@Bills_date where Bills_id = '" + Convert.ToInt64(metroTextBox1.Text) + "'"; SQLiteCommand cmd3 = new SQLiteCommand(query_save3, conn1); cmd3.Parameters.AddWithValue("@Bills_sum", Convert.ToInt64(metroTextBox4.Text)); cmd3.Parameters.AddWithValue("@Bills_date_update", metroTextBox3.Text); cmd3.Parameters.AddWithValue("@Bills_date", metroTextBox5.Text); cmd3.ExecuteNonQuery(); conn1.Close(); MessageBox.Show("تم تعديل محتويات الفاتورة", "تعديل", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); Bills1 b = new Bills1(); b.Show(); } } }