Exemplo n.º 1
0
    void Delete()
    {
        string delid = Request["delid"];

        if (string.IsNullOrEmpty(delid))
        {
            Response.Write("请选择记录!");
            return;
        }
        CBaseObjectMgr BaseObjectMgr = Global.GetCtx(Session["TopCompany"].ToString()).FindBaseObjectMgrCache(m_Table.Code, m_guidParentId);

        if (BaseObjectMgr == null)
        {
            BaseObjectMgr        = new CBaseObjectMgr();
            BaseObjectMgr.TbCode = m_Table.Code;
            BaseObjectMgr.Ctx    = Global.GetCtx(Session["TopCompany"].ToString());
            string sWhere = string.Format(" id='{0}'", delid);
            BaseObjectMgr.GetList(sWhere);
        }
        if (!BaseObjectMgr.Delete(new Guid(delid), true))
        {
            Response.Write("删除失败!");
            return;
        }
    }
Exemplo n.º 2
0
    void Delete()
    {
        string ids = Request["ids"];

        if (string.IsNullOrEmpty(ids))
        {
            Response.Write("请选择行!");
            return;
        }
        if (m_ViewAccessType != AccessType.write)
        {
            Response.Write("没有写权限!");
            return;
        }
        if (m_TableAccessType != AccessType.write)
        {
            Response.Write("没有写权限!");
            return;
        }

        CBaseObjectMgr BaseObjectMgr = Global.GetCtx(Session["TopCompany"].ToString()).FindBaseObjectMgrCache(m_Table.Code, m_guidParentId);

        if (BaseObjectMgr == null)
        {
            BaseObjectMgr        = new CBaseObjectMgr();
            BaseObjectMgr.TbCode = m_Table.Code;
            BaseObjectMgr.Ctx    = Global.GetCtx(Session["TopCompany"].ToString());
            string sWhere = string.Format(" id in ('{0}')", ids.TrimEnd(",".ToCharArray()));
            BaseObjectMgr.GetList(sWhere);
        }
        string[] arr = ids.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
        foreach (string sId in arr)
        {
            if (!BaseObjectMgr.Delete(new Guid(sId)))
            {
                Response.Write(BaseObjectMgr.Ctx.LastError);
                return;
            }
        }

        if (!BaseObjectMgr.Save(true))
        {
            Response.Write("删除失败!");
            return;
        }
    }
Exemplo n.º 3
0
        private void tbtDel_Click(object sender, EventArgs e)
        {
            //if (dataGridView.CurrentRow == null)
            //{
            //    MessageBox.Show("请选择一项!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //    return;
            //}
            //if (MessageBox.Show("是否确认删除?", "确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
            //    return;
            CBaseObject obj = (CBaseObject)dataGridView.CurrentRow.Tag;

            BaseObjectMgr.Delete(obj);
            //if (!BaseObjectMgr.Delete(obj,true))
            //{
            //    MessageBox.Show("删除失败!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            //    return ;
            //}
            dataGridView.Rows.Remove(dataGridView.CurrentRow);
        }