Ejemplo n.º 1
0
        /// <summary>
        /// 设子表列隐藏状态
        /// </summary>
        /// <param name="col">列号</param>
        /// <param name="v">值</param>
        public void SetDColHide(int col, bool v)
        {
            ColDef coldef = GetDColDataByCol(col);

            if (coldef != null)
            {
                coldef.hide = v;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 设子表列标签
        /// </summary>
        /// <param name="col">列号</param>
        /// <param name="v">值</param>
        public void SetDColLabel(int col, string v)
        {
            ColDef coldef = GetDColDataByCol(col);

            if (coldef != null)
            {
                coldef.colLabel = v;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 设子表小数位数
        /// </summary>
        /// <param name="col">列号</param>
        /// <param name="v">值</param>
        public void SetDColDec(int col, int v)
        {
            ColDef coldef = GetDColDataByCol(col);

            if (coldef != null)
            {
                coldef.colDec = v;
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 设列宽
        /// </summary>
        /// <param name="col">列号</param>
        /// <param name="v">值</param>
        public void SetColWid(int col, int v)
        {
            ColDef coldef = GetColDataByCol(col);

            if (coldef != null)
            {
                coldef.colWidth = v;
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 设列居中方式
        /// </summary>
        /// <param name="col">列号</param>
        /// <param name="v">值</param>
        public void SetColAlign(int col, int v)
        {
            ColDef coldef = GetColDataByCol(col);

            if (coldef != null)
            {
                coldef.colAlign = v;
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 设列名称
        /// </summary>
        /// <param name="col">列号</param>
        /// <param name="v">值</param>
        public void SetColName(int col, string v)
        {
            ColDef coldef = GetColDataByCol(col);

            if (coldef != null)
            {
                coldef.colName = v;
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 设子表关键列状态
        /// </summary>
        /// <param name="col"></param>
        /// <param name="v"></param>
        public void SetDColKeyCol(int col, bool v)
        {
            ColDef coldef = GetDColDataByCol(col);

            if (coldef != null)
            {
                coldef.keyCol = v;
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 移动子表列
        /// </summary>
        /// <param name="oldcol">旧位置</param>
        /// <param name="newcol">新位置</param>
        public void MoveDCol(int oldcol, int newcol)
        {
            ColDef coldef1 = GetDColDataByCol(oldcol);
            ColDef coldef2 = GetDColDataByCol(newcol);

            if ((coldef1 != null) && (coldef2 != null))
            {
                _dcolList.Move(_dcolList.IndexOf(oldcol), _dcolList.IndexOf(newcol));
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 取子表列标签
        /// </summary>
        /// <param name="col">列号</param>
        /// <returns></returns>
        public string GetDColLabel(int col)
        {
            ColDef coldef = GetDColDataByCol(col);

            if (coldef != null)
            {
                return(coldef.colLabel);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 取列名称
        /// </summary>
        /// <param name="col">列号</param>
        /// <returns></returns>
        public string GetColName(int col)
        {
            ColDef coldef = GetColDataByCol(col);

            if (coldef != null)
            {
                return(coldef.colName);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 取列隐藏状态
        /// </summary>
        /// <param name="col">列号</param>
        /// <returns></returns>
        public bool GetColHide(int col)
        {
            ColDef coldef = GetColDataByCol(col);

            if (coldef != null)
            {
                return(coldef.hide);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 取列宽
        /// </summary>
        /// <param name="col">列号</param>
        /// <returns></returns>
        public int GetColWid(int col)
        {
            ColDef coldef = GetColDataByCol(col);

            if (coldef != null)
            {
                return(coldef.colWidth);
            }
            else
            {
                return(0);
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 取子表小数位数
        /// </summary>
        /// <param name="col">列号</param>
        /// <returns></returns>
        public int GetDColDec(int col)
        {
            ColDef coldef = GetDColDataByCol(col);

            if (coldef != null)
            {
                return(coldef.colDec);
            }
            else
            {
                return(0);
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        /// 根据名称取列号
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public int GetColByName(string name)
        {
            ColDef coldef = _colList.Cast <ColDef>().FirstOrDefault(a => a.colName == name);

            if (coldef != null)
            {
                return(coldef.colIndx);
            }
            else
            {
                return(-1);
            }
        }
Ejemplo n.º 15
0
        /// <summary>
        /// 取子表关键列状态
        /// </summary>
        /// <param name="col"></param>
        /// <returns></returns>
        public bool GetDColKeyCol(int col)
        {
            ColDef coldef = GetDColDataByCol(col);

            if (coldef != null)
            {
                return(coldef.keyCol);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 16
0
        /// <summary>
        /// 复制数据对象
        /// </summary>
        /// <param name="sou">源对象,需从DataPacket继承</param>
        public override void AssignFrom(DataPacket sou)
        {
            base.AssignFrom(sou);
            ColDef s = sou as ColDef;

            if (s != null)
            {
                _colIndx  = s._colIndx;
                _colName  = s._colName;
                _colLabel = s._colLabel;
                _colWidth = s._colWidth;
                _colAlign = s._colAlign;
                _colType  = s._colType;
                _colDec   = s._colDec;
                _hide     = s._hide;
                _keyCol   = s._keyCol;
            }
        }
Ejemplo n.º 17
0
        /// <summary>
        /// 根据列号取显示值
        /// </summary>
        /// <param name="col">列号</param>
        /// <returns></returns>
        public string GetDspValue(int col)
        {
            string  ret     = null;
            ColData coldata = GetColDataByCol(col);

            if (coldata != null)
            {
                ret = coldata.express;
                if (_fields != null)
                {
                    ColDef coldef = _fields.Cast <ColDef>().FirstOrDefault(a => a.colIndx == col);
                    if (coldef != null)
                    {
                        switch (coldef.colType)
                        {
                        case (int)_dataType.dtString:
                            ret = coldata.express;
                            break;

                        case (int)_dataType.dtInt:
                            ret = int.Parse(coldata.express).ToString();
                            break;

                        case (int)_dataType.dtBoolean:
                            ret = Boolean.Parse(coldata.express).ToString();
                            break;

                        case (int)_dataType.dtFloat:
                            ret = float.Parse(coldata.express).ToString("F" + coldef.colDec.ToString());
                            break;

                        default:
                            ret = coldata.express;
                            break;
                        }
                        ;
                    }
                    ;
                }
                ;
            }
            ;
            return(ret);
        }
Ejemplo n.º 18
0
 /// <summary>
 /// 根据列名取列数据
 /// </summary>
 /// <param name="colname">列名</param>
 /// <returns></returns>
 public ColData GetColDataByColName(string colname)
 {
     if (_fields != null)
     {
         ColDef coldef = _fields.Cast <ColDef>().FirstOrDefault(a => a.colName == colname);
         if (coldef != null)
         {
             return(GetColDataByCol(coldef.colIndx));
         }
         else
         {
             return(null);
         }
     }
     else
     {
         return(null);
     }
 }
Ejemplo n.º 19
0
        /// <summary>
        /// 增加子表列
        /// </summary>
        /// <param name="col">列号</param>
        /// <param name="colname">列名</param>
        /// <param name="collabel">列标签,为空则默认为列名</param>
        /// <param name="colalign">列居中方式</param>
        /// <param name="coltype">列数据类型</param>
        /// <param name="coldec">列显示小数位数</param>
        /// <returns></returns>
        public ColDef AddNewDField(int col, string colname, string collabel, int colwidth, int colalign, int coltype, int coldec, bool hide = false, bool keycol = false)
        {
            ColDef coldef = new ColDef();

            coldef.colIndx  = col;
            coldef.colName  = colname;
            coldef.colLabel = collabel;
            if (string.IsNullOrEmpty(collabel))
            {
                coldef.colLabel = colname;
            }
            coldef.colWidth = colwidth;
            coldef.colAlign = colalign;
            coldef.colType  = coltype;
            coldef.colDec   = coldec;
            coldef.hide     = hide;
            coldef.keyCol   = keycol;
            _dcolList.Add(coldef);
            return(coldef);
        }
Ejemplo n.º 20
0
        /// <summary>
        /// 根据列名设值
        /// </summary>
        /// <param name="colname">列名</param>
        /// <param name="v"></param>
        public void SetValueByColName(string colname, string v)
        {
            ColData coldata = GetColDataByColName(colname);

            if (coldata != null)
            {
                coldata.express = v;
            }
            else
            {
                if (_fields != null)
                {
                    ColDef coldef = _fields.Cast <ColDef>().FirstOrDefault(a => a.colName == colname);
                    if (coldef != null)
                    {
                        SetValue(coldef.colIndx, v);
                    }
                }
                ;
            };
        }