예제 #1
0
        public bool Equals(GameEvent other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return(Assistants.OrderBy(a => a.Gamertag).SequenceEqual(other.Assistants.OrderBy(a => a.Gamertag)) &&
                   DeathDisposition == other.DeathDisposition &&
                   IsAssassination == other.IsAssassination &&
                   IsGroundPound == other.IsGroundPound &&
                   IsHeadshot == other.IsHeadshot &&
                   IsMelee == other.IsMelee &&
                   IsShoulderBash == other.IsShoulderBash &&
                   IsWeapon == other.IsWeapon &&
                   Equals(Killer, other.Killer) &&
                   KillerAgent == other.KillerAgent &&
                   KillerAttachmentIds.OrderBy(ka => ka).SequenceEqual(other.KillerAttachmentIds.OrderBy(ka => ka)) &&
                   KillerStockId == other.KillerStockId &&
                   Equals(KillerWorldLocation, other.KillerWorldLocation) &&
                   Equals(Victim, other.Victim) &&
                   VictimAgent == other.VictimAgent &&
                   VictimAttachmentIds.OrderBy(ka => ka).SequenceEqual(other.VictimAttachmentIds.OrderBy(ka => ka)) &&
                   VictimStockId == other.VictimStockId &&
                   Equals(VictimWorldLocation, other.VictimWorldLocation) &&
                   Equals(EventName, other.EventName) &&
                   string.Equals(TimeSinceStart, other.TimeSinceStart));
        }
예제 #2
0
        public void AssistantHandlerConstructorTest()
        {
            Assistants       assistant        = new Assistants();
            AssistantHandler assistantHandler = new AssistantHandler(assistant);

            Assert.AreSame(assistant, assistantHandler.CurrentAssistant);
        }
예제 #3
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Assistants?.GetHashCode() ?? 0;
         hashCode = (hashCode * 397) ^ (int)DeathDisposition;
         hashCode = (hashCode * 397) ^ IsAssassination.GetHashCode();
         hashCode = (hashCode * 397) ^ IsGroundPound.GetHashCode();
         hashCode = (hashCode * 397) ^ IsHeadshot.GetHashCode();
         hashCode = (hashCode * 397) ^ IsMelee.GetHashCode();
         hashCode = (hashCode * 397) ^ IsShoulderBash.GetHashCode();
         hashCode = (hashCode * 397) ^ IsWeapon.GetHashCode();
         hashCode = (hashCode * 397) ^ (Killer != null ? Killer.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (int)KillerAgent;
         hashCode = (hashCode * 397) ^ (KillerWeaponAttachmentIds?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)KillerWeaponStockId;
         hashCode = (hashCode * 397) ^ (KillerWorldLocation != null ? KillerWorldLocation.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Victim != null ? Victim.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (int)VictimAgent;
         hashCode = (hashCode * 397) ^ (VictimAttachmentIds?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)VictimStockId;
         hashCode = (hashCode * 397) ^ (VictimWorldLocation != null ? VictimWorldLocation.GetHashCode() : 0);
         return(hashCode);
     }
 }
예제 #4
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Assistants?.GetHashCode() ?? 0;
         hashCode = (hashCode * 397) ^ (int)DeathDisposition;
         hashCode = (hashCode * 397) ^ IsAssassination.GetHashCode();
         hashCode = (hashCode * 397) ^ IsGroundPound.GetHashCode();
         hashCode = (hashCode * 397) ^ IsHeadshot.GetHashCode();
         hashCode = (hashCode * 397) ^ IsMelee.GetHashCode();
         hashCode = (hashCode * 397) ^ IsShoulderBash.GetHashCode();
         hashCode = (hashCode * 397) ^ IsWeapon.GetHashCode();
         hashCode = (hashCode * 397) ^ (Killer?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ KillerAgent.GetHashCode();
         hashCode = (hashCode * 397) ^ (KillerAttachmentIds?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)KillerStockId;
         hashCode = (hashCode * 397) ^ (KillerWorldLocation?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Victim?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ VictimAgent.GetHashCode();
         hashCode = (hashCode * 397) ^ (VictimAttachmentIds?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)VictimStockId;
         hashCode = (hashCode * 397) ^ (VictimWorldLocation?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)EventName;
         hashCode = (hashCode * 397) ^ (TimeSinceStart?.GetHashCode() ?? 0);
         return(hashCode);
     }
 }
예제 #5
0
    /// <summary>
    /// 删除请求的新闻
    /// </summary>
    public void deleteRequestAssistant()
    {
        string           id               = Request.QueryString["id"];
        Assistants       assistant        = AssistantHandler.getAssistantById(id);
        AssistantHandler assistantHandler = new AssistantHandler(assistant);

        assistantHandler.Delete();
    }
예제 #6
0
        static void removeassistant()
        {
            using (var context = new Context())
            {
                Assistants hp = new Assistants();
                Console.WriteLine("Enter Assistent Id");
                hp.AssistentId = Convert.ToInt32(Console.ReadLine());

                context.Assistants.Remove(hp);
                context.SaveChanges();
            }
        }
예제 #7
0
 static void getassistant()
 {
     using (var context = new Context())
     {
         Assistants hp = new Assistants();
         //Console.WriteLine("Enter Hospital Id");
         foreach (var item in context.Assistants.ToList())
         {
             Console.WriteLine($"ID {item.AssistentId} - Name {item.AssistentName}- PatientId{item.PatientId} - DepartmentId{item.DepartmentId}");
         }
     }
 }
예제 #8
0
 public void Delete()
 {
     try
     {
         db.Assistants.DeleteOnSubmit(currentAssistant);
         Submit();
         currentAssistant = null;
     }
     catch (Exception)
     {
         throw new DeleteException();
     }
 }
예제 #9
0
        public void InsertTest()
        {
            Assistants a = new Assistants {
                ID = "test", name = "test", password = "******"
            };
            AssistantHandler ah = new AssistantHandler(a);

            ah.Insert();
            Assert.IsTrue(AssistantHandler.DB.Assistants.First(assistant => assistant.ID == "test").Equals(a));

            AssistantHandler.DB.Assistants.DeleteOnSubmit(a);
            AssistantHandler.DB.SubmitChanges();
        }
예제 #10
0
 static void addassistant()
 {
     using (var context = new Context())
     {
         Assistants dp = new Assistants();
         Console.WriteLine("Enter Assistent Name");
         dp.AssistentName = Console.ReadLine();
         Console.WriteLine("Enter Patient Id");
         dp.PatientId = Convert.ToInt32(Console.ReadLine());
         Console.WriteLine("Enter Department id");
         dp.DepartmentId = Convert.ToInt32(Console.ReadLine());
         context.Assistants.Add(dp);
         context.SaveChanges();
     }
 }
예제 #11
0
        public void getAssistantByIdTest()
        {
            Assistants a = new Assistants {
                ID = "test", name = "test", password = "******"
            };

            AssistantHandler.DB.Assistants.InsertOnSubmit(a);
            AssistantHandler.DB.SubmitChanges();

            Assistants expected = AssistantHandler.DB.Assistants.First(assistant => assistant.ID == "test");
            Assistants actual   = AssistantHandler.getAssistantById("test");

            AssistantHandler.DB.Assistants.DeleteOnSubmit(a);
            AssistantHandler.DB.SubmitChanges();
            Assert.AreSame(expected, actual);
        }
예제 #12
0
    protected bool register(string id, string pwd, string name)
    {
        Assistants a = new Assistants {
            ID = id, name = name, password = pwd
        };
        AssistantHandler ah = new AssistantHandler(a);

        try
        {
            ah.Insert();
        }
        catch (Exception)
        {
            return(false);
        }
        return(true);
    }
예제 #13
0
        public void DeleteTest()
        {
            Assistants a = new Assistants {
                ID = "test", name = "test", password = "******"
            };

            AssistantHandler.DB.Assistants.InsertOnSubmit(a);
            AssistantHandler.DB.SubmitChanges();
            AssistantHandler ah = new AssistantHandler(a);

            ah.Delete();
            Assert.IsFalse(AssistantHandler.DB.Assistants.Any(assistant => assistant.ID == "test"));

            if (AssistantHandler.DB.Assistants.Any(assistant => assistant.ID == "test"))
            {
                AssistantHandler.DB.Assistants.DeleteOnSubmit(a);
                AssistantHandler.DB.SubmitChanges();
            }
        }
예제 #14
0
    protected bool isPwdCorrect(string id, string pwd)
    {
        DataClassesDataContext db = new DataClassesDataContext();

        try
        {
            Assistants a = db.Assistants.First(ass => ass.ID == id);
            if (a.password == pwd)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        catch (Exception)
        {
            return(false);
        }
    }
예제 #15
0
        public bool SellProduct(ShopAssistant assistant, Product product)
        {
            var assist      = Assistants.SingleOrDefault(x => x.Equals(assistant));
            var itemProduct = Products.SingleOrDefault(x => x.Equals(product));

            if (assist == null)
            {
                return(false);
            }
            if (itemProduct == null)
            {
                return(false);
            }
            if (itemProduct.Count == 0)
            {
                return(false);
            }
            assistant.SellProduct(itemProduct);
            itemProduct.Count--;
            return(true);
        }
예제 #16
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Assistants?.GetHashCode() ?? 0;
         hashCode = (hashCode * 397) ^ DeathDisposition.GetHashCode();
         hashCode = (hashCode * 397) ^ ImpulseId.GetHashCode();
         hashCode = (hashCode * 397) ^ IsAssassination.GetHashCode();
         hashCode = (hashCode * 397) ^ IsGroundPound.GetHashCode();
         hashCode = (hashCode * 397) ^ IsHeadshot.GetHashCode();
         hashCode = (hashCode * 397) ^ IsMelee.GetHashCode();
         hashCode = (hashCode * 397) ^ IsShoulderBash.GetHashCode();
         hashCode = (hashCode * 397) ^ IsWeapon.GetHashCode();
         hashCode = (hashCode * 397) ^ (Killer?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ KillerAgent.GetHashCode();
         hashCode = (hashCode * 397) ^ (KillerWeaponAttachmentIds?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ KillerWeaponStockId.GetHashCode();
         hashCode = (hashCode * 397) ^ (KillerWorldLocation?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ MedalId.GetHashCode();
         hashCode = (hashCode * 397) ^ (Player?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ RoundIndex.GetHashCode();
         hashCode = (hashCode * 397) ^ ShotsFired.GetHashCode();
         hashCode = (hashCode * 397) ^ ShotsLanded.GetHashCode();
         hashCode = (hashCode * 397) ^ TimeWeaponActiveAsPrimary.GetHashCode();
         hashCode = (hashCode * 397) ^ (Victim?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ VictimAgent.GetHashCode();
         hashCode = (hashCode * 397) ^ (VictimAttachmentIds?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ VictimStockId.GetHashCode();
         hashCode = (hashCode * 397) ^ (VictimWorldLocation?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (WeaponAttachmentIds?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ WeaponStockId.GetHashCode();
         hashCode = (hashCode * 397) ^ (int)EventName;
         hashCode = (hashCode * 397) ^ TimeSinceStart.GetHashCode();
         return(hashCode);
     }
 }
예제 #17
0
        public bool Equals(GameEvent other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return(((Assistants == null && other.Assistants == null) || (Assistants != null && other.Assistants != null && Assistants.OrderBy(a => a.Gamertag).SequenceEqual(other.Assistants.OrderBy(a => a.Gamertag)))) &&
                   DeathDisposition == other.DeathDisposition &&
                   ImpulseId == other.ImpulseId &&
                   IsAssassination == other.IsAssassination &&
                   IsGroundPound == other.IsGroundPound &&
                   IsHeadshot == other.IsHeadshot &&
                   IsMelee == other.IsMelee &&
                   IsShoulderBash == other.IsShoulderBash &&
                   IsWeapon == other.IsWeapon &&
                   Equals(Killer, other.Killer) &&
                   KillerAgent == other.KillerAgent &&
                   ((KillerWeaponAttachmentIds == null && other.KillerWeaponAttachmentIds == null) || (KillerWeaponAttachmentIds != null && other.KillerWeaponAttachmentIds != null && KillerWeaponAttachmentIds.OrderBy(ka => ka).SequenceEqual(other.KillerWeaponAttachmentIds.OrderBy(ka => ka)))) &&
                   KillerWeaponStockId == other.KillerWeaponStockId &&
                   Equals(KillerWorldLocation, other.KillerWorldLocation) &&
                   MedalId == other.MedalId &&
                   Equals(Player, other.Player) &&
                   RoundIndex == other.RoundIndex &&
                   ShotsFired == other.ShotsFired &&
                   ShotsLanded == other.ShotsLanded &&
                   TimeWeaponActiveAsPrimary.Equals(other.TimeWeaponActiveAsPrimary) &&
                   Equals(Victim, other.Victim) &&
                   VictimAgent == other.VictimAgent &&
                   ((VictimAttachmentIds == null && other.VictimAttachmentIds == null) || (VictimAttachmentIds != null && other.VictimAttachmentIds != null && VictimAttachmentIds.OrderBy(ka => ka).SequenceEqual(other.VictimAttachmentIds.OrderBy(ka => ka)))) &&
                   VictimStockId == other.VictimStockId &&
                   Equals(VictimWorldLocation, other.VictimWorldLocation) &&
                   ((WeaponAttachmentIds == null && other.WeaponAttachmentIds == null) || (WeaponAttachmentIds != null && other.WeaponAttachmentIds != null && WeaponAttachmentIds.OrderBy(ka => ka).SequenceEqual(other.WeaponAttachmentIds.OrderBy(ka => ka)))) &&
                   WeaponStockId == other.WeaponStockId &&
                   EventName == other.EventName &&
                   TimeSinceStart.Equals(other.TimeSinceStart));
        }
예제 #18
0
 public AssistantHandler(Assistants assistant)
 {
     currentAssistant = assistant;
 }
예제 #19
0
 public int GetAssistantCount()
 {
     return(Assistants.Count());
 }
예제 #20
0
 public Cook this[int assistantIndex]
 {
     [MethodCallExpressionTransformer(typeof(IndexerTransformer))]
     get { return(Assistants.Take(assistantIndex).First()); }
 }
예제 #21
0
 public int CalculateOverall() => Assistants.Sum(x => x.SelledProducts.Sum(y => y.Price * y.Count));