| | |
| | | this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick; |
| | | toolBarMenu1.btnChkClick += ToolBarMenu1_btnChkClick; |
| | | toolBarMenu1.btnFChkClick += ToolBarMenu1_btnFChkClick; |
| | | btnFZ.Click += btnFZ_Click; |
| | | gridView2.CustomUnboundColumnData += gridView2_CustomUnboundColumnData; |
| | | this.toolBarMenu1.getXmlConfig(); |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, picCheckBox, this, "checkStatus", "", (value) => |
| | | { |
| | |
| | | } |
| | | |
| | | DataTable _newTable = JsonConvert.DeserializeObject<DataTable>(array.ToString()); |
| | | DataTable _oldTable = _newTable.Clone(); |
| | | DataTable _oldTable = gridControl1.DataSource as DataTable; |
| | | if (_oldTable == null) |
| | | { |
| | | _oldTable = _newTable.Clone(); |
| | | } |
| | | DataRow[] sourceRows = _newTable.Select(); |
| | | for (int i = 0; i < sourceRows.Length; i++) |
| | | { |
| | |
| | | private void ToolBarMenu1_btnDelClick1(object sender, EventArgs e) |
| | | { |
| | | string rowGuid = "", rowName = ""; |
| | | (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_Guid, gridView1, "guid"); |
| | | (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_Guid, gridView1, "errorNo"); |
| | | if (string.IsNullOrEmpty(rowGuid)) |
| | | { |
| | | ToolBox.MsgHelper.Warning("请先选择你要操作的行!"); |
| | |
| | | ; |
| | | toolBarMenu1.guidKey = ""; |
| | | string rowGuid, rowName; |
| | | (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_Guid, gridView1, "guid"); |
| | | (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_Guid, gridView1, "errorNo"); |
| | | if (string.IsNullOrEmpty(rowGuid)) |
| | | { |
| | | MsgHelper.Warning("请先选择你要操作的行!"); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void gridView2_CustomUnboundColumnData(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDataEventArgs e) |
| | | { |
| | | if (e.Column.FieldName == "rowNo" && e.IsGetData) |
| | | { |
| | | e.Value = e.ListSourceRowIndex + 1; |
| | | } |
| | | } |
| | | |
| | | private void btnFZ_Click(object sender, EventArgs e) |
| | | { |
| | | // 获取当前选中行的行号 |
| | | int focusedRowHandle = gridView2.FocusedRowHandle; |
| | | if (focusedRowHandle < 0) return; |
| | | |
| | | // 获取当前行的时长 |
| | | DataRow currentRow = gridView2.GetDataRow(focusedRowHandle); |
| | | if (currentRow == null) return; |
| | | |
| | | var hourValue = currentRow["hour"]; |
| | | if (hourValue == null) return; |
| | | |
| | | decimal hourlySalary = 0; |
| | | decimal hour = 0; |
| | | decimal.TryParse(txt_HourlySalary.Text, out hourlySalary); |
| | | // 获取时长 |
| | | decimal.TryParse(currentRow["hour"]?.ToString(), out hour); |
| | | |
| | | // 批量设置下面所有行的时长 |
| | | for (int i = focusedRowHandle + 1; i < gridView2.DataRowCount; i++) |
| | | { |
| | | var row = gridView2.GetDataRow(i); |
| | | if (row != null) |
| | | { |
| | | row["hour"] = hourValue; |
| | | // 计算计时工资 |
| | | row["salary"] = hourlySalary * hour; |
| | | } |
| | | } |
| | | gridView2.RefreshData(); |
| | | } |
| | | } |
| | | } |