c# - .NET Winforms project with complex GUI and constraints between fields -
i work @ company repairs stuff , each time repair have fill paper tables everywhere , tons of fields.
want rid of papers , need application replace whole thing, , store results in db. have use c# .net , windows forms.
the problem now : there comboboxes in form values affect behavior of other controls. example, if combobox1 has value1, combobox2 available values choose value2, value3, value6, ...
consider :
╔════╦════════╗ ║ ok ║ not ok ║ ╠════╬════════╬═════════════════════════════════════════════════════════╗ ║ ║ ║ measure 1 : ....... (threshold value1 : > 180cd/m²) ║ ║ ∙ ║ ∘ ║ (threshold value2 : > 130cd/m²) ║ ║ ║ ║ measure 2 : ....... (threshold value3 : > 100cd/m²) ║ ╚════╩════════╩═════════════════════════════════════════════════════════╝
the cells under 'ok' , 'not ok' radiobuttons. until (on paper) checked manually according values of measure 1 , 2. winforms app, have checked automatically lower chance of errors. don't think i'd have many problems managing that, parsing string values , comparing them threshold. gets real messy that, showned, threshold not same , changes values of aforementionned comboboxes.
it sounds simple, , if that, it's quite heavy because there's lot of controls being involved.
i'd know elegant , efficient way manage of these constraints between controls.
what have thought of far
the hard way :
callbacks everywhere. whenever value changes somewhere, function called , stuff update form. means lot of dependancies across controls , no evolution possible unless want rewrite whole application.
the less hard way :
db store pretty constraints, , whenever important changes, quick check through db allow know controls update , update in them. i'm not sure how i'm seeing radiobutton , thresholds stuff, example, trick available values of comboxbox2 being choosen value of combobox1 :
╔═════════════╗ ╔═══════════════════════╗ ║ cb1_values ║ ║ cb2_values ║ ╠═════════════╣ ╠═══════════╦═══════════╣ ║ values ║ ║ cb1values ║ cb2values ║ ╠═════════════╣ ╠═══════════╬═══════════╣ ║ value1 ║ ║ value1 ║ value4 ║ ║ value2 ║ ║ value1 ║ value5 ║ ║ value3 ║ ║ value1 ║ value6 ║ ╚═════════════╝ ║ value2 ║ value7 ║ ║ value2 ║ value8 ║ ║ value3 ║ value3 ║ ║ value3 ║ value6 ║ ║ value3 ║ value9 ║ ╚═══════════╩═══════════╝
do "select cb2values cb2_values cb1values = value1"
, boom, here available values combobox2 when combobox1 = value1.
in case think idea, don't know @ how threshold thing, neither able come idea...
any appreciated ! :)
the question rather should configuration declarative or imperative.
in understanding going write small erp manages items, state, availability in warehouse..etc. rather keeping state information in db in case, avoid 2 different sources of information (data , configuration).
you need store items state in db in case, let's store controls state there. controls state crucial make right, conditions health of app. none of users query database sql
, likely, rather work interface.
would better on db side have stored procedures, triggers check state on every submit of data, or state change. approach follow giants sap
, may applicable in smaller cases, yours, imo.
Comments
Post a Comment