protected void cuslist_ItemCommand(object source, RepeaterCommandEventArgs e) { string id = e.CommandArgument.ToString(); switch (e.CommandName) { case "Delete": AusTypeInfo typeInfo = AusTypeInfoManager.getAusTypesById(Convert.ToInt32(id)); string typeName = typeInfo.typename; int count = AusDetialInfoManager.getAusDetialInfoByAusType(typeName); if (count > 0) { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('费用类别正在使用中,无法删除!');", true); } else { bool del = AusTypeInfoManager.Delete(Convert.ToInt32(id)); if (del == true) { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "add", "<script>alert('删除成功');window.location='AusTypeList.aspx'</script>", false); } else { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "add", "<script>alert('删除失败')</script>", true); } } break; case "Update": Response.Redirect("UpdateAusType.aspx?id=" + id); break; case "Tick": AusTypeInfo typeInfo1 = AusTypeInfoManager.getAusTypesById(Convert.ToInt32(id)); typeInfo1.iscy = "y"; AusTypeInfoManager.Update(typeInfo1); break; case "TurnBack": AusTypeInfo typeInfo2 = AusTypeInfoManager.getAusTypesById(Convert.ToInt32(id)); typeInfo2.iscy = "n"; AusTypeInfoManager.Update(typeInfo2); break; } dataBind(); }
protected void type_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName == "Delete") { string id = e.CommandArgument.ToString(); IList <AusTypeInfo> cop = AusTypeInfoManager.getAusRottenInfo(Convert.ToInt32(id)); if (cop.Count > 0) { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('正在使用中的类型不能删除!');", true); } else { AusTypeInfoManager.Delete(Convert.ToInt32(id)); } } getType(); }