示例#1
0
 protected void btnDelete_Click(object sender, System.EventArgs e)
 {
     System.Collections.Generic.List <string> list = new System.Collections.Generic.List <string>();
     if (this.hfldContract.Value.Contains("["))
     {
         list = JsonHelper.GetListFromJson(this.hfldContract.Value);
     }
     else
     {
         list.Add(this.hfldContract.Value);
     }
     try
     {
         foreach (string current in list)
         {
             System.Collections.Generic.List <PayoutContractModel> list2 = this.payoutContract.GetList(string.Format(" Con_Payout_Contract.MainContractID = '{0}'", current));
             if (list2.Count > 0)
             {
                 base.RegisterScript("top.ui.alert('请先删除补充协议!');");
                 return;
             }
             if (this.payoutContract.IsReferenced(current))
             {
                 base.RegisterScript("top.ui.alert('请先删除此合同的关联数据!');");
                 return;
             }
         }
         PayoutTarget payoutTarget = new PayoutTarget();
         payoutTarget.DelByContractId(list);
         this.payoutContract.Delete(list);
         ConConfigContractService conConfigContractService = new ConConfigContractService();
         conConfigContractService.Deltes(list);
         base.RegisterScript("window.location = window.location;");
     }
     catch
     {
         base.RegisterScript("top.ui.alert('删除失败!');");
     }
 }
示例#2
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,
            "';"
        }));
    }