dopostImportsourceCotroller

mail@pastecode.io avatar
unknown
plain_text
6 months ago
2.6 kB
1
Indexable
Never
if (request.getParameter("btnSubmitAddImportSource") != null && request.getParameter("btnSubmitAddImportSource").equals("Confirm")) {
            try {
                int numsize = Integer.parseInt(request.getParameter("paraNumSize"));
                int productid = Integer.parseInt(request.getParameter("paraProductID"));
                int quantity = Integer.parseInt(request.getParameter("paraQuantity"));
                ImportSource ip = new ImportSource(numsize, productid, quantity);
                AdminDAOs dao = new AdminDAOs();
                int kq = dao.AddNewImportSource(ip);
                if (kq != 0) {
                    response.sendRedirect("/Admin/ImportSource");
                } else {
                    response.sendRedirect("/Admin/AddNewImportSource");

                }
            } catch (SQLException ex) {
                Logger.getLogger(AdminController.class
                        .getName()).log(Level.SEVERE, null, ex);

            } catch (ClassNotFoundException ex) {
                Logger.getLogger(AdminController.class
                        .getName()).log(Level.SEVERE, null, ex);
            }
        }
        //============================================================================================
        if (request.getParameter("btnSubmitUpdateImportSource") != null && request.getParameter("btnSubmitUpdateImportSource").equals("Confirm")) {
            try {
                int sizeid = Integer.parseInt(request.getParameter("paraSizeID"));
                int numsize = Integer.parseInt(request.getParameter("paraNumSize"));
                int productid = Integer.parseInt(request.getParameter("paraProductID"));
                int quantity = Integer.parseInt(request.getParameter("paraQuantity"));
                ImportSource ip = new ImportSource(sizeid, numsize, productid, quantity);
                AdminDAOs dao = new AdminDAOs();
                int kq = dao.UpdateImportSource(ip);
                if (kq != 0) {
                    response.sendRedirect("/Admin/ImportSource");
                } else {
                    response.sendRedirect("/Admin/UpdateImportSource");

                }
            } catch (SQLException ex) {
                Logger.getLogger(AdminController.class
                        .getName()).log(Level.SEVERE, null, ex);

            } catch (ClassNotFoundException ex) {
                Logger.getLogger(AdminController.class
                        .getName()).log(Level.SEVERE, null, ex);
            }
        }