コード例 #1
0
        public string GetValue(DataRow row)
        {
            string _val = row[Name].ToString();

            if (!_val.IsEmpty())
            {
                if (!RegName.IsEmpty())
                {
                    var ioc = RegName.SingletonByPage <CodeTable <CodeDataModel> >();
                    if (ioc != null)
                    {
                        return(ioc[_val].CODE_TEXT);
                    }
                }
            }
            return(_val);
        }
コード例 #2
0
        //public ScoreConfig Score { get; set; }

        public string GetValue(DataRow row, IServiceProvider provider)
        {
            string _val = row[Name].ToString();

            if (!_val.IsEmpty())
            {
                if (!RegName.IsEmpty())
                {
                    var ioc = provider.GetCodePlugService <CodeTable <CodeDataModel> >(RegName);
                    if (ioc != null)
                    {
                        return(ioc[_val].CodeText);
                    }
                }
            }
            return(_val);
        }
コード例 #3
0
        private void InternalInitialize(DataSet dataSet, int pageSize, string keyValue, string foreignKeyValue, string tableName, string primaryKey, string foreignKey, bool isFillEmpty, DataFormConfig dataFormConfig)
        {
            // ColumnLegalHashTable = new HashSet<string>();
            this.DataFormConfig = dataFormConfig;

            UniqueList = this.DataFormConfig.Columns.Where(a => a.IsUniqueKey).Select(a => a.Name).ToList();
            //SingleUploadColumns = this.DataFormConfig.Columns.FindAll(
            //    a => (a.ControlType == ControlType.SingleImageUpload || a.ControlType == ControlType.SingleFileUpload) && (a.Upload != null && a.Upload.HasKey)).ToList();
            //MultiUploadColumns = this.DataFormConfig.Columns.FindAll(
            //    a => (a.ControlType == ControlType.MultiImageUpload || a.ControlType == ControlType.MultiFileUpload) && (a.Upload != null && a.Upload.HasKey)).ToList();
            MomeryColumns = this.DataFormConfig.Columns.FindAll(
                a => (a.ControlType == ControlType.Momery && !a.RegName.IsEmpty())
                ).ToList();
            this.KeyValues   = new List <string>();
            this.IsFillEmpty = isFillEmpty;
            this.PostDataSet = dataSet;
            this.KeyValue    = keyValue;
            if (dataSet != null)
            {
                var _dtPageSys = dataSet.Tables["PAGE_SYS"];

                if (_dtPageSys != null && _dtPageSys.Rows.Count > 0)
                {
                    if (_dtPageSys.Columns.Contains("PageStyle"))
                    {
                        this.PageStyle = _dtPageSys.Rows[0]["PageStyle"].Value <PageStyle>();
                    }
                }

                var dt = dataSet.Tables["_KEY"];
                if (dt != null && dt.Rows.Count > 0)
                {
                    List <string> keyValueList = new List <string>();
                    foreach (DataRow row in dt.Rows)
                    {
                        string _key = row["KeyValue"].ToString();
                        keyValueList.Add(_key);
                    }
                    KeyValues = keyValueList;
                }
            }

            // if (dataSet.Tables["PAGE"])
            if (RegName.IsEmpty())
            {
                fRegName = tableName;
            }
            if (PrimaryKey.IsEmpty())
            {
                PrimaryKey = primaryKey;
            }
            if (ForeignKey.IsEmpty())
            {
                ForeignKey = foreignKey;
            }
            if (!ForeignKey.IsEmpty())
            {
                if (foreignKeyValue.IsEmpty())
                {
                    this.ForeignKeyValue = KeyValues.Count() == 1 ? KeyValues.First() : foreignKeyValue;
                }
                else
                {
                    this.ForeignKeyValue = foreignKeyValue;
                }
            }
            if (dataSet != null)
            {
                this.Pagination = new Pagination().FormDataTable(dataSet.Tables["PAGER"]);
            }
            else
            {
                this.Pagination = new Pagination()
                {
                    //TableName = RegName,
                    DataTime = DateTime.Now,
                    PageSize = pageSize
                }
            };
            this.Pagination.TableName = RegName;
            if (this.Pagination.PageSize == 0)
            {
                this.Pagination.PageSize = pageSize;
            }
            if (this.Pagination.PageSize == 0)
            {
                this.Pagination.PageSize = 20;
            }
        }