internal static void 专家调度一级动态优化_GridDragOver(object sender, DragEventArgs e) { e.Effect = DragDropEffects.None; if (e.Data == null) { return; } if (e.Data.GetDataPresent(m_dragDataFormatAdd)) { Xceed.Grid.Cell destCell = sender as Xceed.Grid.Cell; if (destCell == null) { return; } Xceed.Grid.Cell srcCell = e.Data.GetData(m_dragDataFormatAdd) as Xceed.Grid.Cell; // 增加 if (srcCell.GridControl != destCell.GridControl && destCell.Value == null && destCell.ParentColumn.FieldName == m_topGridDragFildeName && destCell.ParentRow.ForeColor != 专家调度一级静态优化.优化DisableColor) { e.Effect = DragDropEffects.Link; } } else if (e.Data.GetDataPresent(m_dragDataFormatDelete)) { Xceed.Grid.Cell destCell = sender as Xceed.Grid.Cell; Xceed.Grid.Cell srcCell = e.Data.GetData(m_dragDataFormatDelete) as Xceed.Grid.Cell; if (destCell != null) { // 更改 if (destCell.GridControl == srcCell.GridControl) { if (destCell.Value == null && destCell.ParentColumn.FieldName == m_topGridDragFildeName && destCell.ParentRow != srcCell.ParentRow && destCell.ParentRow.ForeColor != 专家调度一级静态优化.优化DisableColor) { e.Effect = DragDropEffects.Move; } } // 删除 else { e.Effect = DragDropEffects.Move; } } else { // 删除 Xceed.Grid.GridControl destGrid = sender as Xceed.Grid.GridControl; if (destGrid != null && destGrid != srcCell.GridControl) { e.Effect = DragDropEffects.Move; } } } }
void m_全部监管车辆及作业现状Grid_GridDragOver(object sender, System.Windows.Forms.DragEventArgs e) { e.Effect = System.Windows.Forms.DragDropEffects.None; if (e.Data == null) { return; } if (e.Data.GetDataPresent(m_dragDataFormatAdd)) { Xceed.Grid.Cell destCell = sender as Xceed.Grid.Cell; if (destCell == null) { return; } Xceed.Grid.Cell srcCell = e.Data.GetData(m_dragDataFormatAdd) as Xceed.Grid.Cell; // 增加 if (srcCell.GridControl != destCell.GridControl && destCell.Value == null && destCell.ParentColumn.FieldName.StartsWith("第") && destCell.ParentColumn.FieldName.EndsWith("天")) { e.Effect = System.Windows.Forms.DragDropEffects.Link; } } else if (e.Data.GetDataPresent(m_dragDataFormatDelete)) { Xceed.Grid.Cell destCell = sender as Xceed.Grid.Cell; if (destCell == null) { Xceed.Grid.GridControl grid = sender as Xceed.Grid.GridControl; if (grid != null) { e.Effect = System.Windows.Forms.DragDropEffects.Move; } } else { Xceed.Grid.Cell srcCell = e.Data.GetData(m_dragDataFormatDelete) as Xceed.Grid.Cell; if (srcCell != null) { if (srcCell.GridControl != destCell.GridControl) { e.Effect = System.Windows.Forms.DragDropEffects.Move; } else { if (destCell.Value == null && destCell.ParentColumn.FieldName.StartsWith("第") && destCell.ParentColumn.FieldName.EndsWith("天")) { e.Effect = System.Windows.Forms.DragDropEffects.Move; } } } } } }
internal static void 批量确认_Click(Xceed.Grid.GridControl nowGrid, 专家任务性质?zjrwxz) { foreach (Xceed.Grid.DataRow row in nowGrid.DataRows) { bool?b = Feng.Utils.ConvertHelper.ToBoolean(row.Cells["选定2"].Value); if (b.HasValue && b.Value) { 专家调度一级静态优化_DoubleClick(row.Cells["确认"], zjrwxz); } } }
public static void btn批量确认_Click(Xceed.Grid.GridControl grid, Action <object, System.EventArgs> action, string selectColumnName = "选定", string confirmColumnName = "确认") { foreach (Xceed.Grid.DataRow row in grid.DataRows) { bool?b = Feng.Utils.ConvertHelper.ToBoolean(row.Cells[selectColumnName].Value); if (b.HasValue && b.Value) { action(row.Cells[confirmColumnName], System.EventArgs.Empty); } } }
/// <summary> /// /// </summary> /// <param name="grid"></param> /// <param name="columnName"></param> public DialogResult ShowDialog(Xceed.Grid.GridControl grid, string columnName) { m_grid = grid; m_columnName = columnName; m_data.Clear(); if (m_grid.Columns[columnName].CellViewerManager is INameValueControl) { foreach (Xceed.Grid.DataRow row in grid.DataRows) { string s = row.Cells[m_columnName].GetDisplayText(); { m_data[s] = s; } } } else { foreach (Xceed.Grid.DataRow row in grid.DataRows) { string s = row.Cells[m_columnName].GetDisplayText(); if (!string.IsNullOrEmpty(s)) { m_data[s] = row.Cells[m_columnName].Value; } } } cobValue1.Items.Clear(); cobValue2.Items.Clear(); foreach (KeyValuePair <string, object> kvp in m_data) { cobValue1.Items.Add(new object[] { kvp.Key }); cobValue2.Items.Add(new object[] { kvp.Key }); } cobValue1.AdjustDropDownControlSize(); cobValue2.AdjustDropDownControlSize(); return(base.ShowDialog()); }
void 车队调度静态任务下达_GridDragDrop(object sender, DragEventArgs e) { if (e.Data == null) { return; } if (e.Data.GetDataPresent(m_dragDataFormatAdd)) { Xceed.Grid.Cell destCell = sender as Xceed.Grid.Cell; if (destCell == null) { return; } Xceed.Grid.Cell srcCell = e.Data.GetData(m_dragDataFormatAdd) as Xceed.Grid.Cell; // 增加 if (destCell.GridControl == m_待命车辆_单车单任务Grid) { if (srcCell.GridControl != destCell.GridControl && destCell.Value == null && destCell.ParentColumn.FieldName == m_topGridDragFildeName) { destCell.Tag = srcCell; destCell.Value = (srcCell.ParentRow.Tag as 专家任务).新任务号; //destCell.ParentRow.ForeColor = 专家调度一级静态优化.优化DisableColor; srcCell.ParentRow.ForeColor = 专家调度一级静态优化.优化DisableColor; } } } else if (e.Data.GetDataPresent(m_dragDataFormatDelete)) { Xceed.Grid.Cell destCell = sender as Xceed.Grid.Cell; Xceed.Grid.Cell srcCell = e.Data.GetData(m_dragDataFormatDelete) as Xceed.Grid.Cell; if (destCell != null) { // 更改 if (destCell.GridControl == srcCell.GridControl) { if (destCell.GridControl == m_待命车辆_单车单任务Grid) { if (destCell.Value == null && destCell.ParentColumn.FieldName == m_topGridDragFildeName && destCell.ParentRow != srcCell.ParentRow && destCell.ParentRow.ForeColor != 专家调度一级静态优化.优化DisableColor) { destCell.Tag = srcCell.Tag; srcCell.Tag = null; destCell.Value = srcCell.Value; srcCell.Value = null; //destCell.ParentRow.ForeColor = 专家调度一级静态优化.优化DisableColor; //srcCell.ParentRow.ResetForeColor(); } } } // 删除 else { Xceed.Grid.Cell srcCell2 = srcCell.Tag as Xceed.Grid.Cell; srcCell2.ParentRow.ResetForeColor(); srcCell.Tag = null; srcCell.Value = null; //srcCell.ParentRow.ResetForeColor(); } } else { // 删除 Xceed.Grid.GridControl destGrid = sender as Xceed.Grid.GridControl; if (destGrid != null) { Xceed.Grid.Cell srcCell2 = srcCell.Tag as Xceed.Grid.Cell; srcCell2.ParentRow.ResetForeColor(); srcCell.Tag = null; srcCell.Value = null; //srcCell.ParentRow.ResetForeColor(); } } } //else if (srcRow.Tag is 车辆) //{ // object tag = destCell.Tag; // destCell.Tag = srcRow.Cells["中心新任务号"].Tag; // srcRow.Cells["中心新任务号"].Tag = tag; // object tag1 = destCell.ParentRow.Cells["作业号"].Tag; // destCell.ParentRow.Cells["作业号"].Tag = srcRow.Cells["作业号"].Tag; // 车辆作业 srcClzy = destCell.ParentRow.Cells["作业号"].Tag as 车辆作业; // destCell.ParentRow.Cells["作业号"].Value = srcClzy.作业号; // srcRow.Cells["作业号"].Tag = tag1; // if (destCell.Value == null) // { // destCell.Value = ((destCell.Tag as Xceed.Grid.CellRow).Tag as 专家任务).新任务号; // srcRow.Cells["中心新任务号"].Value = null; // srcRow.Cells["作业号"].Value = null; // destCell.ParentRow.BackColor = 专家调度一级静态优化.优化DisableColor; // srcRow.ResetBackColor(); // m_clzyDao.更换车辆作业(srcClzy, destCell.ParentRow.Tag as 车辆); // } // else // { // destCell.Value = ((destCell.Tag as Xceed.Grid.CellRow).Tag as 专家任务).新任务号; // srcRow.Cells["中心新任务号"].Tag = tag; // srcRow.Cells["中心新任务号"].Value = ((srcRow.Cells["中心新任务号"].Tag as Xceed.Grid.CellRow).Tag as 专家任务).新任务号; // srcRow.Cells["作业号"].Tag = tag1; // 车辆作业 destClzy = srcRow.Cells["作业号"].Tag as 车辆作业; // srcRow.Cells["作业号"].Value = destClzy.作业号; // destCell.ParentRow.BackColor = 专家调度一级静态优化.优化DisableColor; // srcRow.BackColor = 专家调度一级静态优化.优化DisableColor; // m_clzyDao.更换车辆作业(srcClzy, destClzy); // } //} }
void 车队调度静态任务下达_GridDragOver(object sender, DragEventArgs e) { e.Effect = DragDropEffects.None; if (e.Data == null) { return; } if (e.Data.GetDataPresent(m_dragDataFormatAdd)) { Xceed.Grid.Cell destCell = sender as Xceed.Grid.Cell; if (destCell == null) { return; } Xceed.Grid.Cell srcCell = e.Data.GetData(m_dragDataFormatAdd) as Xceed.Grid.Cell; // 增加 if (destCell.GridControl == m_待命车辆_单车单任务Grid) { if (srcCell.GridControl != destCell.GridControl && destCell.Value == null && destCell.ParentColumn.FieldName == m_topGridDragFildeName) { e.Effect = DragDropEffects.Link; } } } else if (e.Data.GetDataPresent(m_dragDataFormatDelete)) { Xceed.Grid.Cell destCell = sender as Xceed.Grid.Cell; Xceed.Grid.Cell srcCell = e.Data.GetData(m_dragDataFormatDelete) as Xceed.Grid.Cell; if (destCell != null) { // 更改 if (destCell.GridControl == srcCell.GridControl) { if (destCell.GridControl == m_待命车辆_单车单任务Grid) { if (destCell.Value == null && destCell.ParentColumn.FieldName == m_topGridDragFildeName && destCell.ParentRow != srcCell.ParentRow) { e.Effect = DragDropEffects.Move; } } } // 删除 else { e.Effect = DragDropEffects.Move; } } else { // 删除 Xceed.Grid.GridControl destGrid = sender as Xceed.Grid.GridControl; if (destGrid != null && destGrid != srcCell.GridControl) { e.Effect = DragDropEffects.Move; } } } }
/// <summary> /// /// </summary> /// <param name="grid"></param> /// <param name="columnName"></param> public DialogResult ShowDialog(Xceed.Grid.GridControl grid, string columnName) { m_grid = grid; m_columnName = columnName; m_data.Clear(); if (m_grid.Columns[columnName].CellViewerManager is INameValueControl) { foreach (Xceed.Grid.DataRow row in grid.DataRows) { string s = row.Cells[m_columnName].GetDisplayText(); { m_data[s] = s; } } } else { foreach (Xceed.Grid.DataRow row in grid.DataRows) { string s = row.Cells[m_columnName].GetDisplayText(); if (!string.IsNullOrEmpty(s)) { m_data[s] = row.Cells[m_columnName].Value; } } } cobValue1.Items.Clear(); cobValue2.Items.Clear(); foreach (KeyValuePair<string, object> kvp in m_data) { cobValue1.Items.Add(new object[] {kvp.Key}); cobValue2.Items.Add(new object[] {kvp.Key}); } cobValue1.AdjustDropDownControlSize(); cobValue2.AdjustDropDownControlSize(); return base.ShowDialog(); }
void m_全部监管车辆及作业现状Grid_GridDragDrop(object sender, System.Windows.Forms.DragEventArgs e) { if (e.Data == null) { return; } if (e.Data.GetDataPresent(m_dragDataFormatAdd)) { Xceed.Grid.Cell destCell = sender as Xceed.Grid.Cell; if (destCell == null) { return; } Xceed.Grid.Cell srcCell = e.Data.GetData(m_dragDataFormatAdd) as Xceed.Grid.Cell; // 增加 if (srcCell.GridControl != destCell.GridControl && destCell.Value == null && destCell.ParentColumn.FieldName.StartsWith("第") && destCell.ParentColumn.FieldName.EndsWith("天")) { string s = srcCell.ParentRow.Cells[m_topGridDragFildeName].Value.ToString(); string[] ss = s.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); int? idx = ConvertHelper.ToInt(ss[0]); if (idx.HasValue) { destCell.Tag = srcCell; destCell.Value = idx.Value.ToString(); } ModifySrcCell(srcCell, -1); } } else if (e.Data.GetDataPresent(m_dragDataFormatDelete)) { Xceed.Grid.Cell destCell = sender as Xceed.Grid.Cell; Xceed.Grid.Cell srcCell = e.Data.GetData(m_dragDataFormatDelete) as Xceed.Grid.Cell; if (destCell == null) { Xceed.Grid.GridControl grid = sender as Xceed.Grid.GridControl; if (grid != null) { ModifySrcCell(srcCell.Tag as Xceed.Grid.Cell, 1); srcCell.Value = null; srcCell.Tag = null; } } else { if (srcCell != null) { if (srcCell.GridControl != destCell.GridControl) { ModifySrcCell(srcCell.Tag as Xceed.Grid.Cell, 1); srcCell.Value = null; srcCell.Tag = null; } else { if (destCell.Value == null && destCell.ParentColumn.FieldName.StartsWith("第") && destCell.ParentColumn.FieldName.EndsWith("天")) { destCell.Value = srcCell.Value; destCell.Tag = srcCell.Tag; srcCell.Value = null; srcCell.Tag = null; } } } } } }
internal static void 专家调度一级静态优化_GridDragDrop(object sender, DragEventArgs e) { if (e.Data == null) { return; } if (e.Data.GetDataPresent(m_dragDataFormatAdd)) { Xceed.Grid.Cell destCell = sender as Xceed.Grid.Cell; if (destCell == null) { return; } Xceed.Grid.Cell srcCell = e.Data.GetData(m_dragDataFormatAdd) as Xceed.Grid.Cell; // 增加 if (srcCell.ParentRow != destCell.ParentRow && (srcCell.GridControl != destCell.GridControl || srcCell.GridControl.Name.Contains("小箱配对")) && destCell.Value == null && destCell.ParentColumn.FieldName == m_topGridDragFildeName && destCell.ParentRow.ForeColor != 专家调度一级静态优化.优化DisableColor) { destCell.Tag = srcCell; destCell.Value = (srcCell.ParentRow.Tag as 任务).任务号; destCell.ParentRow.ForeColor = 专家调度一级静态优化.优化DisableColor; srcCell.ParentRow.ForeColor = 专家调度一级静态优化.优化DisableColor; } } else if (e.Data.GetDataPresent(m_dragDataFormatDelete)) { Xceed.Grid.Cell destCell = sender as Xceed.Grid.Cell; Xceed.Grid.Cell srcCell = e.Data.GetData(m_dragDataFormatDelete) as Xceed.Grid.Cell; if (destCell != null) { // 更改 if (destCell.GridControl == srcCell.GridControl) { if (destCell.Value == null && destCell.ParentColumn.FieldName == m_topGridDragFildeName && destCell.ParentRow != srcCell.ParentRow && destCell.ParentRow.ForeColor != 专家调度一级静态优化.优化DisableColor) { destCell.Tag = srcCell.Tag; srcCell.Tag = null; destCell.Value = srcCell.Value; srcCell.Value = null; destCell.ParentRow.ForeColor = 专家调度一级静态优化.优化DisableColor; srcCell.ParentRow.ResetForeColor(); } } // 删除 else { Xceed.Grid.Cell srcCell2 = srcCell.Tag as Xceed.Grid.Cell; srcCell2.ParentRow.ResetForeColor(); srcCell.Tag = null; srcCell.Value = null; srcCell.ParentRow.ResetForeColor(); } } else { // 删除 Xceed.Grid.GridControl destGrid = sender as Xceed.Grid.GridControl; if (destGrid != null) { Xceed.Grid.Cell srcCell2 = srcCell.Tag as Xceed.Grid.Cell; srcCell2.ParentRow.ResetForeColor(); srcCell.Tag = null; srcCell.Value = null; srcCell.ParentRow.ResetForeColor(); } } } }