示例#1
0
        public List <Ytbl_CorreoNotificacionesModels> SelectCorreos()
        {
            conn = new Connection();
            OleDbConnection objConn = conn.Conn();

            string commText = "select * from YTBL_CORREONOTIFICACIONES";

            objConn.Open();
            OleDbCommand cmd = new OleDbCommand();

            cmd.Connection  = objConn;
            cmd.CommandText = commText;
            cmd.CommandType = CommandType.Text;
            OleDbDataReader myReader = cmd.ExecuteReader();

            int RecordCount = 0;
            List <Ytbl_CorreoNotificacionesModels> correoNotificacionesLista = new List <Ytbl_CorreoNotificacionesModels>();

            try
            {
                if (myReader.HasRows)
                {
                    while (myReader.Read())
                    {
                        Ytbl_CorreoNotificacionesModels CorreoNotificaciones = new Ytbl_CorreoNotificacionesModels();
                        RecordCount++;

                        CorreoNotificaciones.Id      = int.Parse(myReader.GetDecimal(0).ToString());
                        CorreoNotificaciones.Name    = myReader.GetString(1).ToString();
                        CorreoNotificaciones.Correo  = myReader.GetString(2).ToString();
                        CorreoNotificaciones.IsValid = myReader.GetString(3).ToString();
                        CorreoNotificaciones.System  = myReader.GetString(4).ToString();
                        CorreoNotificaciones.Fecha   = DateTime.Parse(myReader.GetDateTime(5).ToString());

                        correoNotificacionesLista.Add(CorreoNotificaciones);
                    }
                }

                return(correoNotificacionesLista);
            }
            catch (Exception ex)
            {
                myReader.Close();
                objConn.Close();
                Logs.WriteErrorLog("Error en la consulta de datos||" + ex.ToString());
                return(correoNotificacionesLista);
            }
            finally
            {
                myReader.Close();
                objConn.Close();
            }
        }
示例#2
0
        public bool SaveYtbl_CorreoNotificaciones(Ytbl_CorreoNotificacionesModels CorreoNotificacionesModels)
        {
            conn = new Connection();
            OleDbConnection objConn = conn.Conn();

            try
            {
                // Calling sp_processdata defined inside PKG PKG_MANAGER

                string commText = "YPKG_WEBCORTES.YPRD_INSERTNOTIFICACIONES";
                objConn.Open();
                OleDbCommand cmd = new OleDbCommand(commText, objConn);

                cmd.CommandType = CommandType.StoredProcedure;

                OleDbParameter Name = new OleDbParameter("PV_NAME", OleDbType.VarChar);
                Name.Direction = ParameterDirection.Input;
                Name.Value     = CorreoNotificacionesModels.Name;
                cmd.Parameters.Add(Name);

                OleDbParameter Correo = new OleDbParameter("PV_CORREO", OleDbType.VarChar);
                Correo.Direction = ParameterDirection.Input;
                Correo.Value     = CorreoNotificacionesModels.Correo;
                cmd.Parameters.Add(Correo);

                OleDbParameter IsValid = new OleDbParameter("PV_ISVALID", OleDbType.VarChar);
                IsValid.Direction = ParameterDirection.Input;
                IsValid.Value     = CorreoNotificacionesModels.IsValid;
                cmd.Parameters.Add(IsValid);

                OleDbParameter System = new OleDbParameter("PV_SYSTEM", OleDbType.VarChar);
                System.Direction = ParameterDirection.Input;
                System.Value     = CorreoNotificacionesModels.System;
                cmd.Parameters.Add(System);

                cmd.ExecuteNonQuery();

                objConn.Close();

                return(true);
            }
            catch (Exception ex)
            {
                Logs.WriteErrorLog("Error en insert: " + ex.ToString());
                objConn.Close();
                return(false);
            }
            finally
            {
                objConn.Close();
            }
        }
        public bool ExecuteSave(Ytbl_ProgCorteModels ListCorte)
        {
            Ytbl_DetalleProgCorteModels SaveDetalle = new Ytbl_DetalleProgCorteModels();

            try
            {
                if (SaveYtbl_ProgCorte(ListCorte) == false)
                {
                    return(false);
                }

                int idProgCorte = SelectMaxId(ListCorte.Document_Name);

                Parallel.For(0, DetalleCorte.Count, i =>
                {
                    Ytbl_DetalleProgCorteModels CorteDetalle = new Ytbl_DetalleProgCorteModels();

                    CorteDetalle.id_ProgCorte       = idProgCorte;
                    CorteDetalle.CpartyId           = DetalleCorte[i].CpartyId;
                    CorteDetalle.CpartyAccountId    = DetalleCorte[i].CpartyAccountId;
                    CorteDetalle.CitemId            = DetalleCorte[i].CitemId;
                    CorteDetalle.FormaPago          = DetalleCorte[i].FormaPago;
                    CorteDetalle.Ciudad             = DetalleCorte[i].Ciudad;
                    CorteDetalle.BancoId            = DetalleCorte[i].BancoId;
                    CorteDetalle.TipoNegocio        = DetalleCorte[i].TipoNegocio;
                    CorteDetalle.EmpresaFacturadora = DetalleCorte[i].EmpresaFacturadora;
                    CorteDetalle.FieldV1            = DetalleCorte[i].FieldV1;
                    CorteDetalle.FieldV2            = DetalleCorte[i].FieldV2;
                    CorteDetalle.FieldN1            = DetalleCorte[i].FieldN1;
                    CorteDetalle.FieldN2            = DetalleCorte[i].FieldN2;
                    CorteDetalle.FieldD1            = DetalleCorte[i].FieldD1;
                    CorteDetalle.Status             = DetalleCorte[i].Status;

                    SaveDetalle.SaveYtbl_DetalleProgCorte(CorteDetalle);
                });

                /*foreach (var item in DetalleCorte)
                 * {
                 *  Ytbl_DetalleProgCorteModels CorteDetalle = new Ytbl_DetalleProgCorteModels();
                 *
                 *  CorteDetalle.id_ProgCorte = idProgCorte;
                 *  CorteDetalle.CpartyId = item.CpartyId ;
                 *  CorteDetalle.CpartyAccountId = item.CpartyAccountId;
                 *  CorteDetalle.CitemId = item.CitemId;
                 *  CorteDetalle.FormaPago = item.FormaPago;
                 *  CorteDetalle.Ciudad = item.Ciudad;
                 *  CorteDetalle.BancoId = item.BancoId;
                 *  CorteDetalle.TipoNegocio = item.TipoNegocio;
                 *  CorteDetalle.EmpresaFacturadora = item.EmpresaFacturadora;
                 *  CorteDetalle.FieldV1 = item.FieldV1;
                 *  CorteDetalle.FieldV2 = item.FieldV2;
                 *  CorteDetalle.FieldN1 = item.FieldN1;
                 *  CorteDetalle.FieldN2 = item.FieldN2;
                 *  CorteDetalle.FieldD1 = item.FieldD1;
                 *  CorteDetalle.Status = item.Status;
                 *
                 *  SaveDetalle.SaveYtbl_DetalleProgCorte(CorteDetalle);
                 *
                 * }*/

                Ytbl_CorreoNotificacionesModels notificacion = new Ytbl_CorreoNotificacionesModels();

                notificacion.SendMailNotification(idProgCorte);

                return(true);
            }
            catch (Exception ex)
            {
                Logs.WriteErrorLog("Error en ExecuteSave: " + ex.ToString());
                return(false);
            }
        }