Beispiel #1
0
        internal static void 专家调度一级静态优化_DoubleClick(Xceed.Grid.Cell srcCell, 专家任务性质?zjrwxz)
        {
            if (srcCell == null)
            {
                return;
            }

            if (srcCell.ParentColumn.FieldName == "移出")
            {
                if (srcCell.ParentRow.Cells["新任务号"].Value != null)
                {
                    Xceed.Grid.Cell srcCell2 = srcCell.ParentRow.Cells[m_topGridDragFildeName].Tag as Xceed.Grid.Cell;
                    srcCell.ParentGrid.DataRows.Remove(srcCell.ParentRow as Xceed.Grid.DataRow);
                    srcCell2.ParentGrid.DataRows.Remove(srcCell2.ParentRow as Xceed.Grid.DataRow);
                }
            }
            else if (srcCell.ParentColumn.FieldName == "取消")
            {
                任务 x = null, y = null;
                if (srcCell.ParentRow.Cells["新任务号"].Value != null)
                {
                    //x = srcCell.ParentRow.Tag as 任务;
                    return;
                }
                if (srcCell.ParentRow.Cells[m_topGridDragFildeName].Value != null)
                {
                    if (srcCell.ParentRow.Cells[m_topGridDragFildeName].Tag != null)
                    {
                        y = (srcCell.ParentRow.Cells[m_topGridDragFildeName].Tag as Xceed.Grid.Cell).ParentRow.Tag as 任务;
                    }
                }
                if (m_dao.撤销专家任务(x, y))
                {
                    if (srcCell.ParentRow.Cells[m_topGridDragFildeName].Tag != null)
                    {
                        (srcCell.ParentRow.Cells[m_topGridDragFildeName].Tag as Xceed.Grid.Cell).ParentRow.ResetForeColor();
                    }
                    srcCell.ParentRow.ResetForeColor();
                    srcCell.ParentRow.Cells[m_topGridDragFildeName].Value = null;
                    srcCell.ParentRow.Cells[m_topGridDragFildeName].Tag   = null;
                    srcCell.ParentRow.Cells["新任务号"].Value = null;
                }
                else
                {
                    Feng.MessageForm.ShowWarning("无法移出任务!", "操作失败");
                }
            }
            else if (srcCell.ParentColumn.FieldName == "确认")
            {
                if (srcCell.ParentRow.Cells["新任务号"].Value != null)
                {
                    return;
                }

                Xceed.Grid.Cell destCell = srcCell.ParentRow.Cells[m_topGridDragFildeName].Tag as Xceed.Grid.Cell;
                if (destCell == null)
                {
                    return;
                }

                任务   x    = srcCell.ParentRow.Tag as 任务;
                任务   y    = destCell.ParentRow.Tag as 任务;
                专家任务 zjrw = null;

                string bz = null;
                if (srcCell.ParentRow.Cells["备注"].Value != null)
                {
                    bz = (string)srcCell.ParentRow.Cells["备注"].Value;
                }

                zjrw = m_dao.生成专家任务(x, y, zjrwxz, bz);

                if (zjrw != null)
                {
                    srcCell.ParentRow.Cells["新任务号"].Value = zjrw.新任务号;
                    srcCell.ParentRow.Cells["新任务号"].Tag   = zjrw;
                }
            }
            else if (srcCell.ParentColumn.FieldName == "紧急下达")
            {
                if (srcCell.ParentRow.Cells["新任务号"].Tag != null)
                {
                    var zjrw = srcCell.ParentRow.Cells["新任务号"].Tag as 专家任务;
                    if (!zjrw.达时间.HasValue)
                    {
                        using (var form = new 紧急下达(zjrw))
                        {
                            if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            {
                                srcCell.ParentRow.Cells["新任务号"].Tag = form.专家任务;
                            }
                        }
                    }
                }
            }
        }
        internal static void 专家调度一级静态优化_DoubleClick(Xceed.Grid.Cell srcCell, 专家任务性质? zjrwxz)
        {
            if (srcCell == null)
                return;

            if (srcCell.ParentColumn.FieldName == "移出")
            {
                if (srcCell.ParentRow.Cells["新任务号"].Value != null)
                {
                    Xceed.Grid.Cell srcCell2 = srcCell.ParentRow.Cells[m_topGridDragFildeName].Tag as Xceed.Grid.Cell;
                    srcCell.ParentGrid.DataRows.Remove(srcCell.ParentRow as Xceed.Grid.DataRow);
                    srcCell2.ParentGrid.DataRows.Remove(srcCell2.ParentRow as Xceed.Grid.DataRow);
                }
            }
            else if (srcCell.ParentColumn.FieldName == "取消")
            {
                任务 x = null, y = null;
                if (srcCell.ParentRow.Cells["新任务号"].Value != null)
                {
                    //x = srcCell.ParentRow.Tag as 任务;
                    return;
                }
                if (srcCell.ParentRow.Cells[m_topGridDragFildeName].Value != null)
                {
                    if (srcCell.ParentRow.Cells[m_topGridDragFildeName].Tag != null)
                        y = (srcCell.ParentRow.Cells[m_topGridDragFildeName].Tag as Xceed.Grid.Cell).ParentRow.Tag as 任务;
                }
                if (m_dao.撤销专家任务(x, y))
                {
                    if (srcCell.ParentRow.Cells[m_topGridDragFildeName].Tag != null)
                        (srcCell.ParentRow.Cells[m_topGridDragFildeName].Tag as Xceed.Grid.Cell).ParentRow.ResetForeColor();
                    srcCell.ParentRow.ResetForeColor();
                    srcCell.ParentRow.Cells[m_topGridDragFildeName].Value = null;
                    srcCell.ParentRow.Cells[m_topGridDragFildeName].Tag = null;
                    srcCell.ParentRow.Cells["新任务号"].Value = null;
                }
                else
                {
                    Feng.MessageForm.ShowWarning("无法移出任务!", "操作失败");
                }
            }
            else if (srcCell.ParentColumn.FieldName == "确认")
            {
                if (srcCell.ParentRow.Cells["新任务号"].Value != null)
                    return;

                Xceed.Grid.Cell destCell = srcCell.ParentRow.Cells[m_topGridDragFildeName].Tag as Xceed.Grid.Cell;
                if (destCell == null)
                    return;

                任务 x = srcCell.ParentRow.Tag as 任务;
                任务 y = destCell.ParentRow.Tag as 任务;
                专家任务 zjrw = null;

                string bz = null;
                if (srcCell.ParentRow.Cells["备注"].Value != null)
                    bz = (string)srcCell.ParentRow.Cells["备注"].Value;

                zjrw = m_dao.生成专家任务(x, y, zjrwxz, bz);

                if (zjrw != null)
                {
                    srcCell.ParentRow.Cells["新任务号"].Value = zjrw.新任务号;
                    srcCell.ParentRow.Cells["新任务号"].Tag = zjrw;
                }
            }
            else if (srcCell.ParentColumn.FieldName == "紧急下达")
            {
                if (srcCell.ParentRow.Cells["新任务号"].Tag != null)
                {
                    var zjrw = srcCell.ParentRow.Cells["新任务号"].Tag as 专家任务;
                    if (!zjrw.下达时间.HasValue)
                    {
                        using (var form = new 紧急下达(zjrw))
                        {
                            if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            {
                                srcCell.ParentRow.Cells["新任务号"].Tag = form.专家任务;
                            }
                        }
                    }
                }
            }
        }