kindlebox/Kindlebox/Rabbit.cs

168 lines
4.8 KiB
C#

using Kindlebox.Properties;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Policy;
using System.Text;
using System.Threading.Tasks;
namespace Kindlebox
{
internal class Rabbit
{
/*=====================
* Status Codes
*---------------
* 0 = Herd
* 1 = For Sale
* 2 = Holding
* 3 = Sold/Adopted
* 4 = Other
* 5 = Culled
=====================*/
public Guid RabbitID { get; set; }
public string FarmName { get; set; }
public string RabbitName { get; set; }
public string Breed { get; set; }
public string EarNumber { get; set; }
public string Color { get; set; }
public string RegNumber { get; set; }
public string GCNumber { get; set; }
public decimal Weight { get; set; }
public DateTime Birthday { get; set; }
public string Sex { get; set; }
public string AGene { get; set; }
public string BGene { get; set; }
public string CGene { get; set; }
public string DGene { get; set; }
public string EGene { get; set; }
public string EnGene { get; set; }
public string VGene { get; set; }
public Guid SireID { get; set; }
public Guid DamID { get; set; }
public Guid LitterID { get; set; }
public int Status { get; set; }
public List<Guid> Litters { get; set; }
public string ImagePath { get; set; }
public bool PregnantStatus { get; set; }
public DateTime SellDate { get; set; }
public DateTime DeathDate { get; set; }
public DateTime LastPregnantDate { get; set; }
[JsonConstructor]
public Rabbit(Guid rabbitID, string farmName, string rabbitName, string earNumber, string color, string regNum, string gcNum, decimal weight, DateTime birthday, string sex, int status)
{
RabbitID = rabbitID;
FarmName = farmName;
RabbitName = rabbitName;
Breed = "Holland Lop";
EarNumber = earNumber;
Color = color;
RegNumber = regNum;
GCNumber = gcNum;
Weight = weight;
Birthday = birthday;
Sex = sex;
ImagePath = "rabbit_placeholder";
LitterID = Guid.NewGuid();
Status = status;
Litters = null;
ImagePath = "rabbit_placeholder";
AGene = "A_";
BGene = "B_";
CGene = "C_";
DGene = "D_";
EGene = "E_";
EnGene = "en_";
VGene = "v_";
PregnantStatus = false;
SellDate = DateTime.Parse("2222-01-01");
DeathDate = DateTime.Parse("2222-01-01");
LastPregnantDate = DateTime.Parse("0001-01-01");
}
public Rabbit(Guid rabbitID, string farmName, string rabbitName, DateTime birthday, Guid sireID, Guid damID, Guid litterID)
{
RabbitID = rabbitID;
FarmName = farmName;
RabbitName = rabbitName;
Breed = "Holland Lop";
EarNumber = "";
Color = "";
RegNumber = "";
GCNumber = "";
Weight = 0;
Birthday = birthday;
Sex = "";
AGene = "A_";
BGene = "B_";
CGene = "C_";
DGene = "D_";
EGene = "E_";
EnGene = "en_";
VGene = "v_";
SireID = sireID;
DamID = damID;
LitterID = litterID;
Status = 0;
Litters = null;
ImagePath = "rabbit_placeholder";
PregnantStatus = false;
SellDate = DateTime.Parse("2222-01-01");
DeathDate = DateTime.Parse("2222-01-01");
LastPregnantDate = DateTime.Parse("0001-01-01");
}
public Rabbit getRabbit(Guid rabbitID)
{
Rabbit rabbit = null;
foreach (Rabbit r in RabbitList.rabbits)
{
if (r.RabbitID.Equals(rabbitID))
{
rabbit = r;
}
}
return rabbit;
}
public Rabbit getSire(Guid sireID)
{
Rabbit sire = null;
foreach (Rabbit rabbit in RabbitList.rabbits)
{
if (rabbit.RabbitID.Equals(sireID))
{
sire = rabbit;
}
}
return sire;
}
public Rabbit getDam (Guid damID)
{
Rabbit dam = null;
foreach (Rabbit rabbit in RabbitList.rabbits)
{
if (rabbit.RabbitID.Equals(damID))
{
dam = rabbit;
}
}
return dam;
}
}
}