Package pl.zgora.uz.wmie.fe.admin.ajax.action

Source Code of pl.zgora.uz.wmie.fe.admin.ajax.action.CompanyAjaxAction

package pl.zgora.uz.wmie.fe.admin.ajax.action;

import java.util.ArrayList;
import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.MatchMode;
import org.hibernate.criterion.Projections;
import org.hibernate.criterion.Restrictions;

import pl.zgora.uz.wmie.fe.sps.business.service.CompanyService;
import pl.zgora.uz.wmie.fe.sps.business.util.BusinessUtil;
import pl.zgora.uz.wmie.fe.sps.business.util.HibernateUtil;
import pl.zgora.uz.wmie.fe.sps.database.classes.Company;

public class CompanyAjaxAction {
 
  public void deleteSelectedCompany(Integer id) throws Exception {
    CompanyService companyService = (CompanyService) BusinessUtil
        .findBusiness("CompanyService");
    companyService.deleteById(id);
  }
 
  public String isLoginUnique(String login) throws Exception {
    CompanyService companyService=(CompanyService) BusinessUtil
        .findBusiness("CompanyService");
    List<Criterion> criterions = new ArrayList<Criterion>();
    criterions.add(Restrictions.eq("userLogin", login));
    List<Company> lista=companyService.findByParams(criterions);
    if (lista.size()==0) {
      return "ok";
    } else {
      return String.valueOf(lista.get(0).getIdCompany());
    }
  }
}
TOP

Related Classes of pl.zgora.uz.wmie.fe.admin.ajax.action.CompanyAjaxAction

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.