public ItemGenerico ConsultaPrecioBase(string codMaterial, string desMaterial)
        {
            DAABRequest.Parameter[] arrParam =
            {
                new DAABRequest.Parameter("K_MATEC_CODMATERIAL",  DbType.String, ParameterDirection.Input),
                new DAABRequest.Parameter("K_MATEV_DESCMATERIAL", DbType.String, ParameterDirection.Input),
                new DAABRequest.Parameter("K_RESULT_SET",         DbType.Object, ParameterDirection.Output)
            };

            for (int i = 0; i < arrParam.Length; i++)
            {
                arrParam[i].Value = DBNull.Value;
            }

            arrParam[0].Value = codMaterial;
            arrParam[1].Value = desMaterial;

            BDMSSAP     obj       = new BDMSSAP(BaseDatos.BD_MSSAP);
            DAABRequest obRequest = obj.CreaRequest();

            obRequest.CommandType = CommandType.StoredProcedure;
            obRequest.Command     = BaseDatos.PKG_CONSULTA_MSSAP + Constantes.MSSapPreciosBase;       //dga
            //obRequest.Command = BaseDatos.PkgMSSap + Constantes.MSSapPreciosBase;


            obRequest.Parameters.AddRange(arrParam);

            //ArrayList filas = new ArrayList();
            IDataReader  dr   = null;
            ItemGenerico item = new ItemGenerico();

            try
            {
                dr = obRequest.Factory.ExecuteReader(ref obRequest).ReturnDataReader;
                while (dr.Read())
                {
                    item              = new ItemGenerico();
                    item.Codigo       = Funciones.CheckStr(dr["MATEC_CODMATERIAL"]);
                    item.Descripcion  = Funciones.CheckStr(dr["MATEV_DESCMATERIAL"]);
                    item.PrecioBase   = Funciones.CheckDbl(dr["MATEN_PRECIOBASE"]);
                    item.PrecioCompra = Funciones.CheckDbl(dr["MATEN_PRECIOCOMPRA"]);
                    //filas.Add(item);
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                if (dr != null && dr.IsClosed == false)
                {
                    dr.Close();
                }
                obRequest.Parameters.Clear();
                obRequest.Factory.Dispose();
            }

            return(item);
        }
Exemple #2
0
		public bool AnularPedido(Int64 p_nroPedido, string vMotivoPedido, string vEstado, string vTipOficina)
		{
			//string pestado = Convert.ToString(System.Configuration.ConfigurationSettings.AppSettings["codPedidoEstadoAnular"]);
			DAABRequest.Parameter[] arrParam = {
												   new DAABRequest.Parameter("K_PEDIN_NROPEDIDO", DbType.Int64, ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIV_MOTIVOPEDIDO", DbType.String , ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIC_ESTADO", DbType.String, ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIC_TIPOOFICINA", DbType.String, ParameterDirection.Input),
												   new DAABRequest.Parameter("K_NROLOG", DbType.String,ParameterDirection.Output),
												   new DAABRequest.Parameter("K_DESLOG", DbType.String,ParameterDirection.Output)
											   };

			for (int i = 0; i < arrParam.Length; i++)
				arrParam[i].Value = DBNull.Value;

			if (p_nroPedido > 0)
			{
				arrParam[0].Value = p_nroPedido;
				arrParam[1].Value = vMotivoPedido;
				arrParam[2].Value = vEstado;
				arrParam[3].Value = vTipOficina;
			}
			int codResp=99;
			bool salida = false;
			
			BDMSSAP obj = new BDMSSAP(BaseDatos.BD_MSSAP);
			DAABRequest obRequest = obj.CreaRequest();
			obRequest.CommandType = CommandType.StoredProcedure;
			//obRequest.Command = BaseDatos.PkgMSSap + ".SSAPSU_ANULARPEDIDO";
			obRequest.Command = BaseDatos.PKG_CONSULTA_MSSAP + ".SSAPSU_ANULARPEDIDO";
			obRequest.Parameters.AddRange(arrParam);

			try
			{
				obRequest.Factory.ExecuteNonQuery(ref obRequest);

				IDataParameter pSalida0;
				IDataParameter pSalida1;
				pSalida0 = (IDataParameter)obRequest.Parameters[4];
				pSalida1 = (IDataParameter)obRequest.Parameters[5];
				codResp = Funciones.CheckInt(pSalida0.Value);
				
				salida = codResp==0?true:false;

			}
			catch (Exception ex)
			{
				throw ex;
			}
			finally
			{
				obRequest.Factory.Dispose();
			}
			return salida;
		}
Exemple #3
0
		public bool ActualizarPedido(Int64 pNroPedido, string vEquipos, string vPresuscrito, string vNroCarta, string vOperador, string vPublicar, string vCorreo, ref string strMensaje)
		{
			DAABRequest.Parameter[] arrParam = {
												   new DAABRequest.Parameter("NROPEDIDO", DbType.Int64, ParameterDirection.Input),
												   new DAABRequest.Parameter("EQUIPOS", DbType.String, 1000, ParameterDirection.Input),
												   new DAABRequest.Parameter("PRESUSCRITO", DbType.String, 2, ParameterDirection.Input),
												   new DAABRequest.Parameter("NROCARTA", DbType.String, 50, ParameterDirection.Input),
												   new DAABRequest.Parameter("OPERADOR", DbType.String, 50, ParameterDirection.Input),
												   new DAABRequest.Parameter("PUBLICAR", DbType.String, 2, ParameterDirection.Input),
												   new DAABRequest.Parameter("CORREO", DbType.String, 200, ParameterDirection.Input),
												   new DAABRequest.Parameter("RESPUESTA", DbType.Int32, ParameterDirection.Output)
											   };

			int i;
			for (i = 0; i < arrParam.Length; i++)
				arrParam[i].Value = DBNull.Value;

			arrParam[0].Value = pNroPedido;
			arrParam[1].Value = vEquipos;
			arrParam[2].Value = vPresuscrito;
			arrParam[3].Value = vNroCarta;
			arrParam[4].Value = vOperador;
			arrParam[5].Value = vPublicar;
			arrParam[6].Value = vCorreo;

			bool retorno = false;

			BDMSSAP obj = new BDMSSAP(BaseDatos.BD_MSSAP);
			DAABRequest obRequest = obj.CreaRequest();
			obRequest.CommandType = CommandType.StoredProcedure;
			obRequest.Command = BaseDatos.PKG_CONSULTA_MSSAP + ".SSAPSU_PEDIDO";
			//obRequest.Command = BaseDatos.PkgMSSap + ".SSAPSU_PEDIDO";
			obRequest.Parameters.AddRange(arrParam);

			try
			{
				obRequest.Factory.ExecuteNonQuery(ref obRequest);
				IDataParameter parRetorno;
				parRetorno = (IDataParameter)obRequest.Parameters[7];
				retorno = (Funciones.CheckInt(parRetorno.Value) == 1);
			}
			catch (Exception ex)
			{
				strMensaje = ex.Message.ToString();
				throw ex;
			}
			finally
			{
				obRequest.Parameters.Clear();
				obRequest.Factory.Dispose();
			}
			return retorno;
		}
Exemple #4
0
//		public void ActualizarDescuentoPedido (int pNropedido,string pCodEsquema, string pClaseCondicion, decimal pDesctMonto ,out string pNrolog,out string pDeslog )
//		{
//			DAABRequest.Parameter[] arrParam = {
//												   new DAABRequest.Parameter("K_PEDIN_NROPEDIDO", DbType.Int64, ParameterDirection.Input),												   
//												   new DAABRequest.Parameter("K_ESQUC_CODIGOESQUEMA", DbType.String, ParameterDirection.Input),
//												   new DAABRequest.Parameter("K_CLCOC_CODCLASECONDICION", DbType.String, ParameterDirection.Input),
//												   new DAABRequest.Parameter("K_DESCN_MONTO", DbType.Decimal, ParameterDirection.Input),
//												   new DAABRequest.Parameter("K_NROLOG", DbType.String , ParameterDirection.Output),
//												   new DAABRequest.Parameter("K_DESLOG", DbType.String , ParameterDirection.Output)
//												   
//											   };
//
//			for (int i = 0; i < arrParam.Length; i++)
//				arrParam[i].Value = DBNull.Value;
//
//			arrParam[0].Value = pNropedido;
//			arrParam[1].Value = pCodEsquema;
//			arrParam[2].Value = pClaseCondicion;
//			arrParam[3].Value = pDesctMonto;
//			
//			BDMSSAP obj = new BDMSSAP(BaseDatos.BD_MSSAP);
//			DAABRequest obRequest = obj.CreaRequest();
//			obRequest.CommandType = CommandType.StoredProcedure;
//			obRequest.Command = BaseDatos.PKG_CONSULTA_MSSAP + ".SSAPSU_DESCUENTO";
//			obRequest.Parameters.AddRange(arrParam);
//			obRequest.Transactional = true;
//
//			try
//			{
//				obRequest.Factory.ExecuteNonQuery(ref obRequest);
//				obRequest.Factory.CommitTransaction();
//				IDataParameter pSalida1;
//				IDataParameter pSalida2;
//				pSalida1 = (IDataParameter)obRequest.Parameters[4];
//				pSalida2 = (IDataParameter)obRequest.Parameters[5];
//
//				pNrolog = Funciones.CheckStr(pSalida1.Value);
//				pDeslog = Funciones.CheckStr(pSalida2.Value);
//			}
//			catch (Exception ex)
//			{
//				obRequest.Factory.RollBackTransaction();
//				pNrolog="-1";
//				pDeslog = ex.Message.ToString();
//				throw ex;
//			}
//			finally
//			{
//				obRequest.Factory.Dispose();				
//			}
//		}

		public void ActualizarDescuentoPedido(int pNropedido, int pConsecutivo, string pCodEsquema, string pClaseCondicion, decimal pDesctMonto, out string pNrolog, out string pDeslog)
		{
			DAABRequest.Parameter[] arrParam = {
												   new DAABRequest.Parameter("K_PEDIN_NROPEDIDO", DbType.Int64, ParameterDirection.Input),												   
												   new DAABRequest.Parameter("K_DEPEN_CONSECUTIVO", DbType.Int64, ParameterDirection.Input),                                                                             
												   new DAABRequest.Parameter("K_ESQUC_CODIGOESQUEMA", DbType.String, ParameterDirection.Input),
												   new DAABRequest.Parameter("K_CLCOC_CODCLASECONDICION", DbType.String, ParameterDirection.Input),
												   new DAABRequest.Parameter("K_DESCN_MONTO", DbType.Decimal, ParameterDirection.Input),
												   new DAABRequest.Parameter("K_NROLOG", DbType.String , ParameterDirection.Output),
												   new DAABRequest.Parameter("K_DESLOG", DbType.String , ParameterDirection.Output)
												   
											   };

			for (int i = 0; i < arrParam.Length; i++)
				arrParam[i].Value = DBNull.Value;

			arrParam[0].Value = pNropedido;
			arrParam[1].Value = pConsecutivo;
			arrParam[2].Value = pCodEsquema;
			arrParam[3].Value = pClaseCondicion;
			arrParam[4].Value = pDesctMonto;
			
			BDMSSAP obj = new BDMSSAP(BaseDatos.BD_MSSAP);
			DAABRequest obRequest = obj.CreaRequest();
			obRequest.CommandType = CommandType.StoredProcedure;
			obRequest.Command = BaseDatos.PKG_VENTA + ".SSAPSU_DESCUENTO";
			obRequest.Parameters.AddRange(arrParam);
			obRequest.Transactional = true;

			try
			{
				obRequest.Factory.ExecuteNonQuery(ref obRequest);
				obRequest.Factory.CommitTransaction();
				IDataParameter pSalida1;
				IDataParameter pSalida2;
				pSalida1 = (IDataParameter)obRequest.Parameters[5];
				pSalida2 = (IDataParameter)obRequest.Parameters[6];

				pNrolog = Funciones.CheckStr(pSalida1.Value);
				pDeslog = Funciones.CheckStr(pSalida2.Value);
			}
			catch (Exception ex)
			{
				obRequest.Factory.RollBackTransaction();
				pNrolog="-1";
				pDeslog = ex.Message.ToString();
				throw ex;
			}
			finally
			{
				obRequest.Factory.Dispose();				
			}
		}
Exemple #5
0
		public void RecalculaEsquema (int pNropedido,int pCodConsecutivo, string pEsquemaCalcu ,out string pNrolog,out string pDeslog )
		{
			DAABRequest.Parameter[] arrParam = {
												   new DAABRequest.Parameter("K_PEDIN_NROPEDIDO", DbType.Int64, ParameterDirection.Input),												   
												   new DAABRequest.Parameter("K_DEPEN_CONSECUTIVO", DbType.Int64, ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIC_ESQUEMACALCULO", DbType.String, ParameterDirection.Input),
												   new DAABRequest.Parameter("K_NROLOG", DbType.String , ParameterDirection.Output),
												   new DAABRequest.Parameter("K_DESLOG", DbType.String , ParameterDirection.Output)
												   
											   };

			for (int i = 0; i < arrParam.Length; i++)
				arrParam[i].Value = DBNull.Value;

			arrParam[0].Value = pNropedido;
			arrParam[1].Value = pCodConsecutivo;
			arrParam[2].Value = pEsquemaCalcu;
			
			BDMSSAP obj = new BDMSSAP(BaseDatos.BD_MSSAP);
			DAABRequest obRequest = obj.CreaRequest();
			obRequest.CommandType = CommandType.StoredProcedure;
			obRequest.Command = BaseDatos.PKG_VENTA + ".SSAPSU_RECALCULARESQUEMA";
			obRequest.Parameters.AddRange(arrParam);
			obRequest.Transactional = true;

			try
			{
				obRequest.Factory.ExecuteNonQuery(ref obRequest);
				obRequest.Factory.CommitTransaction();
				IDataParameter pSalida1;
				IDataParameter pSalida2;
				pSalida1 = (IDataParameter)obRequest.Parameters[3];
				pSalida2 = (IDataParameter)obRequest.Parameters[4];

				pNrolog = Funciones.CheckStr(pSalida1.Value);
				pDeslog = Funciones.CheckStr(pSalida2.Value);
			}
			catch (Exception ex)
			{
				obRequest.Factory.RollBackTransaction();
				pNrolog="-1";
				pDeslog = ex.Message.ToString();
				throw ex;
			}
			finally
			{
				obRequest.Factory.Dispose();				
			}
		}
Exemple #6
0
		public bool EliminarPedidoMSSASP(Int64 p_nroPedido, string tipoficina)
		{
			//string pestado = Convert.ToString(System.Configuration.ConfigurationSettings.AppSettings["codPedidoEstadoAnular"]);
			DAABRequest.Parameter[] arrParam = {
												   new DAABRequest.Parameter("K_PEDIN_NROPEDIDO", DbType.Int64, ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIC_TIPOOFICINA", DbType.String , ParameterDirection.Input)
												   
											   };

			for (int i = 0; i < arrParam.Length; i++)
				arrParam[i].Value = DBNull.Value;

			if (p_nroPedido > 0)
			{
				arrParam[0].Value = p_nroPedido;
				arrParam[1].Value = tipoficina;
			}

			bool salida = false;
			
			BDMSSAP obj = new BDMSSAP(BaseDatos.BD_MSSAP);
			DAABRequest obRequest = obj.CreaRequest();
			obRequest.CommandType = CommandType.StoredProcedure;
			obRequest.Command = BaseDatos.PKG_VENTA + ".SSAPSD_LIBERARPEDIDO";
			obRequest.Parameters.AddRange(arrParam);
			obRequest.Transactional=true;

			try
			{
				obRequest.Factory.ExecuteNonQuery(ref obRequest);
				obRequest.Factory.CommitTransaction();
				salida = true;

			}
			catch (Exception ex)
			{
				throw ex;
			}
			finally
			{
				
				obRequest.Parameters.Clear();
				obRequest.Factory.Dispose();
			}
			return salida;
		}
        public DataSet ConsultaCliente(string tipoDocCliente, string nroDocCliente)
        {
            DataSet dtbLista;

            DAABRequest.Parameter[] arrParam =
            {
                new DAABRequest.Parameter("K_CLIEC_TIPODOCCLIENTE", DbType.String, ParameterDirection.Input),
                new DAABRequest.Parameter("K_CLIEV_NRODOCCLIENTE",  DbType.String, ParameterDirection.Input),
                new DAABRequest.Parameter("CU_CLIENTE",             DbType.Object, ParameterDirection.Output)
            };


            for (int i = 0; i < arrParam.Length; i++)
            {
                arrParam[i].Value = DBNull.Value;
            }

            arrParam[0].Value = tipoDocCliente;
            arrParam[1].Value = nroDocCliente;

            BDMSSAP     obj       = new BDMSSAP(BaseDatos.BD_MSSAP);
            DAABRequest obRequest = obj.CreaRequest();

            obRequest.CommandType = CommandType.StoredProcedure;
            obRequest.Command     = BaseDatos.PKG_CONSULTA_MSSAP + Constantes.MSSapDatosCliente;        //dga
            //obRequest.Command = BaseDatos.PkgMSSap + Constantes.MSSapDatosCliente;
            obRequest.Parameters.AddRange(arrParam);

            //BEClienteSAP oConsultaCliente = null;

            try
            {
                dtbLista = obRequest.Factory.ExecuteDataset(ref obRequest);                 //.Tables[0];
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                obRequest.Parameters.Clear();
                obRequest.Factory.Dispose();
            }
            return(dtbLista);
        }
Exemple #8
0
		public bool CambiarEstadoSerie(string p_CodSerie,string p_estado, ref string strMensaje)
		{
			DAABRequest.Parameter[] arrParam = {
				new DAABRequest.Parameter("K_SERIC_CODSERIE", DbType.String, ParameterDirection.Input),												   
				new DAABRequest.Parameter("K_SERIC_ESTADO", DbType.String , ParameterDirection.Input),
			};

			for (int i = 0; i < arrParam.Length; i++)
				arrParam[i].Value = DBNull.Value;

			if (p_CodSerie != "")
			{
				arrParam[0].Value = p_CodSerie;
				arrParam[1].Value = p_estado;				
			}

			bool salida = false;

			BDMSSAP obj = new BDMSSAP(BaseDatos.BD_MSSAP);
			DAABRequest obRequest = obj.CreaRequest();
			obRequest.CommandType = CommandType.StoredProcedure;
			obRequest.Command = BaseDatos.PKG_CONSULTA_MSSAP + ".SSAPSU_ACTUALIZARESTADOSERIE";
			//obRequest.Command = BaseDatos.PkgMSSap + ".SSAPSU_ACTUALIZARESTADOSERIE";
			obRequest.Parameters.AddRange(arrParam);

			try
			{
				obRequest.Factory.ExecuteNonQuery(ref obRequest);

				salida = true;
			}
			catch (Exception ex)
			{
				strMensaje = ex.Message.ToString();
				throw ex;

			}
			finally
			{

				obRequest.Factory.Dispose();
			}
			return salida;
		}
Exemple #9
0
		//Flujo DRA 14/10/2015
		public bool ActualizarPedidoDRA(int nroGeneradoSap, string nroAsociadoDRA, ref string oNroError, ref string oDescError)
		{
			oNroError = "-1";
			oDescError = string.Empty;

			DAABRequest.Parameter[] arrParam = {
												   new DAABRequest.Parameter("K_PEDIN_NROPEDIDO", DbType.Int64, ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIV_DRAASOCIADO", DbType.String, ParameterDirection.Input),
												   new DAABRequest.Parameter("K_NROLOG", DbType.String, ParameterDirection.Output),
												   new DAABRequest.Parameter("K_DESLOG", DbType.String, ParameterDirection.Output) 
											   };

			for (int i = 0; i < arrParam.Length; i++)
				arrParam[i].Value = DBNull.Value;

			arrParam[0].Value = nroGeneradoSap;
			arrParam[1].Value = nroAsociadoDRA;

			bool salida = false;

			BDMSSAP obj = new BDMSSAP(BaseDatos.BD_MSSAP);
			DAABRequest obRequest = obj.CreaRequest();
			obRequest.CommandType = CommandType.StoredProcedure;
			obRequest.Command = BaseDatos.PKG_VENTA + ".SSAPSU_UPDATEDRAPEDIDO";
			obRequest.Parameters.AddRange(arrParam);

			try
			{
				obRequest.Factory.ExecuteNonQuery(ref obRequest);
				oNroError = Funciones.CheckStr(((IDataParameter)obRequest.Parameters[2]).Value);
				oDescError = Funciones.CheckStr(((IDataParameter)obRequest.Parameters[3]).Value);

				salida = true;
			}
			catch (Exception ex)
			{
				throw ex;
			}
			finally
			{
				obRequest.Factory.Dispose();
			}
			return salida;
		}
        //Flujo DRA 14/10/2015
        public bool ObtenerInterlocutorPadre(string codInterlocutor, ref string codInterlocutorPadre)
        {
            DAABRequest.Parameter[] arrParam = { new DAABRequest.Parameter("K_INTEV_CODINTERLOCUTOR", DbType.String, ParameterDirection.Input),
                                                 new DAABRequest.Parameter("K_INTEV_CODPADRE",        DbType.String, ParameterDirection.Output) };

            bool retorno = false;
            int  i       = 0;

            for (i = 0; i < arrParam.Length; i++)
            {
                arrParam[i].Value = DBNull.Value;
            }

            arrParam[0].Value = codInterlocutor;

            BDMSSAP     obj       = new BDMSSAP(BaseDatos.BD_MSSAP);
            DAABRequest obRequest = obj.CreaRequest();

            obRequest.CommandType = CommandType.StoredProcedure;
            obRequest.Command     = BaseDatos.PKG_CONSULTA_MSSAP + ".SSAPSS_CONSULTAPADRE_INTER";
            obRequest.Parameters.AddRange(arrParam);

            try
            {
                obRequest.Factory.ExecuteNonQuery(ref obRequest);

                IDataParameter parSalida;
                parSalida            = (IDataParameter)obRequest.Parameters[1];
                codInterlocutorPadre = Funciones.CheckStr(parSalida.Value);

                retorno = true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                obRequest.Parameters.Clear();
                obRequest.Factory.Dispose();
            }

            return(retorno);
        }
Exemple #11
0
		public bool ActualizarEstadoPedido ( BEParametrosMSSAP oParamMSSAP)
		{
			DAABRequest.Parameter[] arrParam = {
												   new DAABRequest.Parameter("K_PEDIN_NROPEDIDO", DbType.Int64, ParameterDirection.Input),												   
												   new DAABRequest.Parameter("K_PEDIC_ESTADO", DbType.String , ParameterDirection.Input)
			};

			for (int i = 0; i < arrParam.Length; i++)
				arrParam[i].Value = DBNull.Value;

			arrParam[0].Value = oParamMSSAP.IdPedidoMSSAP;
			arrParam[1].Value = oParamMSSAP.EstadoPedidoMSSAP;
			
			string nroError=string.Empty, desError=string.Empty;
			BDMSSAP obj = new BDMSSAP(BaseDatos.BD_MSSAP);
			DAABRequest obRequest = obj.CreaRequest();
			obRequest.CommandType = CommandType.StoredProcedure;
            obRequest.Command = BaseDatos.PKG_CONSULTA_MSSAP+ ".SSAPSU_ACTUALIZARPAGO";
			//obRequest.Command = BaseDatos.PkgMSSap+ ".SSAPSU_ACTUALIZARPAGO";
			obRequest.Parameters.AddRange(arrParam);

			try
			{
				obRequest.Factory.ExecuteNonQuery(ref obRequest);
//				nroError = Funciones.CheckStr(((IDataParameter)obRequest.Parameters[2]).Value);
//				desError = Funciones.CheckStr(((IDataParameter)obRequest.Parameters[3]).Value);		
				nroError="0";
			}
			catch (Exception ex)
			{
				nroError="-1";
				desError = ex.Message.ToString();
				throw ex;
			}
			finally
			{
				obRequest.Factory.Dispose();				
			}
			return nroError=="0";			
		}
        public ArrayList ConsultarStock(string pcodOficina, string pdesOficina, string pTipoOficina)
        {
            DAABRequest.Parameter[] arrParam =
            {
                new DAABRequest.Parameter("K_OFICV_CODOFICINA",  DbType.String, ParameterDirection.Input),
                new DAABRequest.Parameter("K_OFICV_DESCRIPCION", DbType.String, ParameterDirection.Input),
                new DAABRequest.Parameter("K_OFICC_TIPOOFICINA", DbType.String, ParameterDirection.Input),
                new DAABRequest.Parameter("K_RESULT_SET",        DbType.Object, ParameterDirection.Output)
            };

            for (int i = 0; i < arrParam.Length; i++)
            {
                arrParam[i].Value = DBNull.Value;
            }
            BEParametroOficina oPar = ParametrosOficina(pcodOficina);

            arrParam[0].Value = oPar.codigoOficinaMSSAP; //pcodOficina;
            arrParam[1].Value = "";                      //pdesOficina;
            arrParam[2].Value = oPar.TipoOficina;

            BDMSSAP     obj       = new BDMSSAP(BaseDatos.BD_MSSAP);
            DAABRequest obRequest = obj.CreaRequest();

            obRequest.CommandType = CommandType.StoredProcedure;
            obRequest.Command     = BaseDatos.PKG_CONSULTA_MSSAP + Constantes.MSSapStockDisponible;        //dga
            //obRequest.Command = BaseDatos.PkgMSSap + Constantes.MSSapStockDisponible;


            obRequest.Parameters.AddRange(arrParam);

            ArrayList   filas = new ArrayList();
            IDataReader dr    = null;

            try
            {
                dr = obRequest.Factory.ExecuteReader(ref obRequest).ReturnDataReader;
                while (dr.Read())
                {
                    //BEConsultaStock item = new BEConsultaStock();
                    ItemGenerico item = new ItemGenerico();
                    item.Codigo       = Funciones.CheckStr(dr["MATEC_CODMATERIAL"]);
                    item.Descripcion  = Funciones.CheckStr(dr["MATEV_DESCMATERIAL"]);
                    item.stockVenta   = Funciones.CheckInt(dr["STOCN_LIBRE"]);
                    item.tipoMaterial = Funciones.CheckStr(dr["MATEC_TIPOMATERIAL"]);

                    filas.Add(item);
                }
            }
            catch (Exception ex)
            {
                throw (ex);
                //return ex.Message;
            }
            finally
            {
                if (dr != null && dr.IsClosed == false)
                {
                    dr.Close();
                }
                obRequest.Parameters.Clear();
                obRequest.Factory.Dispose();
            }

            return(filas);
        }
        //05102015 SSAPSS_OFICINA

        public ItemGenerico ConsultarSerieXPDV(string strCodOficina, string strDesOficina)
        {
            DAABRequest.Parameter[] arrParam =
            {
                new DAABRequest.Parameter("K_OFICV_CODOFICINA",  DbType.String, ParameterDirection.Input),
                new DAABRequest.Parameter("K_OFICV_DESCRIPCION", DbType.String, ParameterDirection.Input),
                new DAABRequest.Parameter("K_RESULT_SET",        DbType.Object, ParameterDirection.Output)
            };

            for (int i = 0; i < arrParam.Length; i++)
            {
                arrParam[i].Value = DBNull.Value;
            }

            arrParam[0].Value = strCodOficina;            //pCodOficina;
            arrParam[1].Value = strDesOficina;            //pDesOficina;

            BDMSSAP     obj       = new BDMSSAP(BaseDatos.BD_MSSAP);
            DAABRequest obRequest = obj.CreaRequest();

            obRequest.CommandType = CommandType.StoredProcedure;
            obRequest.Command     = BaseDatos.PKG_CONSULTA_MSSAP + ".SSAPSS_OFICINA";        //dga
            //obRequest.Command = BaseDatos.PkgMSSap + Constantes.MSSapValidaSeries;

            obRequest.Transactional = true;
            obRequest.Parameters.AddRange(arrParam);
            ItemGenerico item = new ItemGenerico();
            IDataReader  dr   = null;

            try
            {
                dr = obRequest.Factory.ExecuteReader(ref obRequest).ReturnDataReader;

                if (dr != null)
                {
                    while (dr.Read())
                    {
                        //item = new BEArticulo();
                        item                      = new ItemGenerico();
                        item.Codigo               = Funciones.CheckStr(dr["OFICV_CODOFICINA"]);
                        item.Descripcion          = Funciones.CheckStr(dr["OFICV_DESCRIPCION"]);
                        item.CodInterlocutorPadre = Funciones.CheckStr(dr["INTEV_CODPADRE"]);
                    }
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                if (dr != null && dr.IsClosed == false)
                {
                    dr.Close();
                }
                obRequest.Parameters.Clear();
                obRequest.Factory.Dispose();
            }

            return(item);
        }
        private BEParametroOficina ParametrosOficinaMSSAP(string sCodigoOficina)
        {
            DAABRequest.Parameter[] arrParam =
            {
                new DAABRequest.Parameter("K_OFICV_CODOFICINA",  DbType.String, ParameterDirection.Input),
                new DAABRequest.Parameter("K_OFICV_DESCRIPCION", DbType.String, ParameterDirection.Input),
                new DAABRequest.Parameter("K_RESULT_SET",        DbType.Object, ParameterDirection.Output)
            };

            int i = 0;

            for (i = 0; i < arrParam.Length; i++)
            {
                arrParam[i].Value = DBNull.Value;
            }

            arrParam[0].Value = sCodigoOficina;

            BDMSSAP     obj       = new BDMSSAP(BaseDatos.BD_MSSAP);
            DAABRequest obRequest = obj.CreaRequest();

            obRequest.CommandType = CommandType.StoredProcedure;
            obRequest.Command     = BaseDatos.PKG_CONSULTA_MSSAP + ".SSAPSS_OFICINA";
            obRequest.Parameters.AddRange(arrParam);

            BEParametroOficina item = new BEParametroOficina();

            IDataReader dr = null;

            try
            {
                dr = obRequest.Factory.ExecuteReader(ref obRequest).ReturnDataReader;
                if (dr != null)
                {
                    while (dr.Read())
                    {
                        item = new BEParametroOficina();
                        item.codigoOficinaVenta = Funciones.CheckStr(dr["OFICV_CODOFICINA"]);
                        item.DescripcionOficina = Funciones.CheckStr(dr["OFICV_DESCRIPCION"]);
                        item.codigoCentro       = Funciones.CheckStr(dr["OFICC_CODCENTRO"]);
                        item.codigoAlmacen      = Funciones.CheckStr(dr["OFICC_CODALMACEN"]);
                        item.CodigoRegion       = Funciones.CheckStr(dr["OFICC_REGION"]);
                        item.orgVenta           = Funciones.CheckStr(dr["OFICC_ORGVENTA"]);
                    }
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                if (dr != null && dr.IsClosed == false)
                {
                    dr.Close();
                }
                obRequest.Parameters.Clear();
                obRequest.Factory.Dispose();
            }
            return(item);
        }
        public ItemGenerico ConsultaPrecioVenta(string codMaterial, string codSerie, double preBase, double preVenta)
        {
            DAABRequest.Parameter[] arrParam =
            {
                new DAABRequest.Parameter("K_PREVC_CODMATERIAL",     DbType.String,  ParameterDirection.Input),
                new DAABRequest.Parameter("K_PREVC_CODSERIE",        DbType.String,  ParameterDirection.Input),
                new DAABRequest.Parameter("K_PREVN_PRECIOBASE",      DbType.Decimal, ParameterDirection.Input),
                new DAABRequest.Parameter("K_PREVN_PRECIOVENTA",     DbType.Decimal, ParameterDirection.Input),
                new DAABRequest.Parameter("K_PREVC_CODMATERIAL_OUT", DbType.String,  ParameterDirection.Output),
                new DAABRequest.Parameter("K_PREVV_DESCRIPCION_OUT", DbType.String,  ParameterDirection.Output),
                new DAABRequest.Parameter("K_PREVC_CODSERIE_OUT",    DbType.String,  ParameterDirection.Output),
                new DAABRequest.Parameter("K_PREVN_PRECIOBASE_OUT",  DbType.Decimal, ParameterDirection.Output),
                new DAABRequest.Parameter("K_PREVN_PRECIOVENTA_OUT", DbType.Decimal, ParameterDirection.Output),
                new DAABRequest.Parameter("K_PREVN_DESCUENTO_OUT",   DbType.Decimal, ParameterDirection.Output),
                new DAABRequest.Parameter("K_PREVN_IGV_OUT",         DbType.Decimal, ParameterDirection.Output),
                new DAABRequest.Parameter("K_PREVN_TOTAL_OUT",       DbType.Decimal, ParameterDirection.Output)
            };

            for (int i = 0; i < arrParam.Length; i++)
            {
                arrParam[i].Value = DBNull.Value;
            }

//			arrParam[0].Value = codMaterial;
//			arrParam[1].Value = codSerie;
//			arrParam[2].Value = preBase;
//			arrParam[3].Value = preVenta;

            arrParam[0].Value = codMaterial;
            arrParam[1].Value = codSerie;
            arrParam[2].Value = preBase;
            arrParam[3].Value = preVenta;

            BDMSSAP     obj       = new BDMSSAP(BaseDatos.BD_MSSAP);
            DAABRequest obRequest = obj.CreaRequest();

            obRequest.CommandType = CommandType.StoredProcedure;
            obRequest.Command     = BaseDatos.PKG_CONSULTA_MSSAP + Constantes.MSSapPrecioVenta;        //dga
            //obRequest.Command = BaseDatos.PkgMSSap + Constantes.MSSapPrecioVenta;

            obRequest.Transactional = true;
            obRequest.Parameters.AddRange(arrParam);

            //ArrayList filas = new ArrayList();
            IDataReader  dr   = null;
            ItemGenerico item = new ItemGenerico();

            try
            {
                dr = obRequest.Factory.ExecuteReader(ref obRequest).ReturnDataReader;
                if (dr != null)
                {
//					while(dr.Read())
//					{
                    item                 = new ItemGenerico();
                    item.Codigo          = codMaterial;
                    item.Descripcion     = Funciones.CheckStr(((IDataParameter)obRequest.Parameters[5]).Value);
                    item.PrecioBase      = preBase;
                    item.PrecioCompra    = preVenta;
                    item.CodMaterial_Out = Funciones.CheckStr(((IDataParameter)obRequest.Parameters[4]).Value);
                    item.Descripcion_Out = Funciones.CheckStr(((IDataParameter)obRequest.Parameters[5]).Value);
                    item.CodSerie_Out    = Funciones.CheckStr(((IDataParameter)obRequest.Parameters[6]).Value);
                    item.PrecioBase_Out  = Convert.ToDecimal(((IDataParameter)obRequest.Parameters[7]).Value);
                    item.PrecioVenta_Out = Convert.ToDecimal(((IDataParameter)obRequest.Parameters[8]).Value);
                    item.Descuento_Out   = Convert.ToDecimal(((IDataParameter)obRequest.Parameters[9]).Value);
                    item.Igv_Out         = Convert.ToDecimal(((IDataParameter)obRequest.Parameters[10]).Value);
                    item.Total_Out       = Convert.ToDecimal(((IDataParameter)obRequest.Parameters[11]).Value);
                    //filas.Add(item);
//					}
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                if (dr != null && dr.IsClosed == false)
                {
                    dr.Close();
                }
                obRequest.Parameters.Clear();
                obRequest.Factory.Dispose();
            }

            return(item);
        }
Exemple #16
0
		public static Int64 RegistrarPedido(string CadenaCabecera, ref string codResp, ref string msgResp)
		{
			int i;
			Int64 nroPedidoMsSap = 0;
			string[] arrDBAcuerdo = CadenaCabecera.Split(Convert.ToChar(";"));

			DAABRequest.Parameter[] arrParam = {   new DAABRequest.Parameter("K_OFICV_CODOFICINA", DbType.String,  ParameterDirection.Input),
												   new DAABRequest.Parameter("K_INTEV_CODINTERLOCUTOR", DbType.String,  ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIC_TIPODOCUMENTO", DbType.String,  ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIC_ORGVENTA", DbType.String,  ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIC_CANALVENTA", DbType.String,  ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIC_SECTOR", DbType.String,  ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIC_TIPOVENTA", DbType.String, ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDID_FECHADOCUMENTO", DbType.DateTime, ParameterDirection.Input), //D
												   new DAABRequest.Parameter("K_PEDIV_MOTIVOPEDIDO", DbType.String,  ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIC_CLASEFACTURA", DbType.String,  ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIV_DESCCLASEFACTURA", DbType.String,  ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIV_DESTINOMERCADERIA", DbType.String, ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIC_CLASEPEDIDO", DbType.String,  ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIC_CODTIPOOPERACION", DbType.String,  ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIV_DESCTIPOOPERACION", DbType.String,  ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDID_FECHAENTREGA", DbType.DateTime, ParameterDirection.Input), //D
												   new DAABRequest.Parameter("K_PEDIV_SISTEMAVENTA", DbType.String,  ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIV_CODVENDEDOR", DbType.String, ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIC_ESTADO", DbType.String,  ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIC_ISRENTA", DbType.String,  ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIN_PEDIDOALTA", DbType.String, ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIV_UBIGEO", DbType.String,  ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIC_ESQUEMACALCULO", DbType.String,  ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIC_TIPODOCCLIENTE", DbType.String,  ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIV_NRODOCCLIENTE", DbType.String,  ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIC_TIPOCLIENTE", DbType.String,  ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIV_NOMBRECLIENTE", DbType.String,  ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIV_PATERNOCLIENTE", DbType.String,  ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIV_MATERNOCLIENTE", DbType.String,  ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDID_NACIMIENTOCLIENTE",DbType.Date , ParameterDirection.Input),//D
												   new DAABRequest.Parameter("K_PEDIV_RAZONSOCIAL", DbType.String,  ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIV_CORREOCLIENTE", DbType.String,  ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIV_TELEFONOCLIENTE", DbType.String,  ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIC_ESTADOCIVILCLIENTE", DbType.String,  ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIV_DIRECCIONCLIENTE", DbType.String,  ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIN_NUMEROCALLE", DbType.String, ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIV_DISTRITOCLIENTE", DbType.String,  ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIC_CODDPTOCLIENTE", DbType.String,  ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIV_PAISCLIENTE", DbType.String,  ParameterDirection.Input),                                                   
												   new DAABRequest.Parameter("K_PEDIC_RLTIPODOCUMENTO", DbType.String,  ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIV_RLNRODOCUMENTO", DbType.String,  ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIV_RLPATERNOCLIENTE", DbType.String,  ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIV_RLMATERNOCLIENTE", DbType.String,  ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIV_RLNOMBRE", DbType.String,  ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIC_TIPOOFICINA", DbType.String,  ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIC_ISSISCAD", DbType.String,  ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDIV_USUARIOCREA", DbType.String,  ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDID_FECHACREA", DbType.DateTime, ParameterDirection.Input), //D
												   new DAABRequest.Parameter("K_PEDIV_USUARIOMODI", DbType.String,  ParameterDirection.Input),
												   new DAABRequest.Parameter("K_PEDID_FECHAMODI", DbType.DateTime, ParameterDirection.Input), //D
												   new DAABRequest.Parameter("K_PEDIC_FLAGLP", DbType.String, ParameterDirection.Input), 
												   new DAABRequest.Parameter("K_PEDIN_NROPEDIDO", DbType.Int64, ParameterDirection.Output),
												   new DAABRequest.Parameter("K_NROLOG", DbType.String,  ParameterDirection.Output),
												   new DAABRequest.Parameter("K_DESLOG", DbType.String, ParameterDirection.Output)
											   };

			for (i = 0; i < arrParam.Length; i++)
				arrParam[i].Value = DBNull.Value;

			for (i = 0; i < arrDBAcuerdo.Length; i++)
			{
				if (arrDBAcuerdo[i]!= null  &&  arrDBAcuerdo[i].Trim() != "")
				{
					if (arrParam[i].DbType== DbType.DateTime )
					{
						arrParam[i].Value = Funciones.CheckDate(arrDBAcuerdo[i]).ToLongDateString();
					}
					if (arrParam[i].DbType== DbType.Date )
					{
						arrParam[i].Value = Funciones.CheckDate(arrDBAcuerdo[i]).ToShortDateString();
					}	
					else if (arrParam[i].DbType== DbType.Decimal)
					{
						arrParam[i].Value = Funciones.CheckDecimal(arrDBAcuerdo[i]);
					}
					else if (arrParam[i].DbType== DbType.Double)
					{
						arrParam[i].Value = Funciones.CheckDbl(arrDBAcuerdo[i]);
					}
					else if (arrParam[i].DbType== DbType.Int64)
					{
						arrParam[i].Value = Funciones.CheckInt64(arrDBAcuerdo[i]);
					}
					else if (arrParam[i].DbType== DbType.Int32)
					{
						arrParam[i].Value = Funciones.CheckInt(arrDBAcuerdo[i]);
			}
					else
			{
						arrParam[i].Value = arrDBAcuerdo[i];
					}
				}
			}

			BDMSSAP obj = new BDMSSAP(BaseDatos.BD_MSSAP);
			DAABRequest obRequest = obj.CreaRequest();
			obRequest.CommandType = CommandType.StoredProcedure;
			//obRequest.Command = BaseDatos.PkgMSSap + ".SSAPSI_PEDIDO";
			obRequest.Command = BaseDatos.PKG_CONSULTA_MSSAP + ".SSAPSI_PEDIDO";//dga
			obRequest.Parameters.AddRange(arrParam);
			obRequest.Transactional = true;

			try
			{
				obRequest.Factory.ExecuteNonQuery(ref obRequest);
				obRequest.Factory.CommitTransaction();
				IDataParameter pSalida0;
				IDataParameter pSalida1;
				IDataParameter pSalida2;
				pSalida0 = (IDataParameter)obRequest.Parameters[51];
				pSalida1 = (IDataParameter)obRequest.Parameters[52];
				pSalida2 = (IDataParameter)obRequest.Parameters[53];
				nroPedidoMsSap = Funciones.CheckInt64(pSalida0.Value);
				codResp = Funciones.CheckStr(pSalida1.Value);
				msgResp = Funciones.CheckStr(pSalida2.Value);
			}
			catch (Exception ex)
			{
				codResp = "-99";
				msgResp = ex.Message.ToString();
				obRequest.Factory.RollBackTransaction();
			}
			finally
			{
				obRequest.Parameters.Clear();
				obRequest.Factory.Dispose();
			}
			return nroPedidoMsSap;
		}
        public ItemGenerico ConsultarSerie(string pcodSerie)
        {
            DAABRequest.Parameter[] arrParam =
            {
                new DAABRequest.Parameter("K_SERIC_CODSERIE", DbType.String, ParameterDirection.Input),
                new DAABRequest.Parameter("K_RESULT_SET",     DbType.Object, ParameterDirection.Output)
            };

            for (int i = 0; i < arrParam.Length; i++)
            {
                arrParam[i].Value = DBNull.Value;
            }
            arrParam[0].Value = pcodSerie;
            BDMSSAP     obj       = new BDMSSAP(BaseDatos.BD_MSSAP);
            DAABRequest obRequest = obj.CreaRequest();

            obRequest.CommandType = CommandType.StoredProcedure;
            obRequest.Command     = BaseDatos.PKG_CONSULTA_MSSAP + Constantes.MSSapValidaSeries;        //dga
            //obRequest.Command = BaseDatos.PkgMSSap + Constantes.MSSapValidaSeries;

            obRequest.Transactional = true;
            obRequest.Parameters.AddRange(arrParam);

            ItemGenerico item = new ItemGenerico();
            IDataReader  dr   = null;

            try
            {
                dr = obRequest.Factory.ExecuteReader(ref obRequest).ReturnDataReader;

                if (dr != null)
                {
                    while (dr.Read())
                    {
                        //item = new BEArticulo();
                        item                 = new ItemGenerico();
                        item.Codigo          = Funciones.CheckStr(dr["MATEC_CODMATERIAL"]);
                        item.Descripcion     = Funciones.CheckStr(dr["MATEV_DESCMATERIAL"]);
                        item.serie           = Funciones.CheckStr(dr["SERIC_CODSERIE"]);
                        item.estado          = Funciones.CheckStr(dr["SERIC_ESTADO"]);
                        item.PuntoVenta      = Funciones.CheckStr(dr["OFICV_CODOFICINA"]);
                        item.Tipo            = Funciones.CheckStr(dr["MATEC_TIPOMATERIAL"]);
                        item.CodInterlocutor = Funciones.CheckStr(dr["INTEV_CODPADRE"]);
                    }
                }
            }
            catch (Exception ex)
            {
                //CAMBIO!!!
                item = null;
                HelperLog.CrearArchivolog("Error en el Catch:", ex.Message, "", "", "");
            }
            finally
            {
                if (dr != null && dr.IsClosed == false)
                {
                    dr.Close();
                }
                obRequest.Parameters.Clear();
                obRequest.Factory.Dispose();
            }

            return(item);
        }
        public ArrayList ConsultarPoolPagos(string strCadenaParametros)
        {
            //BEParametroOficina oConsultaParametrosOficina = ConsultaParametrosOficina(Funciones.CheckStr(strCadenaParametros.Split(';')[2]),null);


            DAABRequest.Parameter[] arrParam =
            {
                new DAABRequest.Parameter("K_PEDIC_ESTADO",         DbType.String, ParameterDirection.Input),
                new DAABRequest.Parameter("K_PEDID_FECHADOCUMENTO", DbType.Date,   ParameterDirection.Input),
                new DAABRequest.Parameter("K_OFICV_CODOFICINA",     DbType.String, ParameterDirection.Input),
                new DAABRequest.Parameter("CU_ESTADOPEDIDO",        DbType.Object, ParameterDirection.Output)
            };

            for (int i = 0; i < arrParam.Length; i++)
            {
                arrParam[i].Value = DBNull.Value;
            }

            arrParam[0].Value = Funciones.CheckStr(strCadenaParametros.Split(';')[0]);
            arrParam[1].Value = Funciones.CheckDate(strCadenaParametros.Split(';')[1]).ToString("dd/MM/yyyy");
            arrParam[2].Value = "0004070046";

            BDMSSAP     obj       = new BDMSSAP(BaseDatos.BD_MSSAP);
            DAABRequest obRequest = obj.CreaRequest();

            obRequest.CommandType = CommandType.StoredProcedure;
            obRequest.Command     = BaseDatos.PKG_CONSULTA_MSSAP + ".SSAPSS_DIP_POOLPAGOS";        //dga
            //obRequest.Command = BaseDatos.PkgMSSap + ".SSAPSS_DIP_POOLPAGOS";
            obRequest.Parameters.AddRange(arrParam);

            ArrayList   filas = new ArrayList();
            IDataReader dr    = null;

            try
            {
                dr = obRequest.Factory.ExecuteReader(ref obRequest).ReturnDataReader;
                while (dr.Read())
                {
                    Documento item = new Documento();
                    item.DOCUMENTO_SAP      = Funciones.CheckStr(dr["PEDIN_NROPEDIDO"]);
                    item.FECHA              = Funciones.CheckStr(dr["PEDID_FECHADOCUMENTO"]);
                    item.NOMBRE_CLIENTE     = Funciones.CheckStr(dr["PEDIV_NOMBRECLIENTE"]);
                    item.IMPORTE            = Funciones.CheckDbl(dr["INPAN_TOTALDOCUMENTO"]);
                    item.SALDO              = Funciones.CheckDbl(dr["PEDIN_SALDO"]);
                    item.TIPO_DOCUMENTO_DES = Funciones.CheckStr(dr["PEDIV_DESCCLASEFACTURA"]);
                    item.FACTURA_SUNAT      = Funciones.CheckStr(dr["PAGOC_CODSUNAT"]).Replace("*", "");
                    try { if (Funciones.CheckInt(item.FACTURA_SUNAT) == 0)
                          {
                              item.FACTURA_SUNAT = "";
                          }
                    }
                    catch {}
                    item.UTILIZACION      = String.Empty;
                    item.UTILIZACION_DES  = String.Empty;
                    item.CUOTAS           = String.Empty;
                    item.MONEDA           = Funciones.CheckStr(dr["PEDIC_MONEDA"]);
                    item.NETO             = Funciones.CheckDbl(dr["INPAN_TOTALMERCADERIA"]);
                    item.IMPUESTO         = Funciones.CheckDbl(dr["INPAN_TOTALIMPUESTO"]);
                    item.PAGOS            = Funciones.CheckDbl(dr["PEDIN_PAGO"]);
                    item.NRO_DEP_GARANTIA = String.Empty;
                    item.NRO_REF_DEP_GAR  = String.Empty;
                    item.FLAG_REPOSICION  = "N";


                    //------------------------------------Agregar Campo Nro Celular - Oliver Rivera ------------------------------------//

                    item.NRO_CELULAR = String.Empty;

                    //------------------------------------Agregar Campo Nro Celular - Oliver Rivera ------------------------------------//


                    item.NRO_CONTRATO = item.DOCUMENTO_SAP;                    // Funciones.CheckStr(dr["NRO_CONTRATO"]);
                    if (Funciones.IsContratoVacio(item.NRO_CONTRATO))
                    {
                        item.NRO_CONTRATO = string.Empty;
                        item.NRO_SEC      = item.DOCUMENTO_SAP;                   //oConsultaExpressPorta.ObtenerSecByPedido(item.DOCUMENTO_SAP);
                    }
                    else
                    {
                        item.NRO_SEC = new VentaExpressDatos().ObtenerSecMSSAP(item.NRO_CONTRATO);                        //oConsulta.ObtenerSec(item.NRO_CONTRATO);
                        if (item.NRO_SEC == "")
                        {
                            //item.NRO_SEC = oConsultaExpressPorta.ObtenerSecByContrato(item.NRO_CONTRATO);
                        }
                        //item.NRO_SEC=item.DOCUMENTO_SAP;
                    }

                    try
                    {
//						listaPlanes = oConsulta.ListarPlanesSolicitudPersona(item.NRO_SEC);
//						foreach(PlanDetalleConsumer plan in listaPlanes)
//						{
//							string CodPlan = Funciones.CheckStr(plan.PLANC_CODIGO);
//							string planes2PlayCorp = ConfigurationSettings.AppSettings["CodPlanes2PlayCorporativo"];
//							if (planes2PlayCorp.IndexOf(";" + CodPlan + ";") > -1)
//							{
//								item.FLAG = "1";
//							}
//						}
                    }
                    catch {}

                    String sNroPedido     = item.DOCUMENTO_SAP;
                    String sNroContrato   = item.NRO_CONTRATO;
                    String sTipoDocumento = Funciones.CheckStr(dr["PEDIC_CLASEFACTURA"]);
                    //Para saber si es DL o DE
                    if (sTipoDocumento == "DG")
                    {
//						DataSet dsTipoDocumento = ConsultarTipoGarantia("",sNroContrato);
//						if(dsTipoDocumento.Tables[0].Rows.Count>0)
//						{
//							sTipoDocumento = dsTipoDocumento.Tables[0].Rows[0].ItemArray[18].ToString();
//						}
                    }
                    item.CLASE_FACTURA = sTipoDocumento;
                    filas.Add(item);
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                obRequest.Parameters.Clear();
                obRequest.Factory.Dispose();
            }
            return(filas);
        }
Exemple #19
0
		public static int RegistrarPedidoDetalle(Int64 idPedido, string cadenaDetalle)
		{
			int i = 0, codResp;
			string[] arrDBAcuerdo = cadenaDetalle.Split(Convert.ToChar(";"));
			DAABRequest.Parameter[] arrParam = {
												   new DAABRequest.Parameter("K_PEDIN_NROPEDIDO", DbType.Int64,ParameterDirection.Input),
												   new DAABRequest.Parameter("K_OFICV_CODOFICINA", DbType.String,10,ParameterDirection.Input),
												   new DAABRequest.Parameter("K_INTEV_CODINTERLOCUTOR", DbType.String,20,ParameterDirection.Input),
												   new DAABRequest.Parameter("K_SERIC_CODSERIE", DbType.String,20,ParameterDirection.Input),
												   new DAABRequest.Parameter("K_DEPEC_CODMATERIAL", DbType.String,20,ParameterDirection.Input),
												   new DAABRequest.Parameter("K_DEPEV_DESCMATERIAL", DbType.String,200,ParameterDirection.Input),
												   new DAABRequest.Parameter("K_DEPEN_CANTIDAD", DbType.Int32,ParameterDirection.Input),
												   new DAABRequest.Parameter("K_DEPEN_PRECIOVENTA", DbType.Double,ParameterDirection.Input),
												   new DAABRequest.Parameter("K_DEPEV_NROTELEFONO", DbType.String,20,ParameterDirection.Input),
												   new DAABRequest.Parameter("K_DEPEV_NROCLARIFY", DbType.String,ParameterDirection.Input),
												   new DAABRequest.Parameter("K_DEPEN_NRORENTA", DbType.String,ParameterDirection.Input),
												   new DAABRequest.Parameter("K_DEPEN_TOTALRENTA", DbType.String,ParameterDirection.Input),
												   new DAABRequest.Parameter("K_DEPEN_NROCUOTA", DbType.String,ParameterDirection.Input),
												   new DAABRequest.Parameter("K_DEPEV_CODIGOLP", DbType.String,ParameterDirection.Input),
												   new DAABRequest.Parameter("K_DEPEV_DESCRIPCIONLP", DbType.String,ParameterDirection.Input),
												   new DAABRequest.Parameter("K_DEPEV_USUARIOCREA", DbType.String,20,ParameterDirection.Input),
												   new DAABRequest.Parameter("K_DEPED_FECHACREA", DbType.DateTime,ParameterDirection.Input),
												   new DAABRequest.Parameter("K_DEPEV_USUARIOMODI", DbType.String,20,ParameterDirection.Input),
												   new DAABRequest.Parameter("K_DEPED_FECHAMODI", DbType.DateTime,ParameterDirection.Input),
												   new DAABRequest.Parameter("K_DEPEC_CENTROCOSTO", DbType.String,ParameterDirection.Input),
												   new DAABRequest.Parameter("K_NROLOG", DbType.String,300,ParameterDirection.Output),
												   new DAABRequest.Parameter("K_DESLOG", DbType.String,3000,ParameterDirection.Output)
				                                   
											   };


			BDMSSAP obj = new BDMSSAP(BaseDatos.BD_MSSAP);
			DAABRequest obRequest = obj.CreaRequest();
			obRequest.CommandType = CommandType.StoredProcedure;
			obRequest.Command = BaseDatos.PKG_CONSULTA_MSSAP + ".SSAPSI_DETALLEPEDIDO";
			//obRequest.Command = BaseDatos.PkgMSSap + ".SSAPSI_DETALLEPEDIDO";
			obRequest.Parameters.AddRange(arrParam);
			obRequest.Transactional = true;

			for (i = 0; i < arrParam.Length; i++)
				arrParam[i].Value = DBNull.Value;

			for (i = 0; i < arrDBAcuerdo.Length; i++)
			{
				if (arrDBAcuerdo[i].Trim() != "")
					arrParam[i].Value = arrDBAcuerdo[i].Trim();
			}
			arrParam[0].Value = idPedido;

			if (arrDBAcuerdo[16].Trim() != "")
				arrParam[16].Value = Funciones.CheckDate(arrDBAcuerdo[16].Trim());

			if (arrDBAcuerdo[18].Trim() != "")
				arrParam[18].Value = Funciones.CheckDate(arrDBAcuerdo[18].Trim());


			try
			{
				obRequest.Factory.ExecuteNonQuery(ref obRequest);
				obRequest.Factory.CommitTransaction();

				IDataParameter pSalida0;
				IDataParameter pSalida1;
				pSalida0 = (IDataParameter)obRequest.Parameters[20];
				pSalida1 = (IDataParameter)obRequest.Parameters[21];
				codResp = Funciones.CheckInt(pSalida0.Value);
			}
			catch (Exception e)
			{
				obRequest.Factory.RollBackTransaction();
				throw e;
			}
			finally
			{
				obRequest.Parameters.Clear();
				obRequest.Factory.Dispose();
			}
			return codResp;
		}
        public ArrayList ConsultarSerieMaterial(string pCodOficina, string pDesOficina, string pCodCentro, string pcodAlmacen,
                                                string pcodMaterial, string pdescMaterial, string pTipoOficina)
        {
            //Invocara al SP SSAPSS_SERIEXMATERIAL
            DAABRequest.Parameter[] arrParam =
            {
                new DAABRequest.Parameter("K_OFICV_CODOFICINA",   DbType.String, ParameterDirection.Input),
                new DAABRequest.Parameter("K_OFICV_DESCRIPCION",  DbType.String, ParameterDirection.Input),
                //new DAABRequest.Parameter("K_SERIC_CODSERIE", DbType.String, ParameterDirection.Input),
                new DAABRequest.Parameter("K_OFICC_CODCENTRO",    DbType.String, ParameterDirection.Input),
                new DAABRequest.Parameter("K_OFICC_CODALMACEN",   DbType.String, ParameterDirection.Input),
                new DAABRequest.Parameter("K_MATEC_CODMATERIAL",  DbType.String, ParameterDirection.Input),
                new DAABRequest.Parameter("K_MATEV_DESCMATERIAL", DbType.String, ParameterDirection.Input),
                new DAABRequest.Parameter("K_OFICC_TIPOOFICINA",  DbType.String, ParameterDirection.Input),
                new DAABRequest.Parameter("K_RESULT_SET",         DbType.Object, ParameterDirection.Output)
            };

            for (int i = 0; i < arrParam.Length; i++)
            {
                arrParam[i].Value = DBNull.Value;
            }
            BEParametroOficina oPar = ParametrosOficina(pCodOficina);

            arrParam[0].Value = oPar.codigoOficinaMSSAP; //pCodOficina;
            arrParam[1].Value = "";                      //pDesOficina;
            arrParam[2].Value = oPar.codigoCentro;       //pCodCentro;
            arrParam[3].Value = oPar.codigoAlmacen;      //pcodAlmacen;
            arrParam[4].Value = pcodMaterial; HelperLog.CrearArchivolog("LOG_ConsultarSerieMaterial", arrParam[4].Value.ToString(), "", "", "");
            arrParam[5].Value = pdescMaterial; HelperLog.CrearArchivolog("LOG_ConsultarSerieMaterial", "", "", "", "");
            arrParam[6].Value = oPar.TipoOficina; HelperLog.CrearArchivolog("LOG_ConsultarSerieMaterial", arrParam[6].Value.ToString(), "", "", "");

            BDMSSAP     obj       = new BDMSSAP(BaseDatos.BD_MSSAP);
            DAABRequest obRequest = obj.CreaRequest();

            obRequest.CommandType = CommandType.StoredProcedure;
            obRequest.Command     = BaseDatos.PKG_CONSULTA_MSSAP + Constantes.MSSapSeriesMaterial;       //dga
            //obRequest.Command = BaseDatos.PkgMSSap + Constantes.MSSapSeriesMaterial;

            obRequest.Transactional = true;
            obRequest.Parameters.AddRange(arrParam);

            ArrayList   filas = new ArrayList();
            IDataReader dr    = null;

            try
            {
                dr = obRequest.Factory.ExecuteReader(ref obRequest).ReturnDataReader;

                if (dr != null)
                {
                    while (dr.Read())
                    {
                        //BEConsultaSerieMaterial item = new BEConsultaSerieMaterial();
                        ItemGenerico item = new ItemGenerico();
                        //item.Codigo = Funciones.CheckStr(dr["MATEC_CODMATERIAL"]);
                        item.Codigo       = Funciones.CheckStr(dr["SERIC_CODSERIE"]);
                        item.Descripcion  = Funciones.CheckStr(dr["MATEV_DESCMATERIAL"]);
                        item.Codigo2      = Funciones.CheckStr(dr["MATEC_CODMATERIAL"]);
                        item.serie        = Funciones.CheckStr(dr["SERIC_CODSERIE"]);
                        item.tipoMaterial = Funciones.CheckStr(dr["MATEC_TIPOMATERIAL"]);

                        filas.Add(item);
                    }
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                if (dr != null && dr.IsClosed == false)
                {
                    dr.Close();
                }
                obRequest.Parameters.Clear();
                obRequest.Factory.Dispose();
            }


            return(filas);
        }