public FormProcessState() { InitializeComponent(); ReadColumnConfig(dataGridView1, "Set_125"); _list = new FishEntity.ProcessStateEntity(); _bll = new FishBll.Bll.ProcessStateBll(); comCode.DataSource = _bll.getCode(); comCode.DisplayMember = "code"; comNumbering.DataSource = _bll.getNumbering(); comNumbering.DisplayMember = "Numbering"; DealDataGridViewHeader(); this.dtpStart.Format = System.Windows.Forms.DateTimePickerFormat.Custom; this.dtpStart.CustomFormat = " "; this.dtpEnd.Format = System.Windows.Forms.DateTimePickerFormat.Custom; this.dtpEnd.CustomFormat = " "; User(); if (FishEntity.Variable.User.username == "admin" || FishEntity.Variable.User.username == "ceo" || FishEntity.Variable.User.username == "zd_lyk") { this.dataGridView1.ReadOnly = false; } else { this.dataGridView1.ReadOnly = true; } cmbeffect.SelectedItem = "全部"; //DealDataGridViewHeader_One (); //DealDataGridViewHeader_two (); }
private void dataGridView1_CellMouseUp(object sender, DataGridViewCellMouseEventArgs e) { if (boolget == true) { if (e.ColumnIndex < 0 || e.RowIndex < 0) { } else { } if (dataGridView1.Columns[e.ColumnIndex].Name.Equals("effect", StringComparison.OrdinalIgnoreCase) == true) { if (FishEntity.Variable.User.username == "admin" || FishEntity.Variable.User.username == "ceo" || FishEntity.Variable.User.username == "zd_lyk") { _list = new FishEntity.ProcessStateEntity(); _bll = new FishBll.Bll.ProcessStateBll(); _list.Numbering = dataGridView1.Rows[e.RowIndex].Cells["Numbering"].Value.ToString(); if (bool.Parse(dataGridView1.Rows[e.RowIndex].Cells["effect"].Value.ToString())) { _list.Effect = "无效"; } else { _list.Effect = "有效"; } bool idx = _bll.update(_list.Effect, _list.Numbering); if (idx) { MessageBox.Show("修改成功!"); boolget = false; } else { MessageBox.Show("修改失败!"); boolget = false; } } } } else { return; } }
void getValue(int i, FishEntity.ProcessStateEntity _list) { int idx = dataGridView1.Rows.Add(); DataGridViewRow row = dataGridView1.Rows[idx]; row.Cells["id"].Value = _list.id; row.Cells["code"].Value = _list.code; row.Cells["Numbering"].Value = _list.Numbering; switch (_list.Effect) { case "有效": row.Cells["effect"].Value = false; break; case "无效": row.Cells["effect"].Value = true; break; default: row.Cells["effect"].Value = false; break; } _createmanSet = _createmanGet.createmanGet(_list.Numbering); if (_createmanSet != null) { row.Cells["xssqBool"].Value = _createmanSet.createman.ToString(); row.Cells["demand"].Value = _createmanSet.demand.ToString(); row.Cells["Signdate"].Value = _createmanSet.Signdate.ToString(); row.Cells["Purchasecontractnumber"].Value = _createmanSet.Purchasecontractnumber.ToString(); } row.Cells["xssqExBool"].Value = string.Empty; //送审提交Name _ReviewModel = _Reviewbll.UserName(_list.Numbering); if (_ReviewModel != null) { row.Cells["xshtBool"].Value = _ReviewModel.userName.ToString(); } row.Cells["xshtExBool"].Value = string.Empty; row.Cells["fksqBool"].Value = string.Empty; row.Cells["fksqExBool"].Value = string.Empty; row.Cells["thdCode"].Value = _list.ThdCode; row.Cells["thdBool"].Value = string.Empty; row.Cells["bdCode"].Value = _list.BdCode; row.Cells["bdBool"].Value = string.Empty; row.Cells["bdExBool"].Value = string.Empty; row.Cells["hwfkCode"].Value = _list.HwfkCode; row.Cells["hwfkBool"].Value = string.Empty; row.Cells["hwfkExBool"].Value = string.Empty; row.Cells["wtfkCode"].Value = _list.WtfkCode; row.Cells["wtfkBool"].Value = string.Empty; row.Cells["wtfkExBool"].Value = string.Empty; row.Cells["skjlBool"].Value = string.Empty; row.Cells["skjlExBool"].Value = string.Empty; row.Cells["tchsBool"].Value = string.Empty; row.Cells["tchsExBool"].Value = string.Empty; if (_list.xssqBool == true) { dataGridView1.Rows[i].Cells["xssqBool"].Style.BackColor = Color.FromName("Red"); } else { dataGridView1.Rows[i].Cells["xssqBool"].Style.BackColor = Color.FromName("Blue"); } if (_list.xssqExBool == true) { dataGridView1.Rows[i].Cells["xssqExBool"].Style.BackColor = Color.FromName("Red"); } else { dataGridView1.Rows[i].Cells["xssqExBool"].Style.BackColor = Color.FromName("Blue"); } if (_list.xshtBool == true) { dataGridView1.Rows[i].Cells["xshtBool"].Style.BackColor = Color.FromName("Red"); } else { dataGridView1.Rows[i].Cells["xshtBool"].Style.BackColor = Color.FromName("Blue"); } if (_list.xshtExBool == true) { dataGridView1.Rows[i].Cells["xshtExBool"].Style.BackColor = Color.FromName("Red"); } else { dataGridView1.Rows[i].Cells["xshtExBool"].Style.BackColor = Color.FromName("Blue"); } switch (_list.fksqBool) { case '1': dataGridView1.Rows[i].Cells["fksqBool"].Style.BackColor = Color.FromName("Red"); break; case '2': dataGridView1.Rows[i].Cells["fksqBool"].Style.BackColor = Color.FromName("yellow"); break; case '0': dataGridView1.Rows[i].Cells["fksqBool"].Style.BackColor = Color.FromName("Blue"); break; case '3': dataGridView1.Rows[i].Cells["fksqBool"].Style.BackColor = Color.FromName("green"); break; default: /// <summary> /// null /// </summary> dataGridView1.Rows[i].Cells["fksqBool"].Style.BackColor = Color.FromName("Blue"); break; } if (_list.fksqExBool == true) { dataGridView1.Rows[i].Cells["fksqExBool"].Style.BackColor = Color.FromName("Red"); } else { dataGridView1.Rows[i].Cells["fksqExBool"].Style.BackColor = Color.FromName("Blue"); } switch (_list.thdBool) { case '1': dataGridView1.Rows[i].Cells["thdBool"].Style.BackColor = Color.FromName("Red"); break; case '2': dataGridView1.Rows[i].Cells["thdBool"].Style.BackColor = Color.FromName("yellow"); break; case '0': dataGridView1.Rows[i].Cells["thdBool"].Style.BackColor = Color.FromName("Blue"); break; default: /// <summary> /// null /// </summary> dataGridView1.Rows[i].Cells["thdBool"].Style.BackColor = Color.FromName("Blue"); break; } switch (_list.bdBool) { case '1': dataGridView1.Rows[i].Cells["bdBool"].Style.BackColor = Color.FromName("Red"); break; case '2': dataGridView1.Rows[i].Cells["bdBool"].Style.BackColor = Color.FromName("yellow"); break; case '0': dataGridView1.Rows[i].Cells["bdBool"].Style.BackColor = Color.FromName("Blue"); break; default: /// <summary> /// null /// </summary> dataGridView1.Rows[i].Cells["bdBool"].Style.BackColor = Color.FromName("Blue"); break; } if (_list.bdExBool == true) { dataGridView1.Rows[i].Cells["bdExBool"].Style.BackColor = Color.FromName("Red"); dataGridView1.Rows[i].Cells["bdBool"].Style.BackColor = Color.FromName("Red"); } else { dataGridView1.Rows[i].Cells["bdExBool"].Style.BackColor = Color.FromName("Blue"); } switch (_list.hwfkBool) { case '1': dataGridView1.Rows[i].Cells["hwfkBool"].Style.BackColor = Color.FromName("Red"); break; case '2': dataGridView1.Rows[i].Cells["hwfkBool"].Style.BackColor = Color.FromName("yellow"); break; case '0': dataGridView1.Rows[i].Cells["hwfkBool"].Style.BackColor = Color.FromName("Blue"); break; default: /// <summary> /// null /// </summary> dataGridView1.Rows[i].Cells["hwfkBool"].Style.BackColor = Color.FromName("Blue"); break; } if (_list.hwfkExBool == true) { dataGridView1.Rows[i].Cells["hwfkExBool"].Style.BackColor = Color.FromName("Red"); } else { dataGridView1.Rows[i].Cells["hwfkExBool"].Style.BackColor = Color.FromName("Blue"); } switch (_list.wtfkBool) { case '1': dataGridView1.Rows[i].Cells["wtfkBool"].Style.BackColor = Color.FromName("Red"); break; case '2': dataGridView1.Rows[i].Cells["wtfkBool"].Style.BackColor = Color.FromName("yellow"); break; case '0': dataGridView1.Rows[i].Cells["wtfkBool"].Style.BackColor = Color.FromName("Blue"); break; default: /// <summary> /// null /// </summary> dataGridView1.Rows[i].Cells["wtfkBool"].Style.BackColor = Color.FromName("Blue"); break; } if (_list.wtfkExBool == true) { dataGridView1.Rows[i].Cells["wtfkExBool"].Style.BackColor = Color.FromName("Red"); } else { dataGridView1.Rows[i].Cells["wtfkExBool"].Style.BackColor = Color.FromName("Blue"); } switch (_list.skjlBool) { case '1': dataGridView1.Rows[i].Cells["skjlBool"].Style.BackColor = Color.FromName("Red"); break; case '2': dataGridView1.Rows[i].Cells["skjlBool"].Style.BackColor = Color.FromName("yellow"); break; case '0': dataGridView1.Rows[i].Cells["skjlBool"].Style.BackColor = Color.FromName("Blue"); break; default: /// <summary> /// null /// </summary> dataGridView1.Rows[i].Cells["skjlBool"].Style.BackColor = Color.FromName("Blue"); break; } if (_list.skjlExBool == true) { dataGridView1.Rows[i].Cells["skjlExBool"].Style.BackColor = Color.FromName("Red"); } else { dataGridView1.Rows[i].Cells["skjlExBool"].Style.BackColor = Color.FromName("Blue"); } if (_list.tchsBool == true) { dataGridView1.Rows[i].Cells["tchsBool"].Style.BackColor = Color.FromName("Red"); } else { dataGridView1.Rows[i].Cells["tchsBool"].Style.BackColor = Color.FromName("Blue"); } if (_list.tchsExBool == true) { dataGridView1.Rows[i].Cells["tchsExBool"].Style.BackColor = Color.FromName("Red"); } else { dataGridView1.Rows[i].Cells["tchsExBool"].Style.BackColor = Color.FromName("Blue"); } }