Beispiel #1
0
        public bool NormasProductosIguales(NormasProductos auxNPCRM, ref Entity npUpdate, Guid Tiponorma, Guid UOM, Guid SUOM)
        {
            bool res = false;

            if (!Aen_Vendible_Web.Equals(auxNPCRM.Aen_Vendible_Web))
            {
                res = true;
            }
            if (!Aen_Documento_Mod.Equals(auxNPCRM.Aen_Documento_Mod))
            {
                res = true;
            }
            if (!Aen_IdiomaGUID.Equals(auxNPCRM.Aen_IdiomaGUID))
            {
                res = true;
            }
            if (!(Aen_Precio.Equals(decimal.MinValue) && auxNPCRM.Aen_Precio.Equals(decimal.MinValue)) &&
                (!Aen_Precio.ToString("#,##").Equals(auxNPCRM.Aen_Precio.ToString("#,##"))))
            {
                res = true;
            }
            if (!Aen_SoporteGUID.Equals(auxNPCRM.Aen_SoporteGUID))
            {
                res = true;
            }
            if (!Aen_ArticuloGUID.Equals(auxNPCRM.Aen_ArticuloGUID))
            {
                res = true;
            }
            if (!Aen_Documento.Equals(auxNPCRM.Aen_Documento))
            {
                res = true;
            }
            if (!Aen_Path.Equals(auxNPCRM.Aen_Path))
            {
                res = true;
            }
            if (!Aen_Url_Organismo.Equals(auxNPCRM.Aen_Url_Organismo))
            {
                res = true;
            }
            if (!Aen_Codigo_Producto.Equals(auxNPCRM.Aen_Codigo_Producto))
            {
                res = true;
            }
            if (!Aen_Nombre_Producto.Equals(auxNPCRM.Aen_Nombre_Producto))
            {
                res = true;
            }

            if (res)
            {
                Productoid = auxNPCRM.Productoid;
                npUpdate   = GetEntity(Tiponorma, UOM, SUOM);
            }

            return(res);
        }
Beispiel #2
0
        public Entity GetEntity(Guid TipoNorma, Guid UomID, Guid SUomID)
        {
            Entity e = new Entity(NombreCamposNormasProductos.EntityName);

            if (Productoid != Guid.Empty)
            {
                e.Id = Productoid;
                e[NombreCamposNormasProductos.EntityId] = Productoid;
            }
            e[NombreCamposNormasProductos.Aen_Vendible_WebCRM]  = Aen_Vendible_Web;
            e[NombreCamposNormasProductos.Aen_Documento_ModCRM] = Aen_Documento_Mod;
            e[NombreCamposNormasProductos.Aen_IdiomaCRM]        = (Aen_IdiomaGUID.Equals(Guid.Empty)) ? null : new EntityReference("aen_idioma", Aen_IdiomaGUID);
            if (!Aen_Fecha_Documento.Equals(string.Empty))
            {
                var okFecha = DateTime.TryParse(Aen_Fecha_Documento, out DateTime f);
                if (okFecha)
                {
                    e[NombreCamposNormasProductos.Aen_Fecha_DocumentoCRM] = f;
                }
            }
            if (!Aen_Precio.Equals(decimal.MinValue))
            {
                Money reven = new Money(Convert.ToDecimal(Aen_Precio));
                e[NombreCamposNormasProductos.Aen_PrecioCRM] = reven;
            }
            else
            {
                //Money reven = new Money();
                e[NombreCamposNormasProductos.Aen_PrecioCRM] = null;
            }
            e[NombreCamposNormasProductos.Aen_SoporteCRM]         = (Aen_SoporteGUID.Equals(Guid.Empty)) ? null : new EntityReference("aen_formato", Aen_SoporteGUID);
            e[NombreCamposNormasProductos.Aen_ArticuloCRM]        = (Aen_ArticuloGUID.Equals(Guid.Empty)) ? null : new EntityReference(NombreCamposNormas.EntityNameVersion, Aen_ArticuloGUID);
            e[NombreCamposNormasProductos.Aen_DocumentoCRM]       = Aen_Documento.Equals(string.Empty) ? string.Empty : Aen_Documento;
            e[NombreCamposNormasProductos.Aen_PathCRM]            = Aen_Path.Equals(string.Empty) ? string.Empty : Aen_Path;
            e[NombreCamposNormasProductos.Aen_Url_OrganismoCRM]   = Aen_Url_Organismo.Equals(string.Empty) ? string.Empty : Aen_Url_Organismo;
            e[NombreCamposNormasProductos.Aen_Codigo_ProductoCRM] = Aen_Codigo_Producto.Equals(string.Empty) ? string.Empty : Aen_Codigo_Producto;
            e[NombreCamposNormasProductos.Aen_Nombre_ProductoCRM] = Aen_Nombre_Producto.Equals(string.Empty) ? string.Empty : Aen_Nombre_Producto;
            e["defaultuomid"]         = new EntityReference("uom", UomID);
            e["defaultuomscheduleid"] = new EntityReference("uomschedule", SUomID);
            e["aen_tipodeproducto"]   = new EntityReference("aen_tipodeproducto", TipoNorma);
            e["aen_integracion"]      = true;
            e["quantitydecimal"]      = 2;

            return(e);
        }