public static DataTable PurchaserInfoById(Purchaser obj)
        {
            DataSet   dsDatos;
            DataTable dtDatos = new DataTable();

            try
            {
                var      ConectStr  = Tools.ConectionNow.BuildConection(obj.User);
                Database dbeAuction = new Microsoft.Practices.EnterpriseLibrary.Data.Sql.SqlDatabase(ConectStr);
                //  Database dbeAuction = DatabaseFactory.CreateDatabase("Auction");
                // Crear objeto SP
                DbCommand spComprador = dbeAuction.GetStoredProcCommand("SP_COMPRADORES");
                dbeAuction.AddInParameter(spComprador, "@i_operation", DbType.String, "S");
                dbeAuction.AddInParameter(spComprador, "@i_option", DbType.String, "B");
                dbeAuction.AddInParameter(spComprador, "@id_Comprador", DbType.Int32, obj.IdSegas);
                dbeAuction.AddInParameter(spComprador, "@IdSubasta", DbType.Int32, obj.IdSubasta);
                spComprador.CommandTimeout = 900000000;
                dsDatos = dbeAuction.ExecuteDataSet(spComprador);
                if (dsDatos.Tables[0].Rows.Count > 0)
                {
                    dtDatos = dsDatos.Tables[0];
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine(string.Format("AuctionGas ApiWebServices Auditoria: {0} , NameSpace: {1}, Clase: {2}, Metodo: {3} ", ex.Message, MethodBase.GetCurrentMethod().DeclaringType.Namespace, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name));

                throw new Exception((string.Format("AuctionGas ApiWebServices Auditoria: {0} , NameSpace: {1}, Clase: {2}, Metodo: {3} ", ex.Message, MethodBase.GetCurrentMethod().DeclaringType.Namespace, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name)));
            }
            return(dtDatos);
        }
Пример #2
0
        public static DataTable SearchMessages(UserAutentication objUser)
        {
            DataSet   datos;
            DataTable clientes = new DataTable();

            try
            {
                var      ConectStr  = Tools.ConectionNow.BuildConection(objUser);
                Database dbeAuction = new Microsoft.Practices.EnterpriseLibrary.Data.Sql.SqlDatabase(ConectStr);
                //  Database dbeAuction = DatabaseFactory.CreateDatabase("Auction");
                // Crear objeto SP

                // Crear objeto SP
                DbCommand spConsultarNotificaciones = dbeAuction.GetStoredProcCommand("SP_NOTIFICACIONES");

                dbeAuction.AddInParameter(spConsultarNotificaciones, "@i_operation", DbType.String, "S");
                dbeAuction.AddInParameter(spConsultarNotificaciones, "@i_option", DbType.String, "B");

                spConsultarNotificaciones.CommandTimeout = 900000000;
                datos = dbeAuction.ExecuteDataSet(spConsultarNotificaciones);
                if (datos.Tables[0].Rows.Count > 0)
                {
                    clientes = datos.Tables[0];
                }

                return(clientes);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine(string.Format("AuctionGas ApiWebServices Auditoria: {0} , NameSpace: {1}, Clase: {2}, Metodo: {3} ", ex.Message, MethodBase.GetCurrentMethod().DeclaringType.Namespace, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name));

                throw new Exception((string.Format("AuctionGas ApiWebServices Auditoria: {0} , NameSpace: {1}, Clase: {2}, Metodo: {3} ", ex.Message, MethodBase.GetCurrentMethod().DeclaringType.Namespace, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name)));
            }
        }
Пример #3
0
        /// <summary>
        /// For getting data in single table from database
        /// </summary>
        /// <param name="spDOM"></param>
        /// <returns></returns>
        public static DataTable GetDT(XDocument spDOM, string ConnectionStr)
        {
            try
            {
                Database db = new Microsoft.Practices.EnterpriseLibrary.Data.Sql.SqlDatabase(ConnectionStr);

                DbParameter            parameter;
                DbCommand              cmd;
                IEnumerable <XElement> elems;
                IEnumerable <XElement> elem_list;
                string spName = GetProcName(spDOM);
                cmd = db.GetStoredProcCommand(spName);
                SetCommandTimeOut(cmd);
                elems     = spDOM.Descendants();
                elem_list = from elem in elems select elem;
                foreach (XElement element in elem_list)
                {
                    parameter = cmd.CreateParameter();
                    if (element.Name.ToString() != "BIC" && element.Name.ToString() != "XsdName" && element.Name.ToString() != "procName" && element.Name.ToString() != "pERRORXML")
                    {
                        parameter.ParameterName = "@" + element.Name.ToString();
                        parameter.Value         = element.Value;
                        cmd.Parameters.Add(parameter);
                    }
                }

                return(db.ExecuteDataSet(cmd).Tables[0]);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #4
0
        public static DataTable GetDataTable(int key)
        {
            Database  db         = new Microsoft.Practices.EnterpriseLibrary.Data.Sql.SqlDatabase(LocalSqlConn());
            string    sqlCommand = "select * from accessControl where sitekey='" + key + "' and is_authenticate=1";
            DbCommand DBcmd      = db.GetSqlStringCommand(sqlCommand);

            DBcmd.CommandType = CommandType.Text;

            DataSet ds = db.ExecuteDataSet(DBcmd);

            return(ds.Tables[0]);
        }
Пример #5
0
        public static DataTable SearchParams(Params paramsobj)
        {
            DataSet   datos;
            DataTable parametros   = new DataTable();
            string    tipoConsulta = "A";

            try
            {
                var      ConectStr  = Tools.ConectionNow.BuildConection(paramsobj.User);
                Database dbeAuction = new Microsoft.Practices.EnterpriseLibrary.Data.Sql.SqlDatabase(ConectStr);
                //  Database dbeAuction = DatabaseFactory.CreateDatabase("Auction");
                // Crear objeto SP
                DbCommand spParametros = dbeAuction.GetStoredProcCommand("SP_PARAMETROS");
                if (!String.IsNullOrEmpty(paramsobj.NombreParametro))
                {
                    tipoConsulta = "B";
                }

                dbeAuction.AddInParameter(spParametros, "@i_operation", DbType.String, "S");
                dbeAuction.AddInParameter(spParametros, "@i_option", DbType.String, tipoConsulta);
                dbeAuction.AddInParameter(spParametros, "@NombreParametro", DbType.String, paramsobj.NombreParametro);
                spParametros.CommandTimeout = 900000000;
                datos = dbeAuction.ExecuteDataSet(spParametros);
                if (datos.Tables[0].Rows.Count > 0)
                {
                    parametros = datos.Tables[0];
                }


                return(parametros);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine(string.Format("AuctionGas ApiWebServices Auditoria: {0} , NameSpace: {1}, Clase: {2}, Metodo: {3} ", ex.Message, MethodBase.GetCurrentMethod().DeclaringType.Namespace, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name));
                throw new Exception((string.Format("AuctionGas ApiWebServices Auditoria: {0} , NameSpace: {1}, Clase: {2}, Metodo: {3} ", ex.Message, MethodBase.GetCurrentMethod().DeclaringType.Namespace, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name)));
            }
        }
Пример #6
0
        public static DataTable SearchLog(GasLogSearch search)
        {
            DataSet   dsDatos;
            DataTable dtDatos = new DataTable();

            try
            {
                //Database dbAuction = DatabaseFactory.CreateDatabase("Auction");

                var      ConectStr = Tools.ConectionNow.BuildConection(search.User);
                Database dbAuction = new Microsoft.Practices.EnterpriseLibrary.Data.Sql.SqlDatabase(ConectStr);


                // Crear objeto SP
                DbCommand spConsultarLog = dbAuction.GetStoredProcCommand("SP_GASLOG");

                dbAuction.AddInParameter(spConsultarLog, "@i_operation", DbType.String, "S");
                dbAuction.AddInParameter(spConsultarLog, "@i_option", DbType.String, "A");
                if (search.IdUsuario > 0)
                {
                    dbAuction.AddInParameter(spConsultarLog, "@IdUsuario", DbType.Int16, search.IdUsuario);
                }
                if (search.IdTipoAccion > 0)
                {
                    dbAuction.AddInParameter(spConsultarLog, "@IdTipoAccion", DbType.Int16, search.IdTipoAccion);
                }

                if (search.FechaInicio != null && search.FechaInicio.Length > 0)
                {
                    string   fechain = search.FechaInicio.Substring(0, 10) + " 00:00";
                    DateTime ffin    = Convert.ToDateTime(fechain);
                    dbAuction.AddInParameter(spConsultarLog, "@FechaInicio", DbType.DateTime, ffin);
                }
                if (search.FechaFin != null && search.FechaFin.Length > 0)
                {
                    string   fechaout = search.FechaFin.Substring(0, 10) + " 23:59";
                    DateTime ffout    = Convert.ToDateTime(fechaout);
                    dbAuction.AddInParameter(spConsultarLog, "@FechaFin", DbType.DateTime, ffout);
                }
                if (search.EstadoTransaccion != null && search.EstadoTransaccion.Trim().Length > 0)
                {
                    dbAuction.AddInParameter(spConsultarLog, "@EstadoTrans", DbType.Boolean, search.EstadoTransaccion == "SI" ? true: false);
                }

                spConsultarLog.CommandTimeout = 900000000;
                dsDatos = dbAuction.ExecuteDataSet(spConsultarLog);
                if (dsDatos.Tables[0].Rows.Count > 0)
                {
                    dtDatos = dsDatos.Tables[0];
                }
                //return datos;
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine(string.Format("AuctionGas ApiWebServices Auditoria: {0} , NameSpace: {1}, Clase: {2}, Metodo: {3} ", ex.Message, MethodBase.GetCurrentMethod().DeclaringType.Namespace, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name));

                throw new Exception("Excepcion en la funcion LogGas" + ex.StackTrace);
            }

            return(dtDatos);
        }