Package services

Source Code of services.TicketConfirmer

package services;

import dao.DaoSupportImpl;
import domain.shedule.SheduleReception;

/**
*
* @author axe
*/
public class TicketConfirmer extends DaoSupportImpl {

    public String confirm(int recId) {
        SheduleReception rec = getDao().getById(SheduleReception.class, recId);
        if(rec == null) {
            return "Нет такой записи";
        }
        if(rec.getConfirmed()) {
            return "Эта запись уже подтверждена";
        }
        rec.setConfirmed(true);
        try {
            getDao().save(rec);
        } catch(Exception ex) {
            return "Не удалось подтвердить запись";
        }
        return null;
    }

    public String reject(int recId) {
        SheduleReception rec = getDao().getById(SheduleReception.class, recId);
        if(rec == null) {
            return "Нет такой записи";
        }
        try {
            getDao().delete(rec);
        } catch(Exception ex) {
            return "Не удалось удалить запись";
        }
        return null;
    }

}
TOP

Related Classes of services.TicketConfirmer

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.