public void WriteXml(XmlWriter writer) { writer.WriteElementString("Source", Selector.Source.Value); writer.WriteElementString("Destination", Selector.Destination.Value); writer.WriteElementString("Type", Selector.Type.ToString()); writer.WriteElementString("IsAllow", IsAllow.ToString().ToLowerInvariant()); }
public void SetAction(int uid, int aid, IsAllow allow) { var userInfo = GetById(uid); var ual = userInfo.UserAction.Where(ua => ua.ActionId == aid).FirstOrDefault(); if (ual != null) { if (allow == IsAllow.Allow) { ual.IsAllow = true; } else if (allow == IsAllow.NoAllow) { ual.IsAllow = false; } else { userInfo.UserAction.Remove(ual); } } else { if (allow != IsAllow.UnDefAllow) { ual = new Model.UserAction() { UserId = uid, ActionId = aid }; if (allow == IsAllow.Allow) { ual.IsAllow = true; } else if (allow == IsAllow.NoAllow) { ual.IsAllow = false; } userInfo.UserAction.Add(ual); } } }
public override int GetHashCode() { return(Selector.Source.Value.GetHashCode() ^ Selector.Destination.Value.GetHashCode() ^ Selector.Type.GetHashCode() ^ IsAllow.GetHashCode()); }