public void SavePrivilegeCategory() { try { using (ProxyBE op = new ProxyBE()) { PrivilegeCategory obj = op.Client.GetPrivilegeCategory(SenderUser, CategoryParm.CategoryID); if (obj == null) { obj = new PrivilegeCategory(); } obj.CategoryID = CategoryParm.CategoryID; obj.CategoryName = CategoryParm.CategoryName; obj.IconClass = CategoryParm.IconClass; obj.Sequence = CategoryParm.Sequence; SavePrivilegeCategoryArgs args = new SavePrivilegeCategoryArgs(); args.PrivilegeCategory = obj; op.Client.SavePrivilegeCategory(SenderUser, args); } WriteSuccess(); } catch (Exception ex) { WriteError(ex.Message, ex); } }
public void SavePrivilegeCategory(Sender sender, SavePrivilegeCategoryArgs args) { try { using (ObjectProxy op = new ObjectProxy(true)) { if (PrivilegeCategoryIsDuplicated(sender, args.PrivilegeCategory)) { throw new Exception("权限模块分类名称已经存在。"); } PrivilegeCategory rc = new PrivilegeCategory(); rc.CategoryID = args.PrivilegeCategory.CategoryID; if (op.LoadPrivilegeCategoryByCategoryID(rc) == 0) { args.PrivilegeCategory.Created = DateTime.Now; args.PrivilegeCategory.CreatedBy = sender.UserCode + "." + sender.UserName; args.PrivilegeCategory.Modified = DateTime.Now; args.PrivilegeCategory.ModifiedBy = sender.UserCode + "." + sender.UserName; op.InsertPrivilegeCategory(args.PrivilegeCategory); } else { args.PrivilegeCategory.Modified = DateTime.Now; args.PrivilegeCategory.ModifiedBy = sender.UserCode + "." + sender.UserName; op.UpdatePrivilegeCategoryByCategoryID(args.PrivilegeCategory); } op.CommitTransaction(); } } catch (Exception ex) { PLogger.LogError(ex); throw ex; } }