Merge branch 'master' into yy_temp

This commit is contained in:
YadavendraSinghYaduvanshi
2017-01-20 18:18:34 +05:30
committed by GitHub
4 changed files with 68 additions and 10 deletions
@@ -2306,7 +2306,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
try {
cursordata = db.rawQuery("SELECT BR.BRAND_ID, SB.SUB_CATEGORY||'-'||BR.BRAND AS BRAND FROM BRAND_MASTER BR 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 WHERE COMPANY_ID =1 AND SB.CATEGORY_ID ='" + category_id+ "'", null);
cursordata = db.rawQuery("SELECT BR.BRAND_ID, SB.SUB_CATEGORY||'-'||BR.BRAND AS BRAND FROM BRAND_MASTER BR 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 WHERE COMPANY_ID =1 AND SB.CATEGORY_ID ='" + category_id + "'", null);
if (cursordata != null) {
cursordata.moveToFirst();
@@ -3306,4 +3306,59 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
}
return filled;
}
public boolean isMappingAdditionalPromotionData() {
boolean filled = false;
Cursor dbcursor = null;
try {
dbcursor = db.rawQuery("SELECT * FROM MAPPING_ADDITIONAL_PROMOTION ", null);
if (dbcursor != null) {
dbcursor.moveToFirst();
int icount = dbcursor.getInt(0);
dbcursor.close();
if (icount > 0) {
filled = true;
} else {
filled = false;
}
}
} catch (Exception e) {
Log.d("Exception ", " when fetching Records!!!!!!!!!!!!!!!!!!!!! " + e.toString());
return filled;
}
return filled;
}
public boolean checkAdditionalPromoComplianceData(String store_id, String category_id) {
Log.d("PromoCompliance ", "AdditionalPromoCompliance data--------------->Start<------------");
ArrayList<Promo_Compliance_DataGetterSetter> list = new ArrayList<>();
Cursor dbcursor = null;
try {
dbcursor = db.rawQuery("Select * from Additional_Promo_Compliance_Data " +
"where CATEGORY_ID='" + category_id + "' and STORE_ID='" + store_id + "'", null);
if (dbcursor != null) {
if (dbcursor.moveToFirst()) {
do {
Promo_Compliance_DataGetterSetter sb = new Promo_Compliance_DataGetterSetter();
sb.setSku_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow("SKU_ID")));
list.add(sb);
} while (dbcursor.moveToNext());
}
dbcursor.close();
return list.size() > 0;
}
} catch (Exception e) {
Log.d("Exception ", "when fetching Records!!!!!!!!!!!!!!!!!!!!!" + e.toString());
return false;
}
Log.d("Stock_Facing ", "midday---------------------->Stop<-----------");
return false;
}
}
@@ -268,6 +268,7 @@ public class LoginActivity extends AppCompatActivity {
// There was an error; don't attempt login and focus the first
// form field with an error.
focusView.requestFocus();
} else if(!isuseridValid(userid)){
Snackbar.make(museridView,getString(R.string.error_incorrect_username),Snackbar.LENGTH_SHORT).show();
}else if(!isPasswordValid(password)){
@@ -278,18 +279,17 @@ public class LoginActivity extends AppCompatActivity {
// perform the user login attempt.
new AuthenticateTask().execute();
}
}
private boolean isuseridValid(String userid) {
//TODO: Replace this with your own logic
boolean flag =true;
boolean flag = true;
String u_id = preferences.getString(CommonString.KEY_USERNAME, "");
if(!u_id.equals("") && !userid.equals(u_id)){
if (!u_id.equals("") && !userid.equals(u_id)) {
flag = false;
}
@@ -298,7 +298,7 @@ public class LoginActivity extends AppCompatActivity {
private boolean isPasswordValid(String password) {
//TODO: Replace this with your own logic
boolean flag =true;
boolean flag = true;
String pw = preferences.getString(CommonString.KEY_PASSWORD, "");
@@ -163,8 +163,9 @@ public class DailyDataMenuActivity extends AppCompatActivity {
//data.setCategory_name("Promo Compliance");
data.setCategory_name(getResources().getString(R.string.daily_data_menu_promo_compliance));
if (db.isMappingPromotionData()) {
if (db.checkPromoComplianceData(store_id, categoryId)) {
if (db.isMappingPromotionData() || db.isMappingAdditionalPromotionData()) {
if (db.checkPromoComplianceData(store_id, categoryId) ||
db.checkAdditionalPromoComplianceData(store_id, categoryId)) {
data.setCategory_img(R.mipmap.promo_compliance_done);
} else {
data.setCategory_img(R.mipmap.promo_compliance);
@@ -259,7 +260,7 @@ public class DailyDataMenuActivity extends AppCompatActivity {
holder.categoryName.setTextColor(getResources().getColor(R.color.grey_background));
}
} else if (dailyData.getCategory_name().equalsIgnoreCase(getResources().getString(R.string.daily_data_menu_promo_compliance))) {
if (db.isMappingPromotionData()) {
if (db.isMappingPromotionData() || db.isMappingAdditionalPromotionData()) {
holder.categoryName.setTextColor(getResources().getColor(R.color.colorPrimaryDark));
} else {
holder.categoryName.setTextColor(getResources().getColor(R.color.grey_background));
@@ -291,7 +292,7 @@ public class DailyDataMenuActivity extends AppCompatActivity {
}
} else if (dailyData.getCategory_name().equalsIgnoreCase(getResources().getString(R.string.daily_data_menu_promo_compliance))) {
if (db.isMappingPromotionData()) {
if (db.isMappingPromotionData() || db.isMappingAdditionalPromotionData()) {
Intent intent = new Intent(DailyDataMenuActivity.this, PromoComplianceActivity.class);
intent.putExtra("categoryName", dailyData.getCategory_name());
intent.putExtra("categoryId", categoryId);
@@ -9,7 +9,9 @@
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
card_view:cardCornerRadius="10dp">
<LinearLayout