Hi,
1 application can have multiple blocks and a single compounding wall price for each application, and if c.wall value is added in any block then it should read-only for other block.
how can I do.
Hi,
1 application can have multiple blocks and a single compounding wall price for each application, and if c.wall value is added in any block then it should read-only for other block.
how can I do.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Vishal JoshiRank #377 · 6.7K reputationPosted May 14, 2024, 8:36 AM EDT
Hello,
Handel Duplicate value in calculation
As per the question, there are duplicate prices in add/update record. It's fine to have same value for each block because when you check for a single block you need the same value.
But, you can check in foreach loop if it's a duplicate or the same value you should take FirstOrDefault() or not add again if it's already added to the total price calculation.
Make the input field read-only
you can check if a value has already been added in a database or if it's not null or zero then you should set read-only
Thanks
Vishal Joshi
Jayraj ChhayaRank #304 · 8.2K reputationPosted May 14, 2024, 8:05 AM EDT
To achieve this in a .NET application, you can utilize data structures like dictionaries or hashsets to store unique values for each block. Additionally, you can implement a mechanism to enforce read-only access to the compounding wall value across blocks.
using System; using System.Collections.Generic; public class Application { private Dictionary blockPrices = new Dictionary(); private decimal compoundingWallPrice; public void SetBlockPrice(string blockName, decimal price) { if (!blockPrices.ContainsKey(blockName)) { blockPrices[blockName] = price; } } public decimal GetBlockPrice(string blockName) { return blockPrices.ContainsKey(blockName) ? blockPrices[blockName] : 0; } public decimal CompoundingWallPrice { get { return compoundingWallPrice; } private set { compoundingWallPrice = value; } } }