예제 #1
0
        /// <summary>
        /// Se obtiene los datos  la licencia csp
        /// </summary>
        /// <param name=" "></param>
        /// <returns>Retorna la entidad la licencia csp </returns>
        public DataTable ObtenerDatosLicenciaCSP()
        {
            try
            {
                ZthFetchXml365.zthFetch fetch = new ZthFetchXml365.zthFetch("zth_licenciascsp", ref servicio);
                //se capturan los datos de la entidad licencia csp
                fetch.AgregarCampoRetorno("zth_licenciascsp", "zth_pais", ZthFetchXml365.zthFetch.TipoRetorno.PicklistName);
                fetch.AgregarCampoRetorno("zth_licenciascsp", "zth_cliente", ZthFetchXml365.zthFetch.TipoRetorno.LookupName);
                fetch.AgregarCampoRetorno("zth_licenciascsp", "zth_cliente", ZthFetchXml365.zthFetch.TipoRetorno.LookupValue, "guidCliente");
                fetch.AgregarCampoRetorno("zth_licenciascsp", "zth_facturara", ZthFetchXml365.zthFetch.TipoRetorno.LookupValue);
                fetch.AgregarCampoRetorno("zth_licenciascsp", "zth_cantidad", ZthFetchXml365.zthFetch.TipoRetorno.CrmNumber);
                fetch.AgregarCampoRetorno("zth_licenciascsp", "zth_producto", ZthFetchXml365.zthFetch.TipoRetorno.LookupName);
                fetch.AgregarCampoRetorno("zth_licenciascsp", "zth_producto", ZthFetchXml365.zthFetch.TipoRetorno.LookupValue, "guidProducto");


                //se agrupa los clientes y los productos


                fetch.AgregarOrdenResultadoEntidad("zth_licenciascsp", "zth_cliente",
                                                   ZthFetchXml365.zthFetch.TipoOrdenCampoResultadoEntidad.Ascendente);

                fetch.AgregarOrdenResultadoEntidad("zth_licenciascsp", "zth_producto",
                                                   ZthFetchXml365.zthFetch.TipoOrdenCampoResultadoEntidad.Ascendente);



                DataTable Dato = new DataTable();
                Dato = fetch.GeneraTblconFetchResult(false);


                if (Dato.Rows.Count > 0)
                {
                    return(Dato);
                }
                else
                {
                    return(Dato = null);
                }
            }
            catch (Exception ex)
            {
                ZthMetodosVarios.Metodos.GuardarLog(ruta, "Error al obtener los datos de licecia csp: " + ex.Message.ToString());
                return(null);
            }
        }
예제 #2
0
        /// <summary>
        /// Metodo que obtiene  la fecha de creacion de la factura
        /// </summary>
        /// <param name="mes">primera fecha para validar si esta dentro del rango </param>
        /// <param name="mes2">segunda fecha para validar si esta dentro del rango</param>
        /// <param name="idcli">Guid del cliente</param>
        /// <param name="tipo">Origen de la factura</param>
        /// <returns>retorna la fecha de la factura </returns>
        public DateTime FechaCreacionFactura(DateTime mes, DateTime mes2, string idcli)
        {
            try
            {
                ZthFetchXml365.zthFetch fetch = new ZthFetchXml365.zthFetch("invoice", ref servicio);
                //fetch.AgregarEntidadLinkJoin("invoice", "invoicedetail", (zthFetch.TipoRelacionEntidadLink)1, "invoiceid", "invoiceid");

                fetch.AgregarCampoRetorno("invoice", "createdon", ZthFetchXml365.zthFetch.TipoRetorno.CrmDateTime);
                fetch.AgregarCampoRetorno("invoice", "customerid", ZthFetchXml365.zthFetch.TipoRetorno.LookupValue);
                fetch.AgregarCampoRetorno("invoice", "customerid", ZthFetchXml365.zthFetch.TipoRetorno.LookupName, "Clientes");
                fetch.AgregarCampoRetorno("invoice", "invoicenumber", ZthFetchXml365.zthFetch.TipoRetorno.String);
                // fetch.AgregarCampoRetorno("invoice", "zth_nrofactrurafiscal", ZthFetchXml365.zthFetch.TipoRetorno.String);
                fetch.AgregarCampoRetorno("invoice", "zth_tipodeorigen", ZthFetchXml365.zthFetch.TipoRetorno.PicklistValue);
                fetch.AgregarCampoRetorno("invoice", "invoiceid", ZthFetchXml365.zthFetch.TipoRetorno.Key);

                //fetch.AgregarCampoRetorno("invoice", "invoiceid", ZthFetchXml365.zthFetch.TipoRetorno.Key);
                //  fetch.AgregarCampoRetorno("invoicedetail", "productid", ZthFetchXml365.zthFetch.TipoRetorno.LookupName);


                fetch.AgregarFiltroPlano("invoice", ZthFetchXml365.zthFetch.TipoFiltro.and, "createdon",
                                         ZthFetchXml365.zthFetch.TipoComparacionFiltro.FechaMayorIgualQue, "" + mes.Month + "/" + mes.Day + "/" + mes.Year + "");

                fetch.AgregarFiltroPlano("invoice", ZthFetchXml365.zthFetch.TipoFiltro.and, "createdon",
                                         ZthFetchXml365.zthFetch.TipoComparacionFiltro.FechaMenorIgualQue, "" + mes2.Month + "/" + mes2.Day + "/" + mes2.Year + "");

                fetch.AgregarFiltroPlano("invoice", ZthFetchXml365.zthFetch.TipoFiltro.and, "customerid",
                                         ZthFetchXml365.zthFetch.TipoComparacionFiltro.Igual, idcli);


                fetch.AgregarOrdenResultadoEntidad("invoice", "createdon",
                                                   ZthFetchXml365.zthFetch.TipoOrdenCampoResultadoEntidad.Descendiente);

                //fetch.AgregarFiltroPlano("invoice", ZthFetchXml365.zthFetch.TipoFiltro.and, "zth_tipodeorigen",
                // ZthFetchXml365.zthFetch.TipoComparacionFiltro.Igual, tipo.ToString());

                DataTable Dato = new DataTable();
                Dato = fetch.GeneraTblconFetchResult(false);

                DateTime fecha = new DateTime();
                if (Dato.Rows.Count > 0)
                {
                    return(fecha = (DateTime)Dato.Rows[0]["createdon"]);
                }
                else
                {
                    return(fecha = new DateTime());
                }
            }
            catch (Exception ex)
            {
                ZthMetodosVarios.Metodos.GuardarLog(ruta, "Error al obtener los datos de licecia csp: " + ex.Message.ToString());
                return(new DateTime());
            }
        }///------------
예제 #3
0
        /// <summary>
        ///  se obtiene los datos de la entidad Precio Licencia Cliente
        /// </summary>
        /// <returns>Retorna la entidad Precio Licencia Cliente</returns>
        public DataTable ObtenerDatosPrecioLicenciaCliente()
        {
            try
            {
                ZthFetchXml365.zthFetch fetch = new ZthFetchXml365.zthFetch("zth_preciolicenciacliente", ref servicio);
                //se capturan los datos de la entidad licencia csp
                fetch.AgregarCampoRetorno("zth_preciolicenciacliente", "zth_cliente", ZthFetchXml365.zthFetch.TipoRetorno.LookupName);
                fetch.AgregarCampoRetorno("zth_preciolicenciacliente", "zth_cliente", ZthFetchXml365.zthFetch.TipoRetorno.LookupValue, "idCliente");
                fetch.AgregarCampoRetorno("zth_preciolicenciacliente", "zth_fecha", ZthFetchXml365.zthFetch.TipoRetorno.CrmDateTime);
                fetch.AgregarCampoRetorno("zth_preciolicenciacliente", "zth_valor", ZthFetchXml365.zthFetch.TipoRetorno.CrmMoney);
                fetch.AgregarCampoRetorno("zth_preciolicenciacliente", "zth_producto", ZthFetchXml365.zthFetch.TipoRetorno.LookupName);
                fetch.AgregarCampoRetorno("zth_preciolicenciacliente", "zth_producto", ZthFetchXml365.zthFetch.TipoRetorno.LookupValue, "idProducto");
                fetch.AgregarCampoRetorno("zth_preciolicenciacliente", "zth_tipopago", ZthFetchXml365.zthFetch.TipoRetorno.PicklistName);

                fetch.AgregarOrdenResultadoEntidad("zth_preciolicenciacliente", "zth_cliente",
                                                   ZthFetchXml365.zthFetch.TipoOrdenCampoResultadoEntidad.Ascendente);

                fetch.AgregarOrdenResultadoEntidad("zth_preciolicenciacliente", "zth_producto",
                                                   ZthFetchXml365.zthFetch.TipoOrdenCampoResultadoEntidad.Ascendente);



                DataTable Dato = new DataTable();
                Dato = fetch.GeneraTblconFetchResult(false);

                if (Dato.Rows.Count > 0)
                {
                    //return Dato=Dato.Rows[0]["zth_fecha"].ToString();
                    return(Dato);
                }
                else
                {
                    return(Dato = null);
                }
            }
            catch (Exception ex)
            {
                ZthMetodosVarios.Metodos.GuardarLog(ruta, "Error al obtener los datos de precio licencia cliente: " + ex.Message.ToString());
                return(null);
            }
        }
예제 #4
0
        }//--------------------

        public DateTime ObtenerFechaCreacion(string idcli, string idpro)
        {
            try
            {
                ZthFetchXml365.zthFetch fetch = new ZthFetchXml365.zthFetch("zth_licenciascsp", ref servicio);
                //se capturan los datos de la entidad licencia csp
                fetch.AgregarCampoRetorno("zth_licenciascsp", "zth_pais", ZthFetchXml365.zthFetch.TipoRetorno.PicklistName);
                fetch.AgregarCampoRetorno("zth_licenciascsp", "createdon", ZthFetchXml365.zthFetch.TipoRetorno.CrmDateTime);
                fetch.AgregarCampoRetorno("zth_licenciascsp", "zth_cliente", ZthFetchXml365.zthFetch.TipoRetorno.LookupValue);
                fetch.AgregarCampoRetorno("zth_licenciascsp", "zth_facturara", ZthFetchXml365.zthFetch.TipoRetorno.LookupValue);
                fetch.AgregarCampoRetorno("zth_licenciascsp", "zth_cantidad", ZthFetchXml365.zthFetch.TipoRetorno.CrmNumber);
                //      fetch.AgregarCampoRetorno("zth_licenciascsp", "zth_producto", ZthFetchXml365.zthFetch.TipoRetorno.LookupName);
                fetch.AgregarCampoRetorno("zth_licenciascsp", "zth_producto", ZthFetchXml365.zthFetch.TipoRetorno.LookupValue);



                fetch.AgregarFiltroPlano("zth_licenciascsp", ZthFetchXml365.zthFetch.TipoFiltro.and, "zth_cliente",
                                         ZthFetchXml365.zthFetch.TipoComparacionFiltro.Igual, idcli);

                fetch.AgregarFiltroPlano("zth_licenciascsp", ZthFetchXml365.zthFetch.TipoFiltro.and, "zth_producto",
                                         ZthFetchXml365.zthFetch.TipoComparacionFiltro.Igual, idpro);

                fetch.AgregarOrdenResultadoEntidad("zth_licenciascsp", "createdon",
                                                   ZthFetchXml365.zthFetch.TipoOrdenCampoResultadoEntidad.Ascendente);

                DataTable Dato = new DataTable();
                Dato = fetch.GeneraTblconFetchResult(false);
                DateTime fecha = new DateTime();
                if (Dato.Rows.Count > 0)
                {
                    return(fecha = (DateTime)Dato.Rows[0]["createdon"]);
                    // return Dato;
                }
                else
                {
                    return(fecha = new DateTime());
                }
            }
            catch (Exception ex)
            {
                ZthMetodosVarios.Metodos.GuardarLog(ruta, "Error al obtener los datos de precio licencia cliente: " + ex.Message.ToString());
                return(new DateTime());
            }
        }
예제 #5
0
        }//--------------

        ///// <summary>
        /////   Metodo que obtiene la fecha de creación de la factrua
        ///// </summary>
        ///// <param name="cli"> Se da por parametor el Guid del cliente</param>
        ///// <returns>Retorna la fecha de creacion de la factura </returns>
        //public DateTime FechaCreaciónFactura (string cli ,string idfac)
        //{
        //    try
        //    {

        //        ZthFetchXml365.zthFetch fetch = new ZthFetchXml365.zthFetch("invoice", ref servicio);

        //        fetch.AgregarCampoRetorno("invoice", "createdon", ZthFetchXml365.zthFetch.TipoRetorno.CrmDateTime);
        //        fetch.AgregarCampoRetorno("invoice", "customerid", ZthFetchXml365.zthFetch.TipoRetorno.LookupName);
        //        fetch.AgregarCampoRetorno("invoice", "invoicenumber", ZthFetchXml365.zthFetch.TipoRetorno.String);

        //        //fetch.AgregarFiltroPlano("invoice", ZthFetchXml365.zthFetch.TipoFiltro.and, "customerid",
        //        //  ZthFetchXml365.zthFetch.TipoComparacionFiltro.Igual,cli);

        //        fetch.AgregarFiltroPlano("invoice", ZthFetchXml365.zthFetch.TipoFiltro.and, "invoicenumber",
        //         ZthFetchXml365.zthFetch.TipoComparacionFiltro.Igual, idfac);

        //        //fetch.AgregarOrdenResultadoEntidad("invoice", "createdon",
        //        //   ZthFetchXml365.zthFetch.TipoOrdenCampoResultadoEntidad.Descendiente);



        //        DataTable Dato = new DataTable();
        //        Dato = fetch.GeneraTblconFetchResult(false);

        //        DateTime idFac;
        //        if (Dato.Rows.Count > 0)
        //        {
        //            return idFac = (DateTime)Dato.Rows[0]["createdon"];
        //        }
        //        else
        //        {
        //            return idFac =new DateTime() ;
        //        }
        //    }
        //    catch (Exception ex)
        //    {

        //        ZthMetodosVarios.Metodos.GuardarLog(ruta, "Error al obtener los datos de licecia csp: " + ex.Message.ToString());
        //         return new DateTime();
        //    }
        //}

        /// <summary>
        /// Captura losproductos de los clienetes
        /// </summary>
        /// <param name="guid">parametro guid del cliente registrado</param>
        /// <returns>retorna los productos de los clientes</returns>
        public DataTable ProductosCliente(string guid, string idproducto)
        {
            try
            {
                ZthFetchXml365.zthFetch fetch = new ZthFetchXml365.zthFetch("zth_licenciascsp", ref servicio);


                fetch.AgregarCampoRetorno("zth_licenciascsp", "zth_producto", ZthFetchXml365.zthFetch.TipoRetorno.LookupValue);
                fetch.AgregarCampoRetorno("zth_licenciascsp", "zth_producto", ZthFetchXml365.zthFetch.TipoRetorno.LookupName, " Productos");
                fetch.AgregarCampoRetorno("zth_licenciascsp", "zth_cantidad", ZthFetchXml365.zthFetch.TipoRetorno.String);

                fetch.AgregarFiltroPlano("zth_licenciascsp", ZthFetchXml365.zthFetch.TipoFiltro.and, "zth_cliente",
                                         ZthFetchXml365.zthFetch.TipoComparacionFiltro.Igual, guid.ToString());


                fetch.AgregarOrdenResultadoEntidad("zth_preciolicenciacliente", "productos",
                                                   ZthFetchXml365.zthFetch.TipoOrdenCampoResultadoEntidad.Ascendente);

                //fetch.AgregarFiltroPlano("zth_preciolicenciacliente", ZthFetchXml365.zthFetch.TipoFiltro.and, "zth_producto",
                // ZthFetchXml365.zthFetch.TipoComparacionFiltro.Igual, idproducto.ToString());

                DataTable Dato = new DataTable();
                Dato = fetch.GeneraTblconFetchResult(false);

                if (Dato.Rows.Count > 0)
                {
                    return(Dato);
                }
                else
                {
                    return(Dato = null);
                }
            }
            catch (Exception ex)
            {
                ZthMetodosVarios.Metodos.GuardarLog(ruta, "Error al obtener los datos de licecia csp: " + ex.Message.ToString());
                return(null);
            }
        }//--------------
예제 #6
0
        /// <summary>
        /// Se obtiena el valor de Precio Licencia Clinete
        /// </summary>
        /// <param name=""></param>
        /// <returns>Rtornar el valor de Precio Licencia Cliente </returns>
        public Money RetornaUltimoValor(string idcli, string idpro)
        {
            try
            {
                ZthFetchXml365.zthFetch fetch = new ZthFetchXml365.zthFetch("zth_preciolicenciacliente", ref servicio);
                //se capturan los datos de la entidad licencia csp
                fetch.AgregarCampoRetorno("zth_preciolicenciacliente", "zth_fecha", ZthFetchXml365.zthFetch.TipoRetorno.CrmDateTime);
                fetch.AgregarCampoRetorno("zth_preciolicenciacliente", "zth_valor", ZthFetchXml365.zthFetch.TipoRetorno.CrmMoney);

                //se ordena la columna fecha de manera descendente
                fetch.AgregarOrdenResultadoEntidad("zth_preciolicenciacliente", "zth_fecha",
                                                   ZthFetchXml365.zthFetch.TipoOrdenCampoResultadoEntidad.Descendiente);

                fetch.AgregarFiltroPlano("zth_preciolicenciacliente", ZthFetchXml365.zthFetch.TipoFiltro.and, "zth_cliente",
                                         ZthFetchXml365.zthFetch.TipoComparacionFiltro.Igual, idcli);

                fetch.AgregarFiltroPlano("zth_preciolicenciacliente", ZthFetchXml365.zthFetch.TipoFiltro.and, "zth_producto",
                                         ZthFetchXml365.zthFetch.TipoComparacionFiltro.Igual, idpro);

                DataTable Dato = new DataTable();
                Dato = fetch.GeneraTblconFetchResult(false);
                Money valor = null;
                if (Dato.Rows.Count > 0)
                {
                    return(valor = (Money)Dato.Rows[0]["zth_valor"]);
                }
                else
                {
                    return(valor = null);
                }
            }
            catch (Exception ex)
            {
                ZthMetodosVarios.Metodos.GuardarLog(ruta, "Error al retornar el valor : " + ex.Message.ToString());
                return(null);
            }
        }//----------------
예제 #7
0
        }///------------

        /// <summary>
        /// Metodo que verifica si existe el producto dentro del detalle de la factura
        /// </summary>
        /// <param name="cli">Id del producto de la factura </param>
        /// <returns>Retorna el id del detalle da la factura</returns>
        public string  IdFactura(string cli)
        {
            try
            {
                ZthFetchXml365.zthFetch fetch = new ZthFetchXml365.zthFetch("invoice", ref servicio);

                fetch.AgregarCampoRetorno("invoice", "createdon", ZthFetchXml365.zthFetch.TipoRetorno.CrmDateTime);
                fetch.AgregarCampoRetorno("invoice", "customerid", ZthFetchXml365.zthFetch.TipoRetorno.LookupName);
                fetch.AgregarCampoRetorno("invoice", "invoicenumber", ZthFetchXml365.zthFetch.TipoRetorno.String);
                fetch.AgregarCampoRetorno("invoice", "name", ZthFetchXml365.zthFetch.TipoRetorno.String);

                fetch.AgregarFiltroPlano("invoice", ZthFetchXml365.zthFetch.TipoFiltro.and, "invoiceid",
                                         ZthFetchXml365.zthFetch.TipoComparacionFiltro.Igual, cli);

                fetch.AgregarOrdenResultadoEntidad("invoice", "createdon",
                                                   ZthFetchXml365.zthFetch.TipoOrdenCampoResultadoEntidad.Descendiente);

                DataTable Dato = new DataTable();
                Dato = fetch.GeneraTblconFetchResult(false);

                string idFac;
                if (Dato.Rows.Count > 0)
                {
                    return(idFac = Dato.Rows[0]["invoicenumber"].ToString());
                }
                else
                {
                    return(idFac = null);
                }
            }
            catch (Exception ex)
            {
                ZthMetodosVarios.Metodos.GuardarLog(ruta, "Error al obtener los datos de licecia csp: " + ex.Message.ToString());
                return(null);
            }
        }//--------------