public bool LoadLayout(AMS.Profile.IProfile profile)
        {
            int r = profile.GetValue("SearchManager." + m_sm.Name, "MaxResult", -1);
            if (r != -1)
            {
                m_sm.MaxResult = r;
            }

            string history = profile.GetValue("SearchManager." + m_sm.Name, "History", string.Empty);
            if (!string.IsNullOrEmpty(history))
            {
                string[] ss = history.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
                for(int i=ss.Length -1; i>=0; --i)
                {
                    string s = ss[i];
                    if (string.IsNullOrEmpty(s))
                        continue;
                    string[] sss = s.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                    if (sss.Length == 0)
                        continue;
                    ISearchExpression se = null;
                    try
                    {
                        se = SearchExpression.Parse(sss[0]);
                    }
                    catch (Exception)
                    {
                    }

                    if (se == null)
                        continue;
                    IList<ISearchOrder> so = null;
                    if (sss.Length > 1)
                    {
                        so = SearchOrder.Parse(sss[1]);
                    }
                    SearchHistoryInfo his = m_sm.SetHistory(se, so);
                    his.IsCurrentSession = false;
                }
            }

            bool ret = this.searchControlContainer1.LoadLayout(profile);
            return ret;
        }
        public bool SaveLayout(AMS.Profile.IProfile profile)
        {
            if (m_sm == null)
                return false;
            if (m_sm.MaxResult != SearchManagerDefaultValue.MaxResult)
            {
                profile.SetValue("SearchManager." + m_sm.Name, "MaxResult", m_sm.MaxResult);
            }

            StringBuilder sb = new StringBuilder();
            int idx = 0;
            while (true)
            {
                SearchHistoryInfo his = m_sm.GetHistory(idx);
                if (!string.IsNullOrEmpty(his.Expression))
                {
                    sb.Append(his.Expression);
                    if (!string.IsNullOrEmpty(his.Order))
                    {
                        sb.Append(";");
                        sb.Append(his.Order);
                    }
                    sb.Append(Environment.NewLine);

                    idx++;
                }
                else
                {
                    break;
                }
            }
            profile.SetValue("SearchManager." + m_sm.Name, "History", sb.ToString());

            bool ret = this.searchControlContainer1.SaveLayout(profile);
            return ret;
        }
 public bool LoadLayout(AMS.Profile.IProfile profile)
 {
     if (this.SearchManager != null)
     {
         int r = profile.GetValue("SearchManager." + this.SearchManager.Name, "MaxResult", -1);
         if (r != -1)
         {
             this.SearchManager.MaxResult = r;
             return true;
         }
     }
     return false;
 }
 public bool SaveLayout(AMS.Profile.IProfile profile)
 {
     if (this.SearchManager != null)
     {
         if (this.SearchManager.MaxResult != SearchManagerDefaultValue.MaxResult)
         {
             profile.SetValue("SearchManager." + this.BindingSource.SearchManager.Name, "MaxResult", this.BindingSource.SearchManager.MaxResult);
         }
         return true;
     }
     else
     {
         return false;
     }
 }
 /// <summary>
 /// 保存Column布局
 /// </summary>
 /// <param name="grid"></param>
 /// <param name="sectionName"></param>
 private static bool SaveLayout(this IGrid grid, string sectionName, AMS.Profile.IProfile profile)
 {
     StringBuilder sb = new StringBuilder();
     for (int i = 0; i < grid.Columns.Count; ++i)
     {
         sb.Append(grid.Columns[i].FieldName);
         sb.Append(",");
         sb.Append(grid.Columns[i].Visible);
         sb.Append(",");
         sb.Append(grid.Columns[i].VisibleIndex);
         sb.Append(",");
         sb.Append(grid.Columns[i].Width);
         sb.Append(",");
         sb.Append(grid.Columns[i].Fixed);
         sb.Append(System.Environment.NewLine);
     }
     profile.SetValue(sectionName, "Column", sb.ToString());
     return true;
 }
        private static bool SaveLayoutDetailGrid(this IGrid grid, int level, Xceed.Grid.Collections.DataRowList rowList, AMS.Profile.IProfile profile)
        {
            bool ret = true;
            if (rowList.Count > 0)
            {
                foreach (MyDetailGrid detailGrid in rowList[0].DetailGrids)
                {
                    Form form = grid.FindForm();
                    ret &= detailGrid.SaveLayout("MyGrid." + (form != null ? form.Name : "") + "." + grid.GridName + "." + level.ToString() + "." + detailGrid.GridName + ".Layout", profile);

                    ret &= SaveLayoutDetailGrid(grid, level + 1, detailGrid.DataRows, profile);
                }
            }
            return ret;
        }
        /// <summary>
        /// 
        /// </summary>
        public static bool SaveLayout(this IGrid grid, AMS.Profile.IProfile profile)
        {
            Form form = grid.FindForm();
            bool ret = SaveLayout(grid, "MyGrid." + (form != null ? form.Name : "") + "." + grid.GridName + ".Layout", profile);

            ret &= SaveLayoutDetailGrid(grid, 1, grid.DataRows, profile);
            return ret;
        }
        /// <summary>
        /// SaveLayout
        /// </summary>
        /// <param name="profile"></param>
        public bool SaveLayout(AMS.Profile.IProfile profile)
        {
            string sectionName = "ArchiveDetailForm." + "." + this.Name + "." + m_controlGroupName + ".Layout";

            if (m_dm != null && m_dm.DataControls.Count > 0)
            {
                StringBuilder sb = new StringBuilder();
                for (int i = 0; i < m_dm.DataControls.Count; ++i)
                {
                    sb.Append(m_dm.DataControls[i].Name);
                    sb.Append(",");
                    sb.Append(m_dm.DataControls[i].Available);
                    sb.Append(System.Environment.NewLine);
                }
                profile.SetValue(sectionName, "DataControls", sb.ToString());
            }
            return true;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="grid"></param>
        /// <param name="profile"></param>
        /// <returns></returns>
        public static bool LoadLayout(this IGrid grid, AMS.Profile.IProfile profile)
        {
            grid.LoadStyleSheet(profile);

            return LoadLayout(grid, profile, 0);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="grid"></param>
        /// <param name="profile"></param>
        /// <param name="minLevel"></param>
        /// <returns></returns>
        public static bool LoadLayout(this IGrid grid, AMS.Profile.IProfile profile, int minLevel)
        {
            // 在未初始化前,不读入
            if (grid.Columns.Count == 0)
            {
                return false;
            }

            bool ret = true;
            try
            {
                grid.BeginInit();

                if (0 >= minLevel)
                {
                    Form form = grid.FindForm();
                    ret = grid.LoadLayout("MyGrid." + (form != null ? form.Name : "") + "." + grid.GridName + ".Layout", profile);
                }

                LoadLayoutDetailGrid(grid, 1, grid.DataRows, profile, minLevel);

            }
            catch (Exception ex)
            {
                ExceptionProcess.ProcessWithResume(ex);
            }
            finally
            {
                grid.EndInit();
            }

            return ret;
        }
 /// <summary>
 /// 读入保存的样式
 /// </summary>
 public static void LoadStyleSheet(this IGrid grid, AMS.Profile.IProfile profile)
 {
     string styleSheetName = profile.GetValue("Grid.StyleSheet." + grid.GridName, "Name", "");
     if (string.IsNullOrEmpty(styleSheetName))
     {
         return;
     }
 }
        /// <summary>
        /// ����Column����
        /// </summary>
        /// <param name="grid"></param>
        /// <param name="sectionName"></param>
        public bool SaveLayout(AMS.Profile.IProfile profile)
        {
            if (m_sm == null)
                return false;
            string sectionName = "SearchControlContainer." + "." + m_sm.Name + ".Layout";

            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < m_sm.SearchControls.Count; ++i)
            {
                sb.Append(m_sm.SearchControls[i].Name);
                sb.Append(",");
                sb.Append(m_sm.SearchControls[i].Available);
                sb.Append(",");
                sb.Append(m_sm.SearchControls[i].Index);
                sb.Append(System.Environment.NewLine);
            }
            profile.SetValue(sectionName, "SearchControls", sb.ToString());

            return true;
        }
        /// <summary>
        /// ������ҿؼ���Ϣ
        /// </summary>
        /// <param name="grid"></param>
        /// <param name="profile"></param>
        /// <returns></returns>
        public bool LoadLayout(AMS.Profile.IProfile profile)
        {
            string sectionName = "SearchControlContainer." + "." + m_sm.Name + ".Layout";

            string s = profile.GetValue(sectionName, "SearchControls", "");
            if (string.IsNullOrEmpty(s))
            {
                return false;
            }
            string[] columns = s.Split(new string[] { System.Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);

            foreach (string columnName in columns)
            {
                string[] ss = columnName.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                if (ss.Length != 3)
                {
                    continue;
                }

                ISearchControl sc = m_sm.SearchControls[ss[0]];
                if (sc == null)
                {
                    continue;
                }

                GridColumnInfo info = sc.Tag as GridColumnInfo;
                if (info == null || (!string.IsNullOrEmpty(info.SearchControlType)
                        && Authority.AuthorizeByRule(info.SearchControlVisible)))
                {
                    sc.Available = Convert.ToBoolean(ss[1]);
                }
                else
                {
                    m_sm.SearchControls[ss[0]].Available = false;
                }

                sc.Index = Convert.ToInt32(ss[2]);
            }
            return true;
        }
示例#14
0
        public bool LoadLayout(AMS.Profile.IProfile profile)
        {
            bool ret = GridLayoutExtention.LoadLayout(this, profile);

            ChangeControlPos();

            return ret;
        }
        /// <summary>
        /// 读入保存的Column布局
        /// </summary>
        /// <param name="grid"></param>
        /// <param name="sectionName"></param>
        /// <returns></returns>
        private static bool LoadLayout(this IGrid grid, string sectionName, AMS.Profile.IProfile profile)
        {
            string s = profile.GetValue(sectionName, "Column", "");
            if (string.IsNullOrEmpty(s))
            {
                return false;
            }
            string[] columns = s.Split(new string[] { System.Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);

            foreach (string columnName in columns)
            {
                string[] ss = columnName.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                if (ss.Length != 5)
                {
                    continue;
                }
                if (grid.Columns[ss[0]] == null)
                {
                    continue;
                }

                Xceed.Grid.Column column = grid.Columns[ss[0]];
                // 默认是-1,设置成0是gridcolumnInfo 设置成Invisible
                if (column != null && column.MaxWidth != 0)
                {
                    column.Visible = Convert.ToBoolean(ss[1]);
                    column.VisibleIndex = Convert.ToInt32(ss[2]);
                    column.Width = Convert.ToInt32(ss[3]);
                    column.Fixed = Convert.ToBoolean(ss[4]);
                }
            }
            return true;
        }
示例#16
0
 public bool SaveLayout(AMS.Profile.IProfile profile)
 {
     return GridLayoutExtention.SaveLayout(this, profile);
 }
        /// <summary>
        /// LoadLayout
        /// </summary>
        /// <param name="profile"></param>
        /// <returns></returns>
        public bool LoadLayout(AMS.Profile.IProfile profile)
        {
            string sectionName = "ArchiveDetailForm." + "." + this.Name + "." + m_controlGroupName + ".Layout";

            string s = profile.GetValue(sectionName, "DataControls", "");
            if (string.IsNullOrEmpty(s))
            {
                return false;
            }
            string[] dcs = s.Split(new string[] { System.Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);

            foreach (string dc in dcs)
            {
                string[] ss = dc.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                if (ss.Length != 2)
                {
                    continue;
                }
                if (m_dm.DataControls[ss[0]] == null)
                {
                    continue;
                }

                GridColumnInfo info = m_dm.DataControls[ss[0]].Tag as GridColumnInfo;
                if (m_dm.DataControls[ss[0]] != null)
                {
                    if (info == null || (!string.IsNullOrEmpty(info.DataControlType)
                        && Authority.AuthorizeByRule(info.DataControlVisible)))
                    {
                        m_dm.DataControls[ss[0]].Available = Convert.ToBoolean(ss[1]);
                    }
                    else
                    {
                        m_dm.DataControls[ss[0]].Available = false;
                    }
                }
            }
            return true;
        }