Example #1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            DialogResult dlg = MessageBox.Show("Are you sure you want to delete this contract type?", "Delete confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (dlg == DialogResult.Yes)
            {
                contractType.Delete();
                Close();
            }
        }
Example #2
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <returns>是否成功</returns>
        public override void Delete()
        {
            if (!m_Loaded)
            {
                throw new AppException("尚未初始化");
            }
            bool result = (ContractType.Delete(ContractTypeId) == 1);

            //更新缓存
            if (result && CachedEntityCommander.IsTypeRegistered(typeof(ContractTypeInfo)))
            {
                ResetCache();
            }
            if (!result)
            {
                throw new AppException("删除失败,数据可能被删除");
            }
        }