private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;                //
            }
            //if (dataGridView1.Columns[e.ColumnIndex].Name == "ColCheck")
            //{
            healthCheckDocument = HealthCheckDocuments[e.RowIndex];
            //    //this.btnDetails.Enabled = true;
            //}

            DataGridViewColumn column = dataGridView1.Columns[e.ColumnIndex];

            if (column is DataGridViewCheckBoxColumn)
            {
                DataGridViewDisableCheckBoxCell cell = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex] as DataGridViewDisableCheckBoxCell;
                if (!cell.Enabled)
                {
                    return;
                }
                if ((SelectedStatus)cell.Value == SelectedStatus.NoSelected)
                {
                    cell.Value = SelectedStatus.Selected;
                    SetRadioButtonValue(cell);
                }
                else
                {
                    cell.Value = SelectedStatus.NoSelected;
                }
            }
        }
        private void dataGridView2_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;                //
            }
            healthCheckDetail = HealthCheckDetails[e.RowIndex];

            DataGridViewColumn column = dataGridView2.Columns[e.ColumnIndex];

            if (column is DataGridViewCheckBoxColumn)
            {
                DataGridViewDisableCheckBoxCell cell = dataGridView2.Rows[e.RowIndex].Cells[e.ColumnIndex] as DataGridViewDisableCheckBoxCell;
                if (!cell.Enabled)
                {
                    return;
                }
                if ((SelectedStatus)cell.Value == SelectedStatus.NoSelected)
                {
                    cell.Value = SelectedStatus.Selected;
                    SetRadioButtonValue(cell);
                }
                else
                {
                    cell.Value = SelectedStatus.NoSelected;
                }
            }
        }
Beispiel #3
0
            // Override the Clone method so that the Enabled property is copied.
            public override object Clone()
            {
                DataGridViewDisableCheckBoxCell cell = (DataGridViewDisableCheckBoxCell)base.Clone();

                cell.Enabled = this.Enabled;
                return(cell);
            }
        private void SetRadioButtonValue(DataGridViewDisableCheckBoxCell cell)
        {
            SelectedStatus status = (SelectedStatus)cell.Value;

            if (status == SelectedStatus.Selected)
            {
                status = SelectedStatus.NoSelected;
            }
            else
            {
                status = SelectedStatus.Selected;
            }
            if (this.tabControlHealthDocManage.SelectedIndex == 0)
            {
                for (int i = 0; i < dataGridView1.Rows.Count; i++)
                {
                    DataGridViewDisableCheckBoxCell cel = dataGridView1.Rows[i].Cells["ColCheck"] as DataGridViewDisableCheckBoxCell;
                    if (!cel.Equals(cell))
                    {
                        cel.Value = status;
                    }
                }
            }
            if (this.tabControlHealthDocManage.SelectedIndex == 1)
            {
                for (int i = 0; i < dataGridView2.Rows.Count; i++)
                {
                    DataGridViewDisableCheckBoxCell cel = dataGridView2.Rows[i].Cells["columnCheck"] as DataGridViewDisableCheckBoxCell;
                    if (!cel.Equals(cell))
                    {
                        cel.Value = status;
                    }
                }
            }
        }
Beispiel #5
0
        private void ThreadFwUpgrade(object obj)
        {
            this.m_isUpgradeFlg = 1;
            Program.IdleTimer_Pause(1);
            System.Collections.Generic.List <FirmwareUpgrade> list = obj as System.Collections.Generic.List <FirmwareUpgrade>;
            for (int i = 0; i < list.Count; i++)
            {
                FirmwareUpgrade firmwareUpgrade = list[i];
                firmwareUpgrade.Upgrade(new FirmwareUpgrade.Upgrading(this.Upgrade));
            }
            ControlAccess.ConfigControl config = delegate(Control control, object param)
            {
                this.cbMainFw.Enabled  = true;
                this.butBrowse.Enabled = true;
                this.butSearch.Enabled = true;
                this.butUpdate.Enabled = true;
                this.cbsel.Enabled     = true;
                for (int j = 0; j < this.dgvFwDevice.Rows.Count; j++)
                {
                    DataGridViewRow dataGridViewRow = this.dgvFwDevice.Rows[j];
                    int             num             = System.Convert.ToInt32(dataGridViewRow.Cells["dgvtdevID"].Value.ToString());
                    string          text            = dataGridViewRow.Cells[4].Value.ToString();
                    foreach (string[] current in this.m_allRows)
                    {
                        int num2 = System.Convert.ToInt32(current[6]);
                        if (num == num2)
                        {
                            current[4] = text;
                            current[5] = dataGridViewRow.Cells[5].Value.ToString();
                            break;
                        }
                    }
                    DataGridViewDisableCheckBoxCell dataGridViewDisableCheckBoxCell = dataGridViewRow.Cells[0] as DataGridViewDisableCheckBoxCell;
                    dataGridViewDisableCheckBoxCell.Enabled  = true;
                    dataGridViewDisableCheckBoxCell.ReadOnly = false;
                }
                this.dgvFwDevice.Update();
                this.dgvFwDevice.Focus();
            };
            ControlAccess controlAccess = new ControlAccess(this, config);

            controlAccess.Access(this.dgvFwDevice, null);
            Program.IdleTimer_Run(1);
            this.m_isUpgradeFlg = 2;
        }
Beispiel #6
0
 private void storageDataGridView_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0)
     {
         //Cells[1]为checkBoxColumn列
         DataGridViewDisableCheckBoxCell cell = storageDataGridView.Rows[e.RowIndex].Cells["checkBoxColumn"] as DataGridViewDisableCheckBoxCell;
         if (!cell.Enabled)
         {
             return;
         }
         string isSelected = cell.Value == null ? "NoSelected" : cell.Value.ToString();
         if (SelectedStatus.NoSelected.ToString().Equals(isSelected))
         {
             cell.Value = SelectedStatus.Selected;
             SetRadioButtonValue(cell);
         }
     }
 }
Beispiel #7
0
 private void butUpdate_Click(object sender, System.EventArgs e)
 {
     if (!this.check())
     {
         EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Comm_selectneed, new string[0]));
         return;
     }
     if (this.tbFileNm.Text.Equals(string.Empty))
     {
         EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[]
         {
             this.lbFileNm.Text
         }));
         return;
     }
     this.cbMainFw.Enabled  = false;
     this.butBrowse.Enabled = false;
     this.butSearch.Enabled = false;
     this.butUpdate.Enabled = false;
     this.cbsel.Enabled     = false;
     System.Collections.Generic.List <FirmwareUpgrade> list = new System.Collections.Generic.List <FirmwareUpgrade>();
     for (int i = 0; i < this.dgvFwDevice.Rows.Count; i++)
     {
         DataGridViewRow dataGridViewRow = this.dgvFwDevice.Rows[i];
         DataGridViewDisableCheckBoxCell dataGridViewDisableCheckBoxCell = dataGridViewRow.Cells[0] as DataGridViewDisableCheckBoxCell;
         if (dataGridViewRow.Cells[0].Value != null && (bool)dataGridViewRow.Cells[0].Value)
         {
             list.Add(new FirmwareUpgrade
             {
                 FileName     = this.tbFileNm.Text,
                 CheckVersion = this.cbMainFw.Checked ? 1 : 0,
                 DevID        = System.Convert.ToInt32(dataGridViewRow.Cells["dgvtdevID"].Value.ToString()),
                 DevIP        = dataGridViewRow.Cells["dgvtbIp"].Value.ToString(),
                 httpPort     = dataGridViewRow.Cells["dgvtdevhttpPort"].Value.ToString()
             });
             dataGridViewRow.Cells["dgvtStatus"].Value = EcoLanguage.getMsg(LangRes.FrwUpgradeST_waiting, new string[0]);
         }
         dataGridViewDisableCheckBoxCell.Enabled  = false;
         dataGridViewDisableCheckBoxCell.ReadOnly = true;
     }
     this.dgvFwDevice.Update();
     this.dgvFwDevice.Focus();
     System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(this.ThreadFwUpgrade), list);
 }
Beispiel #8
0
 private void customStyleDataGrid1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
 {
     if ((e.RowIndex != -1) && (e.ColumnIndex == 0))
     {
         if (this.customStyleDataGrid1.Rows[e.RowIndex].Cells[e.ColumnIndex] is DataGridViewCheckBoxCell)
         {
             DataGridViewDisableCheckBoxCell cell = (DataGridViewDisableCheckBoxCell)this.customStyleDataGrid1[e.ColumnIndex, e.RowIndex];
             if (cell != null)
             {
                 if (!cell.Enabled)
                 {
                     cell.Value = 0;
                     return;
                 }
                 if (Convert.ToBoolean(cell.Value))
                 {
                     for (int i = 1; i < (this.customStyleDataGrid1.Columns.Count - 1); i++)
                     {
                         if (i == 1)
                         {
                             ((DataGridViewDisableCheckBoxCell)this.customStyleDataGrid1[i, e.RowIndex]).Value = 1;
                         }
                         else
                         {
                             ((DataGridViewDisableCheckBoxCell)this.customStyleDataGrid1[i, e.RowIndex]).Value = 0;
                         }
                         ((DataGridViewDisableCheckBoxCell)this.customStyleDataGrid1[i, e.RowIndex]).Enabled = true;
                     }
                 }
                 else
                 {
                     for (int j = 1; j < (this.customStyleDataGrid1.Columns.Count - 1); j++)
                     {
                         ((DataGridViewDisableCheckBoxCell)this.customStyleDataGrid1[j, e.RowIndex]).Value   = 0;
                         ((DataGridViewDisableCheckBoxCell)this.customStyleDataGrid1[j, e.RowIndex]).Enabled = false;
                     }
                 }
             }
         }
         this.customStyleDataGrid1.Invalidate();
     }
 }
Beispiel #9
0
        private void StatisticsOptions_Load(object sender, EventArgs e)
        {
            int count = this.customStyleDataGrid1.Rows.Count;
            int num2  = this.customStyleDataGrid1.Columns.Count;

            this.customStyleDataGrid1.SuspendLayout();
            for (int i = 0; i < count; i++)
            {
                for (int j = 0; j < num2; j++)
                {
                    if (this.customStyleDataGrid1[j, i] is DataGridViewDisableCheckBoxCell)
                    {
                        DataGridViewDisableCheckBoxCell cell = (DataGridViewDisableCheckBoxCell)this.customStyleDataGrid1[j, i];
                        cell.Enabled = Convert.ToBoolean(this.dataTable_0.Rows[i][this.customStyleDataGrid1.Columns[j].Name]);
                    }
                }
            }
            this.method_1();
            this.customStyleDataGrid1.ResumeLayout(false);
        }
Beispiel #10
0
 private void UpdateIgnorePermission()
 {
     foreach (DataGridViewRow row in dgPermission.Rows)
     {
         DataRow dr            = (row.DataBoundItem as DataRowView).Row;
         string  userGroupGUID = dr["UserGroupGUID"].ToString();
         Result  result        = UserGroupBus.CheckIgnorePermission(userGroupGUID);
         DataGridViewDisableCheckBoxCell cell = row.Cells[1] as DataGridViewDisableCheckBoxCell;
         if (result.IsOK)
         {
             bool isOK = Convert.ToBoolean(result.QueryResult);
             cell.Enabled = isOK;
         }
         else
         {
             MsgBox.Show(this.Text, result.GetErrorAsString("UserGroupBus.CheckIgnorePermission"), IconType.Error);
             Utility.WriteToTraceLog(result.GetErrorAsString("UserGroupBus.CheckIgnorePermission"));
             cell.Enabled = false;
         }
     }
 }
Beispiel #11
0
        private void SetRadioButtonValue(DataGridViewDisableCheckBoxCell cell)
        {
            SelectedStatus status = (SelectedStatus)cell.Value;

            if (status == SelectedStatus.Selected)
            {
                status = SelectedStatus.NoSelected;
            }
            else
            {
                status = SelectedStatus.Selected;
            }
            for (int i = 0; i < storageDataGridView.Rows.Count; i++)
            {
                DataGridViewDisableCheckBoxCell cel = storageDataGridView.Rows[i].Cells["checkBoxColumn"] as DataGridViewDisableCheckBoxCell;
                if (!cel.Equals(cell))
                {
                    cel.Value = status;
                }
            }
        }
Beispiel #12
0
        private void chkChecked_CheckedChanged(object sender, EventArgs e)
        {
            if (dgService.RowCount <= 0)
            {
                return;
            }
            foreach (DataGridViewRow row in dgService.Rows)
            {
                DataGridViewDisableCheckBoxCell cell = row.Cells["Checked"] as DataGridViewDisableCheckBoxCell;
                if (cell.Enabled)
                {
                    DataRow r = (row.DataBoundItem as DataRowView).Row;
                    r["Checked"] = chkChecked.Checked;
                    string serviceGUID = r["ServiceGUID"].ToString();

                    if (chkChecked.Checked)
                    {
                        if (!_dictService.ContainsKey(serviceGUID))
                        {
                            _dtTemp.ImportRow(r);
                            _dictService.Add(serviceGUID, _dtTemp.Rows[_dtTemp.Rows.Count - 1]);
                        }
                    }
                    else
                    {
                        if (_dictService.ContainsKey(serviceGUID))
                        {
                            _dictService.Remove(serviceGUID);

                            DataRow[] rows = _dtTemp.Select(string.Format("ServiceGUID='{0}'", serviceGUID));
                            if (rows != null && rows.Length > 0)
                            {
                                _dtTemp.Rows.Remove(rows[0]);
                            }
                        }
                    }
                }
            }
        }
Beispiel #13
0
        private void method_4()
        {
            this.dataTable_1 = new DataTable();
            DataTable  table  = new DataTable();
            DataColumn column = new DataColumn("ColName")
            {
                DataType = typeof(string)
            };

            table.Columns.Add(column);
            column = new DataColumn("ColSum")
            {
                DataType = typeof(bool)
            };
            table.Columns.Add(column);
            column = new DataColumn("ColAvg")
            {
                DataType = typeof(bool)
            };
            table.Columns.Add(column);
            column = new DataColumn("ColMax")
            {
                DataType = typeof(bool)
            };
            table.Columns.Add(column);
            column = new DataColumn("ColMin")
            {
                DataType = typeof(bool)
            };
            table.Columns.Add(column);
            DataColumn column2 = new DataColumn("统计列")
            {
                DataType = typeof(string)
            };

            this.dataTable_1.Columns.Add(column2);
            column2 = new DataColumn("总和")
            {
                DataType = typeof(string)
            };
            this.dataTable_1.Columns.Add(column2);
            column2 = new DataColumn("平均值")
            {
                DataType = typeof(string)
            };
            this.dataTable_1.Columns.Add(column2);
            column2 = new DataColumn("最大值")
            {
                DataType = typeof(string)
            };
            this.dataTable_1.Columns.Add(column2);
            column2 = new DataColumn("最小值")
            {
                DataType = typeof(string)
            };
            this.dataTable_1.Columns.Add(column2);
            for (int i = 0; i < this.customStyleDataGrid1.Rows.Count; i++)
            {
                DataGridViewDisableCheckBoxCell cell = this.customStyleDataGrid1.Rows[i].Cells[0] as DataGridViewDisableCheckBoxCell;
                if (((cell != null) && (cell.Value != null)) && (cell.Enabled && Convert.ToBoolean(cell.Value)))
                {
                    DataRow row2 = table.NewRow();
                    row2[0] = this.customStyleDataGrid1.Rows[i].Cells[6].Value.ToString();
                    cell    = this.customStyleDataGrid1.Rows[i].Cells[1] as DataGridViewDisableCheckBoxCell;
                    row2[1] = cell.Value;
                    cell    = this.customStyleDataGrid1.Rows[i].Cells[2] as DataGridViewDisableCheckBoxCell;
                    row2[2] = cell.Value;
                    cell    = this.customStyleDataGrid1.Rows[i].Cells[3] as DataGridViewDisableCheckBoxCell;
                    row2[3] = cell.Value;
                    cell    = this.customStyleDataGrid1.Rows[i].Cells[4] as DataGridViewDisableCheckBoxCell;
                    row2[4] = cell.Value;
                    table.Rows.Add(row2);
                }
            }
            for (int j = 0; j < table.Rows.Count; j++)
            {
                DataRow row = this.dataTable_1.NewRow();
                row[0] = table.Rows[j][0].ToString();
                if ((bool)table.Rows[j][1])
                {
                    row[1] = this.method_6(table.Rows[j][0].ToString());
                }
                if ((bool)table.Rows[j][2])
                {
                    row[2] = this.method_7(table.Rows[j][0].ToString());
                }
                if ((bool)table.Rows[j][3])
                {
                    row[3] = this.method_8(table.Rows[j][0].ToString());
                }
                if ((bool)table.Rows[j][4])
                {
                    row[4] = this.method_9(table.Rows[j][0].ToString());
                }
                this.dataTable_1.Rows.Add(row);
            }
            if ((this.dataTable_1 != null) && (this.dataTable_1.Rows.Count > 0))
            {
                new StatisticsResult(this.dataTable_1).ShowDialog();
            }
            else
            {
                MessageBoxHelper.Show("没有要统计的行", "表格统计", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }