Example #1
0
        private void Updatebutton_Click(object sender, EventArgs e)
        {
            DiryAccess diryAccess = new DiryAccess();
            int        id         = int.Parse(dataGridView1.CurrentRow.Cells[0].Value.ToString());

            if (MessageBox.Show("Are you sure want to update this Event?", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                int rows = dataGridView1.RowCount;
                for (int i = rows - 1; i >= 0; i--)
                {
                    if (dataGridView1.Rows[i].Selected)
                    {
                        DiaryServices diaryServiice = new DiaryServices();
                        MemoryStream  ms2           = new MemoryStream();

                        byte[] img_arry = new byte[ms2.Length];
                        ms2.Read(img_arry, 0, img_arry.Length);

                        //string date = EventdateTime.Value.ToString() ;
                        int result = diaryServiice.UpdateOldEvent(EperiencetextBox.Text, ThoughttextBox.Text, FellingstextBox.Text, importancecomboBox.Text, img_arry, EventdateTime.Value.ToString(), id);


                        if (result > 0)
                        {
                            MessageBox.Show("Event added successfully.");
                        }
                        else
                        {
                            MessageBox.Show("Error in adding Event");
                        }
                    }
                }
            }
        }
Example #2
0
        private void dataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            DiaryServices diaryService = new DiaryServices();


            // dataGridView1.SelectedColumns[0].Index.ToString();
        }
Example #3
0
        private void ShowDiry_Load(object sender, EventArgs e)
        {
            DiaryServices diaryService = new DiaryServices();
            var           list         = diaryService.GetEventtList();

            dataGridView1.DataSource = list;
            var byteImage = list.FirstOrDefault().Picture;

            var image = GetBitmapImage(byteImage);
        }
Example #4
0
        private void AddEvent_Click(object sender, EventArgs e)
        {
            // DateTime datetime = new DateTime();
            DiaryServices diaryServiice = new DiaryServices();
            MemoryStream  ms2           = new MemoryStream();

            byte[] img_arry = new byte[ms2.Length];
            ms2.Read(img_arry, 0, img_arry.Length);

            //string date = EventdateTime.Value.ToString() ;
            int result = diaryServiice.AddNewEvent(EperiencetextBox.Text, ThoughttextBox.Text, FellingstextBox.Text, importancecomboBox.Text, img_arry, EventdateTime.Value.ToString());


            if (result > 0)
            {
                MessageBox.Show("Event added successfully.");
            }
            else
            {
                MessageBox.Show("Error in adding Event");
            }
        }