Пример #1
0
        public DataSet Proveedor_Contador_Nombre(string Nombre)
        {
            if ((DBUser == null) || (DBUser.UserCode == ""))
                return Utilidades.GenerarError("", "Proveedor_Contador_Nombre()", "ERROR: No se ha validado, debe abrir login");
            try
            {
                NavisionDBTable dt = new NavisionDBTable(this.Connection, this.DBUser);
                NavisionDBCommand Cmd = new NavisionDBCommand(this.Connection);
                NavisionDBDataReader Rd = new NavisionDBDataReader();

                DataSet ds = new DataSet();

                dt.TableNo = 23; //Proveedor
                dt.AddColumn(2);
                dt.AddFilter(2, "@*" + Nombre + "*");
                dt.KeyInNavisionFormat = "Name";
                Cmd.Table = dt;
                Rd = Cmd.ExecuteReader(false);
                return Utilidades.GenerarResultado(Convert.ToString(Rd.RecordsAffected));

            }
            catch (Exception ex)
            {
                return Utilidades.GenerarError(this.DBUser.UserCode, "Proveedor_Contador_Nombre()", ex.Message);
            }
        }
Пример #2
0
        public DataSet AltaPack(string numero, string Descripcion, string UMBase, string GrContExis,
                               string PreIVAIncl, string GrIVANeg, string GrContProd, string GrIVAProd,
                               string PreVenta, string CodCategoria, string FechaIni, string FechaFin,
                               string ProdOpcionales, string TipoPack, string MotBloqueo,
                               string CodTienda, DataSet DatosLineas)
        {
            int TimeoutCabecera = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["TIME_OUT_MILISEG_GRABAR_CABECERA"]);
            int TimeoutLineas = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["TIME_OUT_MILISEG_GRABAR_LINEAS"]);

            string nombre_servidor_colas = System.Configuration.ConfigurationManager.AppSettings["NOMBRE_SERVIDOR_COLAS"];
            string colaToNav = System.Configuration.ConfigurationManager.AppSettings["COLA_TO_NAVISION"];
            string colaFromNav = System.Configuration.ConfigurationManager.AppSettings["COLA_FROM_NAVISION"];

            DataSet DsResult = new DataSet();
            if ((this.DBUser == null) || (this.DBUser.UserCode == ""))
                return Utilidades.GenerarError("", "AltaPack()", "ERROR: No se ha validado, debe abrir login");

            NavisionDBTable Dt = new NavisionDBTable(this.Connection, this.DBUser);
            NavisionDBAdapter Da = new NavisionDBAdapter();
            NavisionDBCommand Cmd = new NavisionDBCommand(this.Connection);
            NavisionDBNumSerie NumSerie = new NavisionDBNumSerie(this.DBUser, this.Connection);
            NavisionDBDataReader Rd = new NavisionDBDataReader();
            string NumeroSerieNuevo = "";

            NumeroSerieNuevo = numero;

            try
            {
                NavisionDB.NavisionDBNas nas = new NavisionDB.NavisionDBNas();
                nas.NasInitializeChannels(nombre_servidor_colas, colaFromNav, colaToNav);
                string[] MyArray = new string[16];
                MyArray[0] = numero;
                MyArray[1] = Descripcion;
                MyArray[2] = UMBase;
                MyArray[3] = GrContExis;
                MyArray[4] = PreIVAIncl;
                MyArray[5] = GrIVANeg;
                MyArray[6] = GrContProd;
                MyArray[7] = GrIVAProd;
                MyArray[8] = PreVenta;
                MyArray[9] = CodCategoria;
                MyArray[10] = FechaIni;
                MyArray[11] = FechaFin;
                MyArray[12] = ProdOpcionales;
                MyArray[13] = TipoPack;
                MyArray[14] = MotBloqueo;
                MyArray[15] = CodTienda;

                nas.ExecuteFunction = "DarAltaProductoPack";
                nas.Parameters = MyArray;
                nas.SendParamsAsync(nas, "", false);

            }
            catch (System.Messaging.MessageQueueException ex)
            {
                this.BorrarCabecera(NumeroSerieNuevo, "Pedido");
                DsResult = Utilidades.GenerarError(this.DBUser.UserCode, "AltaPack()", "Error al insertar la cabecera: " + ex.Message + ". Cabecera borrada: " + NumeroSerieNuevo);
                return DsResult;
            }
            try
            {
                int i;
                for (i = 0; i <= DatosLineas.Tables[0].Rows.Count - 1; i++)
                {
                    NavisionDB.NavisionDBNas NasLineas = new NavisionDB.NavisionDBNas();
                    NasLineas.NasInitializeChannels(nombre_servidor_colas, colaFromNav, colaToNav);
                    NasLineas.ExecuteFunction = "PSTD_ComponentesPack";
                    string[] MyArray1 = new string[11];
                    MyArray1[0] = DatosLineas.Tables[0].Rows[i][0].ToString();//CodPack
                    MyArray1[1] = DatosLineas.Tables[0].Rows[i][1].ToString();//NumLinea
                    MyArray1[2] = DatosLineas.Tables[0].Rows[i][2].ToString();//Tipo
                    MyArray1[3] = DatosLineas.Tables[0].Rows[i][3].ToString();//CodProd
                    MyArray1[4] = DatosLineas.Tables[0].Rows[i][4].ToString();//Descripcion
                    MyArray1[5] = DatosLineas.Tables[0].Rows[i][5].ToString();//UDM
                    MyArray1[6] = DatosLineas.Tables[0].Rows[i][6].ToString();//Cantidad
                    MyArray1[7] = DatosLineas.Tables[0].Rows[i][7].ToString();//Coste
                    MyArray1[8] = DatosLineas.Tables[0].Rows[i][8].ToString();//CosteTotal
                    MyArray1[9] = DatosLineas.Tables[0].Rows[i][9].ToString();//Obligatorio
                    MyArray1[10] = DatosLineas.Tables[0].Rows[i][10].ToString();//TipoObli

                    NasLineas.Parameters = MyArray1;
                    NasLineas.SendParamsAsync(NasLineas, "", false);

                }
            }
            catch (System.Messaging.MessageQueueException ex)
            {
                DsResult = Utilidades.GenerarError(this.DBUser.UserCode, "AltaPack()", "Error al insertar línea: " + ex.Message);
                this.BorrarLineas(NumeroSerieNuevo, "Pedido");
                this.BorrarCabecera(NumeroSerieNuevo, "Pedido");
                return DsResult;
            }

            DsResult = Utilidades.GenerarResultado("Correcto");
            DsResult.Tables[0].Columns.Add("NumPedido", Type.GetType("System.String"));
            DsResult.Tables[0].Rows[0]["NumPedido"] = NumeroSerieNuevo;
            return DsResult;
        }
Пример #3
0
        public DataSet DiarioProd_Generar(DataSet DatosLineas)
        {
            int TimeoutCabecera = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["TIME_OUT_MILISEG_GRABAR_CABECERA"]);
            int TimeoutLineas = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["TIME_OUT_MILISEG_GRABAR_LINEAS"]);

            string nombre_servidor_colas = System.Configuration.ConfigurationManager.AppSettings["NOMBRE_SERVIDOR_COLAS"];
            string colaToNav = System.Configuration.ConfigurationManager.AppSettings["COLA_TO_NAVISION"];
            string colaFromNav = System.Configuration.ConfigurationManager.AppSettings["COLA_FROM_NAVISION"];

            DataSet DsResult = new DataSet();
            if ((this.DBUser == null) || (this.DBUser.UserCode == ""))
                return Utilidades.GenerarError("", "DiarioProd_Generar()", "ERROR: No se ha validado, debe abrir login");

            //TODO: Comprobar utilidad de los siguientes objetos !?
            NavisionDBTable Dt = new NavisionDBTable(this.Connection, this.DBUser);
            NavisionDBAdapter Da = new NavisionDBAdapter();
            NavisionDBCommand Cmd = new NavisionDBCommand(this.Connection);
            NavisionDBNumSerie NumSerie = new NavisionDBNumSerie(this.DBUser, this.Connection);
            NavisionDBDataReader Rd = new NavisionDBDataReader();
            string NumeroSerieNuevo = "";

            //NumeroSerieNuevo = NumeroTicket;

            try
            {
                int i;
                for (i = 0; i <= DatosLineas.Tables[0].Rows.Count - 1; i++)
                {
                    NavisionDB.NavisionDBNas NasLineas = new NavisionDB.NavisionDBNas();
                    NasLineas.NasInitializeChannels(nombre_servidor_colas, colaFromNav, colaToNav);
                    NasLineas.ExecuteFunction = "PSTD_DiarioProd_Generar";
                    string[] MyArray1 = new string[11];
                    MyArray1[0] = DatosLineas.Tables[0].Rows[i][0].ToString();//Libro
                    MyArray1[1] = DatosLineas.Tables[0].Rows[i][1].ToString();//Seccion
                    MyArray1[2] = DatosLineas.Tables[0].Rows[i][2].ToString();//Nº linea
                    MyArray1[3] = DatosLineas.Tables[0].Rows[i][3].ToString();//Producto
                    MyArray1[4] = DatosLineas.Tables[0].Rows[i][4].ToString();//Fecha
                    MyArray1[5] = DatosLineas.Tables[0].Rows[i][5].ToString();//Tipo Mov
                    MyArray1[6] = DatosLineas.Tables[0].Rows[i][6].ToString();//Nº documento
                    MyArray1[7] = DatosLineas.Tables[0].Rows[i][7].ToString();//Almacen
                    MyArray1[8] = DatosLineas.Tables[0].Rows[i][8].ToString();//Cantidad
                    MyArray1[9] = DatosLineas.Tables[0].Rows[i][9].ToString();//Cantidad calculada
                    MyArray1[10] = DatosLineas.Tables[0].Rows[i][10].ToString();//Cantidad fisica
                    NasLineas.Parameters = MyArray1;
                    NasLineas.SendParamsAsync(NasLineas, "", false);

                }
            }
            catch (System.Messaging.MessageQueueException ex)
            {
                DsResult = Utilidades.GenerarError(this.DBUser.UserCode, "DiarioProd_Generar()", "Error al insertar línea: " + ex.Message);
                this.BorrarLineas(NumeroSerieNuevo, "Diario Producto");
                this.BorrarCabecera(NumeroSerieNuevo, "Diario Producto");
                return DsResult;
            }

            DsResult = Utilidades.GenerarResultado("Correcto");
            DsResult.Tables[0].Columns.Add("DiarioProd", Type.GetType("System.String"));
            DsResult.Tables[0].Rows[0]["DiarioProd"] = NumeroSerieNuevo;
            return DsResult;
        }
Пример #4
0
        public DataSet HistLinFra_Generar(DataSet DatosLineas)
        {
            int TimeoutCabecera = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["TIME_OUT_MILISEG_GRABAR_CABECERA"]);
            int TimeoutLineas = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["TIME_OUT_MILISEG_GRABAR_LINEAS"]);

            string nombre_servidor_colas = System.Configuration.ConfigurationManager.AppSettings["NOMBRE_SERVIDOR_COLAS"];
            string colaToNav = System.Configuration.ConfigurationManager.AppSettings["COLA_TO_NAVISION"];
            string colaFromNav = System.Configuration.ConfigurationManager.AppSettings["COLA_FROM_NAVISION"];

            DataSet DsResult = new DataSet();
            if ((this.DBUser == null) || (this.DBUser.UserCode == ""))
                return Utilidades.GenerarError("", "HistLinFra_Generar()", "ERROR: No se ha validado, debe abrir login");

            NavisionDBTable Dt = new NavisionDBTable(this.Connection, this.DBUser);
            NavisionDBAdapter Da = new NavisionDBAdapter();
            NavisionDBCommand Cmd = new NavisionDBCommand(this.Connection);
            NavisionDBNumSerie NumSerie = new NavisionDBNumSerie(this.DBUser, this.Connection);
            NavisionDBDataReader Rd = new NavisionDBDataReader();
            string NumeroSerieNuevo = "";

            try
            {
                int i;
                for (i = 0; i <= DatosLineas.Tables[0].Rows.Count - 1; i++)
                {
                    NavisionDB.NavisionDBNas NasLineas = new NavisionDB.NavisionDBNas();
                    NasLineas.NasInitializeChannels(nombre_servidor_colas, colaFromNav, colaToNav);
                    NasLineas.ExecuteFunction = "PSTDHistLinFraGenerar";
                    string[] MyArray1 = new string[3];
                    MyArray1[0] = DatosLineas.Tables[0].Rows[i][0].ToString();//NumFactura
                    MyArray1[1] = DatosLineas.Tables[0].Rows[i][1].ToString();//NumLinea
                    MyArray1[2] = DatosLineas.Tables[0].Rows[i][2].ToString();//Numcheque
                    NasLineas.Parameters = MyArray1;
                    NasLineas.SendParamsAsync(NasLineas, "", false);

                }
            }
            catch (System.Messaging.MessageQueueException ex)
            {
                DsResult = Utilidades.GenerarError(this.DBUser.UserCode, "HistLinFra_Generar()", "Error al insertar línea: " + ex.Message);
                this.BorrarLineas(NumeroSerieNuevo, "HistLinFra");
                this.BorrarCabecera(NumeroSerieNuevo, "HistLinFra");
                return DsResult;
            }

            DsResult = Utilidades.GenerarResultado("Correcto");
            DsResult.Tables[0].Columns.Add("HistLinFra", Type.GetType("System.String"));
            DsResult.Tables[0].Rows[0]["HistLinFra"] = NumeroSerieNuevo;
            return DsResult;
        }
Пример #5
0
        public DataSet Cliente_Contador_Tlfno(string Telefono)
        {
            if ((DBUser == null) || (DBUser.UserCode == ""))
                return Utilidades.GenerarError("", "Cliente_Contador_Tlfno()", "ERROR: No se ha validado, debe abrir login");
            try
            {
                NavisionDBTable dt = new NavisionDBTable(this.Connection, this.DBUser);
                NavisionDBCommand Cmd = new NavisionDBCommand(this.Connection);
                NavisionDBDataReader Rd = new NavisionDBDataReader();

                DataSet ds = new DataSet();

                dt.TableNo = 18; //Cliente
                dt.AddColumn(9);
                dt.AddFilter(9, Telefono);
                dt.KeyInNavisionFormat = "Phone No.";
                Cmd.Table = dt;
                Rd = Cmd.ExecuteReader(false);
                return Utilidades.GenerarResultado(Convert.ToString(Rd.RecordsAffected));

            }
            catch (Exception ex)
            {
                return Utilidades.GenerarError(this.DBUser.UserCode, "Cliente_Contador_Tlfno()", ex.Message);
            }
        }
Пример #6
0
        public DataSet Competidores(string CodProv, string Nombre, string Direccion,
                                string Direccion2, string Poblacion, string Pais,
                                string CP, string Provincia, string Mail,
                                string Web, string Telefono, string Fax,
                                string FechaMod, DataSet DatosLineas)
        {
            int TimeoutCabecera = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["TIME_OUT_MILISEG_GRABAR_CABECERA"]);
            int TimeoutLineas = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["TIME_OUT_MILISEG_GRABAR_LINEAS"]);

            string nombre_servidor_colas = System.Configuration.ConfigurationManager.AppSettings["NOMBRE_SERVIDOR_COLAS"];
            string colaToNav = System.Configuration.ConfigurationManager.AppSettings["COLA_TO_NAVISION"];
            string colaFromNav = System.Configuration.ConfigurationManager.AppSettings["COLA_FROM_NAVISION"];

            DataSet DsResult = new DataSet();
            if ((this.DBUser == null) || (this.DBUser.UserCode == ""))
                return Utilidades.GenerarError("", "Competidores()", "ERROR: No se ha validado, debe abrir login");

            NavisionDBTable Dt = new NavisionDBTable(this.Connection, this.DBUser);
            NavisionDBAdapter Da = new NavisionDBAdapter();
            NavisionDBCommand Cmd = new NavisionDBCommand(this.Connection);
            NavisionDBNumSerie NumSerie = new NavisionDBNumSerie(this.DBUser, this.Connection);
            NavisionDBDataReader Rd = new NavisionDBDataReader();
            string NumeroSerieNuevo = "";

            NumeroSerieNuevo = CodProv;

            try
            {
                NavisionDB.NavisionDBNas nas = new NavisionDB.NavisionDBNas();
                nas.NasInitializeChannels(nombre_servidor_colas, colaFromNav, colaToNav);
                string[] MyArray = new string[13];
                MyArray[0] = CodProv;
                MyArray[1] = Nombre;
                MyArray[2] = Direccion;
                MyArray[3] = Direccion2;
                MyArray[4] = Poblacion;
                MyArray[5] = Pais;
                MyArray[6] = CP;
                MyArray[7] = Provincia;
                MyArray[8] = Mail;
                MyArray[9] = Web;
                MyArray[10] = Telefono;
                MyArray[11] = Fax;
                MyArray[12] = FechaMod;

                nas.ExecuteFunction = "PSTD_Competidores";
                nas.Parameters = MyArray;

                nas.SendParamsAsync(nas, "", false);

            }
            catch (System.Messaging.MessageQueueException ex)
            {
                this.BorrarCabecera(NumeroSerieNuevo, "Pedido");
                DsResult = Utilidades.GenerarError(this.DBUser.UserCode, "Competidores()", "Error al insertar la cabecera: " + ex.Message + ". Cabecera borrada: " + NumeroSerieNuevo);
                return DsResult;
            }
            try
            {
                int i;
                for (i = 0; i <= DatosLineas.Tables[0].Rows.Count - 1; i++)
                {
                    NavisionDB.NavisionDBNas NasLineas = new NavisionDB.NavisionDBNas();
                    NasLineas.NasInitializeChannels(nombre_servidor_colas, colaFromNav, colaToNav);
                    NasLineas.ExecuteFunction = "PSTD_PrecioCompetidores";
                    string[] MyArray1 = new string[6];
                    MyArray1[0] = CodProv;
                    MyArray1[1] = DatosLineas.Tables[0].Rows[i][0].ToString();//producto
                    MyArray1[2] = DatosLineas.Tables[0].Rows[i][1].ToString();//fecha inicio
                    MyArray1[3] = DatosLineas.Tables[0].Rows[i][2].ToString();//unidad medida
                    MyArray1[4] = DatosLineas.Tables[0].Rows[i][3].ToString();//coste
                    MyArray1[5] = DatosLineas.Tables[0].Rows[i][4].ToString();//fecha fin
                    NasLineas.Parameters = MyArray1;
                    NasLineas.SendParamsAsync(NasLineas, "", false);

                }
            }
            catch (System.Messaging.MessageQueueException ex)
            {
                DsResult = Utilidades.GenerarError(this.DBUser.UserCode, "Competidores()", "Error al insertar línea: " + ex.Message);
                this.BorrarLineas(NumeroSerieNuevo, "Pedido");
                this.BorrarCabecera(NumeroSerieNuevo, "Pedido");
                return DsResult;
            }

            DsResult = Utilidades.GenerarResultado("Correcto");
            DsResult.Tables[0].Columns.Add("NumPedido", Type.GetType("System.String"));
            DsResult.Tables[0].Rows[0]["NumPedido"] = NumeroSerieNuevo;
            return DsResult;
        }
Пример #7
0
        public DataSet CabCarga_Generar(string NumCarga, string FechaEnvio, string NatuTrans,
                                        string ModTrans, string Puerto, string EspTrans,
                                        string CodTrans, string CondEnvio, string CodTPV,
                                        string CodTienda, string Estado, string FechaCreacion,
                                        string ServTrans, DataSet DatosLineas)
        {
            int TimeoutCabecera = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["TIME_OUT_MILISEG_GRABAR_CABECERA"]);
            int TimeoutLineas = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["TIME_OUT_MILISEG_GRABAR_LINEAS"]);

            string nombre_servidor_colas = System.Configuration.ConfigurationManager.AppSettings["NOMBRE_SERVIDOR_COLAS"];
            string colaToNav = System.Configuration.ConfigurationManager.AppSettings["COLA_TO_NAVISION"];
            string colaFromNav = System.Configuration.ConfigurationManager.AppSettings["COLA_FROM_NAVISION"];

            DataSet DsResult = new DataSet();
            if ((this.DBUser == null) || (this.DBUser.UserCode == ""))
                return Utilidades.GenerarError("", "CabCarga_Generar()", "ERROR: No se ha validado, debe abrir login");

            NavisionDBTable Dt = new NavisionDBTable(this.Connection, this.DBUser);
            NavisionDBAdapter Da = new NavisionDBAdapter();
            NavisionDBCommand Cmd = new NavisionDBCommand(this.Connection);
            NavisionDBNumSerie NumSerie = new NavisionDBNumSerie(this.DBUser, this.Connection);
            NavisionDBDataReader Rd = new NavisionDBDataReader();
            string NumeroSerieNuevo = "";

            NumeroSerieNuevo = NumCarga;

            try
            {
                NavisionDB.NavisionDBNas nas = new NavisionDB.NavisionDBNas();
                nas.NasInitializeChannels(nombre_servidor_colas, colaFromNav, colaToNav);
                string[] MyArray = new string[13];
                MyArray[0] = NumCarga;
                MyArray[1] = FechaEnvio;
                MyArray[2] = NatuTrans;
                MyArray[3] = ModTrans;
                MyArray[4] = Puerto;
                MyArray[5] = EspTrans;
                MyArray[6] = CodTrans;
                MyArray[7] = CondEnvio;
                MyArray[8] = CodTPV;
                MyArray[9] = CodTienda;
                MyArray[10] = Estado;
                MyArray[11] = FechaCreacion;
                MyArray[12] = ServTrans;

                nas.ExecuteFunction = "PSTD_CabCarga_Generar";
                nas.Parameters = MyArray;

                nas.SendParamsAsync(nas, "", false);

            }
            catch (System.Messaging.MessageQueueException ex)
            {
                this.BorrarCabecera(NumeroSerieNuevo, "Pedido");
                DsResult = Utilidades.GenerarError(this.DBUser.UserCode, "CabCarga_Generar()", "Error al insertar la cabecera: " + ex.Message + ". Cabecera borrada: " + NumeroSerieNuevo);
                return DsResult;
            }
            try
            {
                int i;
                for (i = 0; i <= DatosLineas.Tables[0].Rows.Count - 1; i++)
                {
                    NavisionDB.NavisionDBNas NasLineas = new NavisionDB.NavisionDBNas();
                    NasLineas.NasInitializeChannels(nombre_servidor_colas, colaFromNav, colaToNav);
                    NasLineas.ExecuteFunction = "PSTD_GrabarLineaCarga";
                    string[] MyArray1 = new string[4];
                    MyArray1[0] = NumCarga;
                    MyArray1[1] = DatosLineas.Tables[0].Rows[i][1].ToString();//NumLin
                    MyArray1[2] = DatosLineas.Tables[0].Rows[i][2].ToString();//NumEntrega
                    MyArray1[3] = DatosLineas.Tables[0].Rows[i][3].ToString();//NumLinEntrega
                    NasLineas.Parameters = MyArray1;
                    NasLineas.SendParamsAsync(NasLineas, "", false);

                }
            }
            catch (System.Messaging.MessageQueueException ex)
            {
                DsResult = Utilidades.GenerarError(this.DBUser.UserCode, "CabCarga_Generar()", "Error al insertar línea: " + ex.Message);
                this.BorrarLineas(NumeroSerieNuevo, "Pedido");
                this.BorrarCabecera(NumeroSerieNuevo, "Pedido");
                return DsResult;
            }

            DsResult = Utilidades.GenerarResultado("Correcto");
            DsResult.Tables[0].Columns.Add("NumPedido", Type.GetType("System.String"));
            DsResult.Tables[0].Rows[0]["NumPedido"] = NumeroSerieNuevo;
            return DsResult;
        }
Пример #8
0
        public DataSet CabRep_Generar(string NumeroTicket, string AlmOrigen, string AlmDestino,
                        string FechaEnvio, string FechaReg, string FechaDoc, string AlmTransito,
                        string Vendedor, string NumBultos, DataSet DatosLineas)
        {
            int TimeoutCabecera = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["TIME_OUT_MILISEG_GRABAR_CABECERA"]);
            int TimeoutLineas = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["TIME_OUT_MILISEG_GRABAR_LINEAS"]);

            string nombre_servidor_colas = System.Configuration.ConfigurationManager.AppSettings["NOMBRE_SERVIDOR_COLAS"];
            string colaToNav = System.Configuration.ConfigurationManager.AppSettings["COLA_TO_NAVISION"];
            string colaFromNav = System.Configuration.ConfigurationManager.AppSettings["COLA_FROM_NAVISION"];

            DataSet DsResult = new DataSet();
            if ((this.DBUser == null) || (this.DBUser.UserCode == ""))
                return Utilidades.GenerarError("", "CabRep_Generar()", "ERROR: No se ha validado, debe abrir login");

            //TODO: Comprobar la utilidad de los siguientes objetos !?
            NavisionDBTable Dt = new NavisionDBTable(this.Connection, this.DBUser);
            NavisionDBAdapter Da = new NavisionDBAdapter();
            NavisionDBCommand Cmd = new NavisionDBCommand(this.Connection);
            NavisionDBNumSerie NumSerie = new NavisionDBNumSerie(this.DBUser, this.Connection);
            NavisionDBDataReader Rd = new NavisionDBDataReader();
            string NumeroSerieNuevo = string.Empty;

            NumeroSerieNuevo = NumeroTicket;

            try
            {
                NavisionDB.NavisionDBNas nas = new NavisionDB.NavisionDBNas();
                nas.NasInitializeChannels(nombre_servidor_colas, colaFromNav, colaToNav);
                string[] MyArray = new string[10];
                MyArray[0] = NumeroSerieNuevo;
                MyArray[1] = AlmOrigen;
                MyArray[2] = AlmDestino;
                MyArray[3] = FechaEnvio;
                MyArray[4] = FechaReg;
                MyArray[5] = FechaDoc;
                MyArray[6] = AlmTransito;
                MyArray[7] = Vendedor;
                MyArray[8] = NumBultos;
                MyArray[9] = DatosLineas.Tables[0].Rows.Count.ToString();

                nas.ExecuteFunction = "PSTD_PedTransferencia_Generar";
                nas.Parameters = MyArray;

                nas.SendParamsAsync(nas, "", false);

            }
            catch (System.Messaging.MessageQueueException ex)
            {
                this.BorrarCabecera(NumeroSerieNuevo, "Pedido");
                DsResult = Utilidades.GenerarError(this.DBUser.UserCode, "CabRep_Generar()", "Error al insertar la cabecera: " + ex.Message + ". Cabecera borrada: " + NumeroSerieNuevo);
                return DsResult;
            }
            try
            {
                int i;
                for (i = 0; i <= DatosLineas.Tables[0].Rows.Count - 1; i++)
                {
                    NavisionDB.NavisionDBNas NasLineas = new NavisionDB.NavisionDBNas();
                    NasLineas.NasInitializeChannels(nombre_servidor_colas, colaFromNav, colaToNav);
                    NasLineas.ExecuteFunction = "PSTD_GrabarLineaTransferencia";
                    string[] MyArray1 = new string[7];
                    MyArray1[0] = NumeroSerieNuevo;
                    MyArray1[1] = DatosLineas.Tables[0].Rows[i][0].ToString();//NumDoc
                    MyArray1[2] = DatosLineas.Tables[0].Rows[i][1].ToString();//Cantidad
                    MyArray1[3] = DatosLineas.Tables[0].Rows[i][2].ToString();//AlmOrigen
                    MyArray1[4] = DatosLineas.Tables[0].Rows[i][3].ToString();//AlmDestino
                    MyArray1[5] = DatosLineas.Tables[0].Rows[i][4].ToString();//NumLinea
                    MyArray1[6] = DatosLineas.Tables[0].Rows[i][5].ToString();//CodVariante
                    NasLineas.Parameters = MyArray1;
                    NasLineas.SendParamsAsync(NasLineas, "", false);

                }
            }
            catch (System.Messaging.MessageQueueException ex)
            {
                DsResult = Utilidades.GenerarError(this.DBUser.UserCode, "CabRep_Generar()", "Error al insertar línea: " + ex.Message);
                this.BorrarLineas(NumeroSerieNuevo, "Pedido");
                this.BorrarCabecera(NumeroSerieNuevo, "Pedido");
                return DsResult;
            }

            try
            {
                NavisionDB.NavisionDBNas nasReg = new NavisionDB.NavisionDBNas();
                nasReg.NasInitializeChannels(nombre_servidor_colas, colaFromNav, colaToNav);
                string[] MyArray = new string[1];
                MyArray[0] = NumeroSerieNuevo;

                nasReg.ExecuteFunction = "PSTD_RegEnvio_Transferencia";
                nasReg.Parameters = MyArray;

                nasReg.SendParamsAsync(nasReg, "", false);

            }
            catch (System.Messaging.MessageQueueException ex)
            {
                this.BorrarCabecera(NumeroSerieNuevo, "Factura");
                DsResult = Utilidades.GenerarError(this.DBUser.UserCode, "Ventas_Crear()", "Error al insertar la cabecera: " + ex.Message + ". Cabecera borrada: " + NumeroSerieNuevo);
                return DsResult;
            }

            DsResult = Utilidades.GenerarResultado("Correcto");
            DsResult.Tables[0].Columns.Add("NumPedido", Type.GetType("System.String"));
            DsResult.Tables[0].Rows[0]["NumPedido"] = NumeroSerieNuevo;
            return DsResult;
        }
Пример #9
0
        public DataSet Buscar_Clientes_Contador(string Nombre, string Apellidos, string NIF, string Telefono)
        {
            if ((this.DBUser == null) || (this.DBUser.UserCode == ""))
            {
                return Utilidades.GenerarError("", "Buscar_Clientes_Contador()", "ERROR: No se ha validado, debe abrir login");
            }
            try
            {
                NavisionDBTable table = new NavisionDBTable(this.Connection, this.DBUser);
                NavisionDBCommand command = new NavisionDBCommand(this.Connection);
                NavisionDBDataReader reader = new NavisionDBDataReader();
                DataSet set = new DataSet();
                table.TableNo = 18; //Cliente
                table.AddColumn(86);
                if (Nombre != "")
                {
                    table.AddFilter(4, "*" + Nombre + "*");
                }
                if (Apellidos != "")
                {
                    table.AddFilter(2, "*" + Apellidos + "*");
                }
                if (NIF != "")
                {
                    table.AddFilter(86, "*" + NIF + "*");
                }
                if (Telefono != "")
                {
                    table.AddFilter(9, "*" + Telefono + "*");
                }
                table.KeyInNavisionFormat = "VAT Registration No.";
                command.Table = table;

                return Utilidades.GenerarResultado(Convert.ToString(command.ExecuteReader(false).RecordsAffected));
            }
            catch (Exception exception)
            {
                return Utilidades.GenerarError(this.DBUser.UserCode, "Buscar_Clientes_Contador()", exception.Message);
            }
        }
Пример #10
0
        public static string CompruebaPais(string pais, NavisionDB.NavisionDBConnection conn, NavisionDB.NavisionDBUser user)
        {
            NavisionDBTable dt = new NavisionDBTable(conn, user);
            NavisionDBCommand cmd = new NavisionDBCommand(conn);
            NavisionDBDataReader rd = new NavisionDBDataReader();
            cmd = new NavisionDBCommand(conn);

            if (pais == "")
                return "";
            dt.TableName = "Country";
            dt.AddColumn("Code");
            dt.AddFilter("Code", pais);

            cmd.Table = dt;
            rd = cmd.ExecuteReader(false);

            return (rd.RecordsAffected != 0) ? rd.GetString(0) : "-1";
        }
Пример #11
0
        public static bool CompruebaFormato(string codpais, string dni, NavisionDB.NavisionDBConnection conn, NavisionDB.NavisionDBUser user)
        {
            NavisionDBTable dt = new NavisionDBTable(conn, user);
            //NavisionDBAdapter da = new NavisionDBAdapter();
            NavisionDBDataReader rd = new NavisionDBDataReader();
            NavisionDBCommand cmd = new NavisionDBCommand(conn);

            bool resul = false;

            //			if (codpais == "")
            //				codpais = "ES";

            // Accedemos a la tabla de formatos de dni por pais para contrastar
            dt.TableName = "VAT Registration No. Format";
            dt.AddColumn("Format");
            dt.AddFilter("Country Code", codpais);

            cmd.Table = dt;
            rd = cmd.ExecuteReader(false);
            if (rd.RecordsAffected != 0)
            {
                resul = CompruebaCadenas(rd.GetString(0), dni);
                while (!resul && rd.NextResult())
                {
                    resul = CompruebaCadenas(rd.GetString(0), dni);
                }
            }
            else
            {
                return true;
                // no existen formatos para ese pais, se aceptan todos
            }
            return resul;
        }
Пример #12
0
        public static bool CompruebaDNI(string nif_cif, string codpais, NavisionDB.NavisionDBConnection conn, NavisionDB.NavisionDBUser user)
        {
            NavisionDBTable dt = new NavisionDBTable(conn, user);
            NavisionDBCommand cmd = new NavisionDBCommand(conn);
            NavisionDBDataReader rd = new NavisionDBDataReader();

            nif_cif = nif_cif.Replace("-", "").Replace(".", "").Replace(",", "").Replace(":", "").Replace("_", "");

            // ------------------------------------------- \\
            // PRIMERO COMPROBAMOS QUE NO EXISTE DICHO DNI EN LA TABLA DE CLIENTES
            dt.TableName = "Customer";
            dt.AddColumn("No.");
            dt.AddColumn("VAT Registration No.");

            dt.AddFilter("VAT Registration No.", nif_cif);

            cmd.Table = dt;
            rd = cmd.ExecuteReader(false);

            return (rd.RecordsAffected != 0) ? false : CompruebaFormato(codpais, nif_cif, conn, user);
            //ya existe un cliente con ese dni
        }
Пример #13
0
        public NavisionDBDataReader ExecuteReader(bool LockTable)
        {
            NavisionDBDataReader reader;
            DataRow row;
            int[] fieldNumbers;
            int num;
            int fieldCount;
            CFrontRecordset recordset = this.PrepararConsulta(LockTable);
            if (recordset.EOF)
            {
                reader = new NavisionDBDataReader();
                goto Label_03B0;
            }
            DataTable tabla = new DataTable(this.Tabla.TableName);
            string[] columnsName = null;
            if (((this.Tabla.Columns == null) && (this.Tabla.ColumnsName == null)) && !this.Tabla.NoColumn)
            {
                fieldNumbers = this.Tabla.FieldNumbers;
                fieldCount = this.Tabla.FieldCount;
            }
            else
            {
                fieldCount = this.Tabla.Columns.Length;
                fieldNumbers = this.Tabla.Columns;
                columnsName = this.Tabla.ColumnsName;
            }
            NavisionFieldType[] typeArray = new NavisionFieldType[fieldCount];
            for (num = 0; num < fieldCount; num++)
            {
                string str;
                string typeName = "";
                if (columnsName == null)
                {
                    str = recordset.FieldName(fieldNumbers[num]);
                }
                else
                {
                    str = columnsName[num];
                }
                switch (recordset.FieldType(fieldNumbers[num], ref typeArray[num]))
                {
                    case "Code":
                        typeName = "System.String";
                        break;

                    case "Decimal":
                        typeName = "System.Decimal";
                        break;

                    case "Binary":
                        typeName = "System.String";
                        break;

                    case "Blob":
                        typeName = "System.String";
                        break;

                    case "Boolean":
                        typeName = "System.Boolean";
                        break;

                    case "Date":
                        typeName = "System.DateTime";
                        break;

                    case "DateFormula":
                        typeName = "System.String";
                        break;

                    case "DateTime":
                        typeName = "System.DateTime";
                        break;

                    case "Duration":
                        typeName = "System.String";
                        break;

                    case "Guid":
                        typeName = "System.String";
                        break;

                    case "Option":
                        typeName = "System.String";
                        break;

                    case "RecordId":
                        typeName = "System.String";
                        break;

                    case "Integer":
                        typeName = "System.Int32";
                        break;

                    case "BigInteger":
                        typeName = "System.Int64";
                        break;

                    case "TableFilter":
                        typeName = "System.String";
                        break;

                    case "Time":
                        typeName = "System.DateTime";
                        break;

                    case "Text":
                        typeName = "System.String";
                        break;

                    default:
                        throw new Exception("Error: Unknown data type -> " + recordset.FieldType(fieldNumbers[num], ref typeArray[num]).ToString());
                }
                DataColumn column = new DataColumn(str, Type.GetType(typeName));
                tabla.Columns.Add(column);
            }
            Label_0335:
            row = tabla.NewRow();
            for (num = 0; num < fieldCount; num++)
            {
                row[num] = recordset[fieldNumbers[num]];
            }
            tabla.Rows.Add(row);
            if (!this.Tabla.firstRow)
            {
                if (this.Tabla.Reverse)
                {
                    if (recordset.MovePrevious())
                    {
                        goto Label_0335;
                    }
                }
                else if (recordset.MoveNext())
                {
                    goto Label_0335;
                }
            }
            tabla.AcceptChanges();
            reader = new NavisionDBDataReader(tabla);
            Label_03B0:
            recordset.FreeRec();
            recordset.Close();
            return reader;
        }