Example #1
0
 protected override Alphora.Dataphor.DAE.Runtime.DataParams GetParams()
 {
     DAE.Runtime.DataParams paramsValue = new DAE.Runtime.DataParams();
     paramsValue.Add(DAE.Runtime.DataParam.Create(Dataphoria.UtilityProcess, "AShowGenerated", _showGeneratedObjects));
     paramsValue.Add(DAE.Runtime.DataParam.Create(Dataphoria.UtilityProcess, "AShowSystem", _showSystemObjects));
     paramsValue.Add(DAE.Runtime.DataParam.Create(Dataphoria.UtilityProcess, "ALibraryName", _libraryName));
     return(paramsValue);
 }
Example #2
0
 private static void GetParamsFromRow(IRow row, DAE.Runtime.DataParams LParams, string prefix)
 {
     for (int index = 0; index < row.DataType.Columns.Count; index++)
     {
         LParams.Add(new DAE.Runtime.DataParam(prefix + row.DataType.Columns[index].Name, row.DataType.Columns[index].DataType, Modifier.In, row[index]));
     }
 }
Example #3
0
 /// <summary> Populates a given a (non null) DataParams collection with the actual params used by the DataSet. </summary>
 public void GetAllParams(DAE.Runtime.DataParams paramsValue)
 {
     CheckActive();
     foreach (DataSetDataParam param in _cursor.Params)
     {
         paramsValue.Add(param);
     }
 }
Example #4
0
 protected void PrepareParams()
 {
     if (_params == null)
     {
         _params = new DAE.Runtime.DataParams();
         foreach (DAE.Schema.OrderColumn orderColumn in Source.DataView.Order.Columns)
         {
             _params.Add(new DAE.Runtime.DataParam("ACurrent" + orderColumn.Column.Name, orderColumn.Column.DataType, Modifier.Const));
         }
     }
 }
Example #5
0
        public static void SequenceChange(Client.Session session, ISource source, bool shouldEnlist, DAE.Runtime.Data.IRow fromRow, DAE.Runtime.Data.IRow toRow, bool above, string script)
        {
            if (!String.IsNullOrEmpty(script) && source != null)
            {
                Guid enlistWithATID = Guid.Empty;

                if (shouldEnlist && source.DataView.Active && source.DataView.ApplicationTransactionServer != null)
                {
                    enlistWithATID = source.DataView.ApplicationTransactionServer.ApplicationTransactionID;
                }

                DAE.IServerProcess process = session.DataSession.ServerSession.StartProcess(new DAE.ProcessInfo(session.DataSession.ServerSession.SessionInfo));
                try
                {
                    if (enlistWithATID != Guid.Empty)
                    {
                        process.JoinApplicationTransaction(enlistWithATID, false);
                    }

                    // Prepare arguments
                    DAE.Runtime.DataParams paramsValue = new DAE.Runtime.DataParams();
                    foreach (DAE.Schema.Column column in fromRow.DataType.Columns)
                    {
                        paramsValue.Add(new DAE.Runtime.DataParam("AFromRow." + column.Name, column.DataType, DAE.Language.Modifier.In, fromRow[column.Name]));
                        paramsValue.Add(new DAE.Runtime.DataParam("AToRow." + column.Name, column.DataType, DAE.Language.Modifier.In, toRow[column.Name]));
                    }
                    paramsValue.Add(new DAE.Runtime.DataParam("AAbove", source.DataView.Process.DataTypes.SystemBoolean, DAE.Language.Modifier.In, above));

                    session.ExecuteScript(process, script, paramsValue);
                }
                finally
                {
                    session.DataSession.ServerSession.StopProcess(process);
                }

                source.DataView.Refresh();
            }
        }
        private void InternalSaveData(object data, bool binary)
        {
            if (binary)
            {
                throw new NotSupportedException("InternalSaveData called with ABinary true");
            }

            DAE.Runtime.DataParams paramsValue = new DAE.Runtime.DataParams();
            paramsValue.Add(new DAE.Runtime.DataParam("LibraryName", Dataphoria.UtilityProcess.DataTypes.SystemString, DAE.Language.Modifier.Const, DAE.Schema.Object.EnsureRooted(LibraryName)));
            paramsValue.Add(new DAE.Runtime.DataParam("DocumentName", Dataphoria.UtilityProcess.DataTypes.SystemString, DAE.Language.Modifier.Const, DAE.Schema.Object.EnsureRooted(DocumentName)));
            paramsValue.Add(new DAE.Runtime.DataParam("DocumentType", Dataphoria.UtilityProcess.DataTypes.SystemString, DAE.Language.Modifier.Const, DocumentType));
            paramsValue.Add(new DAE.Runtime.DataParam("Data", Dataphoria.UtilityProcess.DataTypes.SystemString, DAE.Language.Modifier.Const, data));

            DAE.IServerStatementPlan plan = Dataphoria.UtilityProcess.PrepareStatement(".Frontend.CreateAndSave(LibraryName, DocumentName, DocumentType, Data)", paramsValue);
            try
            {
                plan.Execute(paramsValue);
            }
            finally
            {
                Dataphoria.UtilityProcess.UnprepareStatement(plan);
            }
        }
Example #7
0
 /// <summary>Constructs a DataParams from the given parameter names and native value arrays.</summary>
 public static DAE.Runtime.DataParams DataParamsFromNativeParams(IServerProcess process, string[] paramNames, object[] paramsValue)
 {
     DAE.Runtime.DataParams localParamsValue = new DAE.Runtime.DataParams();
     for (int i = 0; i < paramsValue.Length; i++)
     {
         object objectValue = paramsValue[i];
         if (objectValue is DBNull)
         {
             objectValue = null;
         }
         if (objectValue is Double)
         {
             objectValue = Convert.ToDecimal((double)objectValue);
         }
         localParamsValue.Add(DAE.Runtime.DataParam.Create(process, paramNames[i], objectValue, ScalarTypeFromNativeType(process, objectValue == null ? null : objectValue.GetType())));
     }
     return(localParamsValue);
 }
Example #8
0
 public void SetLibrary(string libraryName)
 {
     DAE.Runtime.DataParams paramsValue = new DAE.Runtime.DataParams();
     paramsValue.Add(DAE.Runtime.DataParam.Create(Pipe.Process, "ALibraryName", libraryName));
     using
     (
         DAE.Runtime.Data.Scalar nodeTable =
             DataSession.Evaluate
             (
                 LibraryNodeTypesExpression,
                 paramsValue
             )
     )
     {
         NodeTypeTable.Clear();
         NodeTypeTable.LoadFromString(nodeTable.AsString);
     }
     ValidateNodeTypeTable();
 }
Example #9
0
        public override string SetApplication(string applicationID, string clientType)
        {
            // Reset our current settings
            _theme = null;
            DisposeDefaultIcon();
            ClearDocumentCache();
            ClearImageCache();
            int documentCacheSize = CDefaultDocumentCacheSize;
            int imageCacheSize    = CDefaultImageCacheSize;

            // Optimistically load the settings
            try
            {
                DAE.Runtime.DataParams paramsValue = new DAE.Runtime.DataParams();
                paramsValue.Add(DAE.Runtime.DataParam.Create(Pipe.Process, "AApplicationID", applicationID));

                using (DAE.Runtime.Data.Row row = (DAE.Runtime.Data.Row)Evaluate(Pipe.Process, SettingsExpression, paramsValue))
                {
                    if (row != null)
                    {
                        // Load the theme
                        if (row.HasValue("Theme"))
                        {
                            _theme = (Theme) new BOP.Deserializer().Deserialize((string)row["Theme"], null);
                        }

                        // Load the default form icon
                        if (row.HasValue("IconImage"))
                        {
                            using (Stream iconStream = row.GetValue("IconImage").OpenStream())
                            {
                                Bitmap bitmap = System.Drawing.Image.FromStream(iconStream) as Bitmap;
                                if (bitmap != null)
                                {
                                    _defaultIcon = Icon.FromHandle(bitmap.GetHicon());                                          // TODO: Should this bitmap be disposed after this?
                                }
                            }
                        }

                        // Load the document cache size
                        if (row.HasValue("DocumentCacheSize"))
                        {
                            documentCacheSize = (int)row["DocumentCacheSize"];
                        }

                        // Load the image cache size
                        if (row.HasValue("ImageCacheSize"))
                        {
                            imageCacheSize = (int)row["ImageCacheSize"];
                        }

                        // Load the help file
                        if (row.HasValue("HelpDocument"))
                        {
                            string document = (string)row["HelpDocument"];
                            if (document != String.Empty)
                            {
                                LoadHelpDocument(document);
                            }
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                HandleException(new ClientException(ClientException.Codes.ErrorLoadingSettings, exception));
            }
            finally
            {
                if (_theme == null)
                {
                    _theme = new Theme();
                }
            }

            // Setup the image cache
            try
            {
                if (imageCacheSize > 0)
                {
                    Pipe.ImageCache = new FixedSizeCache <string, byte[]>(imageCacheSize);
                }
            }
            catch (Exception exception)
            {
                HandleException(exception);                     // Don't fail, just warn
            }

            // Set up the client-side document cache
            try
            {
                if (documentCacheSize > 0)
                {
                    Pipe.Cache =
                        new DocumentCache
                        (
                            Path.Combine
                            (
                                Path.Combine(System.IO.Path.GetTempPath(), CCachePath),
                                @"App" + applicationID.ToString()
                            ),
                            documentCacheSize
                        );
                }
            }
                        #if DEBUG
            catch (Exception exception)
                        #else
            catch
                        #endif
            {
                                #if DEBUG
                HandleException(exception);                     // Don't fail if we can't do this and only show something if under debug
                                #endif
            }

            return(base.SetApplication(applicationID, clientType));
        }
Example #10
0
 protected override Alphora.Dataphor.DAE.Runtime.DataParams GetParams()
 {
     DAE.Runtime.DataParams paramsValue = new DAE.Runtime.DataParams();
     paramsValue.Add(DAE.Runtime.DataParam.Create(Dataphoria.UtilityProcess, "ALibraryName", LibraryName));
     return(paramsValue);
 }