Exemple #1
0
        //calculate for Desert Crete
        public override void calculateRLqty()
        {
            double         val1 = 0, val2 = 0;
            SystemMaterial sysMat = SystemMaterials.Where(x => x.Name == "PARATERM BAR LF (TOP ONLY- STANDARD INSTALL)").FirstOrDefault();

            if (sysMat != null)
            {
                val1 = sysMat.IsMaterialChecked ? sysMat.Qty : 0;
            }
            sysMat = SystemMaterials.Where(x => x.Name == "EXTRA PARATERM BAR LF (BOTTOM OR SIDES)").FirstOrDefault();
            if (sysMat != null)
            {
                val2 = sysMat.IsMaterialChecked ? sysMat.Qty : 0;
            }
            sysMat = SystemMaterials.Where(x => x.Name == "PINS & LOADS").FirstOrDefault();
            if (sysMat != null)
            {
                bool ischecked;
                ischecked  = sysMat.IsMaterialChecked;
                sysMat.Qty = sysMat.SMSqft / sysMat.Coverage + (val1 + val2) / 2;
                sysMat.IsMaterialChecked = ischecked;
            }
            sysMat = SystemMaterials.Where(x => x.Name == "PARASEAL LG ROLLS (4X24)").FirstOrDefault();
            if (sysMat != null)
            {
                OtherItem olm = OtherMaterials.Where(x => x.Name == "Linear footage for seams if needed for submerged conditions")
                                .FirstOrDefault();
                if (olm != null)
                {
                    olm.Quantity  = Math.Round(sysMat.Qty * 28, 2);
                    olm.LQuantity = Math.Round(sysMat.Qty * 28, 2);
                }
            }
        }
Exemple #2
0
        public void UpdateQualityTest()
        {
            var item = new OtherItem("test", 3, 10);

            item.UpdateQuality();
            Assert.AreEqual(9, item.Quality);
        }
        public void CollectionValidatorResultOfOtherItemChanges_PropertyValidatorReturnsNOK()
        {
            InvalidItemsOfPropertyValidator.Add(OtherItem);
            OtherItem.Revalidate();

            AfterCollectionValidatorResultOf(OtherItem, changedFrom: OK, to: OK, itemIs: NOK, andValidationStateEvent: HasNotOccured);
            AfterCollectionValidatorResultOf(OtherItem, changedFrom: NOK, to: NOK, itemIs: NOK, andValidationStateEvent: HasNotOccured);
            AfterCollectionValidatorResultOf(OtherItem, changedFrom: OK, to: NOK, itemIs: NOK, andValidationStateEvent: Occured);
            AfterCollectionValidatorResultOf(OtherItem, changedFrom: NOK, to: OK, itemIs: NOK, andValidationStateEvent: Occured);
        }
Exemple #4
0
 private void Issue1251_Test(List <Item> list, OtherItem otherItem)
 {
     list.Add(new Item {
         Text   = "Text",
         Value  = otherItem.Value,
         Value2 = otherItem.Value2,
         Value3 = otherItem.Nullable.ToString(),
         Value4 = otherItem.Nullable2.ToString(),
         Value5 = otherItem.Nullable3.ToString(),
         Value6 = otherItem.Nullable4.ToString()
     });
 }
Exemple #5
0
        public void AssignedItem_IsAssigned_DefaultZoneName()
        {
            var item = (DecoratedItem2)engine.Resolve <ContentActivator>().CreateInstance(typeof(DecoratedItem2), null, null, asProxy: true);

            var child = new OtherItem();

            item.EditableItemWithDefaultChildZoneName = child;

            item.EditableItemWithDefaultChildZoneName.ShouldBe(child);
            item.Children.Single().ShouldBe(child);
            child.Name.ShouldBe("EditableItemWithDefaultChildZoneName");
            child.ZoneName.ShouldBe("OtherZone");
        }
Exemple #6
0
        public void AssignedItem_IsAddedAsChild_WithPropertyNameAsItemName()
        {
            var item = (DecoratedItem)engine.Resolve <ContentActivator>().CreateInstance(typeof(DecoratedItem), null, null, asProxy: true);

            var child = new OtherItem();

            item.TheItem = child;

            item.TheItem.ShouldBe(child);
            item.Children.Single().ShouldBe(child);
            child.Name.ShouldBe("TheItem");
            child.ZoneName.ShouldBe(null);
        }
Exemple #7
0
        public void AssignedItem_IsAssigned_DefaultZoneName_BeforeSaving_NonProxiedItem()
        {
            var item  = new DecoratedItem2();
            var child = new OtherItem();

            item.EditableItemWithDefaultChildZoneName = child;

            this.engine.Resolve <IProxyFactory>().OnSaving(item);

            item.EditableItemWithDefaultChildZoneName.ShouldBe(child);
            item.Children.Single().ShouldBe(child);
            child.Name.ShouldBe("EditableItemWithDefaultChildZoneName");
            child.ZoneName.ShouldBe("OtherZone");
        }
        public ActionResult CreateUpdateOtherItem(OtherItemModel otherItemModel)
        {
            if (!ModelState.IsValid)
            {
                return(ShowErrorMessage(GetModelErrors(ModelState)));
            }

            if (!CheckEmployeeHasBalance(otherItemModel.Price))
            {
                return(ShowErrorMessage(Constant.InsufficientBalance));
            }

            var otherItem = new OtherItem();

            if (otherItemModel.Id > 0)
            {
                otherItem = FarmManagementEntities.OtherItems.Single(x => x.ItemId == otherItemModel.Id);
            }

            otherItem.FarmId    = otherItemModel.FarmId;
            otherItem.AccountId = otherItemModel.AccountId;

            otherItem.TitleExpense = otherItemModel.TitleExpense;
            otherItem.Description  = otherItemModel.Description;
            otherItem.DatePurchase = otherItemModel.DatePurchase;

            if (otherItemModel.Id == 0)
            {
                otherItem.Price = otherItemModel.Price;

                otherItem.InsertDate = DateTime.Now;
                otherItem.UserId     = otherItemModel.UserId;
                FarmManagementEntities.OtherItems.Add(otherItem);

                ManageEmployeeBalance(otherItemModel.Price);
            }
            else
            {
                otherItem.UpdateDate = DateTime.Now;
            }

            FarmManagementEntities.SaveChanges();

            var message = string.Format(Constant.SuccessMessage, otherItemModel.Id > 0 ? "updated" : "added");

            return(ShowSuccessMessage(message));
        }
Exemple #9
0
    public List <ItemUI> FindRanchAnimal()
    {
        List <ItemUI> RanchAnimalList = new List <ItemUI>();

        foreach (Slot slot in slotList)
        {
            if (slot.transform.childCount > 0)
            {
                OtherItem item = slot.transform.GetChild(0).GetComponent <ItemUI>().Item as OtherItem;
                if (item.OtherType == OtherItem.OtherItemType.Pet)
                {
                    ItemUI RanchAnimal = slot.transform.GetChild(0).GetComponent <ItemUI>();
                    RanchAnimalList.Add(RanchAnimal);
                }
            }
        }
        return(RanchAnimalList);
    }
Exemple #10
0
    public List <ItemUI> FindSeed()
    {
        List <ItemUI> seeditemUIs = new List <ItemUI>();

        foreach (Slot slot in slotList)
        {
            if (slot.transform.childCount > 0)
            {
                OtherItem item = slot.transform.GetChild(0).GetComponent <ItemUI>().Item as OtherItem;
                if (item.OtherType == OtherItem.OtherItemType.Seed)
                {
                    ItemUI seedItemUI = slot.transform.GetChild(0).GetComponent <ItemUI>();
                    seeditemUIs.Add(seedItemUI);
                }
            }
        }
        return(seeditemUIs);
    }
        //calculate for Desert Crete
        public override void calculateRLqty()
        {
            double         val1 = 0, val2 = 0;
            SystemMaterial sysMat = SystemMaterials.Where(x => x.Name == "PARATERM BAR LF (TOP ONLY- STANDARD INSTALL)").FirstOrDefault();

            if (sysMat != null)
            {
                val1 = sysMat.IsMaterialChecked ? sysMat.Qty : 0;
            }
            sysMat = SystemMaterials.Where(x => x.Name == "EXTRA PARATERM BAR LF (BOTTOM OR SIDES)").FirstOrDefault();
            if (sysMat != null)
            {
                val2 = sysMat.IsMaterialChecked ? sysMat.Qty : 0;
            }
            sysMat = SystemMaterials.Where(x => x.Name == "PINS & LOADS").FirstOrDefault();
            if (sysMat != null)
            {
                bool ischecked;
                ischecked = sysMat.IsMaterialChecked;
                SystemMaterial sm = SystemMaterials.Where(x => x.Name == "TREMDRAIN 1000 (VERTICAL ONLY)").FirstOrDefault();
                if (sm != null)
                {
                    sysMat.Coverage = sm.IsMaterialChecked?  6 + sm.Qty * 200 / 500:6;
                }
                sysMat.Qty = sysMat.SMSqft / sysMat.Coverage + (val1 + val2) / 2;
                sysMat.IsMaterialChecked = ischecked;
            }
            sysMat = SystemMaterials.Where(x => x.Name == "PARASEAL \"STANDARD\" ROLLS (4X24)").FirstOrDefault();
            if (sysMat != null)
            {
                SystemMaterial myMat = SystemMaterials.Where(x => x.Name == "SEAM TAPE").FirstOrDefault();
                myMat.SMSqft = sysMat.Qty * 28;
                myMat.Qty    = myMat.SMSqft / myMat.Coverage;
                OtherItem oLm = OtherMaterials.Where(x => x.Name == "Linear footage for seams if needed for submerged conditions").FirstOrDefault();
                if (oLm != null)
                {
                    oLm.Quantity  = Math.Round(sysMat.Qty * 28, 2);
                    oLm.LQuantity = Math.Round(sysMat.Qty * 28, 2);
                }
            }
        }
        public async Task <IActionResult> AddOtherItem([FromBody] OtherItemVM otherItem)
        {
            var orgId = getOrg();

            if (otherItem != null)
            {
                if (otherItem.Id == Guid.Empty)
                {
                    OtherItem newItem = new OtherItem()
                    {
                        Id             = Guid.NewGuid(),
                        Item           = otherItem.Item,
                        Amount         = otherItem.Amount,
                        OrganisationId = orgId
                    };

                    _context.Add(newItem);
                    _context.SaveChanges();

                    otherItem.Id = newItem.Id;
                }

                InvoiceOtherItem invoiceOtherItem = new InvoiceOtherItem()
                {
                    Id = Guid.NewGuid(),
                    InvoiceRecordId = otherItem.InvoiceId,
                    OtherItemId     = otherItem.Id,
                    OrganisationId  = orgId,
                    Amount          = otherItem.Amount
                };



                try
                {
                    _context.Add(invoiceOtherItem);
                    _context.SaveChanges();

                    return(Json(new
                    {
                        msg = "Success"
                    }));
                }
                catch
                {
                    return(Json(new
                    {
                        msg = "Failed"
                    }));
                }


                //StatusMessage = "New Vendor successfully created.";
            }

            //StatusMessage = "Error! Check fields...";
            //ViewData["StatusMessage"] = StatusMessage;
            return(Json(new
            {
                msg = "No Data"
            }));
        }
		public void AssignedItem_IsAssigned_DefaultZoneName_BeforeSaving_NonProxiedItem()
		{
			var item = new DecoratedItem2();
			var child = new OtherItem();
			item.EditableItemWithDefaultChildZoneName = child;

			this.engine.Resolve<IProxyFactory>().OnSaving(item);

			item.EditableItemWithDefaultChildZoneName.ShouldBe(child);
			item.Children.Single().ShouldBe(child);
			child.Name.ShouldBe("EditableItemWithDefaultChildZoneName");
			child.ZoneName.ShouldBe("OtherZone");
		}
		public void AssignedItem_IsAssigned_DefaultZoneName()
		{
			var item = (DecoratedItem2)engine.Resolve<ContentActivator>().CreateInstance(typeof(DecoratedItem2), null, null, asProxy: true);

			var child = new OtherItem();
			item.EditableItemWithDefaultChildZoneName = child;

			item.EditableItemWithDefaultChildZoneName.ShouldBe(child);
			item.Children.Single().ShouldBe(child);
			child.Name.ShouldBe("EditableItemWithDefaultChildZoneName");
			child.ZoneName.ShouldBe("OtherZone");
		}
		public void AssignedItem_IsAddedAsChild_WithPropertyNameAsItemName()
		{
			var item = (DecoratedItem)engine.Resolve<ContentActivator>().CreateInstance(typeof(DecoratedItem), null, null, asProxy: true);

			var child = new OtherItem();
			item.TheItem = child;

			item.TheItem.ShouldBe(child);
			item.Children.Single().ShouldBe(child);
			child.Name.ShouldBe("TheItem");
			child.ZoneName.ShouldBe(null);
		}
 /// <summary>
 /// Open a senario item
 /// </summary>
 /// <param name="item"></param>
 private void Open(OtherItem item)
 {
 }