Пример #1
0
        private void btnBinned_Click(object sender, EventArgs e)
        {
            if (this.dataGridView.SelectedRows.Count == 1)
            {
                // get the DupesAction row with the selected TheFileName
                IQueryable <DupesAction> query = Program.popsModel.DupesActions.Where(dupesAction => dupesAction.TheFileName == theFileName);

                DupesAction adupesAction = query.First();

                // if 1 row found then update GooglePhotosRemoved = Y and save the change to the DB
                if (!string.IsNullOrEmpty(adupesAction.TheFileName))
                {
                    // update the db table
                    adupesAction.GooglePhotosRemoved = "Y";
                    Program.popsModel.SaveChanges();

                    // remove the binned row from the datagrid
                    this.dataGridView.Rows.Remove(this.dataGridView.SelectedRows[0]);

                    // make the first row selected
                    this.dataGridView.Rows[0].Selected = true;

                    this.toolStripStatusLabel1.Text = $"INFO - {this.dataGridView.RowCount} dupesActions rows with GooglePhotosRemoved = N";
                }
                else
                {
                    this.toolStripStatusLabel1.Text = $"ERROR - DupesAction row {theFileName} was not found.";
                }
            }
        }
Пример #2
0
        private void btnBinned_Click(object sender, EventArgs e)
        {
            if (this.dataGridView.SelectedRows.Count > 0)
            {
                IQueryable <DupesAction> query = Program.popsModel.DupesActions.Where(dupesAction => dupesAction.TheFileName == theFileName);

                dupesActions = query.ToArray();

                if (dupesActions.Length == 1)
                {
                    DupesAction adupesAction = dupesActions[0];
                    adupesAction.GooglePhotosRemoved = "Y";
                    Program.popsModel.SaveChanges();

                    // refresh the view
                    this.dataGridView.Refresh();
                }
                else
                {
                    this.statusStrip1.Text = $"ERROR - DupesAction row {theFileName} was not updated. dupesActions.Length == {dupesActions.Length}";
                }
            }
        }