/// <summary> /// 删除订单 /// </summary> /// <param name="id">订单的id值</param> private void Del(int id) { To_OrderInfo orderinfo = To_OrderInfoManager.getTo_OrderInfoById(id); if (orderinfo != null) { int jobflowid = orderinfo.JobflowID; JobFlow model = JobFlowManager.GetModel(jobflowid); if (model == null || model.auditstatus != "01") { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "del", "<script>alert('订单已删除或审核员已审核')</script>"); } else if (!To_OrderInfoManager.CanDelete(id)) { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "del", "<script>alert('该订单关联过收款或付款或退款或报销,无法删除')</script>"); } else { string strdel = " jobflowid=" + jobflowid; AuditJobFlowManager.Delete(strdel); JobFlowManager.Delete(jobflowid); To_OrderInfoManager.deleteTo_OrderInfo(Convert.ToInt32(id)); To_OrderCollectDetialManager.deleteTo_OrderCollectDetialByOrderID(Convert.ToInt32(id)); To_OrderPayDetialManager.deleteTo_OrderPayDetialByOrderID(Convert.ToInt32(id)); To_OrderRefunDetialManager.deleteTo_OrderRefunDetialByOrderID(Convert.ToInt32(id)); } } }
/// <summary> /// 删除订单 /// </summary> /// <param name="id">订单的id值</param> private void Del(int id) { To_OrderInfo orderinfo = To_OrderInfoManager.getTo_OrderInfoById(id); if (orderinfo != null) { int jobflowid = orderinfo.JobflowID; JobFlow model = JobFlowManager.GetModel(jobflowid); string strdel = " jobflowid=" + jobflowid; AuditJobFlowManager.Delete(strdel); JobFlowManager.Delete(jobflowid); To_OrderInfoManager.deleteTo_OrderInfo(Convert.ToInt32(id)); To_OrderCollectDetialManager.deleteTo_OrderCollectDetialByOrderID(Convert.ToInt32(id)); To_OrderPayDetialManager.deleteTo_OrderPayDetialByOrderID(Convert.ToInt32(id)); To_OrderRefunDetialManager.deleteTo_OrderRefunDetialByOrderID(Convert.ToInt32(id)); } }
protected void ibtnDeleteAll_Click(object sender, ImageClickEventArgs e) { string delId = ""; //先遍历取得选中项 for (int i = 0; i < this.rpPoliy.Items.Count; i++) { CheckBox cbx = (CheckBox)(rpPoliy.Items[i].FindControl("cbx")); Label lbl = (Label)rpPoliy.Items[i].FindControl("lbl"); if (cbx != null || cbx.Text != "") { if (cbx.Checked) { delId += lbl.Text + ","; } } } //去掉最后一个, delId = (delId + ")").Replace(",)", ""); IList check = delId.Split(','); for (int i = 0; i < check.Count; i++) { To_OrderInfo orderinfo = To_OrderInfoManager.getTo_OrderInfoById(Convert.ToInt32(check[i])); if (orderinfo != null) { int jobflowid = orderinfo.JobflowID; JobFlow model = JobFlowManager.GetModel(jobflowid); string strdel = " jobflowid=" + jobflowid; AuditJobFlowManager.Delete(strdel); JobFlowManager.Delete(jobflowid); To_OrderInfoManager.deleteTo_OrderInfo(Convert.ToInt32(check[i])); To_OrderCollectDetialManager.deleteTo_OrderCollectDetialByOrderID(Convert.ToInt32(check[i])); To_OrderPayDetialManager.deleteTo_OrderPayDetialByOrderID(Convert.ToInt32(check[i])); To_OrderRefunDetialManager.deleteTo_OrderRefunDetialByOrderID(Convert.ToInt32(check[i])); } } BindData(); }