| Line 228... |
Line 228... |
| 228 |
dealText.setText(item.getPrivateDeal().getDealText()+"");
|
228 |
dealText.setText(item.getPrivateDeal().getDealText()+"");
|
| 229 |
}
|
229 |
}
|
| 230 |
else{
|
230 |
else{
|
| 231 |
dealText.setText("");
|
231 |
dealText.setText("");
|
| 232 |
}
|
232 |
}
|
| - |
|
233 |
if(dealTextOption.getSelectedIndex()!=2){
|
| - |
|
234 |
dealText.setEnabled(false);
|
| - |
|
235 |
}
|
| 233 |
dealFreebieOption.clear();
|
236 |
dealFreebieOption.clear();
|
| 234 |
dealFreebieOption.addItem("None","0");
|
237 |
dealFreebieOption.addItem("None","0");
|
| 235 |
dealFreebieOption.addItem("Existing Freebie","1");
|
238 |
dealFreebieOption.addItem("Existing Freebie","1");
|
| 236 |
dealFreebieOption.addItem("Other","2");
|
239 |
dealFreebieOption.addItem("Other","2");
|
| 237 |
dealFreebieOption.setSelectedIndex(item.getPrivateDeal().getDealFreebieOption().intValue());
|
240 |
dealFreebieOption.setSelectedIndex(item.getPrivateDeal().getDealFreebieOption().intValue());
|
| - |
|
241 |
if(dealFreebieOption.getSelectedIndex()!=2){
|
| - |
|
242 |
dealFreebieItemId.setEnabled(false);
|
| - |
|
243 |
}
|
| 238 |
dealFreebieItemId.setText(item.getPrivateDeal().getDealFreebieItemId()+"");
|
244 |
dealFreebieItemId.setText(item.getPrivateDeal().getDealFreebieItemId()+"");
|
| 239 |
preferredInsurer.clear();
|
245 |
preferredInsurer.clear();
|
| 240 |
preferredVendor.clear();
|
246 |
preferredVendor.clear();
|
| 241 |
int index = -1;
|
247 |
int index = -1;
|
| 242 |
if (item.getPreferredVendor() == null) {
|
248 |
if (item.getPreferredVendor() == null) {
|
| Line 341... |
Line 347... |
| 341 |
}
|
347 |
}
|
| 342 |
else{
|
348 |
else{
|
| 343 |
dealEndDate.setValue(null);
|
349 |
dealEndDate.setValue(null);
|
| 344 |
}
|
350 |
}
|
| 345 |
bestSellingRank.setText(item.getBestSellingRank() != null ? item.getBestSellingRank()+"" : "");
|
351 |
bestSellingRank.setText(item.getBestSellingRank() != null ? item.getBestSellingRank()+"" : "");
|
| 346 |
dealRank.setText(item.getPrivateDeal().getRank()!= 0L ? item.getPrivateDeal().getRank()+"" : "");
|
352 |
dealRank.setText(item.getPrivateDeal().getRank()!= 10000L? item.getPrivateDeal().getRank()+"" : "");
|
| 347 |
if(item.getPrivateDeal().isCod()){
|
353 |
if(item.getPrivateDeal().isCod()){
|
| 348 |
isCodOnDeal.setValue(true);
|
354 |
isCodOnDeal.setValue(true);
|
| 349 |
}
|
355 |
}
|
| 350 |
else{
|
356 |
else{
|
| 351 |
isCodOnDeal.setValue(false);
|
357 |
isCodOnDeal.setValue(false);
|
| Line 1353... |
Line 1359... |
| 1353 |
* <br>If update is successful, the old Item object is replaced with the new Item object.
|
1359 |
* <br>If update is successful, the old Item object is replaced with the new Item object.
|
| 1354 |
* @return true if new Item object is created successfully
|
1360 |
* @return true if new Item object is created successfully
|
| 1355 |
* <br>false if some error occurs due to NumberFormatException
|
1361 |
* <br>false if some error occurs due to NumberFormatException
|
| 1356 |
*/
|
1362 |
*/
|
| 1357 |
private boolean createNewItem() {
|
1363 |
private boolean createNewItem() {
|
| 1358 |
|
1364 |
|
| 1359 |
newItem = new Item();
|
1365 |
newItem = new Item();
|
| 1360 |
newItem.setId(item.getId());
|
1366 |
newItem.setId(item.getId());
|
| 1361 |
newItem.setProductGroup(productGroup.getText().trim());
|
1367 |
newItem.setProductGroup(productGroup.getText().trim());
|
| 1362 |
newItem.setBrand(brand.getText().trim());
|
1368 |
newItem.setBrand(brand.getText().trim());
|
| 1363 |
newItem.setModelNumber(modelNumber.getText().trim());
|
1369 |
newItem.setModelNumber(modelNumber.getText().trim());
|
| Line 1393... |
Line 1399... |
| 1393 |
}
|
1399 |
}
|
| 1394 |
else if(dealStartDt==null && privateDeal.getDealPrice()>0){
|
1400 |
else if(dealStartDt==null && privateDeal.getDealPrice()>0){
|
| 1395 |
Window.alert("Enter valid Start Date");
|
1401 |
Window.alert("Enter valid Start Date");
|
| 1396 |
return false;
|
1402 |
return false;
|
| 1397 |
}
|
1403 |
}
|
| - |
|
1404 |
if(isDealActive.getValue() && dealStartDt.getTime() < System.currentTimeMillis()){
|
| - |
|
1405 |
Window.alert("Deal Start Date < Current Date (Either mark InActive or Change Deal Start Date)");
|
| - |
|
1406 |
return false;
|
| - |
|
1407 |
}
|
| 1398 |
if(dealEndDt!=null && privateDeal.getDealPrice() >0){
|
1408 |
if(dealEndDt!=null && privateDeal.getDealPrice() >0){
|
| 1399 |
privateDeal.setEndDate(dealEndDt.getTime());
|
1409 |
privateDeal.setEndDate(dealEndDt.getTime());
|
| 1400 |
}
|
1410 |
}
|
| 1401 |
else if(dealEndDt!=null && privateDeal.getDealPrice()==0){
|
1411 |
else if(dealEndDt!=null && privateDeal.getDealPrice()==0){
|
| 1402 |
Window.alert("Invalid Deal Price format/value. Value should be greater than zero");
|
1412 |
Window.alert("Invalid Deal Price format/value. Value should be greater than zero");
|
| Line 1439... |
Line 1449... |
| 1439 |
}
|
1449 |
}
|
| 1440 |
} catch(NumberFormatException ex) {
|
1450 |
} catch(NumberFormatException ex) {
|
| 1441 |
Window.alert("Invalid deal freebie ItemId");
|
1451 |
Window.alert("Invalid deal freebie ItemId");
|
| 1442 |
return false;
|
1452 |
return false;
|
| 1443 |
}
|
1453 |
}
|
| 1444 |
if(dealTextOption.getSelectedIndex()==1 && bestDealsText.getText().trim().isEmpty()){
|
1454 |
/*if(dealTextOption.getSelectedIndex()==1 && bestDealsText.getText().trim().isEmpty()){
|
| 1445 |
Window.alert("Invalid Best Deals Text");
|
1455 |
Window.alert("Invalid Best Deals Text");
|
| 1446 |
return false;
|
1456 |
return false;
|
| 1447 |
}
|
1457 |
}*/
|
| 1448 |
else if(dealTextOption.getSelectedIndex()==1){
|
1458 |
if(dealTextOption.getSelectedIndex()==1){
|
| 1449 |
privateDeal.setDealText(bestDealsText.getText().trim());
|
1459 |
privateDeal.setDealText(bestDealsText.getText().trim());
|
| 1450 |
privateDeal.setDealTextOption((long) dealTextOption.getSelectedIndex());
|
1460 |
privateDeal.setDealTextOption((long) dealTextOption.getSelectedIndex());
|
| 1451 |
}
|
1461 |
}
|
| 1452 |
else if(dealTextOption.getSelectedIndex()==2 && dealText.getText().trim().isEmpty()){
|
1462 |
else if(dealTextOption.getSelectedIndex()==2 && dealText.getText().trim().isEmpty()){
|
| 1453 |
Window.alert("Please enter some deal Text");
|
1463 |
Window.alert("Please enter some deal Text");
|
| Line 1459... |
Line 1469... |
| 1459 |
}
|
1469 |
}
|
| 1460 |
privateDeal.setCod(isCodOnDeal.getValue());
|
1470 |
privateDeal.setCod(isCodOnDeal.getValue());
|
| 1461 |
privateDeal.setActive(isDealActive.getValue());
|
1471 |
privateDeal.setActive(isDealActive.getValue());
|
| 1462 |
try{
|
1472 |
try{
|
| 1463 |
if(dealRank.getText().trim().isEmpty()){
|
1473 |
if(dealRank.getText().trim().isEmpty()){
|
| 1464 |
privateDeal.setRank(0L);
|
1474 |
privateDeal.setRank(10000L);
|
| 1465 |
}
|
1475 |
}
|
| 1466 |
else{
|
1476 |
else{
|
| - |
|
1477 |
if(Long.parseLong(dealRank.getText().trim()) < 0){
|
| - |
|
1478 |
throw new NumberFormatException();
|
| - |
|
1479 |
}
|
| 1467 |
privateDeal.setRank(Long.parseLong(dealRank.getText().trim()));
|
1480 |
privateDeal.setRank(Long.parseLong(dealRank.getText().trim()));
|
| 1468 |
}
|
1481 |
}
|
| 1469 |
}
|
1482 |
}
|
| 1470 |
catch(NumberFormatException nex){
|
1483 |
catch(NumberFormatException nex){
|
| 1471 |
Window.alert("Invalid Deals Rank");
|
1484 |
Window.alert("Invalid Deals Rank");
|
| Line 1483... |
Line 1496... |
| 1483 |
throw new NumberFormatException("Negative value of MRP");
|
1496 |
throw new NumberFormatException("Negative value of MRP");
|
| 1484 |
}
|
1497 |
}
|
| 1485 |
newItem.setMrp(mrpValue);
|
1498 |
newItem.setMrp(mrpValue);
|
| 1486 |
}
|
1499 |
}
|
| 1487 |
} catch(NumberFormatException ex) {
|
1500 |
} catch(NumberFormatException ex) {
|
| 1488 |
Window.alert("Invalid MRP format/value. Value shoule be greater than zero");
|
1501 |
Window.alert("Invalid MRP format/value. Value should be greater than zero");
|
| 1489 |
return false;
|
1502 |
return false;
|
| 1490 |
}
|
1503 |
}
|
| 1491 |
try {
|
1504 |
try {
|
| 1492 |
if(!sellingPrice.getText().trim().isEmpty()) {
|
1505 |
if(!sellingPrice.getText().trim().isEmpty()) {
|
| 1493 |
double spValue = Double.parseDouble(sellingPrice.getText().trim());
|
1506 |
double spValue = Double.parseDouble(sellingPrice.getText().trim());
|
| Line 1498... |
Line 1511... |
| 1498 |
}
|
1511 |
}
|
| 1499 |
} catch(NumberFormatException ex) {
|
1512 |
} catch(NumberFormatException ex) {
|
| 1500 |
Window.alert("Invalid Selling Price format/value. Value shoule be greater than zero");
|
1513 |
Window.alert("Invalid Selling Price format/value. Value shoule be greater than zero");
|
| 1501 |
return false;
|
1514 |
return false;
|
| 1502 |
}
|
1515 |
}
|
| - |
|
1516 |
if(newItem.getPrivateDeal().getDealPrice()!=0 && newItem.getPrivateDeal().getDealPrice() >= newItem.getSellingPrice()){
|
| - |
|
1517 |
Window.alert("Deal Price can't be more than Selling Price");
|
| - |
|
1518 |
return false;
|
| - |
|
1519 |
}
|
| 1503 |
try {
|
1520 |
try {
|
| 1504 |
if(!weight.getText().trim().isEmpty()) {
|
1521 |
if(!weight.getText().trim().isEmpty()) {
|
| 1505 |
double wtValue = Double.parseDouble(weight.getText().trim());
|
1522 |
double wtValue = Double.parseDouble(weight.getText().trim());
|
| 1506 |
if(wtValue <= 0) {
|
1523 |
if(wtValue <= 0) {
|
| 1507 |
throw new NumberFormatException("Negative value of Weight");
|
1524 |
throw new NumberFormatException("Negative value of Weight");
|
| Line 1697... |
Line 1714... |
| 1697 |
newItem.setUpdatedOn(item.getUpdatedOn());
|
1714 |
newItem.setUpdatedOn(item.getUpdatedOn());
|
| 1698 |
newItem.setItemStatus(item.getItemStatus());
|
1715 |
newItem.setItemStatus(item.getItemStatus());
|
| 1699 |
newItem.setItemInventory(item.getItemInventory());
|
1716 |
newItem.setItemInventory(item.getItemInventory());
|
| 1700 |
newItem.setSimilarItems(item.getSimilarItems());
|
1717 |
newItem.setSimilarItems(item.getSimilarItems());
|
| 1701 |
newItem.setVouchersMap(item.getVouchersMap());
|
1718 |
newItem.setVouchersMap(item.getVouchersMap());
|
| 1702 |
|
1719 |
|
| 1703 |
return true;
|
1720 |
return true;
|
| 1704 |
}
|
1721 |
}
|
| 1705 |
|
1722 |
|
| 1706 |
/**
|
1723 |
/**
|
| 1707 |
* This method is called when Edit button is clicked corresponding to a row in
|
1724 |
* This method is called when Edit button is clicked corresponding to a row in
|
| Line 1905... |
Line 1922... |
| 1905 |
}
|
1922 |
}
|
| 1906 |
if(newItem.getPrivateDeal().getDealFreebieOption().longValue()!=item.getPrivateDeal().getDealFreebieOption().longValue()) {
|
1923 |
if(newItem.getPrivateDeal().getDealFreebieOption().longValue()!=item.getPrivateDeal().getDealFreebieOption().longValue()) {
|
| 1907 |
sb.append("\n-Deal Freebie Option");
|
1924 |
sb.append("\n-Deal Freebie Option");
|
| 1908 |
}
|
1925 |
}
|
| 1909 |
if(!newItem.getPrivateDeal().getDealText().equalsIgnoreCase(item.getPrivateDeal().getDealText())) {
|
1926 |
if(!newItem.getPrivateDeal().getDealText().equalsIgnoreCase(item.getPrivateDeal().getDealText())) {
|
| 1910 |
sb.append("\n-Deal Text");
|
1927 |
sb.append("\n-Deal Text " + newItem.getPrivateDeal().getDealText() +" "+item.getPrivateDeal().getDealText());
|
| 1911 |
}
|
1928 |
}
|
| 1912 |
if(newItem.getPrivateDeal().getDealTextOption()!=item.getPrivateDeal().getDealTextOption()) {
|
1929 |
if(newItem.getPrivateDeal().getDealTextOption()!=item.getPrivateDeal().getDealTextOption()) {
|
| 1913 |
sb.append("\n-Deal Text Option");
|
1930 |
sb.append("\n-Deal Text Option");
|
| 1914 |
}
|
1931 |
}
|
| 1915 |
if(newItem.getPrivateDeal().getRank().longValue()!=item.getPrivateDeal().getRank().longValue()) {
|
1932 |
if(newItem.getPrivateDeal().getRank().longValue()!=item.getPrivateDeal().getRank().longValue()) {
|
| 1916 |
sb.append("\n-Deal Rank");
|
1933 |
sb.append("\n-Deal Rank"+" "+newItem.getPrivateDeal().getRank().longValue()+" "+item.getPrivateDeal().getRank().longValue());
|
| 1917 |
}
|
1934 |
}
|
| 1918 |
if(newItem.getPrivateDeal().isCod()!=item.getPrivateDeal().isCod()) {
|
1935 |
if(newItem.getPrivateDeal().isCod()!=item.getPrivateDeal().isCod()) {
|
| 1919 |
sb.append("\n-Is Deal Cod");
|
1936 |
sb.append("\n-Is Deal Cod");
|
| 1920 |
}
|
1937 |
}
|
| 1921 |
if(newItem.getPrivateDeal().isActive()!=item.getPrivateDeal().isActive()) {
|
1938 |
if(newItem.getPrivateDeal().isActive()!=item.getPrivateDeal().isActive()) {
|