internal static void LoadSearchControlInfos(MyGrid grdSetup, IDisplayManager dmMaster)
        {
            if (dmMaster == null)
            {
                return;
            }

            if (grdSetup.Columns.Count == 0)
            {
                grdSetup.Columns.Add(new Xceed.Grid.Column("名称", typeof(string)));
                grdSetup.Columns.Add(new Xceed.Grid.Column("是否显示", typeof(bool)));
                grdSetup.ReadOnly = false;
                grdSetup.Columns["是否显示"].ReadOnly = false;
                grdSetup.Columns["名称"].ReadOnly   = true;
            }

            grdSetup.DataRows.Clear();

            ISearchManager sm = dmMaster.SearchManager;

            if (sm != null)
            {
                SortedList <int, ISearchControl> scc1 = new SortedList <int, ISearchControl>();
                SortedList <int, ISearchControl> scc2 = new SortedList <int, ISearchControl>();

                foreach (ISearchControl sc in sm.SearchControls)
                {
                    GridColumnInfo info = sc.Tag as GridColumnInfo;
                    if (info == null || (!string.IsNullOrEmpty(info.SearchControlType) &&
                                         Authority.AuthorizeByRule(info.SearchControlVisible)))
                    {
                        if (sc.Available)
                        {
                            scc1.Add(sc.Index, sc);
                        }
                        else
                        {
                            scc2.Add(sc.Index, sc);
                        }
                    }
                }

                foreach (KeyValuePair <int, ISearchControl> kvp in scc1)
                {
                    Xceed.Grid.DataRow row = grdSetup.DataRows.AddNew();
                    row.Cells["是否显示"].Value = kvp.Value.Available;
                    row.Cells["名称"].Value   = kvp.Value.Caption;
                    row.EndEdit();
                }
                foreach (KeyValuePair <int, ISearchControl> kvp in scc2)
                {
                    Xceed.Grid.DataRow row = grdSetup.DataRows.AddNew();
                    row.Cells["是否显示"].Value = kvp.Value.Available;
                    row.Cells["名称"].Value   = kvp.Value.Caption;
                    row.EndEdit();
                }
            }
        }
        internal static void LoadGridInfos(MyGrid grdSetup, IGrid masterGrid)
        {
            if (masterGrid == null)
            {
                return;
            }

            if (grdSetup.Columns.Count == 0)
            {
                grdSetup.Columns.Add(new Xceed.Grid.Column("名称", typeof(string)));
                grdSetup.Columns.Add(new Xceed.Grid.Column("是否显示", typeof(bool)));
                grdSetup.ReadOnly = false;
                grdSetup.Columns["是否显示"].ReadOnly = false;
                grdSetup.Columns["名称"].ReadOnly   = true;
            }

            grdSetup.DataRows.Clear();

            if (masterGrid != null)
            {
                Dictionary <string, GridColumnInfo> visibleColumns = new Dictionary <string, GridColumnInfo>();
                IList <GridColumnInfo> gridColumnInfos             = ADInfoBll.Instance.GetGridColumnInfos(masterGrid.GridName);
                bool hasInfo = gridColumnInfos.Count > 0;

                foreach (GridColumnInfo info in gridColumnInfos)
                {
                    if (!Authority.AuthorizeByRule(info.ColumnVisible))
                    {
                        continue;
                    }
                    visibleColumns[info.GridColumnName] = info;
                }

                SortedList <int, Xceed.Grid.Column> columns = new SortedList <int, Xceed.Grid.Column>();
                foreach (Xceed.Grid.Column column in masterGrid.Columns)
                {
                    if (hasInfo && !visibleColumns.ContainsKey(column.FieldName))
                    {
                        continue;
                    }

                    columns.Add(column.VisibleIndex, column);
                }

                foreach (KeyValuePair <int, Xceed.Grid.Column> kvp in columns)
                {
                    Xceed.Grid.DataRow row = grdSetup.DataRows.AddNew();
                    row.Cells["是否显示"].Value = kvp.Value.Visible;
                    row.Cells["名称"].Value   = kvp.Value.Title;
                    row.EndEdit();

                    if (visibleColumns.ContainsKey(kvp.Value.FieldName))
                    {
                        row.ReadOnly = Authority.AuthorizeByRule(visibleColumns[kvp.Value.FieldName].NotNull);
                    }
                }
            }
        }
        private void LoadGridInfos()
        {
            grdGridColumns.DataRows.Clear();

            IBoundGrid masterGrid = m_masterGrid as IBoundGrid;

            if (masterGrid != null)
            {
                Dictionary <string, GridColumnInfo> visibleColumns = new Dictionary <string, GridColumnInfo>();
                bool hasInfo = GridSettingInfoCollection.Instance[masterGrid.GridName].GridColumnInfos.Count > 0;

                foreach (GridColumnInfo info in GridSettingInfoCollection.Instance[masterGrid.GridName].GridColumnInfos)
                {
                    if (!Authority.AuthorizeByRule(info.ColumnVisible))
                    {
                        continue;
                    }
                    visibleColumns[info.GridColumnName] = info;
                }

                foreach (Xceed.Grid.Column column in masterGrid.Columns)
                {
                    if (hasInfo && !visibleColumns.ContainsKey(column.FieldName))
                    {
                        continue;
                    }

                    Xceed.Grid.DataRow row = grdGridColumns.DataRows.AddNew();
                    row.Cells["是否显示"].Value = column.Visible;
                    row.Cells["名称"].Value   = column.Title;
                    row.EndEdit();

                    if (visibleColumns.ContainsKey(column.FieldName))
                    {
                        row.ReadOnly = Authority.AuthorizeByRule(visibleColumns[column.FieldName].NotNull);
                    }
                }
            }
        }
Ejemplo n.º 4
0
        private void 电子作业单_Load(object sender, EventArgs e)
        {
            int[]    taskIdx             = null;
            string[] importantAreas      = null;
            string[] importantTaskStatus = null;
            string[] importantWorkStatus = null;
            using (IRepository rep = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <车辆作业>())
            {
                var clzy = rep.Get <车辆作业>(m_clzy.ID);

                m_cm.DisplayManager.SetDataBinding(new List <车辆作业> {
                    clzy
                }, string.Empty);
                m_cm.EditCurrent();

                ModelHelper.Get任务状态(clzy.专家任务, out taskIdx, out importantAreas, out importantTaskStatus, out importantWorkStatus);

                StringBuilder strZylx = new StringBuilder();
                for (int i = 0; i < taskIdx.Length; ++i)
                {
                    Xceed.Grid.DataRow row = m_作业流程.DataRows.AddNew();
                    row.Cells["次序"].Value   = i;
                    row.Cells["作业地点"].Value = importantAreas[i];
                    row.Cells["动作"].Value   = importantWorkStatus[i];

                    var rw = clzy.专家任务.任务[taskIdx[i]];
                    row.Cells["箱号"].Value = rw.箱号;
                    row.Cells["箱型"].Value = rw.箱型编号;
                    if (importantWorkStatus[i].StartsWith("港区提箱"))
                    {
                        m_cm.DisplayManager.DataControls["疏港期限"].SelectedDataValue = rw.提箱时间要求.HasValue ? rw.提箱时间要求.Value : rw.提箱时间要求;
                    }
                    else if (importantWorkStatus[i].StartsWith("还箱") || importantWorkStatus[i].StartsWith("进港"))
                    {
                        m_cm.DisplayManager.DataControls["进港还箱期限"].SelectedDataValue = rw.还箱进港时间要求.HasValue ? rw.还箱进港时间要求.Value : rw.还箱进港时间要求;
                    }
                    else if (importantWorkStatus[i].StartsWith("卸货"))
                    {
                        row.Cells["详细地址"].Value = rw.卸货地详细地址;
                        row.Cells["联系人"].Value  = rw.卸货联系人;
                        row.Cells["联系电话"].Value = rw.卸货联系手机 + "," + rw.卸货联系座机;
                    }
                    else if (importantWorkStatus[i].StartsWith("装货"))
                    {
                        row.Cells["详细地址"].Value = rw.装货地详细地址;
                        row.Cells["联系人"].Value  = rw.装货联系人;
                        row.Cells["联系电话"].Value = rw.装货联系手机 + "," + rw.装货联系座机;
                    }

                    row.EndEdit();

                    if (i != 0)
                    {
                        strZylx.Append("、");
                    }
                    strZylx.Append(row.Cells["作业地点"].GetDisplayText() + "(" + row.Cells["动作"].GetDisplayText() + ")");
                }

                m_cm.DisplayManager.DataControls["作业路线"].SelectedDataValue = strZylx.ToString();

                if (m_cm.DisplayManager.DataControls["开始时间"].SelectedDataValue == null)
                {
                    m_cm.DisplayManager.DataControls["开始时间"].SelectedDataValue = System.DateTime.Now;
                }

                if (m_cm.DisplayManager.DataControls["车载Id号"].SelectedDataValue == null)
                {
                    m_cm.DisplayManager.DataControls["车载Id号"].SelectedDataValue = clzy.车辆.车载Id号;
                }

                if (m_cm.DisplayManager.DataControls["驾驶员编号"].SelectedDataValue == null)
                {
                    m_cm.DisplayManager.DataControls["驾驶员编号"].SelectedDataValue = clzy.车辆.主驾驶员编号;
                }
            }
        }