Subversion Repositories SmartDukaan

Rev

Rev 2359 | Rev 2427 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2359 Rev 2387
Line 568... Line 568...
568
        mappingDialog.show();
568
        mappingDialog.show();
569
    }
569
    }
570
 
570
 
571
    private String isItemChanged() {
571
    private String isItemChanged() {
572
        StringBuilder sb = new StringBuilder("");
572
        StringBuilder sb = new StringBuilder("");
573
        if(!productGroup.getText().trim().equals(item.getProductGroup())) {
573
        if(!checkStringsIfEqual(productGroup.getText().trim(), item.getProductGroup())) {
574
            sb.append("\nProduct Group");
574
            sb.append("\n-Product Group");
575
        }
575
        }
576
        if(!brand.getText().trim().equals(item.getBrand())) {
576
        if(!checkStringsIfEqual(brand.getText().trim(), item.getBrand())) {
577
            sb.append("\nBrand");
577
            sb.append("\n-Brand");
578
        }
578
        }
579
        if(!modelNumber.getText().trim().equals(item.getModelNumber())) {
579
        if(!checkStringsIfEqual(modelNumber.getText().trim(), item.getModelNumber())) {
580
            sb.append("\nModel Number");
580
            sb.append("\n-Model Number");
581
        }
581
        }
582
        if(!modelName.getText().trim().equals(item.getModelName())) {
582
        if(!checkStringsIfEqual(modelName.getText().trim(), item.getModelName())) {
583
            sb.append("\nModel Name");
583
            sb.append("\n-Model Name");
584
        }
584
        }
585
        if(!color.getText().trim().equals(item.getColor())) {
585
        if(!checkStringsIfEqual(color.getText().trim(), item.getColor())) {
586
            sb.append("\nColor");
586
            sb.append("\n-Color");
587
        }
587
        }
588
        if(!statusDesc.getText().trim().equals(item.getItemStatusDesc())) {
588
        if(!checkStringsIfEqual(statusDesc.getText().trim(), item.getItemStatusDesc())) {
589
            sb.append("\nStatus Description");
589
            sb.append("\n-Status Description");
590
        }
590
        }
591
        if(!comments.getText().trim().equals(item.getComments())) {
591
        if(!checkStringsIfEqual(comments.getText().trim(), item.getComments())) {
592
            sb.append("\nComments");
592
            sb.append("\n-Comments");
593
        }
593
        }
594
        if(newItem.getMrp() != item.getMrp()) {
594
        if(newItem.getMrp() != item.getMrp()) {
595
            sb.append("\nMRP");
595
            sb.append("\n-MRP");
596
        }
596
        }
597
        if(newItem.getSellingPrice() != item.getSellingPrice()) {
597
        if(newItem.getSellingPrice() != item.getSellingPrice()) {
598
            sb.append("\nSelling Price");
598
            sb.append("\n-Selling Price");
599
        }
599
        }
600
        if(newItem.getWeight() != item.getWeight()) {
600
        if(newItem.getWeight() != item.getWeight()) {
601
            sb.append("\nWeight");
601
            sb.append("\n-Weight");
602
        }
602
        }
603
        if(!bestDealsText.getText().trim().equals(item.getBestDealsText())) {
603
        if(!checkStringsIfEqual(bestDealsText.getText().trim(), item.getBestDealsText())) {
604
            sb.append("\nBest Deal Text");
604
            sb.append("\n-Best Deal Text");
605
        }
605
        }
606
        if(newItem.getBestDealsValue() != item.getBestDealsValue()) {
606
        if(newItem.getBestDealsValue() != item.getBestDealsValue()) {
607
            sb.append("\nBest Deal Value");
607
            sb.append("\n-Best Deal Value");
608
        }
608
        }
609
        if(newItem.getBestSellingRank() != item.getBestSellingRank()) {
609
        if(newItem.getBestSellingRank() != item.getBestSellingRank()) {
610
            sb.append("\nBest Selling Rank");
610
            sb.append("\n-Best Selling Rank");
611
        }
611
        }
612
        if(item.isDefaultForEntity() != defaultForEntity.getValue()) {
612
        if(item.isDefaultForEntity() != defaultForEntity.getValue()) {
613
            sb.append("\nDefault For Entity Flag");
613
            sb.append("\n-Default For Entity Flag");
614
        }
614
        }
615
        if(item.isRisky() != risky.getValue()) {
615
        if(item.isRisky() != risky.getValue()) {
616
            sb.append("\nRisky Flag");
616
            sb.append("\n-Risky Flag");
617
        }
617
        }
618
        if(newItem.getStartDate() != item.getStartDate()) {
618
        if(newItem.getStartDate() != item.getStartDate()) {
619
            sb.append("\nStart Date");
619
            sb.append("\n-Start Date");
620
        }
620
        }
621
        VendorPricings vendorPricings;
621
        VendorPricings vendorPricings;
622
        long vendorId;
622
        long vendorId;
623
        for(int row = 0; row < vendorTable.getRowCount(); row++) {
623
        for(int row = 0; row < vendorTable.getRowCount(); row++) {
624
            vendorId = Long.parseLong(vendorTable.getText(row, TABLE_INDEX_PRICING_VENDORID));
624
            vendorId = Long.parseLong(vendorTable.getText(row, TABLE_INDEX_PRICING_VENDORID));
625
            vendorPricings = item.getVendorPricesMap().get(vendorId);
625
            vendorPricings = item.getVendorPricesMap().get(vendorId);
626
            if(vendorPricings == null) {
626
            if(vendorPricings == null) {
627
                sb.append("\nVendor Prices (Vendor:" + vendorId + ")");
627
                sb.append("\n-Vendor Prices (Vendor:" + vendorId + ")");
628
                continue;
628
                continue;
629
            }
629
            }
630
            if(vendorPricings.getMop() != Double.parseDouble(vendorTable.getText(row, TABLE_INDEX_PRICING_MOP))) {
630
            if(vendorPricings.getMop() != Double.parseDouble(vendorTable.getText(row, TABLE_INDEX_PRICING_MOP))) {
631
                sb.append("\nMOP (Vendor:" + vendorId + ")");
631
                sb.append("\n-MOP (Vendor:" + vendorId + ")");
632
            }
632
            }
633
            if(vendorPricings.getDealerPrice() != Double.parseDouble(vendorTable.getText(row, TABLE_INDEX_PRICING_DP))) {
633
            if(vendorPricings.getDealerPrice() != Double.parseDouble(vendorTable.getText(row, TABLE_INDEX_PRICING_DP))) {
634
                sb.append("\nDealer Price (Vendor:" + vendorId + ")");
634
                sb.append("\n-Dealer Price (Vendor:" + vendorId + ")");
635
            }
635
            }
636
            if(vendorPricings.getTransferPrice() != Double.parseDouble(vendorTable.getText(row, TABLE_INDEX_PRICING_TP))) {
636
            if(vendorPricings.getTransferPrice() != Double.parseDouble(vendorTable.getText(row, TABLE_INDEX_PRICING_TP))) {
637
                sb.append("\nTransfer Price (Vendor:" + vendorId + ")");
637
                sb.append("\n-Transfer Price (Vendor:" + vendorId + ")");
-
 
638
            }
-
 
639
        }
-
 
640
        
-
 
641
        VendorItemMapping mapping;
-
 
642
        String old_key, new_key;
-
 
643
        for(int row = 0; row < vendorTableM.getRowCount(); row++) {
-
 
644
            vendorId = Long.parseLong(vendorTableM.getText(row, TABLE_INDEX_MAPPING_VENDORID));
-
 
645
            old_key = vendorTableM.getText(row, TABLE_INDEX_MAPPING_ITEM_KEY_OLD);
-
 
646
            new_key = vendorTableM.getText(row, TABLE_INDEX_MAPPING_ITEM_KEY);
-
 
647
            mapping = item.getVendorKeysMap().get(vendorId + Item.KEY_SEPARATOR + old_key);
-
 
648
            if(mapping == null || !old_key.equals(new_key)) {
-
 
649
                sb.append("\n-Vendor Key (Vendor:" + vendorId + ",Key: = " + old_key + ")");
-
 
650
                continue;
638
            }
651
            }
639
        }
652
        }
640
        return sb.toString();
653
        return sb.toString();
641
    }
654
    }
642
    
655
    
Line 686... Line 699...
686
                return false;
699
                return false;
687
            }
700
            }
688
        }
701
        }
689
        return true;
702
        return true;
690
    }
703
    }
-
 
704
    
-
 
705
    private boolean checkStringsIfEqual(String s1, String s2) {
-
 
706
        if(s1 == s2) {
-
 
707
            return true;
-
 
708
        }
-
 
709
        if(s1 != null && s2 != null && s1.equals(s2)) {
-
 
710
            return true;
-
 
711
        }
-
 
712
        if((s1 == null && s2.equals("")) || (s2 == null && s1.equals(""))) {
-
 
713
            return true;
-
 
714
        }
-
 
715
        return false;
-
 
716
    }
691
}
717
}