private void btnLikeAdd_Click(object sender, EventArgs e)
        {
            BaseItemDetailsEntity entity = GetEntity();

            entity.Id = null;
            FrmItemDetailsAdd frmItemDetailsAdd = new FrmItemDetailsAdd(entity);

            frmItemDetailsAdd.TargetTableName = this.TargetTableName;
            frmItemDetailsAdd.ShowDialog();
        }
Beispiel #2
0
        ///// <summary>
        ///// 当数据变化时
        ///// </summary>
        //private void OnDataChanged()
        //{
        //    // 重新加载窗体
        //    this.FormOnLoad();
        //    // 设置按钮状态
        //    this.SetControlState();
        //}

        /// <summary>
        /// 添加
        /// </summary>
        /// <returns>主键</returns>
        public string Add()
        {
            FrmItemDetailsAdd frmItemDetailsAdd = new FrmItemDetailsAdd();

            frmItemDetailsAdd.ParentId        = this.ParentId;
            frmItemDetailsAdd.TargetTableName = this.TargetTable;
            frmItemDetailsAdd.OnAdded        += new FrmItemDetailsAdd.OnAddedEventHandler(this.OnAdded);
            //frmItemDetailsAdd.OnDataChanged += new FrmItemDetailsAdd.OnDataChangedEventHandler(this.OnDataChanged);
            if (frmItemDetailsAdd.ShowDialog(this) == DialogResult.OK)
            {
                // 记录当前选中的主键
                this.CurrentEntityId = frmItemDetailsAdd.EntityId;
                // 加载窗体
                this.FormOnLoad();
            }
            return(this.CurrentEntityId);
        }