Пример #1
0
    protected void btnDel_Click(object sender, System.EventArgs e)
    {
        CheckBox checkBox = this.gvBudget.HeaderRow.Cells[0].FindControl("cbAllBox") as CheckBox;

        if (checkBox != null && checkBox.Checked)
        {
            BudTemplateItem.Delete(this.tvBudget.SelectedValue);
            this.strJS.Append(string.Concat(new string[]
            {
                "location='BudTemplateList.aspx?tempId=",
                this.tvBudget.SelectedValue,
                "&tempType=",
                this.ddlType.SelectedValue,
                "';"
            }));
            base.RegisterScript(this.strJS.ToString());
            return;
        }
        System.Collections.Generic.List <string> list = new System.Collections.Generic.List <string>();
        if (this.hfldCheckedIds.Value.Contains("["))
        {
            list = JsonHelper.GetListFromJson(this.hfldCheckedIds.Value);
        }
        else
        {
            list.Add(this.hfldCheckedIds.Value);
        }
        bool flag = false;

        System.Collections.Generic.List <string> orderNumberById = BudTemplateItem.GetOrderNumberById(list);
        if (orderNumberById.Count > 1)
        {
            flag = BudTask.IsStructured(orderNumberById);
        }
        try
        {
            if (flag)
            {
                list.Reverse();
            }
            BudTemplateItem.Delete(list);
            this.strJS.Append("alert('系统提示:\\n删除成功!');");
            this.strJS.Append(string.Concat(new string[]
            {
                "location='BudTemplateList.aspx?tempId=",
                this.tvBudget.SelectedValue,
                "&tempType=",
                this.ddlType.SelectedValue,
                "';"
            }));
        }
        catch
        {
            this.strJS.Append("alert('系统提示:\\n请先删除子项!')");
        }
        base.RegisterScript(this.strJS.ToString());
    }