コード例 #1
0
        private void DataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewRow             row  = dataGridView1.Rows[e.RowIndex];
            Dictionary <string, string> data = new Dictionary <string, string>();
            int id = Convert.ToInt32(row.Cells[0].Value);

            data["name"]     = row.Cells[1].Value.ToString();
            data["email"]    = row.Cells[2].Value.ToString();
            data["subject"]  = row.Cells[3].Value.ToString();
            data["body"]     = row.Cells[4].Value.ToString();
            data["location"] = row.Cells[5].Value.ToString();
            data["date"]     = row.Cells[6].Value.ToString();
            data["duration"] = row.Cells[7].Value.ToString();

            try
            {
                conn = DatabaseReader.CreateConnection();
                if (DatabaseReader.UpdateMeetingData(id, data, conn))
                {
                    MessageBox.Show("Record updated successfully !");
                }
                else
                {
                    MessageBox.Show("Unable to update record !");
                }
            }catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                DatabaseReader.Close(conn);
                conn = null;
            }
        }
コード例 #2
0
        private void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                Dictionary <string, string> data = new Dictionary <string, string>();
                data["name"]    = textBox1.Text;
                data["email"]   = textBox2.Text;
                data["contact"] = textBox3.Text;
                data["address"] = richTextBox1.Text;
                data["company"] = textBox4.Text;


                conn = DatabaseReader.CreateConnection();
                DatabaseReader.CreateContactTable(conn);
                if (DatabaseReader.InsertContactData(data, conn))
                {
                    MessageBox.Show("Record added successfully !");
                }
                else
                {
                    MessageBox.Show("Unable to add record !");
                }
            }catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                DatabaseReader.Close(conn);
                conn = null;
            }
        }
コード例 #3
0
        private void DataGridView1_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
        {
            int id = Convert.ToInt32(dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[0].Value);

            try
            {
                conn = DatabaseReader.CreateConnection();
                if (DatabaseReader.RemoveData("MeetingTable", id, conn))
                {
                    MessageBox.Show("Row deleted successfully !");
                }
                else
                {
                    MessageBox.Show("Unable to delete data !");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                DatabaseReader.Close(conn);
                conn = null;
            }
        }
コード例 #4
0
        private void button_refresh_Click(object sender, RoutedEventArgs e)
        {
            DatabaseReader databaseReader = new DatabaseReader();

            databaseReader.Connect();
            query = databaseReader.Read("SELECT o.id, o.Status, u.address, f.name, oi.quantity, o.total FROM orders o join users u on o.user_id=u.id join order_items oi on oi.order_id=o.id join foods f on f.id = oi.food_id");
            databaseReader.Close();
        }
コード例 #5
0
ファイル: Cook.xaml.cs プロジェクト: RafalStasiowski/projekt
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            DatabaseReader databaseReader = new DatabaseReader();

            databaseReader.Connect();
            query = databaseReader.Read("update orders set Status='W realizacji' where id= " + query[comboBoxOrders.SelectedIndex][0]);
            databaseReader.Close();
        }
コード例 #6
0
ファイル: Cook.xaml.cs プロジェクト: RafalStasiowski/projekt
        private void button_refresh_Click(object sender, RoutedEventArgs e)
        {
            DatabaseReader databaseReader = new DatabaseReader();

            databaseReader.Connect();
            query = databaseReader.Read("select o.id, f.name, oi.quantity, o.Status from orders o join order_items oi on o.id=oi.id join foods f on f.id=oi.food_id");
            databaseReader.Close();
        }
コード例 #7
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Paragon();
            DatabaseReader databaseReader = new DatabaseReader();

            databaseReader.Connect();
            query = databaseReader.Read("update orders set Status='W dostawie' where id= " + query[comboBoxDelivery.SelectedIndex][0]);
            databaseReader.Close();
        }
コード例 #8
0
        public Delivery()
        {
            InitializeComponent();
            DatabaseReader databaseReader = new DatabaseReader();

            databaseReader.Connect();
            query = databaseReader.Read("SELECT o.id, o.Status, u.address, f.name, oi.quantity, o.total FROM orders o join users u on o.user_id=u.id join order_items oi on oi.order_id=o.id join foods f on f.id = oi.food_id");
            databaseReader.Close();
            SetOrdersId();
        }
コード例 #9
0
ファイル: Cook.xaml.cs プロジェクト: RafalStasiowski/projekt
        public Cook()
        {
            InitializeComponent();
            DatabaseReader databaseReader = new DatabaseReader();

            databaseReader.Connect();
            query = databaseReader.Read("select o.id, f.name, oi.quantity, o.Status from orders o join order_items oi on o.id=oi.id join foods f on f.id=oi.food_id");
            databaseReader.Close();
            SetOrdersId();
        }
コード例 #10
0
        private void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                /*Outlook.AppointmentItem appt = Oapp.CreateItem(Outlook.OlItemType.olAppointmentItem) as Outlook.AppointmentItem;
                 * appt.Subject = textBox3.Text;
                 * appt.MeetingStatus = Outlook.OlMeetingStatus.olMeeting;
                 * appt.Location = textBox2.Text;
                 * appt.Start = dateTimePicker1.Value;
                 * appt.Duration = int.Parse(comboBox1.Text);
                 * appt.Body = richTextBox1.Text;
                 * Outlook.Recipient recipRequired = appt.Recipients.Add(textBox1.Text);
                 * recipRequired.Type = (int)Outlook.OlMeetingRecipientType.olRequired;
                 * appt.Recipients.ResolveAll();
                 * appt.Display(false);
                 * this.Close();*/

                Dictionary <string, string> data = new Dictionary <string, string>();
                data["name"]     = textBox1.Text;
                data["email"]    = textBox2.Text;
                data["subject"]  = textBox3.Text;
                data["body"]     = richTextBox1.Text;
                data["location"] = textBox4.Text;
                data["date"]     = dateTimePicker1.Value.Date.ToString();
                data["duration"] = comboBox1.SelectedItem.ToString();

                conn = DatabaseReader.CreateConnection();
                DatabaseReader.CreateMeetingTable(conn);
                if (DatabaseReader.InsertMeetingData(data, conn))
                {
                    MessageBox.Show("Record added successfully !");
                }
                else
                {
                    MessageBox.Show("Unable to add record !");
                }
            }catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                DatabaseReader.Close(conn);
                conn = null;
            }
        }
コード例 #11
0
 public viewMeeting(string date)
 {
     InitializeComponent();
     try
     {
         conn = DatabaseReader.CreateConnection();
         SQLiteDataReader sdr = DatabaseReader.getTodayMeeting(date, conn);
         DataTable        dt  = new DataTable();
         dt.Columns.Add("Id");
         dt.Columns.Add("Name");
         dt.Columns.Add("Email");
         dt.Columns.Add("Subject");
         dt.Columns.Add("Body");
         dt.Columns.Add("Location");
         dt.Columns.Add("Date");
         dt.Columns.Add("Duration");
         while (sdr.Read())
         {
             DataRow row = dt.NewRow();
             row["Id"]       = sdr["Id"];
             row["Name"]     = sdr["Name"];
             row["Email"]    = sdr["Email"];
             row["Subject"]  = sdr["Subject"];
             row["Location"] = sdr["Location"];
             row["Body"]     = sdr["Body"];
             row["Date"]     = sdr["Date"];
             row["Duration"] = sdr["Duration"];
             dt.Rows.Add(row);
         }
         sdr.Close();
         dataGridView1.DataSource          = dt;
         dataGridView1.Columns[0].ReadOnly = true;
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message);
     }
     finally
     {
         DatabaseReader.Close(conn);
         conn = null;
     }
 }
コード例 #12
0
        public viewContact()
        {
            InitializeComponent();
            try
            {
                conn = DatabaseReader.CreateConnection();
                SQLiteDataReader sdr = DatabaseReader.ReadData("ContactTable", conn);
                DataTable        dt  = new DataTable();
                dt.Columns.Add("Id");
                dt.Columns.Add("Name");
                dt.Columns.Add("Email");
                dt.Columns.Add("Contact");
                dt.Columns.Add("Address");
                dt.Columns.Add("Company");

                while (sdr.Read())
                {
                    DataRow row = dt.NewRow();
                    row["Id"]      = sdr["Id"];
                    row["Name"]    = sdr["Name"];
                    row["Email"]   = sdr["Email"];
                    row["Contact"] = sdr["Contact"];
                    row["Address"] = sdr["Address"];
                    row["Company"] = sdr["Company"];

                    dt.Rows.Add(row);
                }
                sdr.Close();
                dataGridView1.DataSource          = dt;
                dataGridView1.Columns[0].ReadOnly = true;
            }
            catch (Exception e)
            {
                MessageBox.Show("Unable to fetch data !");
            }
            finally
            {
                DatabaseReader.Close(conn);
                conn = null;
            }
        }
コード例 #13
0
 public void Close()
 {
     dbWriter.Close();
     dbReader.Close();
     init = false;
 }