private void saveButton_Click(object sender, EventArgs e)
        {
            ItemCondition = conditionsComboBox.SelectedItem as ItemCondition;

            if (ItemCondition == null)
            {
                MessageBox.Show(Properties.Resources.AddNewConditionForm_saveButton_Click_Please_select_a_Condition_,
                                Properties.Resources.AddNewConditionForm_saveButton_Click_Warning, MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);
                return;
            }

            // Dynamically create an instance of our type.
            ItemCondition.CreateInstance();

            // This is where we map our properties based on the required parameters
            foreach (var rawControl in parametersPanel.Controls)
            {
                // We don't want the label that's created if there are no required parameters
                var control = rawControl as IItemConditionParameterControl;

                if (control == null)
                {
                    continue;
                }
                var property = ItemCondition.RequiredProperties
                               .SingleOrDefault(o => o == control.BoundProperty);

                ItemCondition.SetPropertyValue(property, control.GetParameterValue());
            }

            DialogResult = DialogResult.OK;
        }
        private IReadOnlyCollection <BricklinkItemAvailability> ParseAvailabilityColumn(
            HtmlNode column,
            ItemCondition condition)
        {
            var rows = column.SelectNodes(".//tr[@align='RIGHT']")?.ToList();

            if (rows == null || rows.Count == 0)
            {
                return(new List <BricklinkItemAvailability>());
            }

            var results = new List <BricklinkItemAvailability>();

            foreach (var row in rows)
            {
                var tds = row.ChildNodes?.ToList();
                if (tds?.Count != 3)
                {
                    continue;
                }

                var link = tds[0].SelectSingleNode("./a")?.Attributes["href"]?.Value;
                if (string.IsNullOrWhiteSpace(link) || !link.StartsWith("/store.asp"))
                {
                    continue;
                }

                var queryString = HttpUtility.ParseQueryString(link.Substring("/store.asp?".Length));
                var storeId     = queryString["sID"];
                if (string.IsNullOrWhiteSpace(storeId))
                {
                    continue;
                }

                int quantity = int.Parse(tds[1].InnerText);

                var priceExtractRegex = new Regex(@".*?&nbsp;\D*([\d,]*)\.(\d+)$");
                var priceMatch        = priceExtractRegex.Match(tds[2].InnerText.Replace(",", string.Empty));
                var priceString       = string.Format(
                    "{0}{1}{2}",
                    priceMatch.Groups[1],
                    CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator,
                    priceMatch.Groups[2]);

                decimal price = Convert.ToDecimal(priceString);

                var item = new BricklinkItemAvailability
                {
                    BricklinkStoreId = storeId,
                    Condition        = condition,
                    Quantity         = quantity,
                    Price            = price
                };

                results.Add(item);
            }

            return(results);
        }
Example #3
0
 public Map(ItemInfo itemInfo)
 {
     _id            = new Guid();
     _itemInfo      = itemInfo;
     _rentStatus    = RentStatus.AVAILABLE;
     _itemStatus    = ItemStatus.RENTABLE;
     _itemCondition = ItemCondition.OK;
 }
Example #4
0
 public Book(ItemInfo itemInfo, string ISBN)
 {
     _id            = new Guid();
     _itemInfo      = itemInfo;
     _isbn          = ISBN;
     _rentStatus    = RentStatus.AVAILABLE;
     _itemStatus    = ItemStatus.RENTABLE;
     _itemCondition = ItemCondition.OK;
 }
Example #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TradeDetails"/> class.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="quantity">The quantity.</param>
        /// <param name="condition">The item condition.</param>
        /// <exception cref="System.ArgumentNullException">item</exception>
        public TradeDetails(Item item, int quantity, ItemCondition condition)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            Item      = item;
            Quantity  = quantity;
            Condition = condition;
        }
Example #6
0
 public static Offer CreateNewOffer( decimal price, ItemAvailability availability, ItemCondition itemCondition )
 {
     var result = new Offer {
     Id = Guid.NewGuid(),
     Availability = availability,
     Condition = itemCondition,
     Currency = "USD",
     Price = price,
     PriceValidityStartDate = System.DateTime.Now,
     PriceValidityEndDate = System.DateTime.Now.AddYears( 100 )
       };
       return result;
 }
        private Guid AddItem(LibraryContext context, ItemCondition itemCondition = ItemCondition.OK, RentStatus rentStatus = RentStatus.AVAILABLE, ItemStatus itemStatus = ItemStatus.RENTABLE)
        {
            var item = ItemFactory.Get(new ItemInfo()
            {
                Author = "Test Author", Description = "A very good testing book", Title = "The best book"
            });

            item.ItemCondition = itemCondition;
            item.RentStatus    = rentStatus;
            item.ItemStatus    = itemStatus;
            context.Items.Add(item);
            context.SaveChanges();
            return(context.Items.Last().Id);
        }
 public Item(string number, int inventoryId, string name, ItemType type, int categoryId, int colorId, int quantity, ItemCondition condition, string completeness, string description, string remarks, Price originalPrice, Price displayPrice)
 {
     Number        = number;
     InventoryId   = inventoryId;
     Name          = name;
     Type          = type;
     CategoryId    = categoryId;
     ColorId       = colorId;
     Quantity      = quantity;
     Condition     = condition;
     Completeness  = completeness;
     Description   = description;
     Remarks       = remarks;
     OriginalPrice = originalPrice;
     DisplayPrice  = displayPrice;
 }
    public void CheckPurchaseConditions(ItemCondition itemCondition, bool isSame)
    {
        switch (itemCondition)
        {
        case ItemCondition.Equipped:
            priceText.text = "장착 중";
            isPurchase     = false;
            purchaseBtn.SetEquipped();
            break;

        case ItemCondition.Purchased:
            priceText.text = "이미 구매함";
            isPurchase     = false;
            purchaseBtn.SetPurchased();
            break;

        case ItemCondition.Blank:
            priceText.text = "";
            purchaseBtn.SetDisarm(isSame);
            isPurchase = false;
            break;

        case ItemCondition.None:
            isPurchase = true;
            purchaseBtn.SetNeedPurchase();

            if (DemandedLevelCheck() == false)
            {
                purchaseBtn.SetNotInteractable();
            }
            if (GameManager.Instance.GetPlayerGold() < price)
            {
                purchaseBtn.SetNotInteractable();
            }
            break;

        default:
            break;
        }
    }
        public async void Update_ItemStatus(ItemStatus status, ItemCondition condition)
        {
            var memberSsn = 112233446;

            using (var context = GetContextWithData())
                using (var controller = new LoansController(context))
                {
                    var     itemId  = context.Items.FirstOrDefault().Id;
                    LoanAPI loanAPI = new LoanAPI()
                    {
                        ItemId = itemId, MemberSsn = memberSsn
                    };
                    await controller.PostLoan(loanAPI);

                    await controller.ReturnLoan(loanAPI, (int)condition);

                    var loans = await controller.GetLoans();

                    var loan = loans.Where(l => l.Item.Id == itemId && l.Member.Ssn == memberSsn).FirstOrDefault();

                    Assert.Equal(status, loan.Item.ItemStatus);
                }
        }
        public async void Return_Loan(ItemCondition condition)
        {
            var memberSsn = 112233445;

            using (var context = GetContextWithData())
                using (var controller = new LoansController(context))
                {
                    var     itemId  = context.Items.FirstOrDefault().Id;
                    LoanAPI loanAPI = new LoanAPI()
                    {
                        ItemId = itemId, MemberSsn = memberSsn
                    };
                    await controller.PostLoan(loanAPI);

                    await controller.ReturnLoan(loanAPI, (int)condition);

                    var loans = await controller.GetLoans();

                    var loanz = loans.Where(l => l.Item.Id == itemId && l.Member.Ssn == memberSsn && l.IsReturned == false);

                    output.WriteLine(loanz.Count().ToString());
                    Assert.True(loanz.Count() == 0);
                }
        }
Example #12
0
 public ConditionalItem(ItemId pri, ItemId sec = ItemId.Unknown, ItemCondition cond = ItemCondition.TAKE_PRIMARY)
 {
     primary   = AutoShopper.getData((int)pri);
     secondary = (sec == ItemId.Unknown) ? null : AutoShopper.getData((int)sec);
     condition = cond;
 }
Example #13
0
 public ConditionalItem(int pri, int sec = -1, ItemCondition cond = ItemCondition.TAKE_PRIMARY)
 {
     primary   = AutoShopper.getData(pri);
     secondary = (sec == -1)?null:AutoShopper.getData(sec);
     condition = cond;
 }
Example #14
0
        private void MoveItem(string data)
        {
            var itemId = int.Parse(data.Split('|')[0]);

            var itemPosition = (StatsManager.Position) int.Parse(data.Split('|')[1]);

            var item =
                DatabaseProvider.InventoryItems.Find(
                    x =>
                    x.Id == itemId &&
                    x.Character.Id == _client.Character.Id);

            if (item == null)
            {
                return;
            }

            if (itemPosition == StatsManager.Position.None)
            {
                var existItem = InventoryItem.ExistItem(item, item.Character, itemPosition);

                if (existItem != null)
                {
                    var id = item.Id;
                    existItem.Quantity += item.Quantity;

                    InventoryItemRepository.Remove(item, true);

                    _client.SendPackets(string.Format("{0}{1}", Packet.ObjectRemove, id));

                    InventoryItemRepository.Update(existItem);

                    _client.SendPackets(string.Format("{0}{1}|{2}", Packet.ObjectQuantity, existItem.Id,
                                                      existItem.Quantity));
                }
                else
                {
                    item.ItemPosition = StatsManager.Position.None;
                    InventoryItemRepository.Update(item);

                    _client.SendPackets(string.Format("{0}{1}|{2}", Packet.ObjectMove, item.Id, (int)itemPosition));
                }

                _client.Character.Stats.RemoveItemStats(item.Stats);

                if (item.ItemInfos.HasSet())
                {
                    _client.Character.Stats.DecreaseItemSetEffect(item);
                }
            }
            else
            {
                if (item.ItemInfos.Level > _client.Character.Level)
                {
                    _client.SendPackets(Packet.ObjectErrorLevel);
                    return;
                }

                if (itemPosition == StatsManager.Position.Anneau1 || itemPosition == StatsManager.Position.Anneau2)
                {
                    if (item.ItemInfos.HasSet())
                    {
                        var itemSet = item.ItemInfos.GetSet();

                        if (_client.Character.CheckIfRingInSetAlredyEquiped(itemSet) == true)
                        {
                            _client.SendPackets(Packet.ObjectErrorRingInSetAlredyEquiped);
                            return;
                        }
                    }
                }

                if (ItemCondition.VerifyIfCharacterMeetItemCondition(_client.Character, item.ItemInfos.Conditions) ==
                    false)
                {
                    _client.SendPackets(string.Format("{0}{1}", Packet.Message, Packet.ConditionToEquipItem));
                    return;
                }

                var existItem = DatabaseProvider.InventoryItems.Find(
                    x =>
                    x.Character == _client.Character &&
                    x.ItemPosition == itemPosition);

                // TODO : debug Pets food & Obvis

                if (existItem != null)
                {
                    _client.SendPackets(Packet.Nothing);
                    return;
                }

                if (item.Quantity > 1)
                {
                    var newItem = item.Copy(quantity: item.Quantity - 1);

                    InventoryItemRepository.Create(newItem, true);

                    item.Quantity = 1;

                    item.ItemPosition = itemPosition;

                    InventoryItemRepository.Update(item);

                    _client.SendPackets(string.Format("{0}{1}|{2}", Packet.ObjectMove, item.Id, (int)itemPosition));

                    _client.SendPackets(string.Format("{0}{1}", Packet.ObjectAdd, newItem.ItemInfo()));
                }
                else
                {
                    item.ItemPosition = itemPosition;

                    InventoryItemRepository.Update(item);

                    _client.SendPackets(string.Format("{0}{1}", Packet.ObjectMove, data));
                }

                _client.Character.Stats.AddItemStats(item.Stats);

                if (item.ItemInfos.HasSet())
                {
                    _client.Character.Stats.IncreaseItemSetEffect(item);
                }
            }

            if (item.ItemInfos.HasSet())
            {
                var set = item.ItemInfos.GetSet();

                SendItemSetBonnus(set);
            }

            RefreshCharacterStats();

            _client.Character.Map.Send(string.Format("{0}{1}|{2}", Packet.ObjectAccessories, _client.Character.Id,
                                                     _client.Character.GetItemsWheneChooseCharacter()));
        }
Example #15
0
 private void OnEnable()
 {
     itemCondition = (ItemCondition)target;
 }
Example #16
0
        // Methods
        public void PostItem(
            string name,
            string description,
            ItemSection section,
            int categoryId,
            int amount,
            ItemCondition condition,
            ItemWarranty warranty,
            ItemDuration duration,
            int userId)
        {
            // Check if parameters are valid...
            if (string.IsNullOrEmpty(name.Trim()) | name.Trim().Length > 50)
            {
                throw new ValidationException("Item name is either blank or has exceeded 50 characters.");
            }

            if (string.IsNullOrEmpty(description.Trim()) | description.Trim().Length > 500)
            {
                throw new ValidationException("Description is either blank or has exceeded 500 characters.");
            }

            if (categoryId <= 0)
            {
                throw new ValidationException("Category is invalid.");
            }

            if (amount <= 0)
            {
                throw new ValidationException("Amount is invalid");
            }

            if (userId <= 0)
            {
                throw new ValidationException("User is invalid.");
            }

            // Get date and time stamps...
            var timeStamp = DateTime.Now;

            // Insert header...
            var header = _headerRepository.Insert(
                new Header()
            {
                Title   = name,
                UserId  = userId,
                Created = timeStamp,
                Updated = timeStamp
            });

            if (header.Id <= 0)
            {
                throw new ApplicationException(@"Failure inserting to table ""Header"".");
            }

            // Insert entry...
            var entry = _entryRepository.Insert(
                new Entry()
            {
                Message  = description,
                HeaderId = header.Id,
                UserId   = userId,
                Created  = timeStamp,
                Updated  = timeStamp
            });

            // Insert item...
            var item = _itemRepository.Insert(
                new Item()
            {
                HeaderId   = header.Id,
                CategoryId = categoryId,
                UserId     = userId,
                Amount     = amount,
                Section    = section,
                Condition  = condition,
                Warranty   = warranty,
                Created    = timeStamp,
                Updated    = timeStamp,
                Expiry     = timeStamp.AddDays((int)duration)
            });

            // Commit - let the caller of this method handle the transaction...
            //var inserted = _unitOfWork.Commit();
            //return inserted;
        }
Example #17
0
        private static QuestCondition ShowConditionInfo(QuestCondition condition)
        {
            var oldtype = condition.ConditionType;

            condition.ConditionType = (ConditionType)RPGMakerGUI.EnumPopup("Condition Type:", condition.ConditionType);
            if (condition.ConditionType != oldtype)
            {
                //TODO: if no longer interact node tree than delete that node tree

                switch (condition.ConditionType)
                {
                case ConditionType.Kill:
                    condition = new KillCondition();
                    break;

                case ConditionType.Item:
                    condition = new ItemCondition();
                    break;

                case ConditionType.Interact:
                    condition = new InteractCondition();
                    break;

                case ConditionType.Deliver:
                    condition = new DeliverCondition();
                    break;

                case ConditionType.Custom:
                    condition = new CustomCondition();
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }

            var killCondition     = condition as KillCondition;
            var itemCondition     = condition as ItemCondition;
            var interactCondition = condition as InteractCondition;
            var deliverCondition  = condition as DeliverCondition;
            var customCondition   = condition as CustomCondition;

            if (killCondition != null)
            {
                if (Rm_RPGHandler.Instance.Combat.NPCsCanFight && Rm_RPGHandler.Instance.Combat.CanAttackNPcs)
                {
                    RPGMakerGUI.Toggle("Is NPC?", ref killCondition.IsNPC);
                }
                else
                {
                    killCondition.IsNPC = false;
                }

                if (killCondition.IsNPC)
                {
                    RPGMakerGUI.PopupID <NonPlayerCharacter>("NPC to Kill:", ref killCondition.CombatantID);
                }
                else
                {
                    RPGMakerGUI.PopupID <CombatCharacter>("Enemy to Kill:", ref killCondition.CombatantID);
                }

                killCondition.NumberToKill = RPGMakerGUI.IntField("Number To Kill:", killCondition.NumberToKill);
            }

            if (itemCondition != null)
            {
                itemCondition.ItemType = (ItemConditionType)RPGMakerGUI.EnumPopup("Required Item Type:", itemCondition.ItemType);

                if (itemCondition.ItemType == ItemConditionType.CraftItem)
                {
                    RPGMakerGUI.PopupID <Item>("CraftItem To Collect:", ref itemCondition.ItemToCollectID, "ID", "Name", "Craft");
                }
                else if (itemCondition.ItemType == ItemConditionType.QuestItem)
                {
                    RPGMakerGUI.PopupID <Item>("Quest Item To Collect:", ref itemCondition.ItemToCollectID, "ID", "Name", "Quest");

                    if (Rm_RPGHandler.Instance.Combat.NPCsCanFight && Rm_RPGHandler.Instance.Combat.CanAttackNPcs)
                    {
                        RPGMakerGUI.Toggle("NPC Drops Items?", ref itemCondition.NPCDropsItem);
                    }
                    else
                    {
                        itemCondition.NPCDropsItem = false;
                    }

                    if (itemCondition.NPCDropsItem)
                    {
                        RPGMakerGUI.PopupID <NonPlayerCharacter>("NPC that Drops Item:", ref itemCondition.CombatantIDThatDropsItem);
                    }
                    else
                    {
                        RPGMakerGUI.PopupID <CombatCharacter>("Enemy that Drops Item:", ref itemCondition.CombatantIDThatDropsItem);
                    }
                }
                else if (itemCondition.ItemType == ItemConditionType.Item)
                {
                    RPGMakerGUI.PopupID <Item>("Item To Collect:", ref itemCondition.ItemToCollectID);
                }

                itemCondition.NumberToObtain = RPGMakerGUI.IntField("Number To Obtain:", itemCondition.NumberToObtain);
            }

            if (interactCondition != null)
            {
                if (RPGMakerGUI.Toggle("Talk to NPC?", ref interactCondition.IsNpc))
                {
                    RPGMakerGUI.PopupID <NonPlayerCharacter>("NPC to talk to:", ref interactCondition.InteractableID);
                }
                else
                {
                    RPGMakerGUI.PopupID <Interactable>("Object to interact with:", ref interactCondition.InteractableID);
                }

                if (GUILayout.Button("Open Interaction Node Tree", "genericButton", GUILayout.MaxHeight(30)))
                {
                    var trees        = Rm_RPGHandler.Instance.Nodes.DialogNodeBank.NodeTrees;
                    var existingTree = trees.FirstOrDefault(t => t.ID == interactCondition.InteractionNodeTreeID);
                    if (existingTree == null)
                    {
                        existingTree = NodeWindow.GetNewTree(NodeTreeType.Dialog);
                        Debug.Log("ExistingTree null? " + existingTree == null);
                        existingTree.ID = interactCondition.ID;

                        Debug.Log(existingTree.ID + ":::" + existingTree.Name);

                        var curSelectedQuest = Rme_Main.Window.CurrentPageIndex == 1 ? selectedQuestChainQuest : selectedQuest;

                        //todo: need unique name
                        existingTree.Name = curSelectedQuest.Name + "Interact";
                        trees.Add(existingTree);
                    }

                    DialogNodeWindow.ShowWindow(interactCondition.ID);
                    interactCondition.InteractionNodeTreeID = existingTree.ID;
                }
            }

            if (deliverCondition != null)
            {
                RPGMakerGUI.PopupID <Item>("Quest Item To Deliver:", ref deliverCondition.ItemToDeliverID, "ID", "Name", "Quest");
                if (RPGMakerGUI.Toggle("Deliver to NPC?", ref deliverCondition.DeliverToNPC))
                {
                    RPGMakerGUI.PopupID <NonPlayerCharacter>("NPC to deliver to:", ref deliverCondition.InteractableToDeliverToID);
                }
                else
                {
                    RPGMakerGUI.PopupID <Interactable>("Object to deliver with:", ref deliverCondition.InteractableToDeliverToID);
                }

                if (GUILayout.Button("Open Interaction On Deliver", "genericButton", GUILayout.MaxHeight(30)))
                {
                    var trees        = Rm_RPGHandler.Instance.Nodes.DialogNodeBank.NodeTrees;
                    var existingTree = trees.FirstOrDefault(t => t.ID == deliverCondition.InteractionNodeTreeID);
                    if (existingTree == null)
                    {
                        existingTree    = NodeWindow.GetNewTree(NodeTreeType.Dialog);
                        existingTree.ID = deliverCondition.ID;
                        //todo: need unique name
                        var curSelectedQuest = Rme_Main.Window.CurrentPageIndex == 1 ? selectedQuestChainQuest : selectedQuest;

                        existingTree.Name = curSelectedQuest.Name + "Interact";
                        trees.Add(existingTree);
                    }

                    DialogNodeWindow.ShowWindow(deliverCondition.ID);
                    deliverCondition.InteractionNodeTreeID = existingTree.ID;
                }
            }

            if (customCondition != null)
            {
                var customVar = customCondition.CustomVariableRequirement;
                RPGMakerGUI.PopupID <Rmh_CustomVariable>("Custom Variable:", ref customVar.VariableID);
                var foundCvar = Rm_RPGHandler.Instance.DefinedVariables.Vars.FirstOrDefault(v => v.ID == customCondition.CustomVariableRequirement.VariableID);
                if (foundCvar != null)
                {
                    switch (foundCvar.VariableType)
                    {
                    case Rmh_CustomVariableType.Float:
                        customVar.FloatValue = RPGMakerGUI.FloatField("Required Value:", customVar.FloatValue);
                        break;

                    case Rmh_CustomVariableType.Int:
                        customVar.IntValue = RPGMakerGUI.IntField("Required Value:", customVar.IntValue);
                        break;

                    case Rmh_CustomVariableType.String:
                        customVar.StringValue = RPGMakerGUI.TextField("Required Value:", customVar.StringValue);
                        break;

                    case Rmh_CustomVariableType.Bool:
                        selectedVarSetterBoolResult = customVar.BoolValue ? 0 : 1;
                        selectedVarSetterBoolResult = EditorGUILayout.Popup("Required Value:",
                                                                            selectedVarSetterBoolResult,
                                                                            new[] { "True", "False" });
                        customVar.BoolValue = selectedVarSetterBoolResult == 0;
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }
                }
            }

            if (condition.ConditionType != ConditionType.Custom)
            {
                RPGMakerGUI.Toggle("Use Custom Tracking Text:", ref condition.UseCustomText);
            }
            else
            {
                condition.UseCustomText = true;
            }

            if (condition.UseCustomText)
            {
                condition.CustomText          = RPGMakerGUI.TextField("Custom Incomplete Text:", condition.CustomText);
                condition.CustomCompletedText = RPGMakerGUI.TextField("Custom Completed Text:", condition.CustomCompletedText);
            }
            GUILayout.Space(5);

            return(condition);
        }
Example #18
0
        public ReportEvaluateCondition InitEvaluateConditions(String ModelIndex, String SheetIndex)
        {
            ReportEvaluateCondition r = null;

            //增加查询条件 Scdel=0 2013-10-17
            StringBuilder sql_Select = new StringBuilder();

            sql_Select.Append("select ID, Description,ReportNumber,ReportDate from sys_biz_reminder_evaluatecondition where Scdel=0 and modelIndex='");
            sql_Select.Append(ModelIndex);
            sql_Select.Append("' and SheetIndex='");
            sql_Select.Append(SheetIndex);
            sql_Select.Append("'");

            //增加查询条件 Scdel=0 2013-10-17
            StringBuilder sql_Item = new StringBuilder();

            sql_Item.Append("select ID,Text,Specifiedvalue,Truevalue,Expression from sys_biz_reminder_Itemcondition where Scdel=0 and EvaluateIndex='");
            sql_Item.Append(string.Concat(ModelIndex, "_", SheetIndex));
            sql_Item.Append("' order by OrderIndex");

            DataSet ds = GetDataSet(new string[] { sql_Select.ToString(), sql_Item.ToString() });

            if (ds != null)
            {
                DataTable ReportEvaluateTable = ds.Tables["sys_biz_reminder_evaluatecondition"];
                DataTable ItemTable           = ds.Tables["sys_biz_reminder_Itemcondition"];

                if (ReportEvaluateTable.Rows.Count > 0)
                {
                    DataRow Row          = ReportEvaluateTable.Rows[0];
                    String  ID           = Row["ID"].ToString();
                    String  Description  = Row["Description"].ToString();
                    String  ReportNumber = Row["ReportNumber"].ToString();
                    String  ReportDate   = Row["ReportDate"].ToString();

                    r              = new ReportEvaluateCondition();
                    r.Index        = ID;
                    r.ModelIndex   = ModelIndex;
                    r.SheetIndex   = SheetIndex;
                    r.Description  = Description;
                    r.ReportNumber = ReportNumber;
                    r.ReportDate   = ReportDate;

                    foreach (DataRow ItemRow in ItemTable.Rows)
                    {
                        String Index          = ItemRow["ID"].ToString();
                        String Text           = ItemRow["Text"].ToString();
                        String Specifiedvalue = ItemRow["Specifiedvalue"].ToString();
                        String Truevalue      = ItemRow["Truevalue"].ToString();
                        String Expression     = ItemRow["Expression"].ToString();

                        ItemCondition Condition = new ItemCondition();
                        Condition.Index          = Index;
                        Condition.EvaluateIndex  = string.Concat(ModelIndex, "_", SheetIndex);
                        Condition.Text           = Text;
                        Condition.Specifiedvalue = Specifiedvalue;
                        Condition.TrueValue      = Truevalue;
                        Condition.Expression     = Expression;

                        r.Items.Add(Condition);
                    }
                }
            }

            return(r);
        }
 public IFilterOptions ItemCondition(ItemCondition condition)
 {
     throw new NotImplementedException();
 }
Example #20
0
        void IItemWorkbook.AddItem(string itemTypeCode, string itemId, int colorId, int quantity, ItemCondition condition)
        {
            var compositeId = string.Format("{0}-{1}", itemTypeCode, itemId);

            dgv_AddItem(compositeId, colorId.ToString(), quantity, condition);
        }
Example #21
0
        public Boolean UpdateEvaluateItemCondition(String ModelIndex, String SheetIndex, ItemCondition Item, int OrderIndex)
        {
            Boolean result = false;

            StringBuilder sql_Item = new StringBuilder();

            //增加查询条件 Scdel=0 2013-10-17
            sql_Item.Append("select ID,SCTS,EvaluateIndex,Text,Specifiedvalue,Truevalue,Expression,OrderIndex,Scts_1 from sys_biz_reminder_Itemcondition where Scdel=0 and EvaluateIndex='");
            sql_Item.Append(string.Concat(ModelIndex, "_", SheetIndex));
            sql_Item.Append("' and ID='");
            sql_Item.Append(Item.Index);
            sql_Item.Append("'");

            DataTable Data = GetDataTable(sql_Item.ToString());

            if (Data != null)
            {
                DataRow ItemRow = null;
                if (Data.Rows.Count > 0)
                {
                    ItemRow = Data.Rows[0];
                }
                else
                {
                    ItemRow = Data.NewRow();
                    Data.Rows.Add(ItemRow);
                }

                ItemRow["ID"]             = Item.Index;
                ItemRow["SCTS"]           = DateTime.Now.ToString();
                ItemRow["EvaluateIndex"]  = string.Concat(ModelIndex, "_", SheetIndex);
                ItemRow["Text"]           = Item.Text;
                ItemRow["Specifiedvalue"] = Item.Specifiedvalue;
                ItemRow["Truevalue"]      = Item.TrueValue;
                ItemRow["Expression"]     = Item.Expression;
                ItemRow["OrderIndex"]     = OrderIndex;

                //新增字段Scts_1    2013-10-17
                ItemRow["Scts_1"] = DateTime.Now.ToString();

                try
                {
                    object r = Update(Data);
                    result = (Convert.ToInt32(r) == 1);
                }
                catch
                {
                }
            }

            return(result);
        }
Example #22
0
        // Methods
        public void PostItem(
            string name,
            string description,
            ItemSection section,
            int categoryId,
            int amount,
            ItemCondition condition,
            ItemWarranty warranty,
            ItemDuration duration,
            int userId)
        {
            // Check if parameters are valid...
            if (string.IsNullOrEmpty(name.Trim()) | name.Trim().Length > 50)
            {
                throw new ValidationException("Item name is either blank or has exceeded 50 characters.");
            }

            if (string.IsNullOrEmpty(description.Trim()) | description.Trim().Length > 500)
            {
                throw new ValidationException("Description is either blank or has exceeded 500 characters.");
            }

            if (categoryId <= 0)
            {
                throw new ValidationException("Category is invalid.");
            }

            if (amount <= 0)
            {
                throw new ValidationException("Amount is invalid");
            }

            if (userId <= 0)
            {
                throw new ValidationException("User is invalid.");
            }

            // Get date and time stamps...
            var timeStamp = DateTime.Now;

            // Insert header...
            var header = _headerRepository.Insert(
                new Header()
                {
                    Title = name,
                    UserId = userId,
                    Created = timeStamp,
                    Updated = timeStamp
                });
            if (header.Id <= 0)
            {
                throw new ApplicationException(@"Failure inserting to table ""Header"".");
            }

            // Insert entry...
            var entry = _entryRepository.Insert(
                new Entry()
                {
                    Message = description,
                    HeaderId = header.Id,
                    UserId = userId,
                    Created = timeStamp,
                    Updated = timeStamp
                });

            // Insert item...
            var item = _itemRepository.Insert(
                new Item()
                {
                    HeaderId = header.Id,
                    CategoryId = categoryId,
                    UserId = userId,
                    Amount = amount,
                    Section = section,
                    Condition = condition,
                    Warranty = warranty,
                    Created = timeStamp,
                    Updated = timeStamp,
                    Expiry = timeStamp.AddDays((int)duration)
                });

            // Commit - let the caller of this method handle the transaction...
            //var inserted = _unitOfWork.Commit();
            //return inserted;
        }
Example #23
0
 public static Boolean UpdateEvaluateItemCondition(String ModelIndex, String SheetIndex, ItemCondition Item, int OrderIndex)
 {
     return(Convert.ToBoolean(Agent.CallService("Yqun.BO.ReminderManager.dll", "UpdateEvaluateItemCondition", new object[] { ModelIndex, SheetIndex, Item, OrderIndex })));
 }
Example #24
0
 /// <summary>
 /// Checks for the used tool to kill/mine/fish/etc.
 /// </summary>
 /// <param name="item">Predicate for the item used</param>
 /// <returns></returns>
 public This UsedTool(ItemCondition item)
 {
     AddCondition(Condition.MatchTool(item));
     return(this as This);
 }
Example #25
0
 public AmazonItemSearchOperation Condition(ItemCondition condition)
 {
     return(this.AddOrReplace("Condition", condition));
 }
Example #26
0
 public static Condition MatchTool(ItemCondition item)
 {
     return(New("match_tool").Set("predicate", item));
 }