hmm ela ela thanks machan info walataMachan mehemai official site eken download karaganin(iso ekath tiyenawa) ita passe net eke search parak dapan key ona tharan hoya ganna puluwan. http://parth8641.blogspot.com/2015/07/microsoft-visual-studio-2015-pro.html meke enterprise key nam mata wada kara pro ekath wada karai. Elaz


මචංලා පොඩි උදව්වක් ඕන..
මට පොඩ්ඩක් පැහැදිලි කරන්න පුළුවංද POS system එකක Bill එක pay කරනකොට Debit and credit cards වලින් pay කරන විදිය.. API එකක් දෙනවද banks වලින්.. නැත්තම් මැනුවල්ද pay කරා කියන එක add කරන්නේ
If-else wage deyakin oka karanne natte ai?JAVA HELP - UNIT OF MEASUREMENTS
මචන්ල මම කෙටියෙන් කියන්නම් මේකයි ප්රශනෙ. මට ඕනෙ unit of measurements (UOM) ටිකක් combo box එකකට දාගන්න. පටන් ගන්නකොට මේ combo box එක හිස්. DB එකෙන් uom එක ගන්නව. එතකොට ඒ UOM එක මෙන්න මේ ටිකෙන් එකක් වෙන්න පුලුවන්.
//Pound, Kilogram, Gram, Miligram, Ounce,Centimetre, Metre, Yard, Foot, Inch
දැන් ඒ UOM Weight වලට අදාල UOM එකක් නම් මට ඉතුරු UOM ටික combo box එකට දාගන්න ඕනෙ. ඒකියන්නෙ ඒ uom එක මේ පහල තියෙන uom වලින් එකක් නම් ඉතුරු ටික add කරගන්න ඕනෙ.
//Weight - Pound, Kilogram, Miligram, Gram, Ounce
Ex 01-
Combo box initial state = Empty
DB return UOM = 'Miligram'
Combo box state =
Pound, Kilogram, Miligram, Gram, Ounce
Ex 02-
Combo box initial state = Empty
DB return UOM = 'Foot'
Combo box state =
Centimetre, Metre, Yard, Foot, Inch
මේක මට if else ගොඩක් දාල කර ගන්න පුලුවන්. ඒත් මට ඕනෙ හොද ඇඩ්වාන්ස් ක්රමයක්.
උදවු දෙන හැමෝටම 13+ ගානෙ දෙන්නම්.
public List<String> getComboStates() {
String uomFromDb="weight"; //This is what you get from the db
List<String> finalComboStates=null;
//Assuming that you have set of combo states
Map<String, List<String>> comboStates = new HashMap<>();
comboStates.put("weightRelated", new ArrayList<String>() {
{
add("kilograms");
add("grams");
add("pounds");
}
});
comboStates.put("lengthRelated", new ArrayList<String>() {
{
add("centimeters");
add("yards");
add("inch");
}
});
switch(uomFromDb){
case "weight":
finalComboStates=comboStates.get("weightRelated");
break;
case "length":
finalComboStates=comboStates.get("lengthRelated");
break;
default:
throw new RuntimeException("Cannot fina a state");
}
return finalComboStates;
}
නෑ මචන් DB එකෙන් එන්නෙ UOM එක මිසක් UOM ඒකෙ ටයිප් එක නෙමෙයි. ඒකයි Advanced මෙතඩ් එකක් හොයන්නෙ.විල්සන් මාමා;19421824 said:If-else wage deyakin oka karanne natte ai?
Advanced method ekak oneda?
Switch ekak use karannath puluwan
Mama nam me wage widiyata karanne
Code:public List<String> getComboStates() { String uomFromDb="weight"; //This is what you get from the db List<String> finalComboStates=null; //Assuming that you have set of combo states Map<String, List<String>> comboStates = new HashMap<>(); comboStates.put("weightRelated", new ArrayList<String>() { { add("kilograms"); add("grams"); add("pounds"); } }); comboStates.put("lengthRelated", new ArrayList<String>() { { add("centimeters"); add("yards"); add("inch"); } }); switch(uomFromDb){ case "weight": finalComboStates=comboStates.get("weightRelated"); break; case "length": finalComboStates=comboStates.get("lengthRelated"); break; default: throw new RuntimeException("Cannot fina a state"); } return finalComboStates; }
switch(uomFromDb){
case "weight":
}
නෑ මචන් DB එකෙන් එන්නෙ UOM එක මිසක් UOM ඒකෙ ටයිප් එක නෙමෙයි. ඒකයි Advanced මෙතඩ් එකක් හොයන්නෙ.
ඕක හරියන්නෙ නෑ. මොකද uomFromDb සමාන වෙන්නෙ inch,gram වගේ ඒවට. ඒතකොට ඔය කේස් හරියන්නෙ නෑ.Code:switch(uomFromDb){ case "weight": }
case "inch": case "gram" වගේ තමා switch කරන්න වෙන්නෙ.
කේස් බර ගානක් ලියන්න වෙනව. ඒකයි ටිකක් ඇඩ්වාන්ස්z ක්රමයක් හොයන්නෙ.
ඒත් එකමනෙ බන්.. එතකොට සේව් කරද්දි switch-case ගොඩක් ඕනෙ වෙනවනෙ uom type එක බලන්න. ඔතන මැප් එකක් දාන්නත් පුලුවන්. ඒත් maintenance ලේසි උනාට execution time එක switch-case වලට වඩා slowවෙනව. ඒකයි අවුලEhemanam itin db ekata uom type eka daaganna wenawa.
JAVA HELP - UNIT OF MEASUREMENTS
මචන්ල මම කෙටියෙන් කියන්නම් මේකයි ප්රශනෙ. මට ඕනෙ unit of measurements (UOM) ටිකක් combo box එකකට දාගන්න. පටන් ගන්නකොට මේ combo box එක හිස්. DB එකෙන් uom එක ගන්නව. එතකොට ඒ UOM එක මෙන්න මේ ටිකෙන් එකක් වෙන්න පුලුවන්.
//Pound, Kilogram, Gram, Miligram, Ounce,Centimetre, Metre, Yard, Foot, Inch
දැන් ඒ UOM Weight වලට අදාල UOM එකක් නම් මට ඉතුරු UOM ටික combo box එකට දාගන්න ඕනෙ. ඒකියන්නෙ ඒ uom එක මේ පහල තියෙන uom වලින් එකක් නම් ඉතුරු ටික add කරගන්න ඕනෙ.
//Weight - Pound, Kilogram, Miligram, Gram, Ounce
Ex 01-
Combo box initial state = Empty
DB return UOM = 'Miligram'
Combo box state =
Pound, Kilogram, Miligram, Gram, Ounce
Ex 02-
Combo box initial state = Empty
DB return UOM = 'Foot'
Combo box state =
Centimetre, Metre, Yard, Foot, Inch
මේක මට if else ගොඩක් දාල කර ගන්න පුලුවන්. ඒත් මට ඕනෙ හොද ඇඩ්වාන්ස් ක්රමයක්.
උදවු දෙන හැමෝටම 13+ ගානෙ දෙන්නම්.
ආ පුතාලා... කොහොමෙයි?![]()
![]()
ela ela hondin innawa... java webe development tika ela mcn.Wedi wediyen igenimata labewa.


ඔන්න උඹේ මේ ත්රෙඩ් ඒකත් හොඳම අධ්යාපනික ත්රෙඩ් එකක් විදියට යෝජනා වෙලා...![]()
http://www.elakiri.com/forum/showthread.php?t=1718466

