public bool Update <TEntity> (IID entity) where TEntity : class
        {
            if (entity == null)
            {
                return(false);
            }

            if (entity.ID == 0)
            {
                return(Add <TEntity> (entity));
            }

            using (CSDB context = new CSDB(Connection))
            {
                TEntity origonal = GetSingle <TEntity>(entity.ID, context);

                MakeObjectsEqual(origonal, entity);

                context.SubmitChanges( );

                cache.AddToCache(typeof(TEntity), entity);

                return(true);
            }
        }
Example #2
0
 public virtual Parser <IInputToken> AdvMathInstruction(IID id) => (
     from dword in InstructionToken(id)
     from cell0 in RefToken
     select new InstructionExpression(Instruction.Summon(id, cell0.Cell)))
 .Token()
 .WithPosition()
 .Named($"{id} expression");
Example #3
0
        internal static HRESULT DllGetClassObject(CLSID clsid, IID iid, out IntPtr ppunk)
        {
            if (iid != ComAPI.guidIClassFactory)
            {
                ppunk = IntPtr.Zero;
                return ComAPI.E_INVALIDARG;
            }

            ComAPI.IClassFactory factory;
            if (registeredClassFactories.TryGetValue(clsid, out factory) ||
                TryGetComClassType(clsid, out factory))
            {
                IntPtr punkFactory = Marshal.GetIUnknownForObject(factory);
                HRESULT hrQI = Marshal.QueryInterface(punkFactory, ref iid, out ppunk);
                Marshal.Release(punkFactory);
                if (hrQI == ComAPI.S_OK)
                {
                    return ComAPI.S_OK;
                }
                else
                {
                    return ComAPI.E_UNEXPECTED;
                }
            }

            // Otherwise it was not found
            ppunk = IntPtr.Zero;
            return ComAPI.CLASS_E_CLASSNOTAVAILABLE;
        }
Example #4
0
        //CONSTRUCTOR
        public Producto()
        {
            IID IID = this;

            IID.Directory = "Productos";
            IID.Prefix    = "Producto";
        }
Example #5
0
 private void modifyUser()
 {
     Usuario.ID              = int.Parse(Request["HFID"].ToString());
     Usuario.Nombre          = Request["tbNombre"].ToString();
     Usuario.DNI             = int.Parse(Request["tbDNI"].ToString());
     Usuario.FechaNacimiento = DateTime.Parse(Request["tbFechaNacimiento"].ToString());
     Usuario.Direccion       = Request["tbDireccion"].ToString();
     Usuario.Mail            = Request["tbMail"].ToString();
     Usuario.Password        = Request["tbPassword"].ToString();
     Usuario.Rol             = Request["HFRol"].ToString();
     Usuario.FechaAceptacion = DateTime.Parse(Request["HFFechaAceptacion"].ToString());
     if (Request.Files.Count > 0)
     {
         IID IID = Usuario;
         IID.FU = Request.Files[0];
     }
     try
     {
         Usuario.Modify();
         Response.Write("<span id=\"MiSpan\">" + Usuario.Find() + "</span>");
     }
     catch (Exception err)
     {
         Response.Write("<span id=\"MiSpan\">" + err.Message + "</span>");
     }
 }
Example #6
0
 internal static HRESULT DllGetClassObject(CLSID clsid, IID iid, out IntPtr ppunk)
 {
     if (iid != ComAPI.guidIClassFactory)
     {
         ppunk = IntPtr.Zero;
         return(ComAPI.E_INVALIDARG);
     }
     foreach (ExcelComClassType comClass in registeredComClassTypes)
     {
         if (comClass.ClsId == clsid)
         {
             ClassFactory factory     = new ClassFactory(comClass);
             IntPtr       punkFactory = Marshal.GetIUnknownForObject(factory);
             HRESULT      hrQI        = Marshal.QueryInterface(punkFactory, ref iid, out ppunk);
             Marshal.Release(punkFactory);
             if (hrQI == ComAPI.S_OK)
             {
                 return(ComAPI.S_OK);
             }
             else
             {
                 return(ComAPI.E_UNEXPECTED);
             }
         }
     }
     ppunk = IntPtr.Zero;
     return(ComAPI.CLASS_E_CLASSNOTAVAILABLE);
 }
Example #7
0
        public override string Erase()
        {
            IID IID = this;

            IID.DeleteImage();
            return(ISP.Erase(this));
        }
Example #8
0
 internal static HRESULT DllGetClassObject(CLSID clsid, IID iid, out IntPtr ppunk)
 {
     if (iid != ComAPI.guidIClassFactory)
     {
         ppunk = IntPtr.Zero;
         return ComAPI.E_INVALIDARG;
     }
     foreach (ExcelComClassType comClass in registeredComClassTypes)
     {
        if (comClass.ClsId == clsid)
        {
            ClassFactory factory = new ClassFactory(comClass);
            IntPtr punkFactory = Marshal.GetIUnknownForObject(factory);
            HRESULT hrQI = Marshal.QueryInterface(punkFactory, ref iid, out ppunk);
            Marshal.Release(punkFactory);
            if (hrQI == ComAPI.S_OK)
            {
                return ComAPI.S_OK;
            }
            else
            {
                return ComAPI.E_UNEXPECTED;
            }
        }
     }
     ppunk = IntPtr.Zero;
     return ComAPI.CLASS_E_CLASSNOTAVAILABLE;
 }
Example #9
0
        /// <summary>
        /// Instancia um novo objeto GUID com o valor passado
        /// </summary>
        /// <param name="guid">valor do GUID</param>
        public GUID(IID guid)
        {
            long result = 0;

            long.TryParse(guid == null ? "" : guid.ToString(), out result);
            this.guid = result;
        }
Example #10
0
        internal static HRESULT DllGetClassObject(CLSID clsid, IID iid, out IntPtr ppunk)
        {
            if (iid != ComAPI.guidIClassFactory)
            {
                ppunk = IntPtr.Zero;
                return(ComAPI.E_INVALIDARG);
            }

            ComAPI.IClassFactory factory;
            if (registeredClassFactories.TryGetValue(clsid, out factory) ||
                TryGetComClassType(clsid, out factory))
            {
                IntPtr  punkFactory = Marshal.GetIUnknownForObject(factory);
                HRESULT hrQI        = Marshal.QueryInterface(punkFactory, ref iid, out ppunk);
                Marshal.Release(punkFactory);
                if (hrQI == ComAPI.S_OK)
                {
                    return(ComAPI.S_OK);
                }
                else
                {
                    return(ComAPI.E_UNEXPECTED);
                }
            }

            // Otherwise it was not found
            ppunk = IntPtr.Zero;
            return(ComAPI.CLASS_E_CLASSNOTAVAILABLE);
        }
Example #11
0
 public exc_link_LoopException(IID link, IID loopedTask)
     : base(string.Format(
              "Link {0} can not create, because of looped task {1}"
              , link.getIDobject().ID
              , loopedTask.getIDobject().ID))
 {
 }
Example #12
0
        public void WithPairCellAndResultCellTest(IID code)
        {
            var args   = Instruction.GetArgumentCountBy(code);
            var result = default(IInputToken);
            var source = $".{code} &(0x0) <| &(0x0) &(0x0)";
            var parser = new AssemblerSyntax().Parser.End();

            if (args == 3)
            {
                result = parser.Parse(source);
            }
            else
            {
                Assert.Throws <ParseException>(() =>
                {
                    parser.Parse(source);
                });
                return;
            }



            if (result is InstructionExpression exp)
            {
                Assert.NotNull(exp.Instruction);
                Assert.Contains(exp.Instruction.GetType().Name, $"{code}");
            }
        }
Example #13
0
        public Usuario()
        {
            IID IID = this;

            IID.Prefix    = "Usuario";
            IID.Directory = "Usuarios";
        }
Example #14
0
 public void DownloadAsync(IID managedID, object userArgs)
 {
     if (managedID == null)
     {
         throw new ArgumentNullException("managedID", "The passed ID is null.");
     }
     this.DownloadAsync(managedID.ID, userArgs);
 }
Example #15
0
        string ISingletonGeneric <Sector> .ListToJson(Sector Data)
        {
            IC.CreateCommand("Sectores_List");
            DataTable DT  = IC.List("Error: No se pudo listar sectores");
            IID       IID = Data;

            return(IID.TableToJson(DT));
        }
Example #16
0
 public Base.Response <FuturesResult> Download(IID managedID)
 {
     if (managedID == null)
     {
         throw new ArgumentNullException("unmanagedID", "The passed ID is empty.");
     }
     return(this.Download(managedID.ID));
 }
Example #17
0
 /// <summary>
 /// Starts an asynchronous download of quotes data.
 /// </summary>
 /// <param name="managedID">The managed ID</param>
 /// <param name="properties">The properties of each quote data. If parameter is null/Nothing, Symbol and LastTradePrizeOnly will set as property. In this case, with YQL server you will get every available property.</param>
 /// <param name="userArgs">Individual user argument</param>
 /// <remarks></remarks>
 public void DownloadAsync(IID managedID, IEnumerable <QuoteProperty> properties, object userArgs)
 {
     if (managedID == null)
     {
         throw new ArgumentNullException("managedID", "The passed ID is null.");
     }
     this.DownloadAsync(managedID.ID, properties, userArgs);
 }
Example #18
0
 /// <summary>
 /// Downloads company informations with passed ID.
 /// </summary>
 /// <param name="managedID">The managed ID of the company</param>
 /// <returns></returns>
 /// <remarks></remarks>
 public YahooManaged.Base.Response <CompanyInfoResult> Download(IID managedID)
 {
     if (managedID == null)
     {
         throw new ArgumentNullException("managedID", "The passed ID is null.");
     }
     return(this.Download(managedID.ID));
 }
Example #19
0
 public override int GetHashCode()
 {
     if (Equals(IID, default(int)))
     {
         return(base.GetHashCode());
     }
     return(IID.GetHashCode());
 }
Example #20
0
        string ISingletonGeneric <Pedido> .ListToJson(Pedido Data)
        {
            IC.CreateCommand("Pedidos_List");
            DataTable DT  = IC.List("Error: No se pudo listar los pedidos");
            IID       IID = Data;

            return(IID.TableToJson(DT));
        }
 /// <summary>
 /// Downloads company statistic data.
 /// </summary>
 /// <param name="managedID">The managed ID</param>
 /// <returns></returns>
 /// <remarks></remarks>
 public async Task <Base.Response <CompanyStatisticsResult> > Download(IID managedID)
 {
     if (managedID == null)
     {
         throw new ArgumentNullException("managedID", "The passed ID is null.");
     }
     return(await this.Download(managedID.ID));
 }
Example #22
0
        string ISingletonGeneric <Usuario> .ListToJson(Usuario Data)
        {
            IC.CreateCommand("Usuarios_List");
            DataTable DT  = IC.List("Error: No se pudieron listar los usuarios");
            IID       IID = Data;

            return(IID.TableToJson(DT));
        }
Example #23
0
        string ISingletonProducto.ListAvailableToJson(Producto Data)
        {
            IC.CreateCommand("Productos_ListAvailable");
            DataTable DT  = IC.List("Error: No se pudo listar los productos");
            IID       IID = Data;

            return(IID.TableToJson(DT));
        }
Example #24
0
 public Base.Response <CompanyProfileResult> Download(IID managedID)
 {
     if (managedID == null)
     {
         throw new ArgumentNullException("managedID", "The ID object is null");
     }
     return(this.Download(managedID.ID));
 }
        string ISingletonGeneric <Categoria> .ListToJson(Categoria Data)
        {
            IC.CreateCommand("Categorias_List");
            DataTable DT  = IC.List("Error: No se pudo listar categorias");
            IID       IID = Data;

            return(IID.TableToJson(DT));
        }
Example #26
0
 /// <summary>
 /// Downloads quotes data.
 /// </summary>
 /// <param name="managedID">The managed ID</param>
 /// <param name="properties">The properties of each quote data. If parameter is null/Nothing, Symbol and LastTradePrizeOnly will set as property. In this case, with YQL server you will get every available property.</param>
 /// <returns></returns>
 /// <remarks></remarks>
 public YahooManaged.Base.Response <QuotesResult> Download(IID managedID, IEnumerable <QuoteProperty> properties)
 {
     if (managedID == null)
     {
         throw new ArgumentNullException("id", "The passed id is null.");
     }
     return(this.Download(managedID.ID, properties));
 }
 /// <summary>
 /// Downloads historic quotes data.
 /// </summary>
 /// <param name="managedID">The managed ID</param>
 /// <param name="fromDate">The startdate of the reviewed period</param>
 /// <param name="todate">The enddate of the reviewed period</param>
 /// <param name="interval">The trading period interval</param>
 /// <returns></returns>
 /// <remarks></remarks>
 public YahooManaged.Base.Response <HistQuotesResult> Download(IID managedID, System.DateTime fromDate, System.DateTime todate, HistQuotesInterval interval)
 {
     if (managedID == null)
     {
         throw new ArgumentNullException("managedID", "The passed ID is null.");
     }
     return(this.Download(managedID.ID, fromDate, todate, interval));
 }
Example #28
0
        public override string Erase()
        {
            ISGL.Erase(this);
            IID IID = this;

            IID.DeleteImage();
            return(this.ListToJson());
        }
        public bool Delete <TEntity> (IID entity) where TEntity : class
        {
            if (Connection == null)
            {
                throw new Exception("No connection to database");
            }

            try
            {
                Type           baseType = typeof(TEntity);
                TableAttribute ta       = null;

                while (true)
                {
                    ta = (TableAttribute)Attribute.GetCustomAttribute(baseType, typeof(TableAttribute));

                    if (ta != null)
                    {
                        break;
                    }

                    baseType = baseType.BaseType;

                    if (baseType == null)
                    {
                        break;
                    }
                }

                if (ta == null)
                {
                    throw new ArgumentException("Failed to find Table of " + typeof(TEntity).ToString( ));
                }


                using (CSDB context = new CSDB(Connection))
                {
#if (DEBUG)
                    TextWriter log = new StringWriter();
                    context.Log = log;
#endif
                    TEntity t = GetSingle <TEntity> (entity.ID, context);

                    context.GetTable(baseType).DeleteOnSubmit(t);
                    context.SubmitChanges( );
#if (UseCache)
                    cache.DeleteItemFromCache(baseType, ((IID)t).ID);
#endif
                    return(true);
                }
            }
            catch (Exception ex)
            {
                ChampionshipSolutions.Diag.Diagnostics.LogLine("Error deleting entity from database of type " + typeof(TEntity).ToString( ));
                ChampionshipSolutions.Diag.Diagnostics.LogLine(ex.Message);
                return(false);
            }
        }
Example #30
0
 public exc_link_LoopException(IID link, IID loopedTask)
     : base(
         string.Format(
             "Link {0} can not create, because of looped task {1}"
             , link.getIDobject().ID
             , loopedTask.getIDobject().ID)
         )
 {
 }
Example #31
0
        public override string Modify()
        {
            ISP.NameExists(this);
            ISP.Modify(this);
            IID IID = this;

            IID.SaveImage();
            return(ListToJson());
        }
Example #32
0
 internal static HRESULT DllGetClassObject(CLSID clsid, IID iid, out IntPtr ppunk)
 //internal static HRESULT DllGetClassObject(ref Guid clsid, ref Guid iid, out object ppunk)
 {
     HRESULT result;
     object[] args = new object[] {clsid, iid, null};
     result = (HRESULT)integrationType.InvokeMember("DllGetClassObject", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, args);
     ppunk = (IntPtr)args[2];
     return result;
 }
Example #33
0
        internal static HRESULT DllGetClassObject(CLSID clsid, IID iid, out IntPtr ppunk)
        //internal static HRESULT DllGetClassObject(ref Guid clsid, ref Guid iid, out object ppunk)
        {
            HRESULT result;

            object[] args = new object[] { clsid, iid, null };
            result = (HRESULT)integrationType.InvokeMember("DllGetClassObject", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, args);
            ppunk  = (IntPtr)args[2];
            return(result);
        }
Example #34
0
        string ISingletonGeneric <Pedido> .Find(Pedido Data)
        {
            IC.CreateCommand("Pedidos_Find");
            IC.ParameterAddInt("ID", Data.ID);
            DataRow DR  = IC.Find("Error: No se pudo encontrar este pedido");
            IID     IID = Data;

            ISPD.MakeData(DR, Data);
            return(IID.RowToJson(DR));
        }
 public Base.Response<QuoteOptionsResult> Download(IID managedID, System.DateTime expirationDate)
 {
     if (managedID == null)
     {
         throw new ArgumentNullException("managedID", "The passed ID is null.");
     }
     else
     {
         return this.Download(managedID.ID, expirationDate);
     }
 }
Example #36
0
 /// <summary>
 /// 对于IID接口,申请一个唯一id
 /// </summary>
 /// <param name="obj"></param>
 /// <returns></returns>
 public int applyId(IID obj)
 {
     int objId;
     if ( !this.isExist(obj) )
     {
         objId = this._currentId++;
     }
     else
     {
         objId = obj.id;
     }
     return objId;
 }
 public int applyUnitId(IID unit)
 {
     return this._unitList.applyId(unit);
 }
 /// <summary>
 /// Downloads a chart image.
 /// </summary>
 /// <param name="managedID">The managed ID of the stock</param>
 /// <returns></returns>
 /// <remarks></remarks>
 public Base.Response<ChartResult> Download(IID managedID)
 {
     if (managedID == null)
         throw new ArgumentNullException("managedID", "The passed ID is null.");
     return this.Download(managedID.ID);
 }
 /// <summary>
 /// Downloads quotes data.
 /// </summary>
 /// <param name="managedID">The managed ID</param>
 /// <param name="properties">The properties of each quote data. If parameter is null/Nothing, Symbol and LastTradePrizeOnly will set as property. In this case, with YQL server you will get every available property.</param>
 /// <returns></returns>
 /// <remarks></remarks>
 public Base.Response<QuotesResult> Download(IID managedID, IEnumerable<QuoteProperty> properties)
 {
     if (managedID == null)
         throw new ArgumentNullException("id", "The passed id is null.");
     return this.Download(managedID.ID, properties);
 }
Example #40
0
 internal static HRESULT DllGetClassObject(CLSID clsid, IID iid, out IntPtr ppunk)
 {
     Debug.Print("DllGetClassObject entered - calling InitializeIntegration.");
     HRESULT result;
     InitializeIntegration();
     Logger.Initialization.Verbose("In DllGetClassObject");
     result = IntegrationHelpers.DllGetClassObject(clsid, iid, out ppunk);
     return result;
 }
 public Base.Response<CompanyProfileResult> Download(IID managedID)
 {
     if (managedID == null)
         throw new ArgumentNullException("managedID", "The ID object is null");
     return this.Download(managedID.ID);
 }
 public Base.Response<FuturesResult> Download(IID managedID)
 {
     if (managedID == null)
         throw new ArgumentNullException("unmanagedID", "The passed ID is empty.");
     return this.Download(managedID.ID);
 }
Example #43
0
 internal static HRESULT DllGetClassObject(CLSID clsid, IID iid, out IntPtr ppunk)
 {
     Debug.Print("DllGetClassObject reached!!");
    // IntPtr pout;
     HRESULT result;
     InitializeIntegration();
     result = IntegrationHelpers.DllGetClassObject(clsid, iid, out ppunk);
     return result;
 }
 public int applyPlayerId(IID player)
 {
     return this._playerList.applyId(player);
 }
Example #45
0
 void Unimake.Data.Generic.Model.IParentModel.Populate(IID id)
 {
     Populate(new GUID((object)id));
 }
Example #46
0
 public bool isExist(IID obj)
 {
     return this._idList.IndexOf(obj) != -1;
 }
 /// <summary>
 /// Downloads historic quotes data.
 /// </summary>
 /// <param name="managedID">The managed ID</param>
 /// <param name="fromDate">The startdate of the reviewed period</param>
 /// <param name="todate">The enddate of the reviewed period</param>
 /// <param name="interval">The trading period interval</param>
 /// <returns></returns>
 /// <remarks></remarks>
 public Base.Response<HistQuotesResult> Download(IID managedID, System.DateTime fromDate, System.DateTime todate, HistQuotesInterval interval)
 {
     if (managedID == null)
         throw new ArgumentNullException("managedID", "The passed ID is null.");
     return this.Download(managedID.ID, fromDate, todate, interval);
 }