Subversion Repositories SmartDukaan

Rev

Rev 419 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 419 Rev 424
Line 81... Line 81...
81
		// TODO Auto-generated constructor stub
81
		// TODO Auto-generated constructor stub
82
		super();
82
		super();
83
		
83
		
84
	}
84
	}
85
	
85
	
86
    // POST /entity
86
    // POST /myaccount
87
    public String create() {
87
    public String create() {
88
    	log.info("MyAccountController.create");
88
    	log.info("MyAccountController.create");
89
    	log.info("action type is " + this.reqparams.get("action"));
89
    	log.info("action type is " + this.reqparams.get("action"));
90
    	
90
    	
91
    	action = Integer.parseInt(this.reqparams.get("action")[0]);
91
    	action = Integer.parseInt(this.reqparams.get("action")[0]);
Line 110... Line 110...
110
    	//log.info("this.request=" + this.request);
110
    	//log.info("this.request=" + this.request);
111
    	
111
    	
112
    	
112
    	
113
    	String userId = "";
113
    	String userId = "";
114
    	
114
    	
115
    	//if(this.session.getAttribute("loggedin").toString().equals("true")){
-
 
116
		//	userId = this.session.getAttribute("userid").toString();
-
 
117
    
115
    
118
    	if(this.userinfo.isLoggedIn()){
116
    	if(this.userinfo.isLoggedIn()){
119
    		userId = (new Long(this.userinfo.getUserId())).toString();
117
    		userId = (new Long(this.userinfo.getUserId())).toString();
120
 
118
 
121
			Map<PageContentKeys, String> params = new HashMap<PageContentKeys, String>();
119
			Map<PageContentKeys, String> params = new HashMap<PageContentKeys, String>();
Line 135... Line 133...
135
 
133
 
136
		Map<PageContentKeys, String> params = new HashMap<PageContentKeys, String>();
134
		Map<PageContentKeys, String> params = new HashMap<PageContentKeys, String>();
137
		params.put(PageContentKeys.CUSTOMER_ID, id);
135
		params.put(PageContentKeys.CUSTOMER_ID, id);
138
		htmlSnippets = PageManager.getPageManager().getPageContents(PageEnum.MY_ACCOUNT_PAGE, params);
136
		htmlSnippets = PageManager.getPageManager().getPageContents(PageEnum.MY_ACCOUNT_PAGE, params);
139
		
137
		
140
    	
-
 
141
        return new DefaultHttpHeaders("index").disableCaching();
138
        return new DefaultHttpHeaders("index").disableCaching();
142
    }
139
    }
143
    
140
    
144
    /**
141
    /**
145
     * 
142
     * 
Line 186... Line 183...
186
				userState.setIsLoggedIn(true);
183
				userState.setIsLoggedIn(true);
187
				
184
				
188
				context.setPrimaryInfo(primaryInfo);
185
				context.setPrimaryInfo(primaryInfo);
189
				context.setUserState(userState);
186
				context.setUserState(userState);
190
				
187
				
191
//				context.getPrimaryInfo().setPassword(email);
-
 
192
//				context.getPrimaryInfo().setPassword(password);
-
 
193
//				context.getUserState().setIsLoggedIn(true);
-
 
194
				
-
 
195
				context = userClient.createContext(context, false);
188
				context = userClient.createContext(context, false);
196
				
189
				
197
				long userId = context.getId();
190
				long userId = context.getId();
198
				
191
				
199
				userClient.setUserAsLoggedIn(userId, (new Date()).getTime());
192
				userClient.setUserAsLoggedIn(userId, (new Date()).getTime());
200
				this.session.removeAttribute("useid");
-
 
201
				this.session.removeAttribute("loggedin");
-
 
202
				this.session.removeAttribute("issessionid");
-
 
203
				this.session.removeAttribute("email");
-
 
204
				
-
 
205
				this.session.setAttribute("userid", userId+"");
-
 
206
				this.session.setAttribute("loggedin", "true");
-
 
207
				this.session.setAttribute("issessionid", "false");
-
 
208
				this.session.setAttribute("email",email);
-
 
209
				
193
				
-
 
194
				this.userinfo.setUserId(userId);
-
 
195
				this.userinfo.setEmail(email);
-
 
196
				this.userinfo.setLoggedIn(true);
210
				
197
				
211
				return true;
198
				return true;
212
			}
199
			}
213
 
200
 
214
			//add address
201
			//add address
215
		case 2:
202
		case 2:
216
			long userId = Long.parseLong(this.reqparams.get("user_id")[0]);
203
			long userId = Long.parseLong(this.reqparams.get("user_id")[0]);
-
 
204
			String name = this.reqparams.get("name")[0];
217
			String line1 = this.reqparams.get("line1")[0];
205
			String line1 = this.reqparams.get("line1")[0];
218
			String line2 = this.reqparams.get("line2")[0];
206
			String line2 = this.reqparams.get("line2")[0];
219
			String landmark = this.reqparams.get("landmark")[0];
207
			String landmark = this.reqparams.get("landmark")[0];
220
			String city = this.reqparams.get("city")[0];
208
			String city = this.reqparams.get("city")[0];
221
			String state = this.reqparams.get("state")[0];
209
			String state = this.reqparams.get("state")[0];
222
			String pin = this.reqparams.get("pin")[0];
210
			String pin = this.reqparams.get("pin")[0];
223
			String country = this.reqparams.get("country")[0];
211
			String country = this.reqparams.get("country")[0];
224
			
-
 
-
 
212
			String phone = this.reqparams.get("phone")[0];
225
	
213
	
226
			Address address = new Address();
214
			Address address = new Address();
-
 
215
			address.setName(name);
227
			address.setLine1(line1);
216
			address.setLine1(line1);
228
			address.setLine1(line2);
217
			address.setLine2(line2);
229
			address.setLandmark(landmark);
218
			address.setLandmark(landmark);
230
			address.setCity(city);
219
			address.setCity(city);
231
			address.setState(state);
220
			address.setState(state);
232
			address.setPin(pin);
221
			address.setPin(pin);
233
			address.setCountry(country);
222
			address.setCountry(country);
-
 
223
			address.setPhone(phone);
234
			long timestamp = (new  Date()).getTime();
224
			long timestamp = (new  Date()).getTime();
235
			
225
			
236
			if(userClient.addAddressForUser(address, userId, timestamp)){
226
			if(userClient.addAddressForUser(address, userId, timestamp)){
237
				return true;
227
				return true;
238
			} else{
228
			} else{