public bool Save()
        {
            if (!Validate())
            {
                return(false);
            }

            if (baseObject == null) //新建
            {
                baseObject        = BaseObjectMgr.CreateBaseObject();
                baseObject.Ctx    = BaseObjectMgr.Ctx;
                baseObject.TbCode = BaseObjectMgr.TbCode;
                bool bHasVisible = false;
                foreach (CBaseObject obj in ViewDetail.ColumnInViewDetailMgr.GetList())
                {
                    CColumnInViewDetail civd = (CColumnInViewDetail)obj;
                    CColumn             col  = (CColumn)BaseObjectMgr.Table.ColumnMgr.Find(civd.FW_Column_id);
                    if (col == null)
                    {
                        continue;
                    }
                    //判断禁止和只读权限字段
                    if (m_sortRestrictColumnAccessType.ContainsKey(col.Id))
                    {
                        AccessType accessType = m_sortRestrictColumnAccessType[col.Id];
                        if (accessType == AccessType.forbide)
                        {
                            continue;
                        }
                        else if (accessType == AccessType.read)
                        {
                            continue;
                        }
                    }
                    //

                    if (col.Code.Equals("id", StringComparison.OrdinalIgnoreCase))
                    {
                        continue;
                    }
                    else if (col.Code.Equals("Created", StringComparison.OrdinalIgnoreCase))
                    {
                        continue;
                    }
                    else if (col.Code.Equals("Creator", StringComparison.OrdinalIgnoreCase))
                    {
                        baseObject.SetColValue(col, Program.User.Id);
                        continue;
                    }
                    else if (col.Code.Equals("Updated", StringComparison.OrdinalIgnoreCase))
                    {
                        continue;
                    }
                    else if (col.Code.Equals("Updator", StringComparison.OrdinalIgnoreCase))
                    {
                        baseObject.SetColValue(col, Program.User.Id);
                        continue;
                    }


                    Control[] ctrls = this.Controls.Find(col.Code, false);
                    if (ctrls.Length > 0)
                    {
                        IColumnCtrl ctrl = (IColumnCtrl)ctrls[0];
                        baseObject.SetColValue(col, ctrl.GetValue());
                        bHasVisible = true;
                    }
                }
                //外键关联
                CBaseObject objP = BaseObjectMgr.m_Parent;
                CColumn     colP = (CColumn)objP.Table.ColumnMgr.Find(viewDetail.PrimaryKey);
                CColumn     colF = (CColumn)BaseObjectMgr.Table.ColumnMgr.Find(viewDetail.ForeignKey);
                BaseObject.SetColValue(colF, objP.GetColValue(colP));

                if (!bHasVisible)
                {
                    MessageBox.Show("没有可修改字段!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    return(false);
                }
                if (!BaseObjectMgr.AddNew(baseObject, true))
                {
                    MessageBox.Show("添加失败!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    return(false);
                }
            }
            else //修改
            {
                List <CBaseObject> lstCol = BaseObjectMgr.Table.ColumnMgr.GetList();
                bool bHasVisible          = false;
                foreach (CBaseObject obj in lstCol)
                {
                    CColumn col = (CColumn)obj;
                    //判断禁止和只读权限字段
                    if (m_sortRestrictColumnAccessType.ContainsKey(col.Id))
                    {
                        AccessType accessType = m_sortRestrictColumnAccessType[col.Id];
                        if (accessType == AccessType.forbide)
                        {
                            continue;
                        }
                        else if (accessType == AccessType.read)
                        {
                            continue;
                        }
                    }
                    //

                    if (col.Code.Equals("id", StringComparison.OrdinalIgnoreCase))
                    {
                        continue;
                    }
                    else if (col.Code.Equals("Created", StringComparison.OrdinalIgnoreCase))
                    {
                        continue;
                    }
                    else if (col.Code.Equals("Creator", StringComparison.OrdinalIgnoreCase))
                    {
                        continue;
                    }
                    else if (col.Code.Equals("Updated", StringComparison.OrdinalIgnoreCase))
                    {
                        baseObject.SetColValue(col, DateTime.Now);
                        continue;
                    }
                    else if (col.Code.Equals("Updator", StringComparison.OrdinalIgnoreCase))
                    {
                        baseObject.SetColValue(col, Program.User.Id);
                        continue;
                    }


                    Control[] ctrls = this.Controls.Find(col.Code, false);
                    if (ctrls.Length > 0)
                    {
                        IColumnCtrl ctrl = (IColumnCtrl)ctrls[0];
                        baseObject.SetColValue(col, ctrl.GetValue());
                        bHasVisible = true;
                    }
                }
                if (!bHasVisible)
                {
                    MessageBox.Show("没有可修改字段!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    return(false);
                }
                if (!BaseObjectMgr.Update(baseObject, true))
                {
                    MessageBox.Show("修改失败!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    return(false);
                }
            }
            return(true);
        }
        public bool Save()
        {
            if (!Validate())
            {
                return(false);
            }

            List <CBaseObject> lstCol = BaseObjectMgr.Table.ColumnMgr.GetList();
            bool bHasVisible          = false;

            foreach (CBaseObject obj in lstCol)
            {
                CColumn col = (CColumn)obj;
                //判断禁止和只读权限字段
                if (m_sortRestrictColumnAccessType.ContainsKey(col.Id))
                {
                    AccessType accessType = m_sortRestrictColumnAccessType[col.Id];
                    if (accessType == AccessType.forbide)
                    {
                        continue;
                    }
                    else if (accessType == AccessType.read)
                    {
                        continue;
                    }
                }
                //

                if (col.Code.Equals("id", StringComparison.OrdinalIgnoreCase))
                {
                    continue;
                }
                else if (col.Code.Equals("Created", StringComparison.OrdinalIgnoreCase))
                {
                    continue;
                }
                else if (col.Code.Equals("Creator", StringComparison.OrdinalIgnoreCase))
                {
                    continue;
                }
                else if (col.Code.Equals("Updated", StringComparison.OrdinalIgnoreCase))
                {
                    BaseObject.SetColValue(col, DateTime.Now);
                    continue;
                }
                else if (col.Code.Equals("Updator", StringComparison.OrdinalIgnoreCase))
                {
                    BaseObject.SetColValue(col, Program.User.Id);
                    continue;
                }


                Control[] ctrls = this.Controls.Find(col.Code, false);
                if (ctrls.Length > 0)
                {
                    IColumnCtrl ctrl = (IColumnCtrl)ctrls[0];
                    BaseObject.SetColValue(col, ctrl.GetValue());
                    bHasVisible = true;
                }
            }
            if (!bHasVisible)
            {
                MessageBox.Show("没有可修改字段!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return(false);
            }
            if (m_bIsNew)
            {
                BaseObjectMgr.AddNew(BaseObject);
            }
            else
            {
                BaseObjectMgr.Update(BaseObject);
            }
            if (!BaseObjectMgr.Save())
            {
                MessageBox.Show("修改失败!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return(false);
            }
            return(true);
        }