Example usage for com.vaadin.ui Notification show

List of usage examples for com.vaadin.ui Notification show

Introduction

In this page you can find the example usage for com.vaadin.ui Notification show.

Prototype

public static Notification show(String caption, Type type) 

Source Link

Document

Shows a notification message the current page.

Usage

From source file:co.edu.icesi.academ.client.perfiles.administrador.PanelEditarPrograma.java

License:Open Source License

private void editarPrograma() {
    this.bo.setDescripcion(txtDesc.getValue());
    this.bo.setNombre(txtNombre.getValue());
    try {/*from   www  .  j  av a  2  s .c  o m*/
        ControladorAdministrador.getInstance().editarPrograma(bo);
        List<ProgramaBO> list = ControladorAdministrador.getInstance().darListaProgramas();
        ControladorAdministrador.getInstance().getAcademUI().getPanelProgramasBloques().cargarProgramas(list);
    } catch (Exception e) {
        Notification.show("Error editar programa " + e.getMessage(), Type.ERROR_MESSAGE);
    }
}

From source file:co.edu.icesi.academ.server.BloqueMateriasServices.java

License:Open Source License

public void asociarAMateriaBloque(List<MateriaBO> materias, BloqueBO bTmp) {
    try {//from   w  ww.j  a  va2s. co  m
        System.err.println("###Bloque " + bTmp + " " + (bTmp instanceof BloqueBO));

        for (MateriaBO materiaBO : materias) {
            System.err.println("Prueba %%%%%% :p" + materiaBO + "  " + (materiaBO instanceof MateriaBO));
        }

        materiaBean.asociarMateriaBloque(materias, bTmp);
    } catch (Exception e) {
        Notification.show("Materia Asociada", Type.HUMANIZED_MESSAGE);
        //         Notification.show("Error AsociarMateriaBloque - BloqueMateriasServices",Type.ERROR_MESSAGE);
    }
    //      bloqueBean.asociarMateriaBloque(materias,bTmp);
}

From source file:com.anphat.cms.appparams.controller.ListAppParamsController.java

public void doSearchListAppParams() {
    appParamsDTO = new AppParamsDTO();
    appParamsDTO = getValueForm();//from   w w w.j  a va2 s.c  o  m
    try {
        getListAppParams(appParamsDTO);
        if (lstApParams == null || lstApParams.isEmpty()) {
            lstApParams = new ArrayList<>();
            Notification.show(BundleUtils.getString("notFoundData"), Notification.Type.TRAY_NOTIFICATION);
        }
        //set data into table
        setDataTable(lstApParams);
    } catch (Exception ex) {
        StringBuilder sb = new StringBuilder();
        Logger.getLogger(ListAppParamsController.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:com.anphat.customer.controller.CommonUploader.java

public void uploadFile() {
    try {/*from   w w  w  .j  a va 2  s  . c  o  m*/
        List lstUpload;
        List<ValidateCells> lstValidateCells = new ArrayList<>();
        lstValidateCells.add(new ValidateCells(DataUtil.STRING, true, 50));//ma hh
        lstValidateCells.add(new ValidateCells(DataUtil.STRING, false, 400));//ten hh
        lstValidateCells.add(new ValidateCells(DataUtil.DOUBLE, true, 10));// so luong                    
        lstValidateCells.add(new ValidateCells(DataUtil.LONG, true, 1));// trang thai hh
        lstValidateCells.add(new ValidateCells(DataUtil.STRING, false, 25));//So thung
        lstValidateCells.add(new ValidateCells(DataUtil.STRING, false, 50));//tu serial
        lstValidateCells.add(new ValidateCells(DataUtil.STRING, false, 50));//den serial
        lstValidateCells.add(new ValidateCells(DataUtil.STRING, false, 25));//ma vi tri
        lstUpload = DataUtil.isValidExcells(mimeType, tempFile, 0, 1, 1, 8, 3, lstValidateCells);
        if (lstUpload == null) {
            Notification.show(BundleUtils.getString("valid.import.file"), Notification.Type.WARNING_MESSAGE);
            return;
        }
        //LAY DANH DACH HANG HOA - CELL DA NHAP
        Object[] tmp;
        String cell;
        List<String> lstCell = Lists.newArrayList();
        String strLstCell = "";
        for (Object lst1 : lstUpload) {
            tmp = (Object[]) lst1;
            cell = (String) tmp[7];
            if (!lstCell.contains(cell)) {
                lstCell.add(cell);
                strLstCell = strLstCell + "," + cell;
            }
        }
        Object[] temp;
        String goodsCode;
        String goodsName;
        String quantity;
        String state;
        String barcode;
        String fromSerial;
        String toSerial;
        String cellCode;
        Long amountReal;
        Long amount;
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        wp.close();
        UI.getCurrent().setPollInterval(-1);
    }
}

From source file:com.anphat.customer.controller.CustomerInfoUploader.java

@Override
public void uploadFile() {
    try {/*from w  w  w .j av a2  s .  c  om*/
        List lstUpload;
        List<ValidateCells> lstValidateCells = new ArrayList<>();
        lstValidateCells.add(new ValidateCells(DataUtil.STRING, true, 14));//mst
        lstValidateCells.add(new ValidateCells(DataUtil.STRING, true, 200));//Ten khach hang
        lstValidateCells.add(new ValidateCells(DataUtil.STRING, false, 50));// CQT - Tinh
        lstValidateCells.add(new ValidateCells(DataUtil.DATE, false, 14));// Ngay dang ky kkt
        lstValidateCells.add(new ValidateCells(DataUtil.DATE, false, 14));// Ngay kkt gan nhat
        lstValidateCells.add(new ValidateCells(DataUtil.STRING, false, 50));// chi cuc thue             
        lstValidateCells.add(new ValidateCells(DataUtil.STRING, false, 25));//Loai khach hang
        lstValidateCells.add(new ValidateCells(DataUtil.STRING, false, 25));//so dien thoai
        lstValidateCells.add(new ValidateCells(DataUtil.STRING, false, 25));//fax
        lstValidateCells.add(new ValidateCells(DataUtil.STRING, false, 25));//Email
        lstValidateCells.add(new ValidateCells(DataUtil.STRING, false, 50));//So tai khoan
        lstValidateCells.add(new ValidateCells(DataUtil.STRING, false, 50));//Ngan hang
        lstValidateCells.add(new ValidateCells(DataUtil.STRING, false, 50));//Dai ly thue
        lstValidateCells.add(new ValidateCells(DataUtil.STRING, false, 200));//Dia chi kinh doanh
        lstValidateCells.add(new ValidateCells(DataUtil.STRING, false, 200));//Dia chi tru so
        lstValidateCells.add(new ValidateCells(DataUtil.STRING, false, 100));//Tn ng?i i din
        lstValidateCells.add(new ValidateCells(DataUtil.STRING, false, 25));//Chng minh th
        lstValidateCells.add(new ValidateCells(DataUtil.STRING, false, 200));//Mo ta
        lstUpload = DataUtil.isValidExcells(mimeType, tempFile, 0, 1, 0, 17, 3, lstValidateCells);
        if (lstUpload == null) {
            Notification.show(BundleUtils.getString("valid.import.file"), Notification.Type.WARNING_MESSAGE);
            return;
        }
        staff = (StaffDTO) VaadinSession.getCurrent().getAttribute("staff");

        //LAY DANH DACH DU LIEU - CELL DA NHAP
        Object[] tmp;

        String taxCode; //Ma so thue
        String name; //Ten khach hang
        String taxAuthority; //C quan thu 
        String dateRegister; //Ngay dang ky kkt
        String lastUploadDate; //Ngay kkt gan nhat
        String taxDepartment; //Chi cc thu
        String custType; //Loai khach hang
        String telNumber; //So dien thoai
        String fax; //So fax
        String email; //Email
        String accountNo; //So tai khoan
        String bankName; //Ngan hang
        String agency; //Dai ly thue
        String deployAddress;//Dia chi kinh doanh
        String officeAddress; //Dia chi tru so
        String representativeName; // Tn ng?i i din
        String representativeId = ""; //Chng minh th
        String description; //Mo ta

        String staffName = staff.getName(); //Nhan vien tai len
        lstUploaded = new ArrayList<>();
        CustomerDTO tempObject;
        List<String> lstTaxCodes = new ArrayList<>();
        for (Object object : lstUpload) {
            tmp = (Object[]) object;
            if (!DataUtil.isNullObject(tmp)) {
                taxCode = DataUtil.getStringNullOrZero(String.valueOf(tmp[0]));
                if (!lstTaxCodes.contains(taxCode) && !"null".equalsIgnoreCase(taxCode)) {
                    lstTaxCodes.add(taxCode);
                    name = DataUtil.getStringNullOrZero(String.valueOf(tmp[1]));
                    taxAuthority = DataUtil.getStringNullOrZero(String.valueOf(tmp[2]));
                    dateRegister = DataUtil.getStringNullOrZero(String.valueOf(tmp[3]));
                    lastUploadDate = DataUtil.getStringNullOrZero(String.valueOf(tmp[4]));
                    taxDepartment = DataUtil.getStringNullOrZero(String.valueOf(tmp[5]));
                    custType = DataUtil.getStringNullOrZero(String.valueOf(tmp[6]));
                    telNumber = DataUtil.getStringNullOrZero(String.valueOf(tmp[7]));
                    fax = DataUtil.getStringNullOrZero(String.valueOf(tmp[8]));
                    email = DataUtil.getStringNullOrZero(String.valueOf(tmp[9]));
                    accountNo = DataUtil.getStringNullOrZero(String.valueOf(tmp[10]));
                    bankName = DataUtil.getStringNullOrZero(String.valueOf(tmp[11]));
                    agency = DataUtil.getStringNullOrZero(String.valueOf(tmp[12]));
                    deployAddress = DataUtil.getStringNullOrZero(String.valueOf(tmp[13]));
                    officeAddress = DataUtil.getStringNullOrZero(String.valueOf(tmp[14]));
                    representativeName = DataUtil.getStringNullOrZero(String.valueOf(tmp[15]));
                    representativeId = DataUtil.getStringNullOrZero(String.valueOf(tmp[16]));
                    description = DataUtil.getStringNullOrZero(String.valueOf(tmp[17]));

                    tempObject = new CustomerDTO(taxCode, name, taxAuthority, dateRegister, lastUploadDate,
                            taxDepartment, custType, telNumber, fax, email, accountNo, bankName, agency,
                            deployAddress, officeAddress, representativeName, representativeId, description,
                            staffName);
                    lstUploaded.add(tempObject);
                }
            }
        }
        if (!DataUtil.isListNullOrEmpty(lstUploaded)) {
            //                lstUploaded = removeDupplicationDatas(lstUploaded);
            List<CustomerDTO> lstCustomerExisted = checkCustomersExisted(lstUploaded);

            //                List<CustomerDTO> lstCustomerHTKK = getInfoOfCustomerFromIHTKK(lstUploaded);

            if (DataUtil.isListNullOrEmpty(lstCustomerExisted)) {
                container = new BeanItemContainer(CustomerDTO.class);
                //                    mapTaxCode2Cust = DataUtil.buildHasmap(lstCustomerHTKK, "taxCode");
                CustomerDTO temp;
                //                    for (CustomerDTO c : lstUploaded) {
                //                        if (mapTaxCode2Cust.containsKey(c.getTaxCode())) {
                //                            temp = mapTaxCode2Cust.get(c.getTaxCode());
                //                            c.setName(temp.getName());
                //                            c.setTaxAuthority(temp.getTaxAuthority() + "00");
                //                        }
                //                    }
                container.addAll(lstUploaded);
                CommonFunctionTableFilter.refreshTable(tblPanel, HEADER, container);
            } else {
                mapTaxCode2Cust = DataUtil.buildHasmap(lstCustomerExisted, "taxCode");
                //                    Map<String, CustomerDTO> mapTaxCode2CustIHTKK = DataUtil.buildHasmap(lstCustomerHTKK, "taxCode");
                CustomerDTO temp;
                String taxCode1;
                for (CustomerDTO c : lstUploaded) {
                    taxCode1 = c.getTaxCode();
                    if (mapTaxCode2Cust.containsKey(taxCode1)) {
                        temp = mapTaxCode2Cust.get(taxCode1);
                        c.setCustId(temp.getCustId());
                        //                            c.setTaxAuthority(temp.getTaxAuthority());
                        //                            if (Objects.equal("90000", temp.getTaxAuthority())) {
                        //                                if (mapTaxCode2CustIHTKK.containsKey(taxCode1)) {
                        //                                    temp = mapTaxCode2CustIHTKK.get(taxCode1);
                        //                                    c.setTaxAuthority(temp.getTaxAuthority() + "00");
                        //                                }
                        //                            }

                    } else {
                        //                            if (mapTaxCode2CustIHTKK.containsKey(taxCode1)) {
                        //                                temp = mapTaxCode2CustIHTKK.get(taxCode1);
                        //                                if (!DataUtil.isStringNullOrEmpty(temp.getName())) {
                        //                                    c.setName(temp.getName());
                        //                                }
                        //                                if (!DataUtil.isStringNullOrEmpty(temp.getTaxAuthority())) {
                        //                                    c.setTaxAuthority(temp.getTaxAuthority() + "00");
                        //                                }
                        //                            }
                    }
                    //                        lstInserts.add(c);
                }

                container = new BeanItemContainer(CustomerDTO.class);
                container.addAll(lstUploaded);
                CommonFunctionTableFilter.refreshTable(tblPanel, HEADER, container);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        wp.close();
        UI.getCurrent().setPollInterval(-1);
    }
}

From source file:com.anphat.customer.controller.TermInformationUploader.java

@Override
public void uploadFile() {
    try {//from  www .j  a  v  a2 s .  co  m
        List lstUpload;
        List<ValidateCells> lstValidateCells = new ArrayList<>();

        lstValidateCells.add(new ValidateCells(DataUtil.STRING, true, 14));//mst
        if ("2".equals(typeOfTermInformation)) {
            lstValidateCells.add(new ValidateCells(DataUtil.DATE, true, 10));//ngay bat dau
        } else {
            lstValidateCells.add(new ValidateCells(DataUtil.DATE, false, 10));//ngay bat dau
        }
        lstValidateCells.add(new ValidateCells(DataUtil.DATE, false, 10));// ngay ket thuc     
        if ("2".equals(typeOfTermInformation)) {
            lstValidateCells.add(new ValidateCells(DataUtil.STRING, true, 500));// Nha cung cap
        } else {
            lstValidateCells.add(new ValidateCells(DataUtil.STRING, false, 500));// Nha cung cap
        }
        lstValidateCells.add(new ValidateCells(DataUtil.STRING, false, 500));//email
        lstValidateCells.add(new ValidateCells(DataUtil.STRING, false, 500));//so dien thoai
        lstValidateCells.add(new ValidateCells(DataUtil.STRING, false, 200));//Nguon du lieu
        lstUpload = DataUtil.isValidExcells(mimeType, tempFile, 0, 1, 0, 6, 3, lstValidateCells);
        if (lstUpload == null) {
            Notification.show(BundleUtils.getString("valid.import.file"), Notification.Type.WARNING_MESSAGE);
            return;
        }
        //LAY DANH DACH DU LIEU - CELL DA NHAP
        Object[] tmp;
        String taxCode;
        String startTime;
        String endTime;
        String provider;
        String email;
        String phone;
        String sourceData;
        lstTermUpload = new ArrayList<>();
        Set<String> set = new HashSet<>();
        TermInformationDTO termInfor;
        String sTermInfo;
        for (Object object : lstUpload) {

            termInfor = new TermInformationDTO();
            tmp = (Object[]) object;
            if (!DataUtil.isNullObject(tmp)) {
                taxCode = DataUtil.getStringNullOrZero(String.valueOf(tmp[0]));
                if (!DataUtil.isStringNullOrEmpty(taxCode) && !"null".equals(taxCode)) {
                    startTime = DataUtil.getStringNullOrZero(String.valueOf(tmp[1]));
                    endTime = DataUtil.getStringNullOrZero(String.valueOf(tmp[2]));
                    provider = DataUtil.getStringNullOrZero(String.valueOf(tmp[3]));
                    email = DataUtil.getStringNullOrZero(String.valueOf(tmp[4]));
                    phone = DataUtil.getStringNullOrZero(String.valueOf(tmp[5]));
                    sourceData = DataUtil.getStringNullOrZero(String.valueOf(tmp[6]));
                    termInfor.setTaxCode(taxCode);
                    termInfor.setStartTime(startTime);
                    termInfor.setEndTime(endTime);
                    termInfor.setSourceData(sourceData);
                    if ("3".equals(typeOfTermInformation)) {
                        termInfor.setIsContactInfo("1");
                    }
                    if (!DataUtil.isStringNullOrEmpty(email)) {
                        termInfor.setEmail(email.toLowerCase());
                    }
                    termInfor.setPhone(phone);
                    if (!DataUtil.isStringNullOrEmpty(provider)) {
                        termInfor.setProvider(provider.toUpperCase());
                    }
                    sTermInfo = taxCode + "/" + startTime + "/" + endTime + "/" + provider + "/" + phone + "/"
                            + email + "/" + sourceData;
                    if (set.add(sTermInfo)) {
                        lstTermUpload.add(termInfor);
                    }
                }
            }
        }
        if (!DataUtil.isListNullOrEmpty(lstTermUpload)) {
            container = new BeanItemContainer(TermInformationDTO.class);
            container.addAll(lstTermUpload);
            CommonFunctionTableFilter.refreshTable(tblPanel, HEADER, container);
        }
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        wp.close();
        UI.getCurrent().setPollInterval(-1);
    }
}

From source file:com.anphat.list.controller.DialogAddMapStaffCustomerController.java

private void initCustTable(CommonTableFilterPanel filterPanel, boolean isAddTable) {
    filterPanel.getToolbar().setVisible(false);
    if (isAddTable) {
        containerLeft = new BeanItemContainer(CustomerDTO.class);
        tblLeft = filterPanel.getMainTable();
        tableUtils = new TableUtils();
        tableUtils.generateColumn(tblLeft);
        tblLeft.setColumnExpandRatio(Constants.CUSTOMER.NAME, 3);
        tblLeft.setColumnExpandRatio(Constants.CUSTOMER.CODE, 1);
        tblLeft.setColumnWidth(Constants.CHECKBOX_COLUMN, 40);
        CommonFunctionTableFilter.initTable(filterPanel, headerCustLeft, containerLeft, captionCustTable,
                tblSize, langCust);// w  ww .j  ava 2  s .  c  o m
        tblLeft.setColumnHeader(Constants.CHECKBOX_COLUMN, "");
    } else {
        containerRight = new BeanItemContainer(MapStaffCustomerDTO.class);
        if (!DataUtil.isListNullOrEmpty(lstMapStaffCustomerDTOs)) {
            containerRight.addAll(lstMapStaffCustomerDTOs);
        }
        tblRight = filterPanel.getMainTable();
        tblRight.addGeneratedColumn("delete", new CustomTable.ColumnGenerator() {

            @Override
            public Object generateCell(final CustomTable source, final Object itemId, Object columnId) {
                final MapStaffCustomerDTO sdto = (MapStaffCustomerDTO) itemId;
                if (DataUtil.isStringNullOrEmpty(sdto.getMapId())) {
                    Button btnCancel = new Button(new ThemeResource(Constants.ICON.CANCEL));
                    btnCancel.setDescription(BundleUtils.getString("common.button.cancel"));
                    btnCancel.addStyleName(Constants.ICON.V_LINK);
                    btnCancel.addClickListener(new Button.ClickListener() {

                        @Override
                        public void buttonClick(Button.ClickEvent event) {
                            source.removeItem(itemId);
                            tblRight.resetPage();
                        }
                    });
                    return btnCancel;
                } else {
                    Button btnDelete = new Button(new ThemeResource(Constants.ICON.DELETE));
                    btnDelete.setDescription(BundleUtils.getString("common.button.delete"));
                    btnDelete.addStyleName(Constants.ICON.V_LINK);
                    btnDelete.addClickListener(new Button.ClickListener() {

                        @Override
                        public void buttonClick(Button.ClickEvent event) {
                            ConfirmDialog.show(UI.getCurrent(), BundleUtils.getString("delete.item.title"),
                                    BundleUtils.getString("delete.item.body"), BundleUtils.getString("yes"),
                                    BundleUtils.getString("no"), new ConfirmDialog.Listener() {
                                        @Override
                                        public void onClose(ConfirmDialog dialog) {
                                            if (dialog.isConfirmed()) {
                                                String returnValue = WSMapStaffCustomer
                                                        .deleteMapStaffCustomer(sdto.getMapId());
                                                if (returnValue.equalsIgnoreCase(Constants.SUCCESS)) {
                                                    tblRight.removeItem(itemId);
                                                    tblRight.resetPage();
                                                    Notification.show(BundleUtils.getString("actionSuccess"),
                                                            Notification.Type.HUMANIZED_MESSAGE);
                                                } else {
                                                    Notification.show(BundleUtils.getString("actionFail"),
                                                            Notification.Type.ERROR_MESSAGE);
                                                }
                                            }

                                        }
                                    });
                        }
                    });
                    return btnDelete;
                }
            }
        });
        //            tblRight.addGeneratedColumn("cancel", new CustomTable.ColumnGenerator() {
        //
        //                @Override
        //                public Object generateCell(final CustomTable source, final Object itemId, Object columnId) {
        //                    MapStaffCustomerDTO sdto = (MapStaffCustomerDTO) itemId;
        //                    if (!DataUtil.isStringNullOrEmpty(sdto.getMapId())) {
        //                        return "";
        //                    }
        //                    Button btnCancel = new Button(new ThemeResource(Constants.ICON.CANCEL));
        //                    btnCancel.setDescription(BundleUtils.getString("common.button.cancel"));
        //                    btnCancel.addStyleName(Constants.ICON.V_LINK);
        //                    btnCancel.addClickListener(new Button.ClickListener() {
        //
        //                        @Override
        //                        public void buttonClick(Button.ClickEvent event) {
        //                            source.removeItem(itemId);
        //                            tblRight.resetPage();
        //                        }
        //                    });
        //                    return btnCancel;
        //                }
        //            });
        tblRight.setColumnWidth("delete", 100);
        //            tblRight.setColumnWidth("cancel", 60);
        tblRight.setColumnExpandRatio("custName", 3);
        tblRight.setColumnExpandRatio("custCode", 1);
        CommonFunctionTableFilter.initTable(filterPanel, headerCustRight, containerRight, captionCustTableView,
                tblSize, langCust);
        tblRight.setColumnHeader("delete", BundleUtils.getString("common.button.delete") + "/"
                + BundleUtils.getString("common.button.cancel"));
        //            tblRight.setColumnHeader("cancel", "");
    }
}

From source file:com.anphat.list.controller.DialogCreateStaffController.java

public String updateEmployee() {
    StaffDTO staff;// ww w  .  j av a  2 s  .  c  om
    String tempEmail = "";
    String inputEmail = "";
    try {
        staff = getValueForm();
        //check valid info here
        staffDTO.setCode(staff.getCode());
        staffDTO.setName(staff.getName());
        staffDTO.setStaffType(staff.getStaffType());
        staffDTO.setStatus(staff.getStatus());
        staffDTO.setTelNumber(staff.getTelNumber());
        //Thuc hien kiem tra khac null vs khac "" doi voi du lieu truoc khi cap nhat thi moi get va trim
        if (staffDTOClone.getEmail() != null && !staffDTOClone.getEmail().equalsIgnoreCase("")) {
            tempEmail = staffDTOClone.getEmail().trim();
        }
        //Tuong tu doi voi  du lieu cua truong email nhap vao tren form update
        if (staff.getEmail() != null && !staff.getEmail().equalsIgnoreCase("")) {
            inputEmail = staff.getEmail().trim();
        }
        String flag = "UPDATE";
        //So sanh gia tri ban dau voi gia tri khi save vao db neu = nhau nghia la khoong co thay doi gi va bo qua buoc set gia tri
        if (!tempEmail.equalsIgnoreCase("") || !inputEmail.equalsIgnoreCase("")) {
            if (!tempEmail.equalsIgnoreCase(inputEmail)) {
                //Sau khi check pass buoc tren thuc hien validate tiep theo voi gia tri moi neu da ton tai trong db roi thi return va day ra thong bao
                if (!checkDuplicateEmail(flag, inputEmail)) {
                    Notification.show(BundleUtils.getString("staff.department.emailexist"),
                            Notification.Type.WARNING_MESSAGE);
                    return null;
                    //Neu chua ton tai thi thuc hien lay gia tri moi
                } else {
                    staffDTO.setEmail(staff.getEmail());
                }
            }
        }
        staffDTO.setBirthDate(staff.getBirthDate());
        staffDTO.setDeptId(staff.getDeptId());
        //            staffDTO.setUserNameLogging("Username");
        //staffDTO = staff;
        format(staffDTO);
        String value = staffDTO.getCode();
        boolean isValid = value.matches("^[a-zA-Z0-9-_]+$");
        if (!isValid) {
            txtEmpCode.focus();
            Notification.show(
                    BundleUtils.getString("lb.deptstaff.emp.code") + " "
                            + BundleUtils.getString("message.error.code.format"),
                    Notification.Type.TRAY_NOTIFICATION);
            return null;
        } else {
            return WSStaff.updateStaff(staffDTO);
        }

    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}

From source file:com.anphat.list.controller.DialogCreateStaffController.java

/**
 * NgocND6 040416 Update staff info to table map_staff_goods when have
 * change info in table staff//from ww  w . j  a  v  a 2  s.  c  o  m
 *
 * @return
 */
//    public String updateStaffInfoMapStaffGoods() {
//        String resultupdate = "";
//        StaffDTO staff = getValueForm();
//        listUpdateMapStaffGoods.clear();
//        if (listMapStaffGoods != null && listMapStaffGoods.size() > 0) {
//            for (MapStaffGoodsDTO msgdto : listMapStaffGoods) {
//                msgdto.setStaffPhone(staff.getTelNumber());
//                msgdto.setStaffEmail(staff.getEmail());
//                listUpdateMapStaffGoods.add(msgdto);
//            }
//            resultupdate = WSMapStaffGoods.insertOrUpdateListMapStaffGoods(listUpdateMapStaffGoods);
//        }
//        return resultupdate;
//    }
//End NgocND6 050416
//Tao moi staff
public ResultDTO createEmployee() {
    StaffDTO staff;
    try {
        staff = getValueForm();
        String emailVal = DataUtil.getStringNullOrZero(
                DataUtil.getStringEscapeHTML4(dialogCreateStaff.getTxtEmail().getValue().trim()));
        String flag = "INSERT";
        //Truyen flag va gia tri lay tu truong email tren form vao
        if (!checkDuplicateEmail(flag, emailVal)) {
            dialogCreateStaff.getTxtPhoneNumber().focus();
            Notification.show(BundleUtils.getString("staff.department.emailexist"),
                    Notification.Type.WARNING_MESSAGE);
            return null;
        }
        staff.setStaffId(null);
        staffDTO = staff;
        //Them password mac dinh
        format(staffDTO);
        //check valid staff code here
        //check valid info here
        String value = staffDTO.getCode();
        boolean isValid = value.matches("^[a-zA-Z0-9-_]+$");
        if (!isValid) {
            txtEmpCode.focus();
            Notification.show(
                    BundleUtils.getString("lb.deptstaff.emp.code") + " "
                            + BundleUtils.getString("message.error.code.format"),
                    Notification.Type.TRAY_NOTIFICATION);
            return null;
        } else {
            return WSStaff.insertStaff(staff);
        }
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}

From source file:com.anphat.list.controller.ListDeptAndStaffController.java

public void doSearchDepartments() {
    //lay gia tri tim kiem
    searchFormDeptController.getValueSearchDepartment();
    //set value// w  ww.  ja  va2s  .c  o  m
    DepartmentDTO department = getControllDepartment();
    //get list
    List<DepartmentDTO> lstDepartment = listDepartmentController.getListDepartmentDTO(department);
    if (lstDepartment == null || lstDepartment.isEmpty()) {
        Notification.show(BundleUtils.getString("dataNotFound"), Notification.Type.HUMANIZED_MESSAGE);
    }
    listDepartmentController.setDataTable(lstDepartment);
}