Subversion Repositories SmartDukaan

Rev

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

Rev 2148 Rev 2944
Line 44... Line 44...
44
        try {
44
        try {
45
            TransactionServiceClient transactionServiceClient = new TransactionServiceClient();
45
            TransactionServiceClient transactionServiceClient = new TransactionServiceClient();
46
            in.shop2020.model.v1.order.TransactionService.Client orderClient = transactionServiceClient.getClient();
46
            in.shop2020.model.v1.order.TransactionService.Client orderClient = transactionServiceClient.getClient();
47
            orders = orderClient.getOrdersForCustomer(userinfo.getUserId(), 0, (new Date()).getTime(), null);
47
            orders = orderClient.getOrdersForCustomer(userinfo.getUserId(), 0, (new Date()).getTime(), null);
48
        } catch (Exception e) {
48
        } catch (Exception e) {
49
            e.printStackTrace();
49
            log.error("Unable to get the orders for the user becauase of: ", e);
50
        }
50
        }
51
 
51
 
52
        if (request.getParameter("type") != null) {
52
        if (request.getParameter("type") != null) {
53
            String requestedFormType = request.getParameter("type").toString().trim();
53
            String requestedFormType = request.getParameter("type").toString().trim();
54
            log.debug("Contact us requested for: " + requestedFormType);
54
            log.debug("Contact us requested for: " + requestedFormType);
Line 78... Line 78...
78
            } else {
78
            } else {
79
                long orderId = Integer.parseInt(id);
79
                long orderId = Integer.parseInt(id);
80
                products = orderClient.getLineItemsForOrder(orderId);
80
                products = orderClient.getLineItemsForOrder(orderId);
81
            }
81
            }
82
        } catch (NumberFormatException e) {
82
        } catch (NumberFormatException e) {
83
            e.printStackTrace();
83
            log.error("Unable to get order id", e);
84
        } catch (Exception e) {
84
        } catch (Exception e) {
85
            e.printStackTrace();
85
            log.error("Unable to get user order details: ", e);
86
        }
86
        }
87
        return "ajax";
87
        return "ajax";
88
    }
88
    }
89
 
89
 
90
    // POST /Save Communication
90
    // POST /Save Communication
Line 108... Line 108...
108
 
108
 
109
            UserContextService.Client userClient = (new UserContextServiceClient()).getClient();
109
            UserContextService.Client userClient = (new UserContextServiceClient()).getClient();
110
 
110
 
111
            if (userClient.saveUserCommunication(userId, email, communicationType, orderId, awb, product, subject,
111
            if (userClient.saveUserCommunication(userId, email, communicationType, orderId, awb, product, subject,
112
                    message)) {
112
                    message)) {
113
                System.out.println("User Communication saved successfully!");
113
                log.info("User Communication saved successfully!");
114
            }
114
            }
115
 
115
 
116
        } catch (NumberFormatException e) {
116
        } catch (NumberFormatException e) {
117
            e.printStackTrace();
117
            log.error("Unable to get communication type or order id: ", e);
118
        } catch (UserContextException e) {
118
        } catch (UserContextException e) {
119
            e.printStackTrace();
119
            log.error("Unable to save user communication: ", e);
120
        } catch (Exception e) {
120
        } catch (Exception e) {
121
            e.printStackTrace();
121
            log.error("Unable to save user communication: ", e);
122
        } finally {
122
        } finally {
123
 
123
 
124
        }
124
        }
125
        return "success";
125
        return "success";
126
    }
126
    }
Line 143... Line 143...
143
    public String getSuccessMsg() {
143
    public String getSuccessMsg() {
144
        return UserMessage.USER_COMMUNICATION_SUCCESS;
144
        return UserMessage.USER_COMMUNICATION_SUCCESS;
145
    }
145
    }
146
 
146
 
147
    private String getOrderIdSelector(List<Long> order_ids) {
147
    private String getOrderIdSelector(List<Long> order_ids) {
148
        String html = "";
148
        StringBuilder html = new StringBuilder();
149
 
149
 
150
        if (order_ids == null || order_ids.size() == 0) {
150
        if (order_ids == null || order_ids.size() == 0) {
151
            html += "<option value='-1'>No Orders Found</option>";
151
            html.append("<option value='-1'>No Orders Found</option>");
152
        } else {
152
        } else {
153
            html += "<option value='-1'>Select Order ID</option>";
153
            html.append("<option value='-1'>Select Order ID</option>");
154
 
154
 
155
            for (long order_id : order_ids) {
155
            for (long order_id : order_ids) {
156
                html += "<option value='" + order_id + "'>" + order_id + "</option>";
156
                html.append("<option value='" + order_id + "'>" + order_id + "</option>");
157
            }
157
            }
158
        }
158
        }
159
        return html;
159
        return html.toString();
160
    }
160
    }
161
 
161
 
162
    public String getProductsForOrder() {
162
    public String getProductsForOrder() {
163
        String html = "";
163
        StringBuilder html = new StringBuilder();
164
 
164
 
165
        if (products == null || products.size() == 0) {
165
        if (products == null || products.size() == 0) {
166
            html += "<option value='-1'>No Products Found</option>";
166
            html.append("<option value='-1'>No Products Found</option>");
167
        } else {
167
        } else {
168
            for (LineItem product : products) {
168
            for (LineItem product : products) {
169
                html += "<option value='" + product.getId() + "'>";
169
                html.append("<option value='" + product.getId() + "'>");
170
 
170
 
171
                if (product.getBrand() != null)
171
                if (product.getBrand() != null)
172
                    html += product.getBrand() + " ";
172
                    html.append(product.getBrand() + " ");
173
                if (product.getModel_name() != null)
173
                if (product.getModel_name() != null)
174
                    html += product.getModel_name() + " ";
174
                    html.append(product.getModel_name() + " ");
175
                if (product.getModel_number() != null)
175
                if (product.getModel_number() != null)
176
                    html += product.getModel_number();
176
                    html.append(product.getModel_number());
177
 
177
 
178
                html += "</option>";
178
                html.append("</option>");
179
            }
179
            }
180
        }
180
        }
181
        return html;
181
        return html.toString();
182
    }
182
    }
183
 
183
 
184
    public String getIdsOfAllOrders() {
184
    public String getIdsOfAllOrders() {
185
        List<Long> order_ids = new ArrayList<Long>();
185
        List<Long> order_ids = new ArrayList<Long>();
186
 
186