private void SaveInfo() { if (HashTypeID.IsNull()) { objHashType = new Sys_HashType(); AutoObjectSetValue(objHashType); objHashRule.InsertHashType(objHashType); MessageDialog("新增成功!", "../../ServiceLayer/HashType/HashTypeList.aspx"); } else { objHashType = objHashRule.Sys_HashType.First(p => p.HashTypeID == HashTypeID); if (objHashRule.Sys_HashType.Any(s => s.HashTypeID != HashTypeID && s.HashTypeCode == HashTypeCode.Text)) { MessageDialog("代码已经存在无法修改"); return; } AutoObjectSetValue(objHashType); objHashRule.SaveChanges(); MessageDialog("修改成功!", "../../ServiceLayer/HashType/HashTypeList.aspx"); } }
public void InsertHashType(Sys_HashType objHashType) { objHashType.HashTypeCode.CheckIsNull("请输入哈希类型代码", LogModuleType.ParameterLog); objHashType.HashTypeName.CheckIsNull("请输入哈希类型名称", LogModuleType.ParameterLog); SysAssert.CheckCondition(this.Sys_HashType.Any((Sys_HashType s) => s.HashTypeCode == objHashType.HashTypeCode), "输入的代码已经存在", LogModuleType.ParameterLog); this.CurrentEntities.AddTosys_hashtype(objHashType); this.CurrentEntities.SaveChanges(); }
public override void RenderPage() { if (HashTypeID > 0) { objHashType = objHashRule.Sys_HashType.First(p => p.HashTypeID == HashTypeID); Page.DataBind(); } }