Example #1
0
    /// <summary>
    /// 删除操作
    /// </summary>
    private void BoxDelet()
    {
        string SMfrom = R("SMfrom"), Sonfrom = R("Sonfrom"), from = R("from"), id = R("id");

        if (string.IsNullOrEmpty(id))
        {
            return;
        }
        string usid = R("usid"), ImgS = R("ImgS"), Files = R("Files"), cssupid = R("cssupid");

        if (!string.IsNullOrEmpty(cssupid))
        {
            Delet.Cssupid = cssupid;
        }
        string[] newstr = id.Split('|'); int i = 0; id = "";
        foreach (string s in newstr)
        {
            if (string.IsNullOrEmpty(id))
            {
                id += "'" + s + "'";
            }
            else
            {
                id += ",'" + s + "'";
            }
        }

        if (!string.IsNullOrEmpty(Files))
        {
            string name = Request["_name"]; newstr = name.Split('|');
            foreach (string s in newstr)
            {
                IOFile.DeleteFolder2(s);
            }
        }
        if (!string.IsNullOrEmpty(SMfrom))
        {
            if (string.IsNullOrEmpty(ImgS))
            {
                i = Delet.Deletint(from, Sonfrom, SMfrom, id);
            }
            else
            {
                i = Delet.Deletimg(from, Sonfrom, SMfrom, id, ImgS);
            }
            if (i > 0)
            {
                Response.Write("删除成功!共删除 " + i + "子表条记录");
            }
            else
            {
                Response.Write("删除成功!没有子表条记录");
            }
        }
        else if (!string.IsNullOrEmpty(Sonfrom))
        {
            if (string.IsNullOrEmpty(ImgS))
            {
                i = Delet.Deletint(from, Sonfrom, id);
            }
            else
            {
                i = Delet.Deletimg(from, Sonfrom, id, ImgS);
            }
            if (i > 0)
            {
                Response.Write("删除成功!共删除 " + i + "子表条记录");
            }
            else
            {
                Response.Write("删除成功!没有子表条记录");
            }
        }
        else
        {
            if (!string.IsNullOrEmpty(usid))
            {
                i = DBHelp.insert("delete from [" + from + "] where [Sid]=" + id + " and [usid]=" + usid);
                if (i > 0)
                {
                    Response.Write("删除成功!共删除 " + i + "条记录");
                }
                else
                {
                    Response.Write("删除失败");
                }
            }
            else
            {
                if (string.IsNullOrEmpty(ImgS))
                {
                    i = Delet.Deletint(from, id);
                }
                else
                {
                    i = Delet.Deletimg(from, id, ImgS);
                }
                if (i > 0)
                {
                    Response.Write("删除成功!共删除 " + i + "条记录");
                }
                else
                {
                    Response.Write("删除失败");
                }
            }
        }
    }