Exemple #1
0
        public GridStructure(Type entity, string linkedColumn = "", string idColumn = "", GridEditStyle editStyle = GridEditStyle.None) : this(entity)
        {
            if (editStyle == GridEditStyle.Linked)
            {
                ColumnParser parser = new ColumnParser();
                _idColumn     = parser.ColumnName(idColumn);
                _linkedColumn = parser.ColumnName(linkedColumn);
                //int columnNum = -1;
                //foreach (PropertyInfo property in _props)
                //{
                //    columnNum++;
                //    if (property.Name == _linkedColumn)
                //        break;
                //}

                this[_linkedColumn].Add("get", "getLink");
                this[_linkedColumn].Add("formatter", "formatEditLink");
                //this[_idColumn].Add("hidden", "true");

                var cookie1 = new HttpCookie("grid_id", idColumn);
                var cookie2 = new HttpCookie("grid_link", linkedColumn);

                HttpContext.Current.Response.AppendCookie(cookie1);
                HttpContext.Current.Response.AppendCookie(cookie2);
            }
        }
Exemple #2
0
        public GridStructure(Type entity, string linkedColumn = "", string idColumn = "", GridEditStyle editStyle = GridEditStyle.None)
            : this(entity)
        {
            if (editStyle == GridEditStyle.Linked)
            {
                ColumnParser parser = new ColumnParser();
                _idColumn = parser.ColumnName(idColumn);
                _linkedColumn = parser.ColumnName(linkedColumn);
                //int columnNum = -1;
                //foreach (PropertyInfo property in _props)
                //{
                //    columnNum++;
                //    if (property.Name == _linkedColumn)
                //        break;
                //}

                this[_linkedColumn].Add("get", "getLink");
                this[_linkedColumn].Add("formatter", "formatEditLink");
                //this[_idColumn].Add("hidden", "true");

                var cookie1 = new HttpCookie("grid_id", idColumn);
                var cookie2 = new HttpCookie("grid_link", linkedColumn);

                HttpContext.Current.Response.AppendCookie(cookie1);
                HttpContext.Current.Response.AppendCookie(cookie2);
            }
        }
Exemple #3
0
        /// <summary>
        /// Creates the grid structure with all the columns in the entity
        /// </summary>
        /// <param name="entity">The enity for which the structure has to be generated</param>
        public GridStructure(Type entity)
        {
            _structure = new List <Dictionary <string, string> >();

            PropertyInfo[] props = entity.GetProperties();
            int            i     = 0;

            _props = props;
            foreach (PropertyInfo property in props)
            {
                i++;
                Dictionary <String, String> cell = new Dictionary <string, string>();
                ColumnParser parser = new ColumnParser();
                string       name   = parser.ColumnName(property.Name);
                cell.Add("name", name);
                cell.Add("field", property.Name);
                cell.Add("width", "auto");
                cell.Add("headerStyles", "font-weight:bold;");
                if (name.Contains("id") || name.Contains("Id") || name.Contains("ID"))
                {
                    cell.Add("hidden", "true");
                }
                _structure.Add(cell);
                if (i >= 15)
                {
                    break;
                }
            }
        }
Exemple #4
0
        /// <summary>
        /// Creates the grid structure with all the columns in the entity
        /// </summary>
        /// <param name="entity">The enity for which the structure has to be generated</param>
        public GridStructure(Type entity)
        {
            _structure = new List<Dictionary<string, string>>();

            PropertyInfo[] props = entity.GetProperties();
            int i = 0;
            _props = props;
            foreach(PropertyInfo property in props)
            {
                i++;
                Dictionary<String, String> cell = new Dictionary<string, string>();
                ColumnParser parser = new ColumnParser();
                string name = parser.ColumnName(property.Name);
                cell.Add("name", name);
                cell.Add("field", property.Name);
                cell.Add("width", "auto");
                cell.Add("headerStyles", "font-weight:bold;");
                if (name.Contains("id") || name.Contains("Id") || name.Contains("ID"))
                    cell.Add("hidden", "true");
                _structure.Add(cell);
                if (i >= 15)
                    break;
            }
        }