Beispiel #1
0
        /// <summary>设置按钮跟面板控件的可用性
        ///
        /// </summary>
        /// <param name="operationType">操作类型</param>
        public void SetMode(EntityOperationType operationType)
        {
            switch (operationType)
            {
            case EntityOperationType.新增:
            case EntityOperationType.修改:
                m_masterStatus = operationType;
                if (operationType == EntityOperationType.新增)
                {
                    ControlManager.ClearAll(grpMaster);
                }
                ControlManager.SetControlEnabled(grpMaster, false);
                ControlManager.SetBtnEnabled(new Component[] { cmdSave, cmdCancel }, true);
                ControlManager.SetBtnEnabled(new Component[] { cmdNew, cmdDelete, cmdEdit }, false);
                ControlManager.SetControlEnabled(grpMaster, true);
                //新增或者修改主表是,明细不可用,只有保存完主表信息才能操作明细信息
                ControlManager.SetControlEnabled(grpDetail, false);
                ControlManager.SetBtnEnabled(new Component[] { cmdSaveDetail, cmdCancelDetail, cmdNewDetail, cmdDeleteDetail, cmdEditDetail }, false);
                break;

            case EntityOperationType.只读:
                m_masterStatus = operationType;
                ControlManager.SetControlEnabled(grpMaster, false);
                ControlManager.SetBtnEnabled(new Component[] { cmdSave, cmdCancel }, false);
                ControlManager.SetBtnEnabled(new Component[] { cmdNew, cmdDelete, cmdEdit }, true);
                SetMode(EntityOperationType.只读明细);
                break;

            case EntityOperationType.新增明细:
            case EntityOperationType.修改明细:
                m_detailStatus = operationType;
                if (operationType == EntityOperationType.新增明细)
                {
                    ControlManager.ClearAll(grpDetail);
                }
                ControlManager.SetControlEnabled(grpDetail, false);
                ControlManager.SetBtnEnabled(new Component[] { cmdSaveDetail, cmdCancelDetail }, true);
                ControlManager.SetBtnEnabled(new Component[] { cmdNewDetail, cmdDeleteDetail, cmdEditDetail }, false);
                ControlManager.SetControlEnabled(grpDetail, true);
                break;

            case EntityOperationType.只读明细:
                m_detailStatus = operationType;
                ControlManager.SetControlEnabled(grpDetail, false);
                ControlManager.SetBtnEnabled(new Component[] { cmdSaveDetail, cmdCancelDetail }, false);
                ControlManager.SetBtnEnabled(new Component[] { cmdNewDetail, cmdDeleteDetail, cmdEditDetail }, true);
                break;
            }
        }
Beispiel #2
0
 private void btnClear_Click(object sender, EventArgs e)
 {
     ControlManager.ClearAll(this.tabPage);
 }