Beispiel #1
0
        public int agregar_reporte(Reporte reporte, List <Detalle_Reporte> detalles_reporte, List <Detalle_Reporte> detalles_reporte_extra, string horas_disponibles, string correos, string user)
        {
            int result = 0;

            string[] vector_correo = correos.Split(',');

            Fecha  fecha         = new Fecha();
            string fecha_asignar = fecha.fecha();

            reporte.FECHA_CREACION   = fecha_asignar;
            reporte.USUARIO_CREACION = user;

            int id = dao_reporte.AgregarReporte(reporte);

            string nombre_cliente = dao_reporte.ObtenerNombreCliente2(id);

            if (detalles_reporte != null)
            {
                for (int i = 0; i < detalles_reporte.Count; i++)
                {
                    detalles_reporte[i].USUARIO_CREACION = user;
                    detalles_reporte[i].FECHA_CREACION   = fecha_asignar;
                    detalles_reporte[i].FK_ID_REPORTE    = id;
                }

                result = dao_reporte.AgregarDetallesReporte(detalles_reporte);
            }

            if (detalles_reporte_extra != null)
            {
                for (int i = 0; i < detalles_reporte_extra.Count; i++)
                {
                    detalles_reporte_extra[i].USUARIO_CREACION = user;
                    detalles_reporte_extra[i].FECHA_CREACION   = fecha_asignar;
                    detalles_reporte_extra[i].FK_ID_REPORTE    = id;
                }

                result = dao_reporte.AgregarDetallesReporteExtra(detalles_reporte_extra);
            }

            if (horas_disponibles != "f" && reporte.TIPO_DOCUMENTO != "Reporte Contrato Garantía")
            {
                double hor = Double.Parse(horas_disponibles);
                dao_contrato.RebajarHorasContrato(reporte.ID_CONTRATO, hor, user, fecha_asignar);

                if (hor == 0)
                {
                    dao_reporte.CambiarEstadoReporteContrato(reporte.ID_CONTRATO, user, fecha_asignar);
                }
            }
            else
            {
                dao_reporte.CambiarEstadoReporteContrato(reporte.ID_CONTRATO, user, fecha_asignar);
            }

            mail.Enviar_Resporte_Correo(encryption.Encrypt(id.ToString()), reporte, detalles_reporte, nombre_cliente, vector_correo);

            return(result);
        }
Beispiel #2
0
        public int Cambiar_Estado_Reporte(string ID_Reporte, string correos)
        {
            int ID_Reporte2 = int.Parse(ID_Reporte);

            string nombre_cliente = daoreporte.ObtenerNombreCliente2(ID_Reporte2);

            string[] vector_correo = correos.Split(',');

            int result = dao_cierre.Cambiar_Estado_Reenvio(ID_Reporte2);


            Reporte Reporte_Obj = new Reporte();

            Reporte_Obj = daoreporte.devuelve_reporte(ID_Reporte2);

            Detalle_Reporte Detalle_Obj2 = new Detalle_Reporte();

            int opc = 0;

            if (Reporte_Obj.ID_CONTRATO != 0)
            {
                opc = 1;
            }
            else if (Reporte_Obj.ID_PROYECTO != 0)
            {
                opc = 2;
            }

            List <Detalle_Reporte> Detalle_Obj = new List <Detalle_Reporte>();

            Detalle_Obj = daoreporte.BuscaDetallesReporte(ID_Reporte2, opc);


            if ((Reporte_Obj.TIPO_DOCUMENTO == "Reporte Contrato") || (Reporte_Obj.TIPO_DOCUMENTO == "Reporte Contrato Garantía") || (Reporte_Obj.TIPO_DOCUMENTO == "Reporte Contrato Facturado"))
            {
                mail.Enviar_Resporte_Correo(encryption.Encrypt(ID_Reporte2.ToString()), Reporte_Obj, Detalle_Obj, nombre_cliente, vector_correo);
            }
            else
            {
                mail.Enviar_Resporte_Correo_Proyecto(encryption.Encrypt(ID_Reporte2.ToString()), Reporte_Obj, Detalle_Obj2, nombre_cliente, vector_correo);
            }

            return(result);
        }