/// <summary>
        /// 创建子控件
        /// </summary>
        protected override void CreateChildControls()
        {
            base.CreateChildControls();

            ManagerMeta = new ManagerFormMeta
            {
                DalCollection = DalCollection,
                PageViewID    = PageViewID
            };

            //初始化
            Create();

            ShowForm(); //绘制控件和表格

            if (!base.Page.IsPostBack)
            {
                switch (OpenButonType)
                {
                case ButonType.ViewData:
                case ButonType.UpdateData:
                    //加载数据,用于显示和修改
                    LoadData();
                    break;
                }
            }

            //调用外部事件
            OnFormBinded(this, new EventArgs());
        }
        /// <summary>
        /// 创建子控件
        /// </summary>
        protected override void CreateChildControls()
        {
            base.CreateChildControls();

            ManagerMeta = new ManagerFormMeta
                              {
                                  DalCollection = DalCollection ,
                                  PageViewID = PageViewID
                              };

            //初始化
            Create();

            ShowForm(); //绘制控件和表格

            if (!base.Page.IsPostBack)
            {
                switch (OpenButonType)
                {
                    case ButonType.ViewData :
                    case ButonType.UpdateData:
                        //加载数据,用于显示和修改
                        LoadData();
                        break;
                }
                
            }

            //调用外部事件
            OnFormBinded(this, new EventArgs());
        }
Esempio n. 3
0
        public void LoadData()
        {
            var debugInfo = new NatureDebugInfo {
                Title = "[Nature.Service.Ashx.BaseAshx]判断Url参数"
            };

            DalCollection dalCollection = DalCollection;

            dalCollection.DalMetadata = DalCollection.DalCustomer;

            var managerFormMeta = new ManagerFormMeta
            {
                DalCollection = dalCollection,
                PageViewID    = int.Parse(PageViewID)
            };

            DicFormInfo = managerFormMeta.GetMetaData(debugInfo.DetailList);

            if (DicFormInfo == null)
            {
                return;
            }

            foreach (KeyValuePair <int, IColumn> info in DicFormInfo)
            {
                var bInfo = (ColumnMeta)info.Value;

                //修改类型,把数据库字段类型,变成.net类型
                switch (bInfo.ColType)
                {
                case "nvarchar":
                case "varchar":
                case "nchar":
                case "char":
                case "text":
                case "ntext":
                case "uniqueidentifier":
                    bInfo.PropertyType = "string";
                    break;

                case "bigint":
                    bInfo.PropertyType = "Int64";
                    break;

                case "int":
                    bInfo.PropertyType = "Int32";
                    break;

                case "smallint":
                case "tinyint":
                    bInfo.PropertyType = "Int16";
                    break;

                case "datetime":
                case "smalldatetime":
                    bInfo.PropertyType = "DateTime";
                    break;

                case "bit":
                    bInfo.PropertyType = "bool";
                    break;


                case "money":
                case "smallmoney":
                    bInfo.PropertyType = "decimal";
                    break;

                default:
                    bInfo.PropertyType = bInfo.ColType;
                    break;
                }
            }

            debugInfo.Stop();
        }
        public void LoadData()
        {
            var debugInfo = new NatureDebugInfo { Title = "[Nature.Service.Ashx.BaseAshx]判断Url参数" };

            DalCollection dalCollection = DalCollection;
            dalCollection.DalMetadata = DalCollection.DalCustomer;

            var managerFormMeta = new ManagerFormMeta
                                      {
                                          DalCollection = dalCollection,
                                          PageViewID = int.Parse(PageViewID)
                                      };

            DicFormInfo = managerFormMeta.GetMetaData(debugInfo.DetailList);

            if (DicFormInfo == null)
                return;

            foreach (KeyValuePair<int, IColumn> info in DicFormInfo)
            {
                var bInfo = (ColumnMeta)info.Value;

                //修改类型,把数据库字段类型,变成.net类型
                switch (bInfo.ColType)
                {
                    case "nvarchar":
                    case "varchar":
                    case "nchar":
                    case "char":
                    case "text":
                    case "ntext":
                    case "uniqueidentifier":
                        bInfo.PropertyType = "string";
                        break;

                    case "bigint":
                        bInfo.PropertyType = "Int64";
                        break;
                    case "int":
                        bInfo.PropertyType = "Int32";
                        break;
                    case "smallint":
                    case "tinyint":
                        bInfo.PropertyType = "Int16";
                        break;

                    case "datetime":
                    case "smalldatetime":
                        bInfo.PropertyType = "DateTime";
                        break;

                    case "bit":
                        bInfo.PropertyType = "bool";
                        break;


                    case "money":
                    case "smallmoney":
                        bInfo.PropertyType = "decimal";
                        break;

                    default:
                        bInfo.PropertyType = bInfo.ColType;
                        break;
                    

                }
            }

            debugInfo.Stop();

        }