コード例 #1
0
    protected void btnDel_Click(object sender, System.EventArgs e)
    {
        if (this.gvBudget.Rows.Count == 0)
        {
            return;
        }
        BudTaskService budTaskService = new BudTaskService();
        CheckBox       checkBox       = this.gvBudget.HeaderRow.Cells[0].FindControl("cbAllBox") as CheckBox;

        if (checkBox != null && checkBox.Checked)
        {
            budTaskService.SuperDel(this.prjId);
            base.RegisterScript(string.Concat(new string[]
            {
                "location='BudgetPlaitList.aspx?prjId=",
                this.prjId,
                "&year=",
                this.year,
                "';"
            }));
            return;
        }
        System.Collections.Generic.List <string> list = new System.Collections.Generic.List <string>();
        string value = this.hfldCheckedIds.Value;

        if (value.Contains('['))
        {
            list = JsonHelper.GetListFromJson(value);
        }
        else
        {
            list.Add(value);
        }
        if (!cn.justwin.Domain.BudTask.CheckDel(list, this.prjId))
        {
            base.RegisterScript("top.ui.alert('请先删除子项')");
        }
        else
        {
            PayoutTarget payoutTarget = new PayoutTarget();
            payoutTarget.DelByTaskId(list);
            foreach (string current in list)
            {
                try
                {
                    cn.justwin.Domain.BudTask.DeleteReourceByTaskId(current);
                    cn.justwin.Domain.BudTask.Delete(current);
                }
                catch
                {
                }
            }
        }
        base.RegisterScript(string.Concat(new string[]
        {
            "location='BudgetPlaitList.aspx?prjId=",
            this.prjId,
            "&year=",
            this.year,
            "';"
        }));
    }