コード例 #1
0
 private void actionMenuUnlock_Click(object sender, EventArgs e)
 {
     foreach (DataGridViewRow row in this.dataGridViewLocks.Rows)
     {
         DataGridViewCheckBoxCell c = (DataGridViewCheckBoxCell)row.Cells["dataGridViewSelectItem"];
         //if (c.Value == null) {
         //    if (c.Selected) { c.Value = c.TrueValue; } else { c.Value = c.FalseValue; }
         //}
         if ((bool)c.EditedFormattedValue == true && (row.Cells[8].Value.ToString() == Cyberarms.IntrusionDetection.Shared.Lock.LOCK_STATUS_SOFTLOCK.ToString() ||
                                                      row.Cells[8].Value.ToString() == Cyberarms.IntrusionDetection.Shared.Lock.LOCK_STATUS_HARDLOCK.ToString().ToString()))
         {
             long lockId;
             if (long.TryParse(row.Cells[7].Value.ToString(), out lockId))
             {
                 Lock l = Locks.GetLockById(lockId);
                 if (l != null)
                 {
                     l.Status = Lock.LOCK_STATUS_UNLOCK_REQUESTED;
                     l.Save();
                 }
                 row.Cells[2].Value = LockStatusAdapter.GetLockStatusName((int)Lock.LOCK_STATUS_MANUAL);
             }
         }
     }
 }