public void Update(IThirdParty parent)
        {
            try
            {
                this.RaiseListChangedEvents = false;

                SessionCode = parent.SessionCode;

                // update (thus deleting) any deleted child objects
                foreach (ProductoCliente obj in DeletedList)
                {
                    obj.DeleteSelf(parent);
                }

                // now that they are deleted, remove them from memory too
                DeletedList.Clear();

                // add/update any current child objects
                foreach (ProductoCliente obj in this)
                {
                    if (obj.IsNew)
                    {
                        obj.Insert(parent);
                    }
                    else
                    {
                        obj.Update(parent);
                    }
                }
            }
            finally
            {
                this.RaiseListChangedEvents = true;
            }
        }
예제 #2
0
        public HomeModule(IThirdParty thirdParty, ILogger logger)
        {
            Get["/"] = args =>
            {
                thirdParty.DoSomething();
                return($"{Thread.CurrentThread.ManagedThreadId}");
            };

            Post["/hello/{user}"] = args =>
            {
                var user = (string)args.user;
                if (user == "error")
                {
                    logger.Warning("Looks like an error is heading your way");
                    throw new Exception("No way!");
                }

                logger.Information("{User} Logged In", user);
                return(Negotiate.WithHeader("SpecialHeader", "SpecialValue")
                       .WithCookie(new NancyCookie("special-cookie", "cookie value", DateTime.Now.AddHours(1)))
                       .WithModel($"Hello {user}"));
            };

            Post["/echo"] = args =>
            {
                var inputStream = Context.Request.Body;
                using (var reader = new StreamReader(inputStream))
                {
                    var content = reader.ReadToEnd();
                    return(content);
                }
            };
        }
예제 #3
0
        internal void DeleteSelf(IThirdParty parent)
        {
            // if we're not dirty then don't update the database
            if (!this.IsDirty)
            {
                return;
            }

            // if we're new then don't update the database
            if (this.IsNew)
            {
                return;
            }

            try
            {
                SessionCode = parent.SessionCode;
                Session().Delete(Session().Get <ClientProductRecord>(Oid));
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

            MarkNew();
        }
        public static ProductoClientes GetChildList(IThirdParty parent, bool childs)
        {
            CriteriaEx criteria = ProductoCliente.GetCriteria(parent.SessionCode);

            criteria.Query  = ProductoClientes.SELECT(parent);
            criteria.Childs = childs;

            return(DataPortal.Fetch <ProductoClientes>(criteria));
        }
예제 #5
0
 public Home(IThirdParty thirdParty, ILogger logger)
 {
     Get("/", args =>
     {
         logger.Information("Requesting root...");
         thirdParty.Work();
         logger.Information("Done working");
         return("Root");
     });
 }
예제 #6
0
        protected void CopyFrom(IThirdParty client, ProductInfo producto)
        {
            OidCliente = client.Oid;
            PDescuento = client.PDescuento;

            if (producto != null)
            {
                OidProducto = producto.Oid;
                Producto    = producto.Nombre;
            }
        }
예제 #7
0
        public static ClientProductList GetChildList(IThirdParty parent, bool childs)
        {
            CriteriaEx criteria = ProductoCliente.GetCriteria(ProductoCliente.OpenSession());

            criteria.Query  = ClientProductList.SELECT(parent);
            criteria.Childs = childs;

            ClientProductList list = DataPortal.Fetch <ClientProductList>(criteria);

            CloseSession(criteria.SessionCode);

            return(list);
        }
예제 #8
0
        public static ProductoCliente NewChild(IThirdParty cliente, ProductInfo producto)
        {
            if (!CanAddObject())
            {
                throw new System.Security.SecurityException(moleQule.Resources.Messages.USER_NOT_ALLOWED);
            }

            ProductoCliente obj = new ProductoCliente();

            obj.CopyFrom(cliente, producto);

            return(obj);
        }
예제 #9
0
        public static ProductoCliente NewChild(IThirdParty parent)
        {
            if (!CanAddObject())
            {
                throw new System.Security.SecurityException(moleQule.Resources.Messages.USER_NOT_ALLOWED);
            }

            ProductoCliente obj = new ProductoCliente();

            obj.OidCliente = parent.Oid;

            return(obj);
        }
예제 #10
0
        internal void Insert(IThirdParty parent)
        {
            // if we're not dirty then don't update the database
            if (!this.IsDirty)
            {
                return;
            }

            try
            {
                OidCliente = parent.Oid;
                parent.Session().Save(Base.Record);
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

            MarkOld();
        }
        public void UpdateHistoria(IThirdParty parent)
        {
            foreach (ProductoCliente item in this)
            {
                if (item.IsNew)
                {
                    parent.Historia += Environment.NewLine +
                                       DateTime.Now.ToString() + " - " +
                                       String.Format(Resources.Messages.NUEVO_PRODUCTO_ASOCIADO,
                                                     item.Producto,
                                                     item.Precio.ToString("C5"),
                                                     AppContext.Principal.Identity.Name);
                }
                else if (item.IsDirty)
                {
                    moleQule.Store.Data.ClientProductRecord obj = Session().Get <moleQule.Store.Data.ClientProductRecord>(item.Oid);
                    if (item.Precio != obj.Precio)
                    {
                        parent.Historia += Environment.NewLine +
                                           DateTime.Now.ToString() + " - " +
                                           String.Format(Resources.Messages.EDITADO_PRODUCTO_ASOCIADO,
                                                         item.Producto,
                                                         item.Precio.ToString("C5"),
                                                         AppContext.Principal.Identity.Name);
                    }
                }
            }

            foreach (ProductoCliente item in DeletedList)
            {
                parent.Historia += Environment.NewLine +
                                   DateTime.Now.ToString() + " - " +
                                   String.Format(Resources.Messages.BORRADO_PRODUCTO_ASOCIADO,
                                                 item.Producto,
                                                 item.Precio.ToString("C5"),
                                                 AppContext.Principal.Identity.Name);
            }
        }
예제 #12
0
        internal void Update(IThirdParty parent)
        {
            // if we're not dirty then don't update the database
            if (!this.IsDirty)
            {
                return;
            }

            try
            {
                OidCliente = parent.Oid;

                SessionCode = parent.SessionCode;
                ClientProductRecord obj = Session().Get <ClientProductRecord>(Oid);
                obj.CopyValues(Base.Record);
                Session().Update(obj);
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

            MarkOld();
        }
 public static string SELECT(IThirdParty parent)
 {
     return(ProductoClientes.SELECT(new QueryConditions(parent.Oid, parent.EEntityType)));
 }
예제 #14
0
 public ThirdPartyFactory(IThirdParty serviceA, IThirdParty serviceB)
 {
     this.serviceA = serviceA;
     this.serviceB = serviceB;
 }
 public ProductoCliente NewItem(IThirdParty parent1, ProductInfo parent2)
 {
     this.NewItem(ProductoCliente.NewChild(parent1, parent2));
     return(this[Count - 1]);
 }
예제 #16
0
        public static string SELECT(IThirdParty source)
        {
            QueryConditions conditions = new QueryConditions(source.Oid, source.EEntityType);

            return(ClientProductList.SELECT(conditions));
        }
예제 #17
0
    public void SendIncident(Ticket objectToBeSent)
    {
        IThirdParty thirdPartyService = GetThirdPartyService(objectToBeSent.ThirdPartyId);

        thirdPartyService.SendIncident(objectToBeSent);
    }
예제 #18
0
 public CountryCodeAdapter(IThirdParty country)
 {
     this.country = country;
 }
 public ThirdPartyFactory(IThirdParty serviceA, IThirdParty serviceB)
 {
     _serviceA = serviceA;
     _serviceB = serviceB;
 }