public void SaveInfo() { if (CategoryID.IsNoNull()) { objCategory = objLogRule.loger_category.First(p => p.CategoryID == CategoryID); objCategory.CategoryName = txtCategoryName.Text; objCategory.LogWriteType = chkLogWriteType.SelectValueString; objCategory.CategoryTypeCode = txtCategoryTypeCode.Text.Trim(); if (objLogRule.loger_category.Any(s => s.ApplicationID == objCategory.ApplicationID && s.CategoryID != objCategory.CategoryID && s.CategoryTypeCode == objCategory.CategoryTypeCode)) { MessageDialog("输入的日志类型代码已经存在"); return; } objLogRule.SaveChanges(); MessageDialog("修改成功", "ApplicationInfo.aspx?ApplicationID=" + ApplicationID); } else { objCategory = new loger_category(); objCategory.CategoryName = txtCategoryName.Text; objCategory.LogWriteType = chkLogWriteType.SelectValueString; objCategory.CategoryTypeCode = txtCategoryTypeCode.Text.Trim(); objCategory.ApplicationID = ApplicationID; objLogRule.InsertCategory(objCategory); MessageDialog("新增成功", "ApplicationInfo.aspx?ApplicationID=" + ApplicationID); } }
public override void RenderPage() { if (CategoryID.IsNoNull()) { objCategory = objLogRule.loger_category.First(p => p.CategoryID == CategoryID); chkLogWriteType.SetSelectValue(objCategory.LogWriteType); Page.DataBind(); } }