public DetailBookController(Views.Book.BookDetailsView view, ReadOnlyContext context, int bookID, int userID)
        {
            this.userID = userID;
            this.bookID = bookID;
            _context = context;
            _detailBookView = view;

            _booksRepository = context.GetRepository<DataInterface.Entities.Copy>();
            _leasesRepository = context.GetRepository<DataInterface.Entities.Lease>();
            _usersRepository = context.GetRepository<DataInterface.Entities.User>();
            _reservationsRepository = context.GetRepository<DataInterface.Entities.Reservation>();
            selectedBook = _booksRepository.GetById(bookID);

            var userBorrowedBooks = _leasesRepository.GetByQuery(x => x.Copy.Book.Id == bookID);
            var userBookingBooks = _reservationsRepository.GetByQuery(x => x.ReservedCopy.Book.Id == bookID);
            Views.Book.BookDetailsView example = new Views.Book.BookDetailsView(selectedBook, userBorrowedBooks, userBookingBooks);

            if (_context.CurrentUser.Role == DataInterface.Enums.Role.Reader)
            {
                Return.Visible = false;
                Title.Enabled = false;
                Author.Enabled = false;
                ISBN.Enabled = false;
                PublishingYear.Enabled = false;
                Publisher.Enabled = false;
                Format.Enabled = false;
            }

            _detailBookView = example;

            Return.Click += ReturnBook_Click;
            Borrow.Click += Borrow_Click;

            _detailBookView.Show();
        }
예제 #2
0
 public MainForm(Models.GameModel model, Views.Table table)
 {
     InitializeComponent();
     gameModel = model;
     tableView = table;
     model.AnswerGameStart += model_AnswerGameStart;
 }
예제 #3
0
        private string CreateSourceFile(Views.ViewBase view, CompilerParameters _Parameters)
        {
            // create source file from template
            string code = Properties.Resources.CodeTemplate
                .Replace("%USER_CODE%", view.MapFunctionCode)
                .Replace("%COLUMN_COUNT%", view.SchemaColumns.Columns.Count.ToString())
                .Replace("%VIEW_ROW%", CreateViewRows(view.ViewsUsed))
                .Replace("%BASE_TYPE%", Type.GetType(view.FireOnTypes[0]).FullName)
                .Replace("%COLUMNS_PARAMS%", CreateColumnParams(view.SchemaColumns))
                .Replace("%DATA_ASSIGN%", CreateDataAssign(view.SchemaColumns))
                ;

            // extract type information for compile references
            Dictionary<string, string> references = new Dictionary<string, string>();

            foreach (string aqn in view.FireOnTypes)
            {
                Type t = Type.GetType(aqn);
                if (references.ContainsKey(t.FullName) == false)
                    references.Add(t.FullName, t.Assembly.Location);
                // TODO :traverse hierarchy and add all references
            }

            _Parameters.ReferencedAssemblies.Add(this.GetType().Assembly.Location);
            // set reference assemblies
            foreach (string s in references.Values)
                _Parameters.ReferencedAssemblies.Add(s);

            return code;
        }
 public override void OnViewCreated(Views.View p0, OS.Bundle p1)
 {
     if (DialogAdapter == null) return;
     DialogAdapter.List = ListView;
     DialogAdapter.RegisterListView();
     base.OnViewCreated(p0, p1);
 }
 public PluginDataItem(Views.Plugins.PluginBase plugin)
 {
     TypeName = plugin.GetType().ToString();
     Outputs = plugin.Outputs;
     Inputs = plugin.Inputs;
     InstanceName = plugin.InstanceName;
 }
예제 #6
0
//        public void test()
//        {
//            Views.View v = new Views.View();
//            v.SchemaColumns = new ViewRowDefinition();
//            v.Name = "test";
//            v.FireOnTypes = new List<string>();
//            v.FireOnTypes.Add("BizFX.Entity.Return, BizFX.Entity, Version=2.0.0.0, Culture=neutral, PublicKeyToken=e5d192f5e46064af");
//            v.SchemaColumns.Columns.Add("Name", DataTypes.String);
//            v.SchemaColumns.Columns.Add("BirthDay", DataTypes.DateTime);
//            v.SchemaColumns.Columns.Add("Address", DataTypes.String);
//            v.SchemaColumns.Columns.Add("Code", DataTypes.Int);
//            v.MapFunctionCode = @"
//List<object[]> q = api.Query(""someview"",""a=1"",0, -1);
//foreach(object[] rr in q)
//{
//    testRow r = new testRow(rr);
//    emit(data.GUID, r.Name, r.BirthDay, r.Address, r.Code*2);
//}
//if(data.IsOK)
//    emit(data.GUID, ""ppp"",DateTime.Now,""hello"",123);
//else
//    api.Log(""error"");
//";
//            //v.SchemaColumns = v.Name;
//            //v.ViewsUsed = new List<Views.ViewRowDefinition>();
//            //v.ViewsUsed.Add(v.SchemaColumns);
//            Compile(v,"RaptorDB\\Views\\");
//        }

        #region [  M A P   C O M P I L E R  ]
        public void Compile(Views.ViewBase view, string mapfolder)
        {
            Directory.CreateDirectory(mapfolder);
            CodeDomProvider cs = CodeDomProvider.CreateProvider("CSharp");
            var _Parameters = new CompilerParameters();

            // create source file
            string code = CreateSourceFile(view, _Parameters);

            // Compile code
            _Parameters.IncludeDebugInformation = false;
            _Parameters.GenerateExecutable = false;
            _Parameters.CompilerOptions = "/optimize";
            _Parameters.OutputAssembly = mapfolder + 
                view.Name +
                //DocID.ToString().Replace("-", "") + 
                ".dll";
            var compilerresult = cs.CompileAssemblyFromSource(_Parameters, code);

            if (compilerresult.Errors.HasErrors)
            {
                foreach (var p in compilerresult.Errors)
                    _log.Error(p.ToString());
            }
            else
            {
                _mapcache.Remove(mapfolder + view.Name + ".dll");
            }
        }
예제 #7
0
        internal AppState(App application)
        {
            m_application = application;

            m_transcript = new Transcript();
            m_view = Views.Transcript;
        }
예제 #8
0
 public NotifyIconWrapper(Views.MainWindow mainWindos)
 {
     InitializeComponent();
     this.Display.Click += this.Display_Click;
     this._mainWindow = mainWindos;
     this._mainWindow.Activate();
 }
예제 #9
0
        public ActionResult Comment(Views.Blog.Models.Comment model)
        {
            if (string.IsNullOrWhiteSpace(model.Name))
                ModelState.AddModelError("Required", "You must enter your name.");

            if (string.IsNullOrWhiteSpace(model.Email))
                ModelState.AddModelError("Required", "You must enter an email address. Your email will not be publicly viewable.");

            if (string.IsNullOrWhiteSpace(model.Body))
                ModelState.AddModelError("Required", "You must some content for your comment.");

            var comments = Session.Query<PostComments>()
                                  .Include(x => x.PostId)
                                  .Where(x => x.PostId == model.PostId)
                                  .FirstOrDefault();

            if (comments == null)
                return new HttpStatusCodeResult(404, "We're having trouble loading the comments for that post.");

            var post = Session.Load<Post>(comments.PostId);

            if (post == null)
                return new HttpStatusCodeResult(404, "We're having trouble finding that post right now.");

            if (ModelState.IsValid == false)
                return RedirectToAction("Post", new { slug = post.Slug });

            if (post.TrashedAt != null || post.PublishedAt == null || post.PublishedAt.Value > DateTimeOffset.UtcNow)
                return new HttpStatusCodeResult(403, "You aren't allowed post a comment on this post right now.");

            var comment = new Comment
            {
                Author = model.Name,
                AuthorEmail = model.Email,
                AuthorUrl = model.Url,
                Body = model.Body,
                WrittenAt = DateTimeOffset.UtcNow,
                UserHostAddress = Request.UserHostAddress,
                UserAgent = Request.UserAgent
            };

            var settings = Settings.Load();
            var posted = false;
            var moderation = false;

            if (settings.CommentsRequireApproval == false)
            {
                comments.ApprovedComments.Add(comment);
                post.NumberOfComments++;
                posted = true;
            }
            else
            {
                comments.UnapprovedComments.Add(comment);
                moderation = true;
            }

            Session.SaveChanges();
            return RedirectToAction("Post", new { slug = post.Slug, posted, moderation });
        }
예제 #10
0
        /// <summary>
        /// Constructor of the class. Sets up the commands, variables and the sql-connection.
        /// </summary>
        /// <param name="adminLogIn">Login data of the admin account.</param>
        public UserEditorViewModel(Views.Utils.LogIn adminLogIn)
        {
            AddUserCommand = new RelayCommand(() => _AddUserCommand(), () => true);
            RemoveUserCommand = new RelayCommand(() => _RemoveUserCommand(), () => true);
            DownloadDatabaseCommand = new RelayCommand(() => _BackupDatabaseCommand(), () => true);

            AdminLogIn = adminLogIn;

            sqlConnection = new SqlConnection(@"Data Source = " + adminLogIn.IPAdress + ", " + adminLogIn.Port + "; Network Library = DBMSSOCN; User ID = " + adminLogIn.UserName + "; Password = "******"; ");
            //ServerConnection serverConnection = new ServerConnection(sqlConnection);
            ServerConnection serverConnection = new ServerConnection(adminLogIn.IPAdress + ", " + adminLogIn.Port);
            server = new Server(serverConnection);
            server.ConnectionContext.LoginSecure = false;
            server.ConnectionContext.Login = adminLogIn.UserName;
            server.ConnectionContext.Password = adminLogIn.Password;

            try
            {
                string temp = server.Information.Version.ToString();   // connection is established
            }
            catch (ConnectionFailureException e)
            {
                MessageBox.Show("Login error: " + e.Message, "Error");
                DialogResult = false;
                return;
            }

            Users = new ObservableCollection<MyUser>();

            FillUserList();
        }
예제 #11
0
        /// <summary>
        /// Sets the OpenGL modelview matrix to obtain a basic billboarding effect
        /// </summary>
        /// <param name="view"></param>
        public static void BillboardCheatSphericalBegin(Views view)
        {
            //  float[] modelview = new float[16];
            int i,j;

            // save the current modelview matrix
            GL.PushMatrix();

            if (view == Views.XY)
            {
                return;
            }

            if (view == Views.XZ)
            {
                GL.Rotate(-90.0f, 1.0f, 0.0f, 0.0f);
                return;
            }

            // get the current modelview matrix
            GL.GetFloat(GetPName.ModelviewMatrix, modelview);

            // undo all rotations
            // beware all scaling is lost as well
            for( i=0; i<3; i++ )
                for( j=0; j<3; j++ ) {
                if ( i==j )
                    modelview[i*4+j] = 1.0f;
                else
                    modelview[i*4+j] = 0.0f;
                }

            // set the modelview with no rotationss
            GL.LoadMatrix(modelview);
        }
예제 #12
0
 public void Navigate(Views sourcePageType)
 {
     var pageType = this.GetViewType(sourcePageType);
     if (pageType != null)
     {
         ((Frame)Window.Current.Content).Navigate(pageType);
     }
 }
예제 #13
0
        /// <summary>
        /// Displays a view
        /// </summary>
        /// <param name="view">The view to show</param>
        public void DisplayView(Views.BaseView view)
        {
            //remove all user controls
            foreach (Control oControl in this.scMain.Panel2.Controls)
                if (oControl is UserControl)
                    oControl.Dispose();

            //show the view
            view.Dock = DockStyle.Fill;
            this.scMain.Panel2.Controls.Add(view);
        }
예제 #14
0
        /// <summary>
        /// Displays a view
        /// </summary>
        /// <param name="view">The view to show</param>
        public void DisplayView(Views.BaseView view)
        {
            //remove all user controls
            for (int i = this.scMain.Panel2.Controls.Count - 1; i >= 0; i--)
            {
                this.scMain.Panel2.Controls[i].Dispose() ;
            }

            //show the view
            view.Dock = DockStyle.Fill;
            this.scMain.Panel2.Controls.Add(view);
        }
        public override void OnViewCreated(Views.View p0, OS.Bundle p1)
        {
            if (DialogAdapter == null)
            {
                ListAdapter = DialogAdapter = new DialogAdapter(Activity, _root, ListView);
                _root = null;
            }

            DialogAdapter.List = ListView;
            DialogAdapter.RegisterListView();
            base.OnViewCreated(p0, p1);
        }
예제 #16
0
파일: Client.cs 프로젝트: xsurge83/mycouch
        public Client(IConnection connection)
        {
            Ensure.That(connection, "connection").IsNotNull();

            Connection = connection;
            EntityReflector = new EntityReflector();
            Serializer = new MyCouchSerializer(EntityReflector); //TODO: Either replace with Func<IEntityReflector> or pass IClient Latter is ugly...ugliest...
            ResponseFactory = new ResponseFactory(this);
            Databases = new Databases(this);
            Documents = new Documents(this);
            Entities = new Entities(this);
            Views = new Views(this);
        }
예제 #17
0
 public static Image DrawAirplane(Aircraft ac, Views view, string selected_SurfName, int secHighlight)
 {
     switch (view)
     {
         case Views.Isomeric:
             return DrawAirplane(ac, 35, 0, -45, selected_SurfName, secHighlight);
         case Views.Planform:
             return DrawAirplane(ac, 0, 0, 0, selected_SurfName, secHighlight);
         case Views.Side:
             return DrawAirplane(ac, 0, 0, -90, selected_SurfName, secHighlight);
         case Views.Front:
             return DrawAirplane(ac, 90, 0, -90, selected_SurfName, secHighlight);
         default: goto case 0;
     }
 }
        void ChildFrame_ItemDataLoad(object sender, Views.ItemDataEventArgs e)
        {
            Content.BreadcrumbItem bci = new Content.BreadcrumbItem()
            {
                Title = e.Title,
                Uri = e.Source
            };

            try {
                if (currentLevel < e.Level)
                {
                    LinksStackPanel.Children.Add(bci);
                    title.Add(e.Title);
                }
                else if (currentLevel == e.Level)
                {
                    LinksStackPanel.Children.Remove(LinksStackPanel.Children.Last());
                    LinksStackPanel.Children.Add(bci);
                    title.Remove(title.Last());
                    title.Add(e.Title);
                }
                else if (currentLevel > e.Level)
                {
                    List<UIElement> links = LinksStackPanel.Children.ToList<UIElement>();
                    LinksStackPanel.Children.Clear();
                    title.Clear();
                    int i = 0;
                    links.ForEach(delegate(UIElement element)
                    {
                        if (i < e.Level) {
                            LinksStackPanel.Children.Add(element);
                            title.Add((element as Content.BreadcrumbItem).Title);
                        }
                        i++;
                    });
                }
                currentLevel = e.Level;
                Content.BreadcrumbItem firstBci = LinksStackPanel.Children.First() as Content.BreadcrumbItem;
                VisualStateManager.GoToState(firstBci, "FirstItemState", false);
                (sender as Views.Item).Title = title.ToString();

            }
            catch (ArgumentException ex) { }
            catch (Exception ex) { }
            LayoutRoot.IsBusy = false;

            //Settings.Write<List<UIElement>>("breadcrumb", LinksStackPanel.Children.ToList<UIElement>());
        }
예제 #19
0
        public Database(string typeName, string server, string name, string connectionString)
        {
            this.typeName = typeName;
            this.server = server;
            this.name = name;
            this.connectionString = connectionString;
            connection = new OdbcConnection(this.connectionString);

            _tables = new Tables(this);
            _views = new Views(this);
            _sequences = new Sequences(this);
            _storedprocedures = new StoredProcedures(this);
            _functions = new Functions(this);
            _modules = new Modules(this);
            _mqts = new MQTS(this);
        }
        public DetailUserController(Views.User.UserDetailView view, ReadOnlyContext context, int userID)
        {
            _detailUserView = view;
            _view = (IDetailView)view;
            _usersRepository = context.GetRepository<DataInterface.Entities.User>();
            _leasesRepository = context.GetRepository<DataInterface.Entities.Lease>();
            _reservationsRepository = context.GetRepository<DataInterface.Entities.Reservation>();
            _bookCopiesRepository = context.GetRepository<DataInterface.Entities.Copy>();
            selectedUser = _usersRepository.GetById(userID);

            var userBorrowedBooks = _leasesRepository.GetByQuery(x => x.User.Id == userID);
            var userReservedBooks = _reservationsRepository.GetByQuery(x => x.ReservedBy.Id == userID);

            Views.User.UserDetailView example = new Views.User.UserDetailView(selectedUser, userBorrowedBooks, userReservedBooks);
            _detailUserView = example;
            _view = example;
            if (context.CurrentUser.Role == DataInterface.Enums.Role.Reader)
            {
                Name.Enabled = false;
                Surname.Enabled = false;
                PESEL.Enabled = false;
                Mail.Enabled = false;
                Phone.Enabled = false;
                Role.Enabled = false;
                Address.Enabled = false;
                Postal.Enabled = false;
                City.Enabled = false;
                State.Enabled = false;
                Country.Enabled = false;
                Active.Enabled = false;
                Update.Enabled = false;
                Return.Enabled = false;
            }

            if (context.CurrentUser.Role == DataInterface.Enums.Role.Librarian)
            {
                Role.Enabled = false;
            }

            isRegistered = Active.Checked;
            Update.Click += Update_Click;
            Return.Click += ReturnBook_Click;
            CancelReservation.Click += CancelReservation_Click;
            ExtendLease.Click += ExtendLease_Click;
            _detailUserView.Show();
        }
        private Type GetViewType(Views view)
        {
            switch (view)
            {
                case Views.Login:
                    return typeof(MainPage);
                case Views.Updates:
                    return typeof(UpdatesPage);
                case Views.Toasts:
                    return typeof(ToastsPage);
                    break;
                case Views.Profile:
                    return typeof(ProfilePage);
                    break;
                default:
                    break;
            }

            return null;
        }
예제 #22
0
        private Type GetViewType(Views view)
        {
            switch (view)
            {
                case Views.MainPage:
                    return typeof(MainPage);
                case Views.DescriptionPage:
                    return typeof(ShortDescriptionPage);
                case Views.TextDescriptionPage:
                    return typeof(OnlyTextDescriptionPage);
                case Views.MainPageSearch:
                    return typeof(MainPageSearch);
                case Views.NoInternetPage:
                    return typeof(NoInternetPage);
                case Views.ByContinent:
                    return typeof(AssociatesByContinent);
                case Views.ByCategory:
                    return typeof(AssociatesByCategory);
            }

            return null;
        }
예제 #23
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="viewState">Definiton of the state of this view</param>
        /// <param name="v">The viewing perspective</param>
        public OpenGLCellPlacementPanel(SpatialViewState viewState, Views v)
            : base()
        {
            this.spatialViewState = viewState;
            this.view = v;

            if (v == Views.XY)
            {
                this.panelViewState = viewState.XY;
            }
            else if (v == Views.XZ)
            {
                this.panelViewState = viewState.XZ;
            }
            else if (v == Views.ThreeD)
            {
                this.panelViewState = viewState.ThreeD;
            }
            else if (v == Views.ThreeDAnalyzer)
            {
                this.panelViewState = viewState.ThreeDAnalyzer;
            }
        }
예제 #24
0
 public void ChangeViewTo(Views view)
 {
     Vector3 pos;
     Vector3 rot;
     switch(view){
         case Views.Hand:
             pos = new Vector3(-37.0f, 76.0f, -500.0f);
             rot = new Vector3(38.0f, 0.0f, 0.0f);
             break;
         case Views.Table:
             pos = new Vector3(-37.0f, 81.4f, -488.84f);
             rot = new Vector3(90.0f, 0.0f, 0.0f);
             break;
         case Views.ActionCards:
             pos = new Vector3(-37.0f, 75.7f, -488.7f);
             rot = new Vector3(90.0f, 0.0f, 0.0f);
             break;
         default:
             return;
     }
     iTween.MoveTo(gameObject, pos, 2.0f);
     iTween.RotateTo(gameObject,  rot, 2.0f);
 }
        public DetailBookController(Views.Book.BookDetailsView view, ReadOnlyContext context, int bookID)
        {
            // _view = view;
            _detailBookView = view;
            this.bookID = bookID;
            this.userID = -1;
            _context = context;
            _booksRepository = context.GetRepository<DataInterface.Entities.Copy>();
            _leasesRepository = context.GetRepository<DataInterface.Entities.Lease>();
            _usersRepository = context.GetRepository<DataInterface.Entities.User>();
            _reservationsRepository = context.GetRepository<DataInterface.Entities.Reservation>();
            selectedBook = _booksRepository.GetById(bookID);

            var userBorrowedBooks = _leasesRepository.GetByQuery(x => x.Copy.Book.Id == bookID);
            var userBookingBooks = _reservationsRepository.GetByQuery(x => x.ReservedCopy.Book.Id == bookID);
            Views.Book.BookDetailsView example = new Views.Book.BookDetailsView(selectedBook, userBorrowedBooks, userBookingBooks);
            _detailBookView = example;
            Return.Enabled = false;
            Return.Click += ReturnBook_Click;
            Borrow.Click += Borrow_Click;

            _detailBookView.Show();
        }
예제 #26
0
        public IList<DatabaseColumn> Execute(DbConnection connection)
        {
            var views = new Views(_viewName).Execute(connection);

            foreach (var view in views)
            {
                var viewName = view.Name;
                using (var cmd = connection.CreateCommand())
                {
                    cmd.CommandText = string.Format(PragmaSql, viewName);
                    int ordinal = 0;
                    using (var dr = cmd.ExecuteReader())
                    {
                        while (dr.Read())
                        {
                            var colName = dr.GetString("name");
                            var col = new DatabaseColumn
                                      {
                                          TableName = viewName,
                                          Name = colName,
                                          Ordinal = ordinal,
                                          //type will be like "nvarchar(32)".
                                          //Lengths /precisions could be parsed out (nb remember this is Sqlite)
                                          DbDataType = dr.GetString("type"),
                                          Nullable = dr.GetBoolean("notnull"),
                                          DefaultValue = dr.GetString("dflt_value"),
                                          IsPrimaryKey = dr.GetBoolean("pk"),
                                      };
                            Result.Add(col);
                            ordinal++;
                        }
                    }
                }
            }

            return Result;
        }
예제 #27
0
 /// <summary>
 /// Start the views
 /// </summary>
 internal override void Start()
 {
     Initialize();
     InitializeViews();
     Views.ForEach(view => view.Start());
 }
        private Views GetViews(string connectionString)
        {
            Views views = new Views(10);

            string sqlCmd = "select [name],[object_id] from sys.views where type='V'";
            SqlDataReader dr = SqlHelper.ExecuteReader(connectionString, CommandType.Text, sqlCmd);
            while (dr.Read())
            {
                string id = dr.GetString(0);
                string displayName = dr.GetString(0);
                string name = dr.GetString(0);
                string comment = string.Empty;
                int objectId = dr.GetInt32(1);

                View view = new View(id, displayName, name, comment);
                view.OriginalName = name;
                view.Columns = this.GetColumns(objectId, connectionString);
                views.Add(id, view);
            }
            dr.Close();

            return views;
        }
예제 #29
0
 public static Image DrawAirplane(Aircraft ac, Views view)
 {
     return(DrawAirplane(ac, view, string.Empty, -1));
 }
 protected override void OnInit(EventArgs e)
 {
     allViews = Views.LoadViews(GetConfigFile(Constants.ConfigFile.ViewPermissionsFile));
     base.OnInit(e);
 }
예제 #31
0
        public override sealed async Task LoadSchemaAsync()
        {
            StartWork();
            try
            {
                await(Task.Run(() =>
                {
                    DataSource.DatabaseMetadata.PreloadTables();
                    DataSource.DatabaseMetadata.PreloadViews();
                })); //Task-10, we need an async version of this.


                Tables.AddRange(DataSource.DatabaseMetadata.GetTablesAndViews().Where(t => t.IsTable).OrderBy(t => t.Name.Schema).ThenBy(t => t.Name.Name).Select(t => new SqlServerTableVM(DataSource, (SqlServerTableOrViewMetadata <SqlDbType>)t)));
                Views.AddRange(DataSource.DatabaseMetadata.GetTablesAndViews().Where(t => !t.IsTable).OrderBy(t => t.Name.Schema).ThenBy(t => t.Name.Name).Select(t => new ViewVM(t)));

                const string tableDescriptionsSql = @"SELECT s.name AS SchemaName, t.name AS TableName, ep.value FROM sys.extended_properties ep
INNER JOIN sys.tables t ON ep.major_id = t.object_id AND ep.minor_id = 0
INNER JOIN sys.schemas s ON t.schema_id = s.schema_id
AND ep.name = 'MS_Description';";

                var tableDescriptions = await DataSource.Sql(tableDescriptionsSql).ToTable().ExecuteAsync();

                foreach (var item in tableDescriptions.Rows)
                {
                    var table = Tables.Single(t => t.Table.Name.Schema == (string)item["SchemaName"] && t.Table.Name.Name == (string)item["TableName"]);
                    table.Description = (string)item["value"];
                }

                const string columnDescriptionsSql = @"SELECT s.name AS SchemaName, t.name AS TableName, c.name AS ColumnName, ep.value FROM sys.extended_properties ep
INNER JOIN sys.tables t ON ep.major_id = t.object_id 
INNER JOIN sys.schemas s ON t.schema_id = s.schema_id
INNER JOIN sys.columns c ON c.object_id = ep.major_id AND c.column_id = ep.minor_id
AND ep.name = 'MS_Description'";


                var columnDescriptions = await DataSource.Sql(columnDescriptionsSql).ToTable().ExecuteAsync();

                foreach (var item in columnDescriptions.Rows)
                {
                    var table  = Tables.Single(t => t.Table.Name.Schema == (string)item["SchemaName"] && t.Table.Name.Name == (string)item["TableName"]);
                    var column = (SqlServerColumnModel)table.Columns.Single(c => c.Name == (string)item["ColumnName"]);
                    column.Description = (string)item["value"];
                }

                const string sparseColumnsSql = @"SELECT s.name AS SchemaName, t.name AS TableName, c.name AS ColumnName, c.is_sparse 
FROM sys.tables t 
INNER JOIN sys.schemas s ON t.schema_id = s.schema_id
INNER JOIN sys.columns c ON c.object_id = t.object_id";
                var          sparseColumns    = await DataSource.Sql(sparseColumnsSql).ToTable().ExecuteAsync();

                foreach (var item in sparseColumns.Rows)
                {
                    var table  = Tables.Single(t => t.Table.Name.Schema == (string)item["SchemaName"] && t.Table.Name.Name == (string)item["TableName"]);
                    var column = (SqlServerColumnModel)table.Columns.Single(c => c.Name == (string)item["ColumnName"]);
                    column.IsSparse = (bool)item["is_sparse"];
                }

                const string relatedTablesSql = @"SELECT s.name AS SchemaName, t.name AS TableName, s2.name AS ReferencedSchemaName, t2.name AS ReferencedTableName
FROM sys.foreign_key_columns fkc
    INNER JOIN sys.tables t
        ON fkc.parent_object_id = t.object_id
    INNER JOIN sys.columns c
        ON c.column_id = fkc.parent_column_id
           AND c.object_id = fkc.parent_object_id
    INNER JOIN sys.schemas s
        ON s.schema_id = t.schema_id
    INNER JOIN sys.tables t2
        ON fkc.referenced_object_id = t2.object_id
    INNER JOIN sys.columns c2
        ON c2.column_id = fkc.referenced_column_id
           AND c2.object_id = fkc.referenced_object_id
    INNER JOIN sys.schemas s2
        ON s2.schema_id = t2.schema_id
    INNER JOIN sys.foreign_keys fk
        ON fk.object_id = fkc.constraint_object_id";

                var relatedTables = await DataSource.Sql(relatedTablesSql).ToTable().ExecuteAsync();

                foreach (var item in relatedTables.Rows)
                {
                    var table        = Tables.Single(t => t.Table.Name.Schema == (string)item["SchemaName"] && t.Table.Name.Name == (string)item["TableName"]);
                    var relatedTable = Tables.Single(t => t.Table.Name.Schema == (string)item["ReferencedSchemaName"] && t.Table.Name.Name == (string)item["ReferencedTableName"]);

                    if (!table.ReferencedTables.Contains(relatedTable))
                    {
                        table.ReferencedTables.Add(relatedTable);
                    }
                    if (!relatedTable.ReferencedByTables.Contains(table))
                    {
                        relatedTable.ReferencedByTables.Add(table);
                    }
                }
            }
            finally
            {
                StopWork();
            }
        }
예제 #32
0
 /// <summary>
 /// Adds a view to the database
 /// </summary>
 /// <param name="ViewName">View name</param>
 public override ITable AddView(string ViewName)
 {
     return(Views.AddAndReturn(new View(ViewName, this)));
 }
        public void master_layout_itself_will_get_no_layout_in_this_case()
        {
            var master = Views.Templates <RazorTemplate>().FirstOrDefault(x => x.Name() == "Application");

            master.Master.ShouldBeNull();
        }
예제 #34
0
        public static ResponseFile Csv(Context context, SiteSettings ss, Export export)
        {
            ss.SetExports(context: context);
            ss.JoinedSsHash.Values.ForEach(currentSs => currentSs
                                           .SetChoiceHash(context: context, all: true));
            var data = new Dictionary <long, Dictionary <long, Dictionary <int, string> > >();
            Dictionary <long, long> keys = null;
            var keyColumns = KeyColumns(export, ss.SiteId);
            var view       = Views.GetBySession(context: context, ss: ss);

            switch (ss.ReferenceType)
            {
            case "Issues":
                keys = IssueData(
                    context: context,
                    ss: ss,
                    data: data,
                    where : view.Where(context: context, ss: ss),
                    orderBy: view.OrderBy(
                        context: context,
                        ss: ss,
                        orderBy: Rds.IssuesOrderBy()
                        .UpdatedTime(SqlOrderBy.Types.desc)),
                    export: export,
                    keys: keys,
                    keyColumns: keyColumns);
                break;

            case "Results":
                keys = ResultData(
                    context: context,
                    ss: ss,
                    data: data,
                    where : view.Where(context: context, ss: ss),
                    orderBy: view.OrderBy(
                        context: context,
                        ss: ss,
                        orderBy: Rds.ResultsOrderBy()
                        .UpdatedTime(SqlOrderBy.Types.desc)),
                    export: export,
                    keys: keys,
                    keyColumns: keyColumns);
                break;
            }
            export.Join?.ForEach(link =>
            {
                var currentSs = ss.JoinedSsHash.Get(link.SiteId);
                switch (currentSs.ReferenceType)
                {
                case "Issues":
                    keys = IssueData(
                        context: context,
                        ss: currentSs,
                        data: data,
                        where : Rds.IssuesWhere().IssueId_In(keys.Values),
                        orderBy: null,
                        export: export,
                        keys: keys,
                        keyColumns: keyColumns);
                    break;

                case "Results":
                    keys = ResultData(
                        context: context,
                        ss: currentSs,
                        data: data,
                        where : Rds.ResultsWhere().ResultId_In(keys.Values),
                        orderBy: null,
                        export: export,
                        keys: keys,
                        keyColumns: keyColumns);
                    break;
                }
            });
            var csv = new System.Text.StringBuilder();

            if (export.Header == true)
            {
                csv.Append(export.Columns.Select(column =>
                                                 "\"" + column.GetLabelText() + "\"").Join(","), "\n");
            }
            data
            .FirstOrDefault(o => o.Key == ss.SiteId)
            .Value?
            .ForEach(dataRow =>
                     csv.Append(export.Columns.Select(column =>
                                                      data
                                                      .Get(column.SiteId)?
                                                      .Get(dataRow.Key)?
                                                      .Get(column.Id) ?? string.Empty).Join(",") + "\n"));
            return(new ResponseFile(csv.ToString(), FileName(ss, export.Name)));
        }
예제 #35
0
 /// <summary>
 /// Adds a view to the database
 /// </summary>
 /// <param name="ViewName">View name</param>
 public virtual View AddView(string ViewName)
 {
     return(Views.AddAndReturn(new View(ViewName, this)));
 }
예제 #36
0
        public void ConvertToStandard(string name)
        {
            //            var oldfields = StandardExtraValues.GetExtraValues().ToList();
            var           oldfields = Views.GetStandardExtraValues(DbUtil.Db, "People");
            ExtraValue    ev        = null;
            List <string> codes     = null;
            var           v         = new CmsData.ExtraValue.Value {
                Name = name
            };

            switch (ExtraValueTable)
            {
            case "People":
                ev = (from vv in DbUtil.Db.PeopleExtras
                      where vv.Field == name
                      select new ExtraValue(vv, null)).First();

                if (CreateExtraValueBits(name, ev, v))
                {
                    return;
                }

                //StandardExtraValues.Field bits = null;
                var bits = oldfields.SingleOrDefault(ff => ff.Codes.Select(x => x.Text).Contains(name));
                if (bits != null)
                {
                    codes             = bits.Codes.Select(x => x.Text).ToList();
                    ev.Type           = "Bits";
                    v.Name            = bits.Name;
                    v.VisibilityRoles = bits.VisibilityRoles;
                    v.EditableRoles   = bits.EditableRoles;
                }
                else
                {
                    var f = oldfields.SingleOrDefault(ff => ff.Name == name);
                    if (f != null)
                    {
                        v.VisibilityRoles = f.VisibilityRoles;
                        v.EditableRoles   = f.EditableRoles;
                    }
                    if (ev.Type == "Code")
                    {
                        codes = (from vv in DbUtil.Db.PeopleExtras
                                 where vv.Field == name
                                 select vv.StrValue).Distinct().ToList();
                    }
                }
                break;

            case "Organization":
                ev = (from vv in DbUtil.Db.OrganizationExtras
                      where vv.Field == name
                      select new ExtraValue(vv, null)).First();
                if (ev.Type == "Code")
                {
                    codes = (from vv in DbUtil.Db.OrganizationExtras
                             where vv.Field == name
                             select vv.StrValue).Distinct().ToList();
                }
                break;

            case "Family":
                ev = (from vv in DbUtil.Db.FamilyExtras
                      where vv.Field == name
                      select new ExtraValue(vv, null)).First();
                if (ev.Type == "Code")
                {
                    codes = (from vv in DbUtil.Db.FamilyExtras
                             where vv.Field == name
                             select vv.StrValue).Distinct().ToList();
                }
                break;

            case "Meeting":
                ev = (from vv in DbUtil.Db.MeetingExtras
                      where vv.Field == name
                      select new ExtraValue(vv, null)).First();
                if (ev.Type == "Code")
                {
                    codes = (from vv in DbUtil.Db.MeetingExtras
                             where vv.Field == name
                             select vv.StrValue).Distinct().ToList();
                }
                break;

            case "OrgMember":
                ev = (from vv in DbUtil.Db.OrgMemberExtras
                      where vv.Field == name
                      select new ExtraValue(vv, null)).First();
                if (ev.Type == "Code")
                {
                    codes = (from vv in DbUtil.Db.OrgMemberExtras
                             where vv.Field == name
                             select vv.StrValue).Distinct().ToList();
                }
                break;

            case "Contact":
                ev = (from vv in DbUtil.Db.ContactExtras
                      where vv.Field == name
                      select new ExtraValue(vv, null)).First();
                if (ev.Type == "Code")
                {
                    codes = (from vv in DbUtil.Db.ContactExtras
                             where vv.Field == name
                             select vv.StrValue).Distinct().ToList();
                }
                break;

            default:
                return;
            }
            v.Type  = ev.Type;
            v.Codes = codes?.Select(x => new CmsData.Classes.ExtraValues.Code {
                Text = x
            }).ToList();
            var i = Views.GetViewsView(DbUtil.Db, ExtraValueTable, ExtraValueLocation);

            i.view.Values.Add(v);
            i.views.Save(DbUtil.Db);
            DbUtil.LogActivity($"EV{ExtraValueTable} ConvertToStandard {name}");
        }
예제 #37
0
 public void DeleteView(string key)
 {
     Views.Remove(key);
 }
예제 #38
0
        public List <SQLServer_Object> FilterByType(FilteringTypeValues Type)
        {
            List <SQLServer_Object> Back = new List <SQLServer_Object>();

            switch (Type)
            {
            case FilteringTypeValues.Tables:
                if (Tables != null && Tables.Count > 0)
                {
                    Back.AddRange(Tables.ToArray());
                }
                break;

            case FilteringTypeValues.Views:
                if (Views != null && Views.Count > 0)
                {
                    Back.AddRange(Views.ToArray());
                }
                break;

            case FilteringTypeValues.Sps:
                if (Sps != null && Sps.Count > 0)
                {
                    Back.AddRange(Sps.ToArray());
                }
                break;

            case FilteringTypeValues.Code:
                if (Views != null && Views.Count > 0)
                {
                    Back.AddRange(Views.ToArray());
                }
                if (Sps != null && Sps.Count > 0)
                {
                    Back.AddRange(Sps.ToArray());
                }
                break;

            case FilteringTypeValues.Fields:
                if (Tables != null && Tables.Count > 0)
                {
                    Back.AddRange(Tables.ToArray());
                }
                if (Views != null && Views.Count > 0)
                {
                    Back.AddRange(Views.ToArray());
                }
                break;

            case FilteringTypeValues.Variables:
            case FilteringTypeValues.Snippets:
                ;
                break;

            case FilteringTypeValues.All:
            default:
                if (Tables != null && Tables.Count > 0)
                {
                    Back.AddRange(Tables.ToArray());
                }
                if (Views != null && Views.Count > 0)
                {
                    Back.AddRange(Views.ToArray());
                }
                if (Sps != null && Sps.Count > 0)
                {
                    Back.AddRange(Sps.ToArray());
                }
                break;
            }
            return(Back);
        }
예제 #39
0
        private void RefreshViews()
        {
            //obtener lista de vistas de la BD actual
            string sql_views;

            sql_views = "SELECT  \n" +
                        "	sobj.id as OwnerId, \n"+
                        "	sobj.name as OwnerName, \n"+
                        "	cols.name as Nombre,    \n"+
                        "	type_name(cols.xusertype) as Tipo,    \n"+
                        "	isnull(cols.prec, 0) as Longitud,    \n"+
                        "	isnull(cols.Scale, 0) as Escala,    \n"+
                        "	isnull(cols.isnullable, 1) as Nullable,    \n"+
                        "	isnull(cols.iscomputed, 0) as Calculated	 \n"+
                        "FROM  \n" +
                        "	sysobjects sobj INNER JOIN syscolumns cols ON sobj.id=cols.id \n"+
                        "WHERE  \n" +
                        "	sobj.xtype = 'V'  \n"+
                        "	and sobj.name <> 'sysdiagrams'  \n"+
                        "order by  \n" +
                        "	sobj.name, cols.colid \n";

            //obtener lista de vistas de la BD actual
            DataTable  Info = new DataTable();
            SqlCommand cmd  = new SqlCommand(sql_views, Conx);

            try
            {
                SqlDataAdapter da = new SqlDataAdapter();
                da.SelectCommand = cmd;
                da.SelectCommand.Connection.Open();
                da.Fill(Info);
                da.SelectCommand.Connection.Close();
            }
            catch (Exception ex)
            {
                cmd.Connection.Close();
                return;
            }
            cmd.Dispose();

            if (Views != null)
            {
                Views.Clear();
            }
            else
            {
                Views = new List <SQLServer_Object>();
            }

            SQLServer_Object CurObj = null;
            string           curview = "";
            int i, rowcount = Info.Rows.Count;

            for (i = 0; i < rowcount; i++)
            {
                if (!curview.Equals(Info.Rows[i]["OwnerName"].ToString(), StringComparison.CurrentCultureIgnoreCase))
                {//agregar solo el campo
                    CurObj  = new SQLServer_Object(this, Convert.ToInt32(Info.Rows[i]["OwnerId"]), Info.Rows[i]["OwnerName"].ToString(), "Vista", DataType.View);
                    curview = CurObj.Name;
                    Views.Add(CurObj);
                }
                SQLServer_Object Field;
                Field = new SQLServer_Object(null, 0, Info.Rows[i]["Nombre"].ToString(), "Campo", DataType.Field);
                Field.LlaveForanea   = false;
                Field.LlavePrimaria  = false;
                Field.Tipo           = Info.Rows[i]["Tipo"].ToString();
                Field.Precision      = Convert.ToInt32(Info.Rows[i]["Longitud"]);
                Field.Nullable       = Convert.ToInt32(Info.Rows[i]["Nullable"]) == 1;
                Field.Calculado      = false;
                Field.Default        = "";
                Field.ReferenceID    = 0;
                Field.ReferenceTable = "";
                Field.ReferenceField = "";
                CurObj.Childs.Add(Field);
            }
        }
예제 #40
0
        public override IEnumerable <ExtraInfo> CodeSummary()
        {
            var NameTypes     = Views.GetViewableNameTypes(DbUtil.Db, "Family", nocache: true);
            var standardtypes = new CodeValueModel().ExtraValueTypeCodes();
            var adhoctypes    = new CodeValueModel().AdhocExtraValueTypeCodes();

            var qcodevalues = (from e in DbUtil.Db.FamilyExtras
                               where e.Type == "Bit" || e.Type == "Code"
                               group e by new
            {
                e.Field,
                val = e.StrValue ?? (e.BitValue == true ? "1" : "0"),
                e.Type,
            } into g
                               select new { key = g.Key, count = g.Count() }).ToList();

            var qcodes = from i in qcodevalues
                         join sv in NameTypes on i.key.Field equals sv.Name into j
                         from sv in j.DefaultIfEmpty()
                         let type = sv == null ? i.key.Type : sv.Type
                                    let typobj = sv == null
                                ? adhoctypes.SingleOrDefault(ee => ee.Code == type)
                                : standardtypes.SingleOrDefault(ee => ee.Code == type)
                                                 let typedisplay = typobj == null ? "unknown" : typobj.Value
                                                                   select new ExtraInfoFamily
            {
                Field       = i.key.Field,
                Value       = i.key.val,
                Type        = i.key.Type,
                TypeDisplay = typedisplay,
                Standard    = sv != null,
                Count       = i.count,
                CanView     = sv == null || sv.CanView
            };

            var qdatavalues = (from e in DbUtil.Db.FamilyExtras
                               where !(e.Type == "Bit" || e.Type == "Code")
                               where e.Type != "CodeText"
                               group e by new
            {
                e.Field,
                e.Type,
            } into g
                               select new { key = g.Key, count = g.Count() }).ToList();

            var qdatums = from i in qdatavalues
                          join sv in NameTypes on i.key.Field equals sv.Name into j
                          from sv in j.DefaultIfEmpty()
                          let type = sv == null ? i.key.Type : sv.Type
                                     let typedisplay = sv == null
                                ? adhoctypes.SingleOrDefault(ee => ee.Code == type)
                                : standardtypes.SingleOrDefault(ee => ee.Code == type)
                                                       select new ExtraInfoFamily
            {
                Field       = i.key.Field,
                Value       = "(multiple)",
                Type        = i.key.Type,
                TypeDisplay = typedisplay == null ? (type ?? "unknown") : typedisplay.Value,
                Standard    = sv != null,
                Count       = i.count,
                CanView     = sv == null || sv.CanView
            };

            return(qcodes.Union(qdatums).OrderBy(ee => ee.Field));
        }
예제 #41
0
        /*
         * public static IMXController NavigateFromButton(string url, Dictionary<string, string> parameters, UIBarButtonItem button)
         * {
         *      //_stashButton = button;
         *
         *      return Navigate(url, parameters);
         * }
         */

        public void LoadViewForController(IMXView fromView, IMXController controller, MXViewPerspective viewPerspective)
        {
            HideLoading();

            if (controller.View == null)
            {
                // get the view, create it if it has yet been created
                controller.View = Views.GetOrCreateView(viewPerspective);
                if (controller.View == null)
                {
                    Console.WriteLine("View not found for perspective!" + viewPerspective.ToString());
                    throw new ArgumentException("View creation failed for perspective!" + viewPerspective.ToString());
                }
            }


            // asign the view it's model and render the contents of the view
            controller.View.SetModel(controller.GetModel());
            controller.View.Render();

            // pull the type from the view
            ViewNavigationContext navigationContext = MXTouchNavigation.GetViewNavigationContext(controller.View);
            UIViewController      viewController    = controller.View as UIViewController;

            // iFactr binding options
            if (viewController == null)
            {
                viewController = RenderLayer(controller.View);
            }


            if (navigationContext == ViewNavigationContext.Modal)
            {
                // treat as a modal/popup view
                touchNavigation.PushToModel(viewController);
            }
            else if (navigationContext == ViewNavigationContext.InContext)
            {
                // it's just an in-context view, just slap it on top of the view that navigated it here!
                UIViewController parentViewController = fromView as UIViewController;
                if (!parentViewController.NavigationController.ViewControllers.Contains(viewController))
                {
                    parentViewController.NavigationController.PushViewController(viewController, true);
                }
                else
                {
                    parentViewController.NavigationController.PopToViewController(viewController, true);
                }
            }
            else
            {
                // if the view is one of the views in the group
                MXTouchViewGroup     viewGroup     = null;
                MXTouchViewGroupItem viewGroupItem = null;

                foreach (MXTouchViewGroup vg in ViewGroups)
                {
                    var viewType = controller.View.GetType();
                    // Check the type itself and its interfaces
                    viewGroupItem = vg.Items.Find(item => item.ViewType == viewType || viewType.GetInterface(item.ViewType.ToString()) != null);

                    if (viewGroupItem != null)
                    {
                        viewGroup = vg;
                        break;
                    }
                }

                if (viewGroup != null)
                {
                    // activate the group!
                    touchNavigation.PushToViewGroup(viewGroup, viewGroupItem, controller.View as UIViewController);
                }
                else
                {
                    switch (navigationContext)
                    {
                    case ViewNavigationContext.Detail:
                        touchNavigation.PushToDetail(viewController);
                        break;

                    case ViewNavigationContext.Master:
                        touchNavigation.PushToMaster(viewController);
                        break;
                    }
                }
            }

            // handle initial view display if not already handled
            ShowView();
        }
예제 #42
0
 public NSDictionary Dictionary()
 {
     return(NSDictionary.FromObjectsAndKeys(Views.ToArray(), ViewNames.ToArray()));
 }
예제 #43
0
        public Dictionary <string, string> Codes(string name)
        {
            var f = Views.GetStandardExtraValues(DbUtil.Db, Table, false, Location).Single(ee => ee.Name == name);

            return(f.Codes.ToDictionary(ee => ee.Text, ee => ee.Text));
        }
예제 #44
0
        /// <summary>
        /// Executes the rendering logic for the view of the specified <see cref="IMXController"/> instance before painting it on the screen.
        /// </summary>
        /// <param name="controller">The controller to output.</param>
        /// <param name="perspective">The perspective that is mapped to the view that will be rendered.</param>
        /// <param name="navigatedUri">A <see cref="String"/> that represents the uri used to navigate to the controller.</param>
        /// <exception cref="ArgumentNullException">Thrown when the <paramref name="controller"/> is <c>null</c>.</exception>
        /// <exception cref="InvalidOperationException">Thrown when there is no view mapped to the <paramref name="perspective"/>.</exception>
        public void OutputController(IMXController controller, string perspective, string navigatedUri)
        {
            if (controller == null)
            {
                throw new ArgumentNullException("controller");
            }

            var     ilayer = controller as iLayer;
            IMXView view   = Views.GetView(controller.ModelType, perspective);

            if (view == null)
            {
                if (ilayer != null)
                {
                    view        = ilayer.GetView();
                    ilayer.View = view;
                }
                else
                {
                    var viewType = Views.GetViewType(controller.ModelType, perspective);
                    if (viewType == null)
                    {
                        object model = controller.GetModel();
                        if (model != null && Device.Reflector.HasAttribute(model.GetType(), typeof(ViewAttribute), false))
                        {
                            view = ReflectiveUIBuilder.GenerateView(model);
                        }
                        else
                        {
                            throw new InvalidOperationException("There is no view or view type mapped to the given perspective.");
                        }
                    }
                    else
                    {
                        view = (IMXView)Activator.CreateInstance(viewType);
                    }
                }
            }

            view.SetModel(controller.GetModel());

            var entry = view as IHistoryEntry;

            if (entry != null)
            {
                entry.OutputPane = PaneManager.Instance.GetPreferredPaneForView(view);
            }

            view.Render();

            {
                var handler = ViewOutputting;
                if (handler != null)
                {
                    var args = new ViewOutputCancelEventArgs(controller, view);
                    handler(this, args);

                    if (args.Cancel)
                    {
                        return;
                    }
                }
            }

            var tabs = view as ITabView;

            if (tabs != null)
            {
                PaneManager.Instance.Tabs = tabs;
            }

            PaneManager.Instance.NavigatedURIs[view] = navigatedUri;
            OnOutputView(view);

            { // Handler scope
                var handler = ViewOutputted;
                if (handler != null)
                {
                    handler(this, new ViewOutputEventArgs(controller, view));
                }
            }

            StopBlockingUserInput();
        }
예제 #45
0
        public WindowViewModel(IObjectProvider objectProvider,
                               IWindowFactory windowFactory,
                               ILogger logger,
                               IWindowsController windowsController,
                               RecentFilesViewModel recentFilesViewModel,
                               GeneralOptionsViewModel generalOptionsViewModel,
                               ISchedulerProvider schedulerProvider,
                               DialogViewModel dialogviewmodel,
                               FileOpenViewModel fileopenviewmodel)
        {
            //This function handles the pinning
            //If the user decides to pin a tab the function will lock that tab and reorder the effected tabs
            Pinning = new ActionCommand(o =>
            {
                var viewsarray       = Views.ToList();
                var pinnedone        = Views.FirstOrDefault(c => c.Header.Equals(o));
                var pinnedindex      = Views.IndexOf(pinnedone);
                bool actualpinned    = false;
                ViewContainer oldtab = null;

                if (o.GetType().IsEquivalentTo(typeof(FilesHeader)))
                {
                    ((FilesHeader)pinnedone.Header).IsPinned = !((FilesHeader)pinnedone.Header).IsPinned;
                    actualpinned = ((FilesHeader)pinnedone.Header).IsPinned;
                }
                else
                {
                    ((FileHeader)pinnedone.Header).IsPinned = !((FileHeader)pinnedone.Header).IsPinned;
                    actualpinned = ((FileHeader)pinnedone.Header).IsPinned;
                }


                if (actualpinned)
                {
                    PinnedNumber  += 1;
                    PinnedNumber2 += 1;

                    oldtab = Views[pinnedindex];

                    viewsarray.Remove(viewsarray[pinnedindex]);
                    viewsarray.Insert(PinnedNumber, oldtab);
                }
                else
                {
                    PinnedNumber  -= 1;
                    PinnedNumber2 -= 1;

                    oldtab = Views[pinnedindex];

                    viewsarray.Remove(viewsarray[pinnedindex]);
                    viewsarray.Insert(PinnedNumber2, oldtab);
                }

                Views = new ObservableCollection <ViewContainer>(viewsarray);

                OnPropertyChanged("Views");
                OnPropertyChanged("PinnedNumber2");
            });
            _logger               = logger;
            _windowsController    = windowsController;
            RecentFiles           = recentFilesViewModel;
            GeneralOptions        = generalOptionsViewModel;
            Dialog                = dialogviewmodel;
            _schedulerProvider    = schedulerProvider;
            _objectProvider       = objectProvider;
            InterTabClient        = new InterTabClient(windowFactory);
            FileOpenDialogCommand = new Command(OpenFileDialog);
            FileOpen              = new FileOpenViewModel(OpenFile);

            ShowInGitHubCommand = new Command(() => Process.Start("https://github.com/RolandPheasant"));

            Views.CollectionChanged += Views_CollectionChanged;

            ZoomOutCommand    = new Command(() => { GeneralOptions.Scale = GeneralOptions.Scale + 5; });
            ZoomInCommand     = new Command(() => { GeneralOptions.Scale = GeneralOptions.Scale - 5; });
            SaveLayoutCommand = new Command(WalkTheLayout);
            ExitCommmand      = new Command(() => Application.Current.Shutdown());

            Version = $"v{Assembly.GetEntryAssembly().GetName().Version.ToString(3)}";

            var fileDropped    = DropMonitor.Dropped.Subscribe(async t => await OpenFile(t));
            var isEmptyChecker = Views.ToObservableChangeSet()
                                 .ToCollection()
                                 .Select(items => items.Count)
                                 .StartWith(0)
                                 .Select(count => count == 0)
                                 .Subscribe(isEmpty => IsEmpty = isEmpty);

            var openRecent = recentFilesViewModel.OpenFileRequest
                             .Subscribe(file =>
            {
                MenuIsOpen = false;
                OpenFile(file);
            });

            _cleanUp = new CompositeDisposable(recentFilesViewModel,
                                               isEmptyChecker,
                                               fileDropped,
                                               DropMonitor,
                                               openRecent,
                                               Disposable.Create(() =>
            {
                Views.Select(vc => vc.Content)
                .OfType <IDisposable>()
                .ForEach(d => d.Dispose());
            }));
        }
예제 #46
0
        public XDocument StandardColumns(bool includeRoot = true)
        {
            var doc = new XDocument();

            using (var writer = doc.CreateWriter())
            {
                var w = new APIWriter(writer);
                if (includeRoot)
                {
                    w.Start("CustomReports");
                }
                w.Start("Report").Attr("name", "YourReportNameGoesHere");
                if (orgid.HasValue)
                {
                    w.Attr("showOnOrgId", orgid);
                }
                foreach (var c in mc.Columns.Values)
                {
                    w.Start("Column").Attr("name", c.Column).End();
                }

                var protectedevs = from value in Views.GetStandardExtraValues(db, "People")
                                   where value.VisibilityRoles.HasValue()
                                   select value.Name;

                var standards = (from value in Views.GetStandardExtraValues(db, "People")
                                 select value.Name).ToList();

                var extravalues = from ev in db.PeopleExtras
                                  where !protectedevs.Contains(ev.Field)
                                  where (ev.UseAllValues ?? false) == false
                                  group ev by new { ev.Field, ev.Type }
                into g
                orderby g.Key.Field
                select g.Key;

                foreach (var ev in extravalues)
                {
                    if (!Regex.IsMatch(ev.Type, @"Code|Date|Text|Int|Bit"))
                    {
                        continue;
                    }
                    w.Start("Column");
                    w.Attr("field", ev.Field).Attr("name", "ExtraValue" + ev.Type);
                    if (!standards.Contains(ev.Field))
                    {
                        w.Attr("disabled", "true");
                    }
                    w.End();
                }
                var statusflags = from f in db.ViewStatusFlagLists
                                  where f.RoleName == null
                                  orderby f.Name
                                  select f;
                foreach (var f in statusflags)
                {
                    w.Start("Column")
                    .Attr("description", f.Name)
                    .Attr("flag", f.Flag)
                    .Attr("name", "StatusFlag")
                    .End();
                }
                if (orgid.HasValue)
                {
                    var specialcols = from c in mc.SpecialColumns.Values
                                      where c.Context == "org"
                                      where c.Column != "SmallGroup"
                                      select c;
                    foreach (var c in specialcols)
                    {
                        w.Start("Column")
                        .Attr("name", c.Column)
                        .Attr("orgid", orgid)
                        .End();
                    }

                    var smallgroups = from sg in db.MemberTags
                                      where sg.OrgId == orgid
                                      orderby sg.Name
                                      select sg;
                    foreach (var sg in smallgroups)
                    {
                        w.Start("Column")
                        .Attr("smallgroup", sg.Name)
                        .Attr("orgid", orgid)
                        .Attr("name", "SmallGroup")
                        .End();
                    }
                }
                w.End();
                if (includeRoot)
                {
                    w.End();
                }
            }
            return(doc);
        }
 public void should_have_exactly_5_views()
 {
     Views.Templates <RazorTemplate>().Count().ShouldEqual(5);
 }
예제 #48
0
 public ListViewColumn(string title, CellView cellView) : this()
 {
     Title = title;
     Views.Add(cellView);
 }
예제 #49
0
        private static DataSet DataSet(Context context, SiteSettings ss, long id)
        {
            var statements = new List <SqlStatement>();

            ss.Sources
            .Values
            .Where(currentSs => currentSs.ReferenceType == "Issues")
            .ForEach(currentSs =>
                     statements.Add(SelectIssues(
                                        context: context,
                                        ss: currentSs,
                                        view: Views.GetBySession(
                                            context: context,
                                            ss: currentSs,
                                            dataTableName: DataTableName(
                                                ss: currentSs,
                                                direction: "Source")),
                                        id: id,
                                        direction: "Source")));
            ss.Destinations
            .Values
            .Where(currentSs => currentSs.ReferenceType == "Issues")
            .ForEach(currentSs =>
                     statements.Add(SelectIssues(
                                        context: context,
                                        ss: currentSs,
                                        view: Views.GetBySession(
                                            context: context,
                                            ss: currentSs,
                                            dataTableName: DataTableName(
                                                ss: currentSs,
                                                direction: "Destination")),
                                        id: id,
                                        direction: "Destination")));
            ss.Sources
            .Values
            .Where(currentSs => currentSs.ReferenceType == "Results")
            .ForEach(currentSs =>
                     statements.Add(SelectResults(
                                        context: context,
                                        ss: currentSs,
                                        view: Views.GetBySession(
                                            context: context,
                                            ss: currentSs,
                                            dataTableName: DataTableName(
                                                ss: currentSs,
                                                direction: "Source")),
                                        id: id,
                                        direction: "Source")));
            ss.Destinations
            .Values
            .Where(currentSs => currentSs.ReferenceType == "Results")
            .ForEach(currentSs =>
                     statements.Add(SelectResults(
                                        context: context,
                                        ss: currentSs,
                                        view: Views.GetBySession(
                                            context: context,
                                            ss: currentSs,
                                            dataTableName: DataTableName(
                                                ss: currentSs,
                                                direction: "Destination")),
                                        id: id,
                                        direction: "Destination")));
            return(statements.Any()
                ? Rds.ExecuteDataSet(
                       context: context,
                       statements: statements.ToArray())
                : null);
        }
예제 #50
0
        public override SQLScriptList ToSqlDiff(List <ISchemaBase> schemas)
        {
            var isAzure10 = this.Info.Version == DatabaseInfo.VersionTypeEnum.SQLServerAzure10;

            var listDiff = new SQLScriptList();

            listDiff.Add(new SQLScript(String.Format(@"/*

    Open DBDiff {0}
    http://opendbiff.codeplex.com/

    Script created by {1}\{2} on {3} at {4}.

    Created on:  {5}
    Source:      {6} on {7}
    Destination: {8} on {9}

*/

",
                                                     System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(),
                                                     Environment.UserDomainName,
                                                     Environment.UserName,
                                                     DateTime.Now.ToShortDateString(),
                                                     DateTime.Now.ToLongTimeString(),
                                                     Environment.MachineName,
                                                     SourceInfo != null ? SourceInfo.Database : "Uknown",
                                                     SourceInfo != null ? SourceInfo.Server : "Uknown",
                                                     Info != null ? Info.Database : "Uknown",
                                                     Info != null ? Info.Server : "Uknown",
                                                     0), 0, Enums.ScripActionType.None));
            if (!isAzure10)
            {
                listDiff.Add("USE [" + Name + "]\r\nGO\r\n\r\n", 0, Enums.ScripActionType.UseDatabase);
                listDiff.AddRange(Assemblies.ToSqlDiff(schemas));
                listDiff.AddRange(UserTypes.ToSqlDiff(schemas));
            }
            listDiff.AddRange(TablesTypes.ToSqlDiff(schemas));
            listDiff.AddRange(Tables.ToSqlDiff(schemas));
            listDiff.AddRange(Rules.ToSqlDiff(schemas));
            listDiff.AddRange(Schemas.ToSqlDiff(schemas));
            listDiff.AddRange(XmlSchemas.ToSqlDiff(schemas));
            listDiff.AddRange(Procedures.ToSqlDiff(schemas));
            if (!isAzure10)
            {
                listDiff.AddRange(CLRProcedures.ToSqlDiff(schemas));
                listDiff.AddRange(CLRFunctions.ToSqlDiff(schemas));
                listDiff.AddRange(FileGroups.ToSqlDiff(schemas));
            }
            listDiff.AddRange(DDLTriggers.ToSqlDiff(schemas));
            listDiff.AddRange(Synonyms.ToSqlDiff(schemas));
            listDiff.AddRange(Views.ToSqlDiff(schemas));
            listDiff.AddRange(Users.ToSqlDiff(schemas));
            listDiff.AddRange(Functions.ToSqlDiff(schemas));
            listDiff.AddRange(Roles.ToSqlDiff(schemas));
            listDiff.AddRange(PartitionFunctions.ToSqlDiff(schemas));
            listDiff.AddRange(PartitionSchemes.ToSqlDiff(schemas));
            if (!isAzure10)
            {
                listDiff.AddRange(FullText.ToSqlDiff(schemas));
            }
            return(listDiff);
        }
예제 #51
0
 public IEnumerable <ConceptRoot> GetAllConceptsRoots()
 {
     return(Views.SelectMany(view => view.Roots));
 }
예제 #52
0
 protected override void CreateMainView()
 {
     base.CreateMainView();
     gridControlView     = (Views.FirstOrDefault() as CustomGridControlView);
     gridControlViewInfo = Views.FirstOrDefault().GetViewInfo() as CustomGridControlViewInfo;
 }
예제 #53
0
 //
 public bool UserView(int userId)
 {
     return(Views.Any(x => x.UserID == userId));
 }
 public List <DVD> GetDvdsAuthors()
 {
     var dvds            = DvdRepository.GetDvds();
     var authors         = DvdRepository.GetAuthorsForDvds(Dvds);
     var DvdsWithAuthors = Views.GetDvdView(dvds, authors);
 }
 public override Views.View OnCreateView(Views.LayoutInflater p0, Views.ViewGroup p1, OS.Bundle p2)
 {
     ListAdapter = DialogAdapter;
     return base.OnCreateView(p0, p1, p2);
 }
예제 #56
0
        public static DataSet DataSet(Context context, SiteSettings ss, long id)
        {
            var targets = ss.EditorColumnHash.Values
                          .SelectMany(o => o
                                      .Where(p => p.StartsWith("_Links-"))
                                      .Select(p => p.Split_2nd('-').ToLong()))
                          .ToList();
            var cache = ss.LinkedSsDataSetHash
                        ?? ItemModel.LinkedSsDataSetHash(context, ss.SiteId);
            var statements = new List <SqlStatement>();

            statements.AddRange(ss.Sources
                                .Values
                                .Where(o => !targets.Any() || targets.Contains(o.SiteId))
                                .Where(currentSs => currentSs.ReferenceType == "Issues")
                                .Select(currentSs => SelectIssues(
                                            context: context,
                                            ss: currentSs,
                                            view: Views.GetBySession(
                                                context: context,
                                                ss: currentSs,
                                                dataTableName: DataTableName(
                                                    ss: currentSs,
                                                    direction: "Source")),
                                            id: id,
                                            direction: "Source",
                                            cache: cache)));
            statements.AddRange(ss.Destinations
                                .Values
                                .Where(o => !targets.Any() || targets.Contains(o.SiteId))
                                .Where(currentSs => currentSs.ReferenceType == "Issues")
                                .Select(currentSs => SelectIssues(
                                            context: context,
                                            ss: currentSs,
                                            view: Views.GetBySession(
                                                context: context,
                                                ss: currentSs,
                                                dataTableName: DataTableName(
                                                    ss: currentSs,
                                                    direction: "Destination")),
                                            id: id,
                                            direction: "Destination",
                                            cache: cache)));
            statements.AddRange(ss.Sources
                                .Values
                                .Where(o => !targets.Any() || targets.Contains(o.SiteId))
                                .Where(currentSs => currentSs.ReferenceType == "Results")
                                .Select(currentSs => SelectResults(
                                            context: context,
                                            ss: currentSs,
                                            view: Views.GetBySession(
                                                context: context,
                                                ss: currentSs,
                                                dataTableName: DataTableName(
                                                    ss: currentSs,
                                                    direction: "Source")),
                                            id: id,
                                            direction: "Source",
                                            cache: cache)));
            statements.AddRange(ss.Destinations
                                .Values
                                .Where(o => !targets.Any() || targets.Contains(o.SiteId))
                                .Where(currentSs => currentSs.ReferenceType == "Results")
                                .Select(currentSs => SelectResults(
                                            context: context,
                                            ss: currentSs,
                                            view: Views.GetBySession(
                                                context: context,
                                                ss: currentSs,
                                                dataTableName: DataTableName(
                                                    ss: currentSs,
                                                    direction: "Destination")),
                                            id: id,
                                            direction: "Destination",
                                            cache: cache)));
            return(statements.Any()
                ? Repository.ExecuteDataSet(
                       context: context,
                       statements: statements.ToArray())
                : null);
        }
예제 #57
0
 public static Image DrawAirplane(Aircraft ac, Views view)
 {
     return DrawAirplane(ac, view, string.Empty, -1);
 }
예제 #58
0
 public virtual IEnumerable <IView> FindViewsBySchema(string schema)
 => Views.Where(item => item.Schema == schema);
예제 #59
0
        /// <summary>
        /// Returns a Translated name for selected Thumbnail Mod
        /// </summary>
        /// <param name="widebanner">Thumbnail enum to translate</param>
        /// <returns>Translated Name</returns>
        private string GetThumbnailName(Views thumb)
        {
            switch (thumb)
            {
                case Views.Default:
                    return Translation.ThumbnailDefault;

                case Views.ThumbsNoFanart:
                    return Translation.ThumbnailsNoFanart;

                case Views.ThumbsXL:
                    return Translation.ThumbnailXL;

                default:
                    return Translation.Thumbnails;
            }
        }
예제 #60
0
 public virtual IEnumerable <IView> FindViewsByName(string name)
 => Views.Where(item => item.Name == name);