Exemple #1
0
        private void lnkbtnDelete_Click(object sender, System.EventArgs e)
        {
            DocumentClass doc     = new DocumentClass();
            bool          sqlFlag = true;
            string        sql     = "";

            foreach (DataGridItem dgi in dgDocList.Items)
            {
                CheckBox cb = (CheckBox)(dgi.Cells[0].Controls[1]);
                if (cb.Checked == true)
                {
                    int    i  = dgi.ItemIndex;
                    string id = dgDocList.DataKeys[i].ToString();
                    if (sqlFlag)
                    {
                        sql    += id;
                        sqlFlag = false;
                    }
                    else
                    {
                        sql += " ,";
                        sql += id;
                    }
                }
            }
            //选择为空
            if (sql == String.Empty)
            {
                Response.Write("<script language=javascript>alert('请选择文档!');window.location='ListView.aspx?ClassID=" + ClassID + "';</script>");
            }
            else
            {
                int deleteFlag = DisplayType.ToString() == "3"?1:0;
                if (doc.DocDelete(sql, deleteFlag))
                {
                    Response.Write("<script language=javascript>alert('文档丢弃成功!');window.location='ListView.aspx?ClassID=" + ClassID + "';</script>");
                }
                else
                {
                    Server.Transfer("../../Error.aspx");
                }
            }
            doc = null;
        }