Ejemplo n.º 1
0
        private ImmasGridSchemaCollection GetData()
        {
            var dt = this.immasGrid1.DataSource as DataTable;
            ImmasGridSchemaCollection columnCollection = new ImmasGridSchemaCollection();

            if (dt == null)
            {
                return(null);
            }

            foreach (DataRow row in dt.Rows)
            {
                if (row.RowState == DataRowState.Deleted)
                {
                    continue;
                }
                ImmasGridSchema column = new ImmasGridSchema();

                column.Key         = row["Key"].ToString();
                column.Caption     = row["Caption"].ToString();
                column.ColumnStyle = (ImmasColumnStyle)int.Parse(row["ColumnStyle"].ToString());
                column.Width       = int.Parse(row["Width"].ToString() == "" ? "0" : row["Width"].ToString());
                column.HAlign      = (HAlign)int.Parse(row["HAlign"].ToString());
                column.VAlign      = (VAlign)int.Parse(row["VAlign"].ToString());
                column.Hidden      = bool.Parse(row["Hidden"].ToString() == "" ? "false" : row["Hidden"].ToString());
                column.ReadOnly    = bool.Parse(row["ReadOnly"].ToString() == "" ? "false" : row["ReadOnly"].ToString());
                column.PrimaryKey  = bool.Parse(row["PrimaryKey"].ToString() == "" ? "false" : row["PrimaryKey"].ToString());

                columnCollection.Add(column);
            }
            return(columnCollection);
        }
Ejemplo n.º 2
0
        private void SetGridSchema(ImmasGridSchemaCollection gridSchemaCollection)
        {
            if (gridSchemaCollection.Count == 0)
            {
                return;
            }

            foreach (ImmasGridSchema column in gridSchemaCollection)
            {
                this.SetColumn(column.Key, column.Caption, column.ColumnStyle, column.Width
                               , HAlign.Center, VAlign.Middle
                               , column.PrimaryKey, column.ReadOnly, column.Hidden);
            }
        }
Ejemplo n.º 3
0
        private void SetData(ImmasGridSchemaCollection data)
        {
            if (data.Count == 0)
            {
                return;
            }

            var dt = this.immasGrid1.DataSource as DataTable;

            if (dt != null)
            {
                dt.Clear();
            }

            if (dt == null)
            {
                dt = new DataTable();
                dt.Columns.Add("Key");
                dt.Columns.Add("Caption");
                dt.Columns.Add("ColumnStyle");
                dt.Columns.Add("Width");
                dt.Columns.Add("HAlign");
                dt.Columns.Add("VAlign");
                dt.Columns.Add("PrimaryKey");
                dt.Columns.Add("ReadOnly");
                dt.Columns.Add("Hidden");
            }

            foreach (ImmasGridSchema column in data)
            {
                DataRow row = dt.NewRow();

                row["Key"]         = column.Key;
                row["Caption"]     = column.Caption;
                row["ColumnStyle"] = (int)column.ColumnStyle;
                row["Width"]       = column.Width;
                row["HAlign"]      = (int)column.HAlign;
                row["VAlign"]      = (int)column.VAlign;
                row["PrimaryKey"]  = column.PrimaryKey;
                row["ReadOnly"]    = column.ReadOnly;
                row["Hidden"]      = column.Hidden;

                dt.Rows.Add(row);
            }
            dt.AcceptChanges();
            this.immasGrid1.DataSource = dt;
        }