예제 #1
0
        public void agregarOrdenServicio(ENT.OrdenServicio ordenServicio)
        {
            DAL.OrdenServicio DalOrdenServicio = new DAL.OrdenServicio();

            //try
            //{
            if (ordenServicio.Empleado.Id <= 0)
            {
                throw new Exception("Debes seleccionar un empleado para estos servicios");
            }
            if (ordenServicio.Orden.Id <= 0)
            {
                throw new Exception("Debes seleccionar una orden para estos servicios");
            }
            if (ordenServicio.Servicio.pServicio == string.Empty)
            {
                throw new Exception("Debes seleccionar un servicio");
            }
            if (ordenServicio.Cantidad <= 0)
            {
                throw new Exception("Debes seleccionar una cantidad valida");
            }
            if (ordenServicio.Id <= 0)
            {
                DalOrdenServicio.agregarOrdenServicio(ordenServicio);
                if (DalOrdenServicio.Error)
                {
                    throw new Exception("Error al agregar los servicios a la orden, " + DalOrdenServicio.ErrorMsg);
                }
            }
            else
            {
                if (ordenServicio.Costo <= 0)
                {
                    throw new Exception("Costos de los servicios invalido verifique");
                }
                DalOrdenServicio.editarOrdenServicio(ordenServicio);
                if (DalOrdenServicio.Error)
                {
                    throw new Exception("Error al actualizar los servicios a la orden, " + DalOrdenServicio.ErrorMsg);
                }
            }
            //}
            //catch (Exception ex)
            //{

            //    throw ex;
            //}
        }
예제 #2
0
 public void eliminarOrdenServicio(ENT.OrdenServicio ordenServicio)
 {
     DAL.OrdenServicio DalOrdenServicio = new DAL.OrdenServicio();
     try
     {
         if (ordenServicio.Id <= 0)
         {
             throw new Exception("Debes seleccionar los servicios, necesarios para eliminar");
         }
         DalOrdenServicio.borraOrdenServicio(ordenServicio);
         if (DalOrdenServicio.Error)
         {
             throw new Exception("Error al eliminar los servicios, " + DalOrdenServicio.ErrorMsg);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }