Пример #1
0
        private void ReloadGridBookmarks()
        {
            int documentTipId = 0;

            try
            {
                documentTipId = int.Parse(DocumentumFactory.GetSelectedGridCellValue(metroGridDokumenta, "dokumentTipId").ToString());
            }
            catch
            {
                documentTipId = 0;
            }
            if (documentTipId > 0)
            {
                using (var context = new documentumEntities())
                {
                    var bookmarks = from Bookmark in context.Bookmarks.Where(s => s.dokumentTipId == documentTipId)
                                    select new
                    {
                        Bookmark.Id,
                        Bookmark.bookmarkTitle,
                        Bookmark.bookmarkName,
                        Bookmark.format
                    };
                    metroGridBookmarks.DataSource = bookmarks.ToList();
                    if (bookmarks.Count() > 0)
                    {
                        metroGridBookmarks.Columns[0].Visible = false;
                    }
                }
            }
        }
Пример #2
0
        private void metroGridBookmarks_RowEnter(object sender, DataGridViewCellEventArgs e)
        {
            string bookmarkName  = DocumentumFactory.GetSelectedGridCellValue(metroGridBookmarks, "bookmarkName").ToString();
            string bookmarkTitle = DocumentumFactory.GetSelectedGridCellValue(metroGridBookmarks, "bookmarkTitle").ToString();
            string format        = DocumentumFactory.GetSelectedGridCellValue(metroGridBookmarks, "format").ToString();

            mtbBookmarkName.Text  = bookmarkName;
            mtbBookmarkTitle.Text = bookmarkTitle;
            mtbFormat.Text        = format;
        }
Пример #3
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            DocumentumFactory.InitializeApplication();
            FormLogin login = new FormLogin();

            if (login.ShowDialog() == DialogResult.OK)
            {
                Application.Run(new FormMain());
            }
        }
Пример #4
0
        private void mbDeleteBookmark_Click(object sender, EventArgs e)
        {
            int bookmarkId = DocumentumFactory.GetSelectedGridId(metroGridBookmarks);

            using (var context = new documentumEntities())
            {
                Bookmark bookmark = context.Bookmarks.SingleOrDefault(b => b.Id == bookmarkId);

                context.Bookmarks.Remove(bookmark);

                context.SaveChanges();
            }
        }
Пример #5
0
        private void metroGridPredmeti_RowEnter(object sender, DataGridViewCellEventArgs e)
        {
            int smerGodinaPredmetId = DocumentumFactory.GetSelectedGridId(metroGridPredmeti);

            if (smerGodinaPredmetId > -1)
            {
                using (var context = new documentumEntities())
                {
                    SmerGodinaPredmet smerGodinaPredmet = context.SmerGodinaPredmets.SingleOrDefault(s => s.Id == smerGodinaPredmetId);
                    mcbGrupa.SelectedValue    = smerGodinaPredmet.grupaId;
                    mcbPredmet.SelectedValue  = smerGodinaPredmet.predmetId;
                    mcbRedniBroj.SelectedItem = smerGodinaPredmet.redniBroj.ToString();
                }
            }
        }
Пример #6
0
        private void mbSaveBookmark_Click(object sender, EventArgs e)
        {
            string bookmarkName  = mtbBookmarkName.Text;
            string bookmarkTitle = mtbBookmarkTitle.Text;
            string format        = mtbFormat.Text;

            int documentTipId = 0;

            try
            {
                documentTipId = int.Parse(DocumentumFactory.GetSelectedGridCellValue(metroGridDokumenta, "dokumentTipId").ToString());
            }
            catch
            {
                documentTipId = 0;
            }
            if (documentTipId > 0)
            {
                using (var context = new documentumEntities())
                {
                    Bookmark bookmark = context.Bookmarks.SingleOrDefault(s => s.dokumentTipId == documentTipId && s.bookmarkName.Equals(bookmarkName));
                    if (bookmark != null)
                    {
                        bookmark.bookmarkTitle = bookmarkTitle;
                        bookmark.format        = format;
                    }
                    else
                    {
                        bookmark = new Bookmark()
                        {
                            dokumentTipId = documentTipId,
                            bookmarkTitle = bookmarkTitle,
                            bookmarkName  = bookmarkName,
                            format        = format
                        };
                        context.Bookmarks.Add(bookmark);
                    }
                    context.SaveChanges();
                }
                ReloadGridBookmarks();
            }
        }