private void 实时监控结束_Load(object sender, EventArgs e)
        {
            m_cm = AssociateDataControlsInControlManager(new Control[] {
                pnl作业号, pnl车牌号, pnl驾驶员编号, pnl联系电话, pnl备注
            },
                                                         "实时监控_车辆作业_监控结束");
            grid = base.AssociateArchiveGrid(pnl作业流程, "实时监控_车辆作业_监控结束_任务");

            var dm = m_cm.DisplayManager;

            dm.DataControls["备注"].ReadOnly = false;

            using (IRepository rep = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <车辆作业>())
            {
                rep.Initialize(m_clzy.车辆, m_clzy);
                rep.Initialize(m_clzy.驾驶员, m_clzy);
                rep.Initialize(m_clzy.专家任务, m_clzy);
                rep.Initialize(m_clzy.专家任务.任务, m_clzy.专家任务);

                dm.DataControls["作业号"].SelectedDataValue   = m_clzy.作业号;
                dm.DataControls["车牌号"].SelectedDataValue   = m_clzy.车辆.车牌号;
                dm.DataControls["驾驶员编号"].SelectedDataValue = m_clzy.驾驶员编号;
                dm.DataControls["联系电话"].SelectedDataValue  = m_clzy.驾驶员.联系方式;
                dm.DataControls["备注"].SelectedDataValue    = m_clzy.备注;

                grid.DisplayManager.SetDataBinding(m_clzy.专家任务.任务, string.Empty);
                for (int i = 0; i < grid.DataRows.Count; ++i)
                {
                    grid.DataRows[i].Cells["序号"].Value = i;
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// 创建Group
        /// </summary>
        internal static void CreateArchiveEvents(this IArchiveGrid grid)
        {
            foreach (GridColumnInfo info in ADInfoBll.Instance.GetGridColumnInfos(grid.GridName))
            {
                switch (info.GridColumnType)
                {
                case GridColumnType.NoColumn:
                    break;

                default:
                    if (info.DoubleClick != null)
                    {
                        GridColumnInfo          info2     = info;
                        Xceed.Grid.InsertionRow insertRow = grid.GetInsertionRow();
                        if (insertRow != null)
                        {
                            insertRow.Cells[info.GridColumnName].DoubleClick += new EventHandler(delegate(object sender, EventArgs e)
                            {
                                EventProcessUtils.ExecuteEventProcess(ADInfoBll.Instance.GetEventProcessInfos(info2.DoubleClick), sender, e);
                            });
                        }
                    }
                    break;
                    //default:
                    //    throw new InvalidOperationException("Invalide gridcolumnType of " + info.GridColumnType + " in " + info.Name);
                }
            }
        }
Exemple #3
0
        internal static void SetGridPermissions(this IArchiveGrid grid)
        {
            GridInfo info = ADInfoBll.Instance.GetGridInfo(grid.GridName);

            if (!string.IsNullOrEmpty(info.AllowInnerInsert))
            {
                grid.AllowInnerInsert = Authority.AuthorizeByRule(info.AllowInnerInsert);
            }
            if (!string.IsNullOrEmpty(info.AllowInnerEdit))
            {
                grid.AllowInnerEdit = Authority.AuthorizeByRule(info.AllowInnerEdit);
            }
            if (!string.IsNullOrEmpty(info.AllowInnerDelete))
            {
                grid.AllowInnerDelete = Authority.AuthorizeByRule(info.AllowInnerDelete);
            }

            if (!string.IsNullOrEmpty(info.AllowInsert))
            {
                grid.ControlManager.AllowInsert = Authority.AuthorizeByRule(info.AllowInsert);
            }
            if (!string.IsNullOrEmpty(info.AllowEdit))
            {
                grid.ControlManager.AllowEdit = Authority.AuthorizeByRule(info.AllowEdit);
            }
            if (!string.IsNullOrEmpty(info.AllowDelete))
            {
                grid.ControlManager.AllowDelete = Authority.AuthorizeByRule(info.AllowDelete);
            }
        }
        private void 实时监控结束_Load(object sender, EventArgs e)
        {
            m_cm = AssociateDataControlsInControlManager(new Control[] {
                pnl作业号,  pnl车牌号, pnl驾驶员编号, pnl联系电话,  pnl备注},
                "实时监控_车辆作业_监控结束");
            grid = base.AssociateArchiveGrid(pnl作业流程, "实时监控_车辆作业_监控结束_任务");

            var dm = m_cm.DisplayManager;
            dm.DataControls["备注"].ReadOnly = false;

            using (IRepository rep = ServiceProvider.GetService<IRepositoryFactory>().GenerateRepository<车辆作业>())
            {
                var clzy = rep.Get<车辆作业>(m_clzy.ID);

                dm.DataControls["作业号"].SelectedDataValue = clzy.作业号;
                dm.DataControls["车牌号"].SelectedDataValue = clzy.车辆.车牌号;
                dm.DataControls["驾驶员编号"].SelectedDataValue = clzy.驾驶员编号;
                dm.DataControls["联系电话"].SelectedDataValue = clzy.驾驶员.联系方式;
                dm.DataControls["备注"].SelectedDataValue = clzy.备注;

                grid.DisplayManager.SetDataBinding(clzy.专家任务.任务, string.Empty);
                for(int i=0; i<grid.DataRows.Count; ++i)
                {
                    grid.DataRows[i].Cells["序号"].Value = i;
                }
            }
        }
        /// <summary>
        /// SaveRowValues
        /// </summary>
        /// <param name="row"></param>
        /// <param name="grid"></param>
        public static void SaveRowValues(Xceed.Grid.CellRow row, IArchiveGrid grid)
        {
            if (row is InsertionRow)
            {
                grid.ControlManager.AddNew();

                row.Tag = grid.ControlManager.DisplayManager.CurrentItem;
                grid.AddThrowInsertRow = true;
            }
            else
            {
                grid.ControlManager.EditCurrent();
                // when insert, dataRow endingedit event will occur also
                row.Tag = grid.ControlManager.DisplayManager.CurrentItem;
            }

            try
            {
                foreach (GridColumnInfo info in ADInfoBll.Instance.GetGridColumnInfos(grid.GridName))
                {
                    if (row.Cells[info.GridColumnName] != null && !string.IsNullOrEmpty(info.PropertyName))
                    {
                        if (info.GridColumnType == GridColumnType.Normal)
                        {
                            if (row.Cells[info.GridColumnName].ReadOnly)
                            {
                                continue;
                            }

                            if (info.GridColumnType == GridColumnType.Normal)
                            {
                                EntityScript.SetPropertyValue(grid.ControlManager.DisplayManager.CurrentItem, info.Navigator, info.PropertyName,
                                                              row.Cells[info.GridColumnName].Value);
                            }
                            else if (info.GridColumnType == GridColumnType.ExpressionColumn)
                            {
                                Script.ExecuteStatement(info.Navigator,
                                                        new Dictionary <string, object> {
                                    { "entity", grid.ControlManager.DisplayManager.CurrentItem },
                                    { "cm", grid.ControlManager }
                                });
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionProcess.ProcessWithNotify(ex);
                throw;
            }

            grid.ControlManager.EndEdit(true);

            grid.AddThrowInsertRow = false;

            grid.ArchiveGridHelper.ClearError(row);
        }
Exemple #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="grid"></param>
        /// <param name="cm"></param>
        /// <param name="gridName"></param>
        public static void SetControlManager(this IArchiveGrid grid, IControlManager cm, string gridName)
        {
            grid.ControlManager = cm;

            grid.GridName = gridName;
            grid.SetGridPermissions();

            grid.SetDisplayManager(cm.DisplayManager, gridName);
        }
 void ArchiveDetailFormAutoWithDetailGrid_FormClosed(object sender, FormClosedEventArgs e)
 {
     foreach (IBoundGrid grid in m_detailGrids)
     {
         IArchiveGrid archiveGrid = grid as IArchiveGrid;
         if (archiveGrid != null)
         {
             base.ControlManager.StateControls.Remove(archiveGrid);
         }
     }
 }
        /// <summary>
        /// 增加详细信息Grid
        /// </summary>
        /// <param name="detailGrid"></param>
        protected void AddDetailGrid(IBoundGrid detailGrid)
        {
            m_detailGrids.Add(detailGrid);

            IArchiveGrid archiveGrid = detailGrid as IArchiveGrid;

            if (archiveGrid != null)
            {
                archiveGrid.IsInDetailMode = true;

                if (base.ControlManager != null)
                {
                    base.ControlManager.StateControls.Add(archiveGrid);
                    base.ControlManager.CheckControls.Add(archiveGrid);
                }
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="grid"></param>
        public ArchiveGridHelper(IArchiveGrid grid)
        {
            m_grid = grid;
            m_cm = grid.ControlManager;

            InitializeComponent();

            this.tsmDelete.Image = Feng.Windows.ImageResource.Get("Feng", "Icons.iconErase.png").Reference;
            this.tsmDeleteBatch.Image = Feng.Windows.ImageResource.Get("Feng", "Icons.iconErase.png").Reference;
            this.tsmDelete.Visible = false;

            GridInfo gridInfo = ADInfoBll.Instance.GetGridInfo(m_grid.GridName);
            if (Authority.AuthorizeByRule(gridInfo.AllowInnerMenu) || Authority.IsDeveloper())
            {
                m_grid.GridHelper.MergeContenxtMenuStripForCell(this.contextMenuStrip1);
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="grid"></param>
        public ArchiveGridHelper(IArchiveGrid grid)
        {
            m_grid = grid;
            m_cm   = grid.ControlManager;

            InitializeComponent();

            this.tsmDelete.Image      = Feng.Windows.ImageResource.Get("Feng", "Icons.iconErase.png").Reference;
            this.tsmDeleteBatch.Image = Feng.Windows.ImageResource.Get("Feng", "Icons.iconErase.png").Reference;
            this.tsmDelete.Visible    = false;

            GridInfo gridInfo = ADInfoBll.Instance.GetGridInfo(m_grid.GridName);

            if (Authority.AuthorizeByRule(gridInfo.AllowInnerMenu) || Authority.IsDeveloper())
            {
                m_grid.GridHelper.MergeContenxtMenuStripForCell(this.contextMenuStrip1);
            }
        }
Exemple #11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="grid"></param>
        /// <returns></returns>
        public static bool CheckControlValue(this IArchiveGrid grid)
        {
            bool ret = true;

            System.ComponentModel.CancelEventArgs e = new System.ComponentModel.CancelEventArgs();
            if (grid.ArchiveGridHelper.InsertionRow != null && grid.ArchiveGridHelper.InsertionRow.IsBeingEdited)
            {
                ret &= grid.ArchiveGridHelper.DoValidateRow(grid.ArchiveGridHelper.InsertionRow, e);
                if (!ret)
                {
                    return(false);
                }
            }
            foreach (Xceed.Grid.DataRow row in grid.DataRows)
            {
                ret &= grid.ArchiveGridHelper.DoValidateRow(row, e);
                if (!ret)
                {
                    return(false);
                }
            }
            return(true);
        }
        ///// <summary>
        /////
        ///// </summary>
        ///// <param name="dataSource"></param>
        ///// <param name="dataMember"></param>
        //public override void SetDataBinding(object dataSource, string dataMember)
        //{
        //    base.SetDataBinding(dataSource, dataMember);
        //}

        #region "Same"
        /// <summary>
        /// SaveRowValues
        /// </summary>
        /// <param name="row"></param>
        /// <param name="grid"></param>
        public static void SaveRowValues(Xceed.Grid.CellRow row, IArchiveGrid grid)
        {
            if (row is InsertionRow)
            {
                //grid.ControlManager.AddNew();
                grid.ControlManager.State = StateType.Add;

                row.Tag = grid.ControlManager.DisplayManager.CurrentItem;
                grid.AddThrowInsertRow = true;
            }
            else
            {
                grid.ControlManager.EditCurrent();
                // when insert, dataRow endingedit event will occur also
                row.Tag = grid.ControlManager.DisplayManager.CurrentItem;
            }

            grid.ControlManager.EndEdit(true);

            grid.AddThrowInsertRow = false;

            grid.ArchiveGridHelper.ClearError(row);
        }
Exemple #13
0
        static void process_pz_DoubleClick(object sender, EventArgs e)
        {
            MyCurrencyTextBox dc   = sender as MyCurrencyTextBox;
            ArchiveDetailForm form = dc.FindForm() as ArchiveDetailForm;

            if (form != null)
            {
                decimal      sum  = 0;
                IArchiveGrid grid = ((form as IArchiveDetailFormWithDetailGrids).DetailGrids[0] as IArchiveGrid);
                foreach (Xceed.Grid.DataRow row in grid.DataRows)
                {
                    if (row.Cells["收付标志"].Value != null &&
                        row.Cells["金额"].Value != null)
                    {
                        decimal?d = ConvertHelper.ToDecimal(row.Cells["金额"].Value);
                        if ((收付标志)row.Cells["收付标志"].Value == 收付标志.收)
                        {
                            sum += d.Value;
                        }
                        else
                        {
                            sum -= d.Value;
                        }
                    }
                }

                if ((凭证类别)form.DisplayManager.DataControls["凭证类别"].SelectedDataValue == 凭证类别.收款凭证)
                {
                    dc.SelectedDataValue = sum;
                }
                else
                {
                    dc.SelectedDataValue = -sum;
                }
            }
        }
        internal static void OnListChanged(ListChangedEventArgs e, IArchiveGrid grid)
        {
            if (grid.DisplayManager.InBatchOperation)
            {
                return;
            }

            try
            {
                grid.DisplayManager.BeginBatchOperation();
                switch (e.ListChangedType)
                {
                case ListChangedType.ItemAdded:
                    if (!grid.AddThrowInsertRow)
                    {
                        Xceed.Grid.DataRow row = grid.DataRows.AddNew();
                        grid.SetDataRowsIListData(grid.ControlManager.DisplayManager.CurrentItem, row);
                        grid.SetGridRowCellPermissions(grid.DataRows[grid.ControlManager.DisplayManager.Position]);
                        grid.SetGridRowCellColors(grid.DataRows[grid.ControlManager.DisplayManager.Position]);
                        row.EndEdit();
                        grid.CurrentRow = row;
                    }
                    grid.ControlManager.DisplayManager.Position = grid.ControlManager.DisplayManager.Count - 1;

                    // 通过InsertRow添加的时候,此时Xceed还未添加上Row ---???
                    // 确定:此时已经有DataRow
                    if (grid.AddThrowInsertRow)
                    {
                        // 重新设置DataRow信息,因为可能在保存的时候有其他信息生成
                        // grid.CurrentRow = InsertRow
                        grid.SetDataRowsIListData(grid.ControlManager.DisplayManager.CurrentItem, grid.DataRows[e.NewIndex]);
                        grid.SetGridRowCellPermissions(grid.DataRows[e.NewIndex]);
                        grid.SetGridRowCellColors(grid.DataRows[e.NewIndex]);
                    }

                    //this.ShowTitleRow();
                    break;

                case ListChangedType.ItemChanged:
                    //bool inEdit = grid.DataRows[e.NewIndex].IsBeingEdited;
                    //if (inEdit)
                    //{
                    //    grid.DataRows[e.NewIndex].CancelEdit();
                    //}
                    grid.SetDataRowsIListData(grid.ControlManager.DisplayManager.Items[e.NewIndex], grid.DataRows[e.NewIndex]);
                    grid.SetGridRowCellPermissions(grid.DataRows[e.NewIndex]);
                    grid.SetGridRowCellColors(grid.DataRows[e.NewIndex]);

                    // maybe there is a detailGrid, so load data in detailGrid
                    grid.ControlManager.DisplayManager.OnPositionChanged(System.EventArgs.Empty);

                    // 可能已经不能修改,不再进入修改状态
                    //if (inEdit)
                    //{
                    //    grid.DataRows[e.NewIndex].BeginEdit();
                    //}
                    break;

                case ListChangedType.ItemDeleted:
                    if (e.NewIndex >= 0 && e.NewIndex < grid.DataRows.Count)
                    {
                        grid.DataRows.RemoveAt(e.NewIndex);
                        //this.ShowTitleRow();
                    }
                    break;

                default:
                    throw new NotSupportedException("not supported listChangedType");
                }
            }
            finally
            {
                grid.DisplayManager.EndBatchOperation();
                grid.DisplayManager.OnPositionChanged(System.EventArgs.Empty);
            }
        }
        internal static void OnListChanged(ListChangedEventArgs e, IArchiveGrid grid)
        {
            if (grid.DisplayManager.InBatchOperation)
            {
                return;
            }

            try
            {
                grid.DisplayManager.BeginBatchOperation();
                switch (e.ListChangedType)
                {
                    case ListChangedType.ItemAdded:
                        if (!grid.AddThrowInsertRow)
                        {
                            Xceed.Grid.DataRow row = grid.DataRows.AddNew();
                            grid.SetDataRowsIListData(grid.ControlManager.DisplayManager.CurrentItem, row);
                            grid.SetGridRowCellPermissions(grid.DataRows[grid.ControlManager.DisplayManager.Position]);
                            grid.SetGridRowCellColors(grid.DataRows[grid.ControlManager.DisplayManager.Position]);
                            row.EndEdit();
                            grid.CurrentRow = row;
                        }
                        grid.ControlManager.DisplayManager.Position = grid.ControlManager.DisplayManager.Count - 1;

                        // ͨ��InsertRow��ӵ�ʱ�򣬴�ʱXceed��δ�����Row ---???
                        // ȷ������ʱ�Ѿ���DataRow
                        if (grid.AddThrowInsertRow)
                        {
                            // ��������DataRow��Ϣ����Ϊ�����ڱ����ʱ����������Ϣ����
                            // grid.CurrentRow = InsertRow
                            grid.SetDataRowsIListData(grid.ControlManager.DisplayManager.CurrentItem, grid.DataRows[e.NewIndex]);
                            grid.SetGridRowCellPermissions(grid.DataRows[e.NewIndex]);
                            grid.SetGridRowCellColors(grid.DataRows[e.NewIndex]);
                        }

                        //this.ShowTitleRow();
                        break;
                    case ListChangedType.ItemChanged:
                        //bool inEdit = grid.DataRows[e.NewIndex].IsBeingEdited;
                        //if (inEdit)
                        //{
                        //    grid.DataRows[e.NewIndex].CancelEdit();
                        //}
                        grid.SetDataRowsIListData(grid.ControlManager.DisplayManager.Items[e.NewIndex], grid.DataRows[e.NewIndex]);
                        grid.SetGridRowCellPermissions(grid.DataRows[e.NewIndex]);
                        grid.SetGridRowCellColors(grid.DataRows[e.NewIndex]);

                        // maybe there is a detailGrid, so load data in detailGrid
                        grid.ControlManager.DisplayManager.OnPositionChanged(System.EventArgs.Empty);

                        // �����Ѿ������޸ģ����ٽ����޸�״̬
                        //if (inEdit)
                        //{
                        //    grid.DataRows[e.NewIndex].BeginEdit();
                        //}
                        break;
                    case ListChangedType.ItemDeleted:
                        if (e.NewIndex >= 0 && e.NewIndex < grid.DataRows.Count)
                        {
                            grid.DataRows.RemoveAt(e.NewIndex);
                            //this.ShowTitleRow();
                        }
                        break;
                    default:
                        throw new NotSupportedException("not supported listChangedType");
                }
            }
            finally
            {
                grid.DisplayManager.EndBatchOperation();
                grid.DisplayManager.OnPositionChanged(System.EventArgs.Empty);
            }
        }
        /// <summary>
        /// SaveRowValues
        /// </summary>
        /// <param name="row"></param>
        /// <param name="grid"></param>
        public static void SaveRowValues(Xceed.Grid.CellRow row, IArchiveGrid grid)
        {
            if (row is InsertionRow)
            {
                grid.ControlManager.AddNew();

                row.Tag = grid.ControlManager.DisplayManager.CurrentItem;
                grid.AddThrowInsertRow = true;
            }
            else
            {
                grid.ControlManager.EditCurrent();
                // when insert, dataRow endingedit event will occur also
                row.Tag = grid.ControlManager.DisplayManager.CurrentItem;
            }

            try
            {
                foreach (GridColumnInfo info in ADInfoBll.Instance.GetGridColumnInfos(grid.GridName))
                {
                    if (row.Cells[info.GridColumnName] != null && !string.IsNullOrEmpty(info.PropertyName))
                    {
                        if (info.GridColumnType == GridColumnType.Normal)
                        {
                            if (row.Cells[info.GridColumnName].ReadOnly)
                            {
                                continue;
                            }

                            if (info.GridColumnType == GridColumnType.Normal)
                            {
                                EntityScript.SetPropertyValue(grid.ControlManager.DisplayManager.CurrentItem, info.Navigator, info.PropertyName,
                                                                 row.Cells[info.GridColumnName].Value);
                            }
                            else if (info.GridColumnType == GridColumnType.ExpressionColumn)
                            {
                                Script.ExecuteStatement(info.Navigator,
                                    new Dictionary<string, object>{ {"entity", grid.ControlManager.DisplayManager.CurrentItem},
                                    {"cm", grid.ControlManager}});
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionProcess.ProcessWithNotify(ex);
                throw;
            }

            grid.ControlManager.EndEdit(true);

            grid.AddThrowInsertRow = false;

            grid.ArchiveGridHelper.ClearError(row);
        }
        /// <summary>
        /// SaveRowValues
        /// </summary>
        /// <param name="row"></param>
        /// <param name="grid"></param>
        public static void SaveRowValues(Xceed.Grid.CellRow row, IArchiveGrid grid)
        {
            if (row is InsertionRow)
            {
                //grid.ControlManager.AddNew();
                grid.ControlManager.State = StateType.Add;

                row.Tag = grid.ControlManager.DisplayManager.CurrentItem;
                grid.AddThrowInsertRow = true;
            }
            else
            {
                grid.ControlManager.EditCurrent();
                // when insert, dataRow endingedit event will occur also
                row.Tag = grid.ControlManager.DisplayManager.CurrentItem;
            }

            grid.ControlManager.EndEdit(true);

            grid.AddThrowInsertRow = false;

            grid.ArchiveGridHelper.ClearError(row);
        }
Exemple #18
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="grid"></param>
 /// <param name="cm"></param>
 public static void SetControlManager(this IArchiveGrid grid, IControlManager cm)
 {
     SetControlManager(grid, cm, null);
 }