public Client_IdentifiedItem(IdentifiedItem identifiedItem, Accessory accessory)
 {
     IdentifiedItemPK     = identifiedItem.IdentifiedItemPK;
     AccessoryID          = accessory.AccessoryID;
     AccessoryDescription = accessory.AccessoryDescription;
     Art   = accessory.Art;
     Color = accessory.Color;
     Item  = accessory.Item;
     IdentifiedQuantity = identifiedItem.IdentifiedQuantity;
 }
 public Client_IdentifiedItemArranged(IdentifiedItem identifiedItem, Accessory accessory, string packID)
 {
     IdentifiedItemPK     = identifiedItem.IdentifiedItemPK;
     AccessoryID          = accessory.AccessoryID;
     AccessoryDescription = accessory.AccessoryDescription;
     Art   = accessory.Art;
     Color = accessory.Color;
     Item  = accessory.Item;
     IdentifiedQuantity = identifiedItem.IdentifiedQuantity;
     PackID             = packID;
 }
Ejemplo n.º 3
0
 public Client_IdentifiedItemStored(IdentifiedItem identifiedItem, Accessory accessory, Pack pack, double actualQuantity)
 {
     IdentifiedItemPK     = identifiedItem.IdentifiedItemPK;
     AccessoryID          = accessory.AccessoryID;
     AccessoryDescription = accessory.AccessoryDescription;
     Art            = accessory.Art;
     Color          = accessory.Color;
     Item           = accessory.Item;
     ActualQuantity = actualQuantity;
     PackID         = pack.PackID;
 }
Ejemplo n.º 4
0
 public void ArrangeIndentifiedItem(IdentifiedItem identifiedItem)
 {
     try
     {
         db.Entry(identifiedItem).State = EntityState.Modified;
         db.SaveChanges();
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Ejemplo n.º 5
0
 public Client_IdentifiedItemRead(IdentifiedItem identifiedItem, Accessory accessory, string packID, int?qualityState)
 {
     IdentifiedItemPK     = identifiedItem.IdentifiedItemPK;
     AccessoryID          = accessory.AccessoryID;
     AccessoryDescription = accessory.AccessoryDescription;
     Art   = accessory.Art;
     Color = accessory.Color;
     Item  = accessory.Item;
     IdentifiedQuantity = identifiedItem.IdentifiedQuantity;
     PackID             = packID;
     QualityState       = qualityState;
 }
Ejemplo n.º 6
0
 public void createIndentifyItem(IdentifiedItem item)
 {
     try
     {
         db.IdentifiedItems.Add(item);
         db.SaveChanges();
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Ejemplo n.º 7
0
 public Client_IdentifiedItemCheckedDetail(IdentifiedItem identifiedItem, Accessory accessory, string packID, double sample, double sumCheckedQuantity)
 {
     IdentifiedItemPK     = identifiedItem.IdentifiedItemPK;
     AccessoryID          = accessory.AccessoryID;
     AccessoryDescription = accessory.AccessoryDescription;
     Art   = accessory.Art;
     Color = accessory.Color;
     Item  = accessory.Item;
     IdentifiedQuantity = identifiedItem.IdentifiedQuantity;
     PackID             = packID;
     Sample             = sample;
     SumCheckedQuantity = sumCheckedQuantity;
 }
Ejemplo n.º 8
0
 public void deleteIdentifiedItem(int IdentifiedItemPK)
 {
     try
     {
         IdentifiedItem identifiedItem = db.IdentifiedItems.Find(IdentifiedItemPK);
         db.IdentifiedItems.Remove(identifiedItem);
         db.SaveChanges();
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public Client_IdentifiedItemCounted(IdentifiedItem identifiedItem, Accessory accessory, Pack pack, PackedItem packedItem)
 {
     IdentifiedItemPK     = identifiedItem.IdentifiedItemPK;
     AccessoryID          = accessory.AccessoryID;
     AccessoryDescription = accessory.AccessoryDescription;
     Art   = accessory.Art;
     Color = accessory.Color;
     Item  = accessory.Item;
     IdentifiedQuantity = identifiedItem.IdentifiedQuantity;
     PackID             = pack.PackID;
     IsCounted          = identifiedItem.IsCounted;
     IsOpened           = pack.IsOpened;
     IsClassified       = packedItem.IsClassified;
 }
Ejemplo n.º 10
0
 public bool IsPackedItemClassified(IdentifiedItem identifiedItem)
 {
     try
     {
         PackedItem packedItem = (from pI in db.PackedItems
                                  where pI.PackedItemPK == identifiedItem.PackedItemPK
                                  select pI).FirstOrDefault();
         return(packedItem.IsClassified);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Ejemplo n.º 11
0
 public void updateIdentifiedItem(int IdentifiedItemPK, double IdentifiedQuantity)
 {
     try
     {
         IdentifiedItem identifiedItem = db.IdentifiedItems.Find(IdentifiedItemPK);
         identifiedItem.IdentifiedQuantity = IdentifiedQuantity;
         db.Entry(identifiedItem).State    = EntityState.Modified;
         db.SaveChanges();
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Ejemplo n.º 12
0
 public void updateIsCheckedOfIdentifiedItem(int identifiedItemPK, bool IsChecked)
 {
     try
     {
         IdentifiedItem identifiedItem = db.IdentifiedItems.Find(identifiedItemPK);
         identifiedItem.IsChecked       = IsChecked;
         db.Entry(identifiedItem).State = EntityState.Modified;
         db.SaveChanges();
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Ejemplo n.º 13
0
        public async Task LoadingIdentifiedItem_WithExistingID_LoadsExistingItem()
        {
            var       repo   = new ArtistMemoryRepository();
            const int testID = 123;

            Artist artist = repo.GetAllItems().FirstOrDefault(a => a.ID == testID);

            Assert.NotNull(artist);

            var postedNewItem = new IdentifiedItem <Artist>(testID.ToString(), repo, new IdConventionIdentifierInfo <Artist>());
            await postedNewItem.LoadAsync();

            Assert.Equal(LazyState.LoadedItem, postedNewItem.LazyState);
            Assert.Equal(postedNewItem.LoadedItem, artist);
        }
Ejemplo n.º 14
0
        public static List <BaseItemType> LoadDrink()
        {
            List <BaseItemType> drinks = new List <BaseItemType>();

            string    filePath = Directory.GetCurrentDirectory() + "//Data//Items//Drinks//Drink.xml";
            XmlReader reader   = XmlReader.Create(filePath);

            List <IdentifiedItem> identifiedItems = new List <IdentifiedItem>();
            string actionWord     = "strikes";
            string governingSkill = "None";
            string category       = "None";

            while (reader.Read())
            {
                if (reader.Depth == 0 && reader.NodeType == XmlNodeType.Element && !reader.Name.Equals("Items"))
                {
                    break;
                }

                if (reader.Name.Equals("Category") && reader.NodeType == XmlNodeType.Element)
                {
                    category = reader.ReadElementContentAsString();
                }

                if (reader.Name.Equals("IdentifiedItem") && reader.NodeType == XmlNodeType.Element)
                {
                    IdentifiedItem item = new IdentifiedItem();
                    while (reader.NodeType != XmlNodeType.EndElement)
                    {
                        reader.Read();
                        if (reader.Name.Equals("Name"))
                        {
                            item.name = reader.ReadElementContentAsString();
                        }
                        else if (reader.Name.Equals("Description"))
                        {
                            item.description = reader.ReadElementContentAsString();
                        }
                        else if (reader.Name.Equals("Value"))
                        {
                            item.value = reader.ReadElementContentAsInt();
                        }
                        else if (reader.Name.Equals("Effect"))
                        {
                            item.interactionFile = reader.ReadElementContentAsString();
                        }
                        else if (reader.Name.Equals("SpawnWeight"))
                        {
                            item.weighting = reader.ReadElementContentAsInt();
                        }
                        else if (reader.Name.Equals("Materials"))
                        {
                            string materials = reader.ReadElementContentAsString();
                            item.materials = materials.Split(',');
                        }
                        else if (reader.Name.Equals("Size"))
                        {
                            item.size = reader.ReadElementContentAsFloat();
                        }
                    }
                    item.category = category;
                    identifiedItems.Add(item);
                }
                else if (reader.Name.Equals("ActionWord"))
                {
                    actionWord = reader.ReadElementContentAsString();
                }
            }

            reader.Close();

            for (int i = 0; i < identifiedItems.Count; i++)
            {
                drinks.Add(new BaseItemType(identifiedItems[i].category, identifiedItems[i].description, identifiedItems[i].description, identifiedItems[i].name,
                                            identifiedItems[i].name, "None", identifiedItems[i].size, MaterialHandler.GetMaterial(identifiedItems[i].materials[RNG.Roll(0, identifiedItems[i].materials.Length - 1)]),
                                            "Drinks", governingSkill, actionWord, identifiedItems[i].interactionFile, identifiedItems[i].value, identifiedItems[i].weighting));
            }

            return(drinks);
        }
Ejemplo n.º 15
0
        public static List <BaseItemType> LoadPotions()
        {
            List <BaseItemType> potions = new List <BaseItemType>();

            string    filePath = Directory.GetCurrentDirectory() + "//Data//Items//Potions//Potions.xml";
            XmlReader reader   = XmlReader.Create(filePath);

            List <IdentifiedItem>   identifiedItems   = new List <IdentifiedItem>();
            List <UnidentifiedItem> unidentifiedItems = new List <UnidentifiedItem>();
            string actionWord     = "strikes";
            string governingSkill = "None";
            string category       = "None";

            while (reader.Read())
            {
                if (reader.Depth == 0 && reader.NodeType == XmlNodeType.Element && !reader.Name.Equals("Items"))
                {
                    break;
                }

                if (reader.Name.Equals("Category") && reader.NodeType == XmlNodeType.Element)
                {
                    category = reader.ReadElementContentAsString();
                }

                if (reader.Name.Equals("IdentifiedItem") && reader.NodeType == XmlNodeType.Element)
                {
                    IdentifiedItem item = new IdentifiedItem();
                    while (reader.NodeType != XmlNodeType.EndElement)
                    {
                        reader.Read();
                        if (reader.Name.Equals("Name"))
                        {
                            item.name = reader.ReadElementContentAsString();
                        }
                        else if (reader.Name.Equals("Description"))
                        {
                            item.description = reader.ReadElementContentAsString();
                        }
                        else if (reader.Name.Equals("Value"))
                        {
                            item.value = reader.ReadElementContentAsInt();
                        }
                        else if (reader.Name.Equals("Effect"))
                        {
                            item.interactionFile = Directory.GetCurrentDirectory() + "//Data//Scripts//Items//Potions//" + reader.ReadElementContentAsString();
                        }
                        else if (reader.Name.Equals("SpawnWeight"))
                        {
                            item.weighting = reader.ReadElementContentAsInt();
                        }
                    }
                    item.category = category;
                    identifiedItems.Add(item);
                }
                else if (reader.Name.Equals("UnidentifiedItem") && reader.NodeType == XmlNodeType.Element)
                {
                    UnidentifiedItem item = new UnidentifiedItem();
                    while (reader.NodeType != XmlNodeType.EndElement)
                    {
                        reader.Read();
                        if (reader.Name.Equals("Name"))
                        {
                            item.name = reader.ReadElementContentAsString();
                        }
                        else if (reader.Name.Equals("Description"))
                        {
                            item.description = reader.ReadElementContentAsString();
                        }
                    }
                    unidentifiedItems.Add(item);
                }
                else if (reader.Name.Equals("ActionWord"))
                {
                    actionWord = reader.ReadElementContentAsString();
                }
            }

            reader.Close();

            ItemMaterial glass = MaterialHandler.GetMaterial("Glass");

            for (int i = 0; i < identifiedItems.Count; i++)
            {
                int index = RNG.Roll(0, unidentifiedItems.Count - 1);
                UnidentifiedItem chosenDescription = unidentifiedItems[index];
                unidentifiedItems.RemoveAt(index);

                potions.Add(new BaseItemType(identifiedItems[i].category, identifiedItems[i].description, chosenDescription.description, chosenDescription.name,
                                             identifiedItems[i].name, "None", 5.0f, glass, "Potions", governingSkill, actionWord,
                                             identifiedItems[i].interactionFile, identifiedItems[i].value, identifiedItems[i].weighting));
            }

            return(potions);
        }
Ejemplo n.º 16
0
        public List <Client_Session_Activity_Angular> GetSessions(int sessionNum)
        {
            List <Client_Session_Activity_Angular> result = new List <Client_Session_Activity_Angular>();

            switch (sessionNum)
            {
            case 1:
                List <IdentifyingSession> identifyingSessions = (from ss in db.IdentifyingSessions
                                                                 select ss).ToList();
                foreach (var ss in identifyingSessions)
                {
                    SystemUser systemUser = db.SystemUsers.Find(ss.UserID);
                    // query pack
                    IdentifiedItem identifiedItem = (from iI in db.IdentifiedItems
                                                     where iI.IdentifyingSessionPK == ss.IdentifyingSessionPK
                                                     select iI).FirstOrDefault();
                    PackedItem packedItem = db.PackedItems.Find(identifiedItem.PackedItemPK);
                    Pack       pack       = db.Packs.Find(packedItem.PackPK);
                    string     content    = "Ghi nhận " + "cụm phụ liệu thuộc Phiếu nhập mã số " + pack.PackID;
                    result.Add(new Client_Session_Activity_Angular(ss.ExecutedDate, systemUser.Name + " (" + ss.UserID + ")", content));
                }
                break;

            case 2:
                List <CountingSession> countingSessions = (from ss in db.CountingSessions
                                                           select ss).ToList();
                foreach (var ss in countingSessions)
                {
                    SystemUser systemUser = db.SystemUsers.Find(ss.UserID);
                    // query pack
                    IdentifiedItem identifiedItem = db.IdentifiedItems.Find(ss.IdentifiedItemPK);
                    PackedItem     packedItem     = db.PackedItems.Find(identifiedItem.PackedItemPK);
                    Pack           pack           = db.Packs.Find(packedItem.PackPK);
                    string         content        = "Kiểm số lượng " + "cụm phụ liệu thuộc Phiếu nhập mã số " + pack.PackID;
                    result.Add(new Client_Session_Activity_Angular(ss.ExecutedDate, systemUser.Name + " (" + ss.UserID + ")", content));
                }
                break;

            case 3:
                List <CheckingSession> checkingSessions = (from ss in db.CheckingSessions
                                                           select ss).ToList();
                foreach (var ss in checkingSessions)
                {
                    SystemUser     systemUser     = db.SystemUsers.Find(ss.UserID);
                    IdentifiedItem identifiedItem = db.IdentifiedItems.Find(ss.IdentifiedItemPK);
                    PackedItem     packedItem     = db.PackedItems.Find(identifiedItem.PackedItemPK);
                    Pack           pack           = db.Packs.Find(packedItem.PackPK);
                    string         content        = "Kiểm chất lượng " + "cụm phụ liệu thuộc Phiếu nhập mã số " + pack.PackID;
                    result.Add(new Client_Session_Activity_Angular(ss.ExecutedDate, systemUser.Name + " (" + ss.UserID + ")", content));
                }
                break;

            case 4:
                List <ClassifyingSession> classifyingSessions = (from ss in db.ClassifyingSessions
                                                                 select ss).ToList();
                foreach (var ss in classifyingSessions)
                {
                    SystemUser     systemUser     = db.SystemUsers.Find(ss.UserID);
                    ClassifiedItem classifiedItem = db.ClassifiedItems.Find(ss.ClassifiedItemPK);
                    PackedItem     packedItem     = db.PackedItems.Find(classifiedItem.PackedItemPK);
                    Pack           pack           = db.Packs.Find(packedItem.PackPK);
                    string         content        = "Đánh giá " + "phụ liệu thuộc Phiếu nhập mã số " + pack.PackID;
                    result.Add(new Client_Session_Activity_Angular(ss.ExecutedDate, systemUser.Name + " (" + ss.UserID + ")", content));
                }
                break;

            case 5:
                List <ArrangingSession> arrangingSessions = (from ss in db.ArrangingSessions
                                                             select ss).ToList();
                foreach (var ss in arrangingSessions)
                {
                    SystemUser  systemUser = db.SystemUsers.Find(ss.UserID);
                    UnstoredBox uBox1      = db.UnstoredBoxes.Find(ss.StartBoxPK);
                    Box         box1       = db.Boxes.Find(uBox1.BoxPK);
                    UnstoredBox uBox2      = db.UnstoredBoxes.Find(ss.DestinationBoxPK);
                    Box         box2       = db.Boxes.Find(uBox2.BoxPK);
                    string      content    = "Sắp xếp " + "cụm phụ liệu từ thùng mã số " + box1.BoxID.Substring(0, box1.BoxID.Length - 3) + "sang thùng mã số " + box2.BoxID.Substring(0, box2.BoxID.Length - 3);
                    result.Add(new Client_Session_Activity_Angular(ss.ExecutedDate, systemUser.Name + " (" + ss.UserID + ")", content));
                }
                break;

            case 6:
                List <ReturningSession> returningSessions = (from ss in db.ReturningSessions
                                                             select ss).ToList();
                foreach (var ss in returningSessions)
                {
                    SystemUser     systemUser     = db.SystemUsers.Find(ss.UserID);
                    FailedItem     failedItem     = db.FailedItems.Find(ss.FailedItemPK);
                    ClassifiedItem classifiedItem = db.ClassifiedItems.Find(failedItem.ClassifiedItemPK);
                    PackedItem     packedItem     = db.PackedItems.Find(classifiedItem.PackedItemPK);
                    Pack           pack           = db.Packs.Find(packedItem.PackPK);
                    string         content        = "Trả hàng lỗi " + "thuộc Phiếu nhập mã số " + pack.PackID;
                    result.Add(new Client_Session_Activity_Angular(ss.ExecutedDate, systemUser.Name + " (" + ss.UserID + ")", content));
                }
                break;

            case 7:
                List <StoringSession> storingSessions = (from ss in db.StoringSessions
                                                         select ss).ToList();
                foreach (var ss in storingSessions)
                {
                    SystemUser systemUser = db.SystemUsers.Find(ss.UserID);
                    Box        box        = db.Boxes.Find(ss.BoxPK);
                    string     content    = "Lưu kho " + "thùng mã số " + box.BoxID.Substring(0, box.BoxID.Length - 3);
                    result.Add(new Client_Session_Activity_Angular(ss.ExecutedDate, systemUser.Name + " (" + ss.UserID + ")", content));
                }
                break;

            case 8:
                List <MovingSession> movingSessions = (from ss in db.MovingSessions
                                                       select ss).ToList();
                foreach (var ss in movingSessions)
                {
                    SystemUser systemUser = db.SystemUsers.Find(ss.UserID);
                    StoredBox  sBox       = db.StoredBoxes.Find(ss.StoredBoxPK);
                    Box        box        = db.Boxes.Find(sBox.BoxPK);
                    Shelf      shelf1     = db.Shelves.Find(ss.StartShelfPK);
                    Shelf      shelf2     = db.Shelves.Find(ss.DestinationShelfPK);
                    string     content    = "Di chuyển thùng " + "mã số " + box.BoxID.Substring(0, box.BoxID.Length - 3)
                                            + "từ kệ " + shelf1.ShelfID + "sang kệ " + shelf2.ShelfID;
                    result.Add(new Client_Session_Activity_Angular(ss.ExecutedDate, systemUser.Name + " (" + ss.UserID + ")", content));
                }
                break;

            case 9:
                List <TransferringSession> tranferringSessions = (from ss in db.TransferringSessions
                                                                  select ss).ToList();
                foreach (var ss in tranferringSessions)
                {
                    SystemUser systemUser = db.SystemUsers.Find(ss.UserID);
                    StoredBox  sBox1      = db.StoredBoxes.Find(ss.StartBoxPK);
                    Box        box1       = db.Boxes.Find(sBox1.BoxPK);

                    StoredBox sBox2 = db.StoredBoxes.Find(ss.StartBoxPK);
                    Box       box2  = db.Boxes.Find(sBox2.BoxPK);

                    string content = "Chuyển phụ liệu " + "tồn kho từ thùng mã số " + box1.BoxID.Substring(0, box1.BoxID.Length - 3)
                                     + "sang thùng mã số " + box2.BoxID.Substring(0, box2.BoxID.Length - 3);
                    result.Add(new Client_Session_Activity_Angular(ss.ExecutedDate, systemUser.Name + " (" + ss.UserID + ")", content));
                }
                break;

            case 10:
                List <IssuingSession> issuingSessions = (from ss in db.IssuingSessions
                                                         select ss).ToList();
                foreach (var ss in issuingSessions)
                {
                    SystemUser systemUser = db.SystemUsers.Find(ss.UserID);
                    Request    request    = db.Requests.Find(ss.RequestPK);
                    string     content    = "Xuất kho " + "phụ liệu cho Yêu cầu nhận mã số " + request.RequestID;
                    result.Add(new Client_Session_Activity_Angular(ss.ExecutedDate, systemUser.Name + " (" + ss.UserID + ")", content));
                }
                break;

            case 11:
                List <ReceivingSession> restoringSessions = (from ss in db.ReceivingSessions
                                                             select ss).ToList();
                foreach (var ss in restoringSessions)
                {
                    SystemUser  systemUser  = db.SystemUsers.Find(ss.UserID);
                    Restoration restoration = db.Restorations.Find(ss.RestorationPK);
                    string      content     = "Nhận tồn " + "phụ liệu thuộc Phiếu trả mã số " + restoration.RestorationID;
                    result.Add(new Client_Session_Activity_Angular(ss.ExecutedDate, systemUser.Name + " (" + ss.UserID + ")", content));
                }
                break;

            default:
                break;
            }

            return(result);
        }
 public Client_CountingSessionDetail(Accessory accessory, Pack pack, CountingSession countingSession, IdentifiedItem identifiedItem, Box box, PackedItem packedItem)
 {
     CountingSessionPK    = countingSession.CountingSessionPK;
     ExecutedDate         = countingSession.ExecutedDate;
     CountedQuantity      = countingSession.CountedQuantity;
     IdentifiedQuantity   = identifiedItem.IdentifiedQuantity;
     AccessoryID          = accessory.AccessoryID;
     AccessoryDescription = accessory.AccessoryDescription;
     Art          = accessory.Art;
     Color        = accessory.Color;
     Item         = accessory.Item;
     PackID       = pack.PackID;
     BoxID        = box.BoxID;
     IsClassified = packedItem.IsClassified;
 }
Ejemplo n.º 18
0
 public Client_FailedItemDetail(Accessory accessory, Pack pack, ClassifyingSession classifyingSession, IdentifiedItem identifiedItem, FailedItem failedItem, SystemUser systemUser, PackedItem packedItem, double sample, double defectLimit, double sumIdentifiedQuantity, double sumCountedQuantity, double sumCheckedQuantity, double sumUnqualifiedQuantity, HashSet<string> boxIDs)
 {
     FailedItemPK = failedItem.FailedItemPK;
     ExecutedDate = classifyingSession.ExecutedDate;
     Comment = classifyingSession.Comment;
     UserID = systemUser.UserID;
     Name = systemUser.Name;
     AccessoryID = accessory.AccessoryID;
     AccessoryDescription = accessory.AccessoryDescription;
     Art = accessory.Art;
     Color = accessory.Color;
     Item = accessory.Item;
     PackID = pack.PackID;
     PackedQuantity = packedItem.PackedQuantity;
     Sample = sample;
     DefectLimit = defectLimit;
     SumIdentifiedQuantity = sumIdentifiedQuantity;
     SumCountedQuantity = sumCountedQuantity;
     SumCheckedQuantity = sumCheckedQuantity;
     SumUnqualifiedQuantity = sumUnqualifiedQuantity;
     BoxIDs = boxIDs;
 }
Ejemplo n.º 19
0
        public static List <BaseItemType> LoadItems()
        {
            List <BaseItemType> weapons = new List <BaseItemType>();

            string folderPath = Directory.GetCurrentDirectory() + GlobalConstants.DATA_FOLDER + "Items";

            string[] files = Directory.GetFiles(folderPath, "*.xml", SearchOption.AllDirectories);


            for (int i = 0; i < files.Length; i++)
            {
                XmlReader reader = XmlReader.Create(files[i]);

                List <IdentifiedItem>   identifiedItems   = new List <IdentifiedItem>();
                List <UnidentifiedItem> unidentifiedItems = new List <UnidentifiedItem>();

                string actionWord = "strikes";
                string category   = "Misc";
                int    lightLevel = 0;

                while (reader.Read())
                {
                    if (reader.Depth == 0 && reader.NodeType == XmlNodeType.Element && !reader.Name.Equals("Items"))
                    {
                        break;
                    }

                    if (reader.Name.Equals("Category") && reader.NodeType == XmlNodeType.Element)
                    {
                        category = reader.ReadElementContentAsString();
                    }

                    if (reader.Name.Equals("IdentifiedItem") && reader.NodeType == XmlNodeType.Element)
                    {
                        IdentifiedItem item = new IdentifiedItem();
                        item.slot  = "None";
                        item.skill = "None";
                        while (reader.NodeType != XmlNodeType.EndElement)
                        {
                            reader.Read();
                            if (reader.Name.Equals("Name"))
                            {
                                item.name = reader.ReadElementContentAsString();
                            }
                            else if (reader.Name.Equals("Description"))
                            {
                                item.description = reader.ReadElementContentAsString();
                            }
                            else if (reader.Name.Equals("Value"))
                            {
                                item.value = reader.ReadElementContentAsInt();
                            }
                            else if (reader.Name.Equals("Effect"))
                            {
                                item.interactionFile = reader.ReadElementContentAsString();
                            }
                            else if (reader.Name.Equals("SpawnWeight"))
                            {
                                item.weighting = reader.ReadElementContentAsInt();
                            }
                            else if (reader.Name.Equals("Materials"))
                            {
                                string materials = reader.ReadElementContentAsString();
                                item.materials = materials.Split(',');
                            }
                            else if (reader.Name.Equals("Size"))
                            {
                                item.size = reader.ReadElementContentAsFloat();
                            }
                            else if (reader.Name.Equals("Slot"))
                            {
                                item.slot = reader.ReadElementContentAsString();
                            }
                            else if (reader.Name.Equals("Skill"))
                            {
                                item.skill = reader.ReadElementContentAsString();
                            }
                            else if (reader.Name.Equals("LightLevel"))
                            {
                                lightLevel = reader.ReadElementContentAsInt();
                            }
                        }
                        item.category = category;
                        identifiedItems.Add(item);
                    }
                    else if (reader.Name.Equals("UnidentifiedItem"))
                    {
                        UnidentifiedItem item = new UnidentifiedItem();
                        while (reader.NodeType != XmlNodeType.EndElement)
                        {
                            reader.Read();
                            if (reader.Name.Equals("Name"))
                            {
                                item.name = reader.ReadElementContentAsString();
                            }
                            else if (reader.Name.Equals("Description"))
                            {
                                item.description = reader.ReadElementContentAsString();
                            }
                        }
                        unidentifiedItems.Add(item);
                    }
                    else if (reader.Name.Equals("ActionWord"))
                    {
                        actionWord = reader.ReadElementContentAsString();
                    }
                }

                reader.Close();

                for (int j = 0; j < identifiedItems.Count; j++)
                {
                    UnidentifiedItem chosenDescription = new UnidentifiedItem(identifiedItems[j].name, identifiedItems[j].description);

                    if (unidentifiedItems.Count != 0)
                    {
                        int index = RNG.Roll(0, unidentifiedItems.Count - 1);
                        chosenDescription = unidentifiedItems[index];
                        unidentifiedItems.RemoveAt(index);
                    }

                    for (int k = 0; k < identifiedItems[j].materials.Length; k++)
                    {
                        weapons.Add(new BaseItemType(identifiedItems[j].category, identifiedItems[j].description, chosenDescription.description, chosenDescription.name,
                                                     identifiedItems[j].name, identifiedItems[j].slot, identifiedItems[j].size,
                                                     MaterialHandler.GetMaterial(identifiedItems[j].materials[k]),
                                                     identifiedItems[j].category, identifiedItems[j].skill, actionWord, identifiedItems[j].interactionFile,
                                                     identifiedItems[j].value, identifiedItems[j].weighting, lightLevel));
                    }
                }
            }

            return(weapons);
        }
Ejemplo n.º 20
0
        public double ActualQuantity(int identifiedItemPK)
        {
            double result  = 0;
            int    numCase = 0;

            try
            {
                IdentifiedItem  item            = db.IdentifiedItems.Find(identifiedItemPK);
                CheckingSession checkingSession = (from checkss in db.CheckingSessions
                                                   where checkss.IdentifiedItemPK == item.IdentifiedItemPK
                                                   select checkss).FirstOrDefault();
                CountingSession countingSession = (from countss in db.CountingSessions
                                                   where countss.IdentifiedItemPK == item.IdentifiedItemPK
                                                   select countss).FirstOrDefault();
                if (item.IsChecked == false && item.IsCounted == false)
                {
                    numCase = 1;
                }
                if (item.IsChecked == false && item.IsCounted == true)
                {
                    numCase = 2;
                }
                if (item.IsChecked == true && item.IsCounted == false)
                {
                    numCase = 3;
                }
                if (item.IsChecked == true && item.IsCounted == true)
                {
                    if (checkingSession.ExecutedDate < countingSession.ExecutedDate)
                    {
                        numCase = 4;
                    }
                    else
                    {
                        numCase = 5;
                    }
                }
                switch (numCase)
                {
                case 1:
                    result += item.IdentifiedQuantity;
                    break;

                case 2:
                    result += countingSession.CountedQuantity;
                    break;

                case 3:
                    result += item.IdentifiedQuantity - checkingSession.UnqualifiedQuantity;
                    break;

                case 4:
                    result += countingSession.CountedQuantity;
                    break;

                case 5:
                    result += countingSession.CountedQuantity - checkingSession.UnqualifiedQuantity;
                    break;

                default:
                    break;
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            return(result);
        }