review
This commit is contained in:
@@ -61,6 +61,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
TableBean tableBean;
|
||||
private SQLiteDatabase db;
|
||||
Context context;
|
||||
ArrayList<T2PGetterSetter> t2PGetterSetters;
|
||||
|
||||
public GSKOrangeDB(Context context) {
|
||||
|
||||
@@ -159,6 +160,16 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
db.delete(CommonString.TABLE_INSERT_PROMO_SKU, "STORE_ID='" + storeid + "'", null);
|
||||
//Gagan end code
|
||||
|
||||
t2PGetterSetters = getT2pCompliancedaletedata(storeid);
|
||||
|
||||
for (int q = 0; q < t2PGetterSetters.size(); q++) {
|
||||
|
||||
db.delete(CommonString.TABLE_INSERT_T2P_GAPS, "COMMON_ID='" + t2PGetterSetters.get(q).getKey_id() + "'", null);
|
||||
db.delete(CommonString.TABLE_INSERT_T2P_SKU, "COMMON_ID='" + t2PGetterSetters.get(q).getKey_id() + "'", null);
|
||||
db.delete(CommonString.TABLE_INSERT_BRAND_AVAIBILITY_DATA, "COMMON_ID='" + t2PGetterSetters.get(q).getKey_id() + "'", null);
|
||||
|
||||
}
|
||||
|
||||
db.delete(CommonString.TABLE_INSERT_T2P_COMPLIANCE, "STORE_ID='" + storeid + "'", null);
|
||||
}
|
||||
|
||||
@@ -180,7 +191,9 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
//Gagan end code
|
||||
|
||||
db.delete(CommonString.TABLE_INSERT_T2P_COMPLIANCE, null, null);
|
||||
|
||||
db.delete(CommonString.TABLE_INSERT_T2P_GAPS, null, null);
|
||||
db.delete(CommonString.TABLE_INSERT_T2P_SKU, null, null);
|
||||
db.delete(CommonString.TABLE_INSERT_BRAND_AVAIBILITY_DATA, null, null);
|
||||
}
|
||||
|
||||
public void InsertJCP(JourneyPlanGetterSetter data) {
|
||||
@@ -2575,6 +2588,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
ContentValues values = new ContentValues();
|
||||
ContentValues values1 = new ContentValues();
|
||||
ContentValues values2 = new ContentValues();
|
||||
ContentValues values3 = new ContentValues();
|
||||
try {
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
|
||||
@@ -2626,18 +2640,17 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
|
||||
ArrayList<BrandAvabilityGetterSetter> brand = data.get(i).getBrandlist();
|
||||
|
||||
for (int k = 0; k < brand.size(); k++) {
|
||||
for (int p = 0; p < brand.size(); p++) {
|
||||
|
||||
values.put("COMMON_ID", l);
|
||||
values.put("BRAND_NAME", brand.get(i).getBRAND());
|
||||
values.put("BRAND_ID", brand.get(i).getBRAND_ID());
|
||||
values3.put("COMMON_ID", l);
|
||||
values3.put("BRAND_NAME", brand.get(p).getBRAND());
|
||||
values3.put("BRAND_ID", brand.get(p).getBRAND_ID());
|
||||
|
||||
db.insert(CommonString.TABLE_INSERT_BRAND_AVAIBILITY_DATA, null, values);
|
||||
db.insert(CommonString.TABLE_INSERT_BRAND_AVAIBILITY_DATA, null, values3);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
Log.d("Exception ", " in T2P_COMPLIANCE " + ex.toString());
|
||||
@@ -3564,7 +3577,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<BrandAvabilityGetterSetter> getBrandAvailbilitydata(String store_id, String category_id,String keyAccount_id,String class_id,String storeType_id) {
|
||||
public ArrayList<BrandAvabilityGetterSetter> getBrandAvailbilitydata(String store_id, String category_id, String keyAccount_id, String class_id, String storeType_id) {
|
||||
Cursor cursordata = null;
|
||||
ArrayList<BrandAvabilityGetterSetter> Data = new ArrayList<BrandAvabilityGetterSetter>();
|
||||
|
||||
@@ -3574,9 +3587,9 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
"INNER JOIN SUB_CATEGORY_MASTER SB ON BR.SUB_CATEGORY_ID = SB.SUB_CATEGORY_ID " +
|
||||
"INNER JOIN CATEGORY_MASTER CA ON SB.CATEGORY_ID = CA.CATEGORY_ID " +
|
||||
"INNER JOIN " +
|
||||
"(SELECT DISTINCT SKU_ID FROM MAPPING_STOCK WHERE KEYACCOUNT_ID = '"+ keyAccount_id+ "' AND STORETYPE_ID = '" +storeType_id+ "' AND CLASS_ID = '" +class_id +"') A " +
|
||||
"(SELECT DISTINCT SKU_ID FROM MAPPING_STOCK WHERE KEYACCOUNT_ID = '" + keyAccount_id + "' AND STORETYPE_ID = '" + storeType_id + "' AND CLASS_ID = '" + class_id + "') A " +
|
||||
"ON SK.SKU_ID = A.SKU_ID " +
|
||||
"WHERE CA.CATEGORY_ID = '"+category_id+"'", null);
|
||||
"WHERE CA.CATEGORY_ID = '" + category_id + "'", null);
|
||||
|
||||
if (cursordata != null) {
|
||||
cursordata.moveToFirst();
|
||||
@@ -3602,7 +3615,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
|
||||
}
|
||||
|
||||
public void InsertBrandAvabilitydata(BrandAvabilityGetterSetter data,ArrayList<BrandAvabilityGetterSetter> list) {
|
||||
public void InsertBrandAvabilitydata(BrandAvabilityGetterSetter data, ArrayList<BrandAvabilityGetterSetter> list) {
|
||||
|
||||
db.delete("Camera_Not_Allowed ", null, null);
|
||||
|
||||
@@ -3656,4 +3669,49 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
// get T2P Compliance data
|
||||
public ArrayList<T2PGetterSetter> getT2pCompliancedaletedata(String store_id) {
|
||||
|
||||
ArrayList<T2PGetterSetter> list = new ArrayList<>();
|
||||
Cursor dbcursor = null;
|
||||
try {
|
||||
|
||||
dbcursor = db.rawQuery("SELECT * FROM " + CommonString.TABLE_INSERT_T2P_COMPLIANCE + " where " +
|
||||
CommonString.KEY_STORE_ID + "='" + store_id + "'", null);
|
||||
|
||||
|
||||
if (dbcursor != null) {
|
||||
dbcursor.moveToFirst();
|
||||
while (!dbcursor.isAfterLast()) {
|
||||
T2PGetterSetter tp = new T2PGetterSetter();
|
||||
|
||||
tp.setKey_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_ID)));
|
||||
|
||||
/* tp.setDisplay_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_DISPLAY_ID)));
|
||||
tp.setBrand_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_BRAND_ID)));
|
||||
tp.setBrand(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_BRAND)));
|
||||
tp.setDisplay(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_DISPLAY)));
|
||||
tp.setRef_image_url(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_IMAGE_URL)));
|
||||
tp.setRef_image_path(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_IMAGE_PATH)));
|
||||
tp.setImage(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_IMAGE)));
|
||||
tp.setImage1(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_IMAGE1)));
|
||||
tp.setImage2(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_IMAGE2)));
|
||||
tp.setRemark(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_REMARK)));
|
||||
tp.setCategory_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_CATEGORY_ID)));
|
||||
tp.setPresent((dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_PRESENT)).equalsIgnoreCase("1")));
|
||||
*/
|
||||
list.add(tp);
|
||||
dbcursor.moveToNext();
|
||||
}
|
||||
dbcursor.close();
|
||||
return list;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return list;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -560,13 +560,13 @@ public class CommonString {
|
||||
+ " INTEGER PRIMARY KEY AUTOINCREMENT ,"
|
||||
|
||||
+ "COMMON_ID"
|
||||
+ " VARCHAR,"
|
||||
+ " INTEGER,"
|
||||
|
||||
+ "BRAND_NAME"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "BRAND_ID"
|
||||
+ " VARCHAR"
|
||||
+ " INTEGER"
|
||||
|
||||
+ ")";
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
||||
Button btn_add,btn_close;
|
||||
ListView listview;
|
||||
LinearLayout linearlay;
|
||||
CardView cardlay;
|
||||
//CardView cardlay;
|
||||
String brand_name="",brand_id="";
|
||||
ArrayList<BrandAvabilityGetterSetter> brand_new_list=new ArrayList<BrandAvabilityGetterSetter>();
|
||||
@Override
|
||||
@@ -1272,7 +1272,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
||||
|
||||
listview = (ListView) dialog.findViewById(R.id.lv);
|
||||
linearlay = (LinearLayout) dialog.findViewById(R.id.list_layout);
|
||||
cardlay = (CardView) dialog.findViewById(R.id.cardId);
|
||||
// cardlay = (CardView) dialog.findViewById(R.id.cardId);
|
||||
|
||||
// Create custom adapter object ( see below CustomAdapter.java )
|
||||
T2PComplianceActivity.CustomBRANDAdapter adapter = new T2PComplianceActivity.CustomBRANDAdapter(T2PComplianceActivity.this, R.layout.custom_spinner_item, brandList);
|
||||
@@ -1281,13 +1281,13 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
||||
|
||||
if (brandGetdata.size() > 0) {
|
||||
linearlay.setVisibility(View.VISIBLE);
|
||||
cardlay.setVisibility(View.VISIBLE);
|
||||
// cardlay.setVisibility(View.VISIBLE);
|
||||
adapterData = new T2PComplianceActivity.MyAdaptorStock(T2PComplianceActivity.this, brandGetdata);
|
||||
listview.setAdapter(adapterData);
|
||||
listview.invalidateViews();
|
||||
} else {
|
||||
linearlay.setVisibility(View.GONE);
|
||||
cardlay.setVisibility(View.GONE);
|
||||
// cardlay.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
spinner_brand.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@@ -1337,7 +1337,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
||||
listview.setAdapter(adapterData);
|
||||
listview.invalidateViews();
|
||||
|
||||
cardlay.setVisibility(View.VISIBLE);
|
||||
// cardlay.setVisibility(View.VISIBLE);
|
||||
linearlay.setVisibility(View.VISIBLE);
|
||||
spinner_brand.setSelection(0);
|
||||
brand_name="";
|
||||
|
||||
@@ -40,6 +40,7 @@ import javax.xml.parsers.SAXParserFactory;
|
||||
import cpm.com.gskmtorange.Database.GSKOrangeDB;
|
||||
import cpm.com.gskmtorange.GetterSetter.AdditionalDialogGetterSetter;
|
||||
import cpm.com.gskmtorange.GetterSetter.AddittionalGetterSetter;
|
||||
import cpm.com.gskmtorange.GetterSetter.BrandAvabilityGetterSetter;
|
||||
import cpm.com.gskmtorange.GetterSetter.CoverageBean;
|
||||
import cpm.com.gskmtorange.GetterSetter.StoreBean;
|
||||
import cpm.com.gskmtorange.R;
|
||||
@@ -726,7 +727,7 @@ public class UploadActivity extends AppCompatActivity {
|
||||
|
||||
ArrayList<GapsChecklistGetterSetter> gapsList = db.getGapsData(t2PGetterSetters.get(i).getKey_id());
|
||||
ArrayList<SkuGetterSetter> skuList = db.getT2PSKUData(t2PGetterSetters.get(i).getKey_id());
|
||||
|
||||
ArrayList<BrandAvabilityGetterSetter> brandList = db.getT2BrandData(t2PGetterSetters.get(i).getKey_id());
|
||||
String gaps_xml = "";
|
||||
String gaps_child;
|
||||
|
||||
@@ -766,6 +767,24 @@ public class UploadActivity extends AppCompatActivity {
|
||||
sku_xml = sku_xml + sku_child;
|
||||
}
|
||||
|
||||
|
||||
String brandxml = "";
|
||||
String brandchild;
|
||||
|
||||
if (brandList.size() > 0) {
|
||||
|
||||
for (int M = 0; M < brandList.size(); M++) {
|
||||
|
||||
brandchild = "[BRAND]"
|
||||
+ "[MID]" + mid + "[/MID]"
|
||||
+ "[USER_ID]" + userId + "[/USER_ID]"
|
||||
+ "[BRAND_ID]" + brandList.get(M).getBRAND_ID() + "[/BRAND_ID]"
|
||||
/* + "[BRAND]" + brandList.get(M).getBRAND() + "[/BRAND]"*/
|
||||
+ "[COMMON_ID]" + Integer.parseInt(t2PGetterSetters.get(i1).getKey_id()) + "[/COMMON_ID]"
|
||||
+ "[/BRAND]";
|
||||
brandxml = brandxml + brandchild;
|
||||
}
|
||||
}
|
||||
String present = "";
|
||||
if (t2PGetterSetters.get(i1).isPresent()) {
|
||||
present = "1";
|
||||
@@ -786,6 +805,8 @@ public class UploadActivity extends AppCompatActivity {
|
||||
+ "[PRESENT]" + present + "[/PRESENT]"
|
||||
+ "[GAPS_DATA]" + gaps_xml + "[/GAPS_DATA]"
|
||||
+ "[SKU_DATA]" + sku_xml + "[/SKU_DATA]"
|
||||
+ "[BRAND_DATA]" + brandxml + "[/BRAND_DATA]"
|
||||
|
||||
+ "[/T2P_DATA]";
|
||||
|
||||
t2p_data_xml = t2p_data_xml + onXML;
|
||||
@@ -796,7 +817,7 @@ public class UploadActivity extends AppCompatActivity {
|
||||
|
||||
request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_UPLOAD_STOCK_XML_DATA);
|
||||
request.addProperty("XMLDATA", t2p_final_xml);
|
||||
request.addProperty("KEYS", "T2P_DATA");
|
||||
request.addProperty("KEYS", "T2P_DATA_NEW");
|
||||
request.addProperty("USERNAME", userId);
|
||||
request.addProperty("MID", mid);
|
||||
|
||||
|
||||
@@ -11,8 +11,7 @@
|
||||
android:layout_marginTop="10dp"
|
||||
android:padding="10dp"
|
||||
card_view:cardBackgroundColor="@color/colorPrimary"
|
||||
card_view:cardCornerRadius="20dp"
|
||||
>
|
||||
card_view:cardCornerRadius="8dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
@@ -72,15 +71,16 @@
|
||||
<Button
|
||||
android:id="@+id/btn_add"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/add"/>
|
||||
android:layout_weight="1"
|
||||
android:text="@string/add" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_cancel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/closed"/>
|
||||
android:text="@string/closed" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -93,28 +93,52 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"></android.support.v7.widget.RecyclerView>-->
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/list_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_weight="95"
|
||||
android:visibility="gone"
|
||||
>
|
||||
|
||||
<ListView
|
||||
android:id="@+id/lv"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:cacheColorHint="#00000000"
|
||||
|
||||
android:choiceMode="singleChoice"
|
||||
android:divider="#ff9933"
|
||||
android:dividerHeight="2dp"
|
||||
android:fastScrollEnabled="true"
|
||||
android:smoothScrollbar="true"></ListView>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
<!-- <android.support.v7.widget.CardView
|
||||
android:id="@+id/cardId"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:padding="10dp"
|
||||
card_view:cardBackgroundColor="@color/colorOrange"
|
||||
card_view:cardCornerRadius="8dp"
|
||||
android:visibility="gone"
|
||||
|
||||
>
|
||||
card_view:cardBackgroundColor="@color/colorOrange"
|
||||
card_view:cardCornerRadius="8dp">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/list_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="95"
|
||||
android:visibility="gone"
|
||||
>
|
||||
>
|
||||
|
||||
<ListView
|
||||
android:id="@+id/lv"
|
||||
android:layout_width="match_parent"
|
||||
@@ -127,5 +151,5 @@
|
||||
android:fastScrollEnabled="true"
|
||||
android:smoothScrollbar="true"></ListView>
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.CardView>
|
||||
</android.support.v7.widget.CardView>-->
|
||||
</LinearLayout>
|
||||
|
||||
Reference in New Issue
Block a user