Ejemplo n.º 1
0
        //private static readonly int ernieTimeout = 0;

        public static IList <ErnieAllInfo> GetLatest()
        {
            Ernie bll = new Ernie();

            if (!enableCaching)
            {
                return(bll.GetLatest());
            }

            string key = "ernie_latest";
            IList <ErnieAllInfo> data = (IList <ErnieAllInfo>)HttpRuntime.Cache[key];

            if (data == null)
            {
                double timeOut = 0;
                data = bll.GetLatest();
                if (data.Count > 0)
                {
                    var model = data[0];
                    timeOut = (int)(model.EndTime - model.StartTime).TotalMilliseconds;
                }

                AggregateCacheDependency cd = DependencyFacade.GetErnieDependency();
                HttpRuntime.Cache.Add(key, data, cd, DateTime.Now.AddMilliseconds(timeOut), Cache.NoSlidingExpiration, CacheItemPriority.High, null);
            }

            return(data);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// This method acts as a proxy between the web and business components to check whether the
        /// underlying product has already been cached.
        /// </summary>
        /// <param name="productId">Product Id</param>
        /// <returns>ProductInfo from Cache or Business component</returns>
        public static ProductInfo GetProduct(string productId)
        {
            Product product = new Product();

            if (!enableCaching)
            {
                return(product.GetProduct(productId));
            }

            string      key  = "product_" + productId;
            ProductInfo data = (ProductInfo)HttpRuntime.Cache[key];

            // Check if the data exists in the data cache
            if (data == null)
            {
                // If the data is not in the cache then fetch the data from the business logic tier
                data = product.GetProduct(productId);

                // Create a AggregateCacheDependency object from the factory
                AggregateCacheDependency cd = DependencyFacade.GetProductDependency();

                // Store the output in the data cache, and Add the necessary AggregateCacheDependency object
                HttpRuntime.Cache.Add(key, data, cd, DateTime.Now.AddHours(productTimeout), Cache.NoSlidingExpiration, CacheItemPriority.High, null);
            }
            return(data);
        }
Ejemplo n.º 3
0
        private void DetailsButton_Click(object sender, EventArgs e)
        {
            Sections grp = new Sections();
            Topics   top = new Topics();

            foreach (DataGridViewRow row in dataGridView1.SelectedRows)
            {
                grp.ID        = (int)row.Cells[0].Value;
                grp.GroupSize = (byte)row.Cells[1].Value;
                grp.Status    = row.Cells[2].Value.ToString();
                if (row.Cells[4].Value != null)
                {
                    grp.TopicID = (int)row.Cells[4].Value;
                    top.ID      = (int)row.Cells[4].Value;
                    top.Title   = row.Cells[5].Value.ToString();
                }
                else
                {
                    top.ID      = 0;
                    grp.TopicID = 0;
                }
                grp.SemID = (int)row.Cells[3].Value;
            }
            top = DependencyFacade.GetTopicData(top);
            MoreInfo mri = new MoreInfo(2, grp, top);

            mri.ShowDialog();
        }
Ejemplo n.º 4
0
 private void SearchButton_Click(object sender, EventArgs e)
 {
     if (SectionTextbox.Text != "")
     {
         searchCrit = new Sections
         {
             ID = Convert.ToInt32(SectionTextbox.Text)
         };
     }
     else
     {
         searchCrit = new Sections
         {
             ID = 0
         };
     }
     dataGridView1.DataSource = DependencyFacade.GetSections(searchCrit, null);
     for (int i = 2; i < 5; i++)
     {
         DataGridViewColumn col = dataGridView1.Columns[i];
         col.Width = 60;
     }
     dataGridView1.Columns[0].Width = 30;
     dataGridView1.Columns[1].Width = 90;
     dataGridView1.Columns[5].Width = 250;
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Method to retrieve and cache category name by its ID
        /// </summary>
        /// <param name="categoryId">Category id</param>
        /// <returns>Category name</returns>
        public static string GetCategoryName(string categoryId)
        {
            Category category = new Category();

            if (!enableCaching)
            {
                return(category.GetCategory(categoryId).Name);
            }

            string cacheKey = string.Format(CATEGORY_NAME_KEY, categoryId);

            // Check if the data exists in the data cache
            string data = (string)HttpRuntime.Cache[cacheKey];

            if (data == null)
            {
                // Caching duration from Web.config
                int cacheDuration = int.Parse(ConfigurationManager.AppSettings["CategoryCacheDuration"]);

                // If the data is not in the cache then fetch the data from the business logic tier
                data = category.GetCategory(categoryId).Name;

                // Create a AggregateCacheDependency object from the factory
                AggregateCacheDependency cd = DependencyFacade.GetCategoryDependency();

                // Store the output in the data cache, and Add the necessary AggregateCacheDependency object
                HttpRuntime.Cache.Add(cacheKey, data, cd, DateTime.Now.AddHours(cacheDuration), Cache.NoSlidingExpiration, CacheItemPriority.High, null);
            }

            return(data);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// This method acts as a proxy between the web and business components to check whether the
        /// underlying item has already been cached.
        /// </summary>
        /// <param name="itemId">Item Id</param>
        /// <returns>ItemInfo from Cache or Business component</returns>
        public static ItemInfo GetItem(string itemId)
        {
            Item item = new Item();

            if (!enableCaching)
            {
                return(item.GetItem(itemId));
            }

            string   key  = "item_" + itemId;
            ItemInfo data = (ItemInfo)HttpRuntime.Cache[key];

            // Check if the data exists in the data cache
            if (data == null)
            {
                // If the data is not in the cache then fetch the data from the business logic tier
                data = item.GetItem(itemId);

                // Create a AggregateCacheDependency object from the factory
                AggregateCacheDependency cd = DependencyFacade.GetItemDependency();

                // Store the output in the data cache, and Add the necessary AggregateCacheDependency object
                HttpRuntime.Cache.Add(key, data, cd, DateTime.Now.AddHours(itemTimeout), Cache.NoSlidingExpiration, CacheItemPriority.High, null);
            }
            return(data);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// This method acts as a proxy between the web and business components to check whether the
        /// underlying category has already been cached.
        /// </summary>
        /// <param name="categoryId">Category Id</param>
        /// <returns>CategoryInfo from Cache or Business component</returns>
        public static CategoryInfo GetCategory(string categoryId)
        {
            Category category = new Category();

            if (!enableCaching)
            {
                return(category.GetCategory(categoryId));
            }

            string       key  = "category_" + categoryId;
            CategoryInfo data = (CategoryInfo)HttpRuntime.Cache[key];

            // Check if the data exists in the data cache
            if (data == null)
            {
                // If the data is not in the cache then fetch the data from the business logic tier
                data = category.GetCategory(categoryId);

                // Create a AggregateCacheDependency object from the factory
                AggregateCacheDependency cd = DependencyFacade.GetCategoryDependency();

                // Store the output in the data cache, and Add the necessary AggregateCacheDependency object
                HttpRuntime.Cache.Add(key, data, cd, DateTime.Now.AddHours(categoryTimeout), Cache.NoSlidingExpiration, CacheItemPriority.High, null);
            }
            return(data);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 获取当前内容类型对应数据
        /// </summary>
        /// <param name="contentType"></param>
        /// <returns></returns>
        public static ContentDetailInfo GetModel(string contentType)
        {
            ContentDetail bll  = new ContentDetail();
            SqlParameter  parm = new SqlParameter("@TypeCode", SqlDbType.NVarChar, 50);

            parm.Value = contentType;

            if (!enableCaching)
            {
                return(bll.GetList("and ct.TypeCode = @TypeCode ", parm).FirstOrDefault());
            }

            string            key  = "contentDetail_single_" + contentType + "";
            ContentDetailInfo data = (ContentDetailInfo)HttpRuntime.Cache[key];

            if (data == null)
            {
                data = bll.GetList("and ct.TypeCode = @TypeCode ", parm).FirstOrDefault();

                AggregateCacheDependency cd = DependencyFacade.GetContentDetailDependency();
                HttpRuntime.Cache.Add(key, data, cd, DateTime.Now.AddHours(contentDetailTimeout), Cache.NoSlidingExpiration, CacheItemPriority.High, null);
            }

            return(data);
        }
Ejemplo n.º 9
0
 private void SearchButton_Click(object sender, EventArgs e)
 {
     if (IDTextbox.Text != "")
     {
         searchCrit = new Topics
         {
             Title = TopicTextbox.Text,
             ID    = Convert.ToInt32(IDTextbox.Text)
         };
     }
     else
     {
         searchCrit = new Topics
         {
             Title = TopicTextbox.Text
         };
     }
     dataGridView1.DataSource            = DependencyFacade.GetTopics(searchCrit);
     dataGridView1.Columns[3].HeaderText = "Teacher name";
     dataGridView1.Columns[4].HeaderText = "Teacher surname";
     for (int i = 0; i < 5; i++)
     {
         DataGridViewColumn col = dataGridView1.Columns[i];
         col.Width = i == 1 ? 250 : 70;
     }
 }
Ejemplo n.º 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string categoryId = Request.QueryString["categoryId"];

            if (!string.IsNullOrEmpty(categoryId))
            {
                // process Home Page link
                HtmlAnchor lnkHome = new HtmlAnchor();
                lnkHome.InnerText = "Home";
                lnkHome.HRef      = "~/Default.aspx";
                plhControl.Controls.Add(lnkHome);
                plhControl.Controls.Add(GetDivider());

                // Process Product page link
                HtmlAnchor lnkProducts = new HtmlAnchor();
                lnkProducts.InnerText = WebUtility.GetCategoryName(categoryId);
                lnkProducts.HRef      = string.Format(PRODUCTS_URL, categoryId);
                plhControl.Controls.Add(lnkProducts);
                string productId = Request.QueryString["productId"];
                if (!string.IsNullOrEmpty(productId))
                {
                    // Process Item page link
                    plhControl.Controls.Add(GetDivider());
                    HtmlAnchor lnkItemDetails = new HtmlAnchor();
                    lnkItemDetails.InnerText = WebUtility.GetProductName(productId);
                    lnkItemDetails.HRef      = string.Format(ITEMS_URL, categoryId, productId);
                    plhControl.Controls.Add(lnkItemDetails);
                }
            }

            // Add cache dependency
            this.CachePolicy.Dependency = DependencyFacade.GetItemDependency();
        }
Ejemplo n.º 11
0
        private void OpenButton_Click(object sender, EventArgs e)
        {
            Files  fl   = DependencyFacade.GetFile(Convert.ToInt32(dataGridView1.SelectedCells[0].Value));
            string path = ByteToString(fl.File.ToArray(), fl.Ext);

            OpenFile(path);
            this.Hide();
        }
Ejemplo n.º 12
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            DependencyFacade.InsertPresenceDate(secID);
            this.Hide();
            Presences prs = new Presences(secID);

            prs.ShowDialog();
        }
Ejemplo n.º 13
0
 private void FileHistory_Load(object sender, EventArgs e)
 {
     dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
     dataGridView1.DataSource    = DependencyFacade.GetSectionFiles(id);
     dataGridView1.Columns.Remove("File");
     dataGridView1.Columns[0].Width = 40;
     dataGridView1.Columns[3].Width = 260;
     dataGridView1.Columns[4].Width = 40;
 }
Ejemplo n.º 14
0
 public LoginPanel()
 {
     InitializeComponent();
     sems = DependencyFacade.GetSems();
     for (int i = 0; i < sems.Length; i++)
     {
         SemCombobox.Items.Add(sems[i].StudyField + ", " + sems[i].Year + ", semestr " + sems[i].Sem);
     }
     SemCombobox.DropDownStyle = ComboBoxStyle.DropDownList;
     SemCombobox.SelectedIndex = 0;
 }
Ejemplo n.º 15
0
 private void SaveButton_Click(object sender, EventArgs e)
 {
     if (topics[TopicCombobox.SelectedIndex].Status.Equals("Open"))
     {
         DependencyFacade.SetTopic(topics[TopicCombobox.SelectedIndex].ID, Convert.ToInt32(SectionTexbox.Text));
         this.Hide();
     }
     else
     {
         MessageBox.Show("This topic is already closed!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
Ejemplo n.º 16
0
 private void SaveButton_Click(object sender, EventArgs e)
 {
     if (QuantityTextbox.Text != "")
     {
         searchCrit = new Sections
         {
             GroupSize = Convert.ToByte(QuantityTextbox.Text),
         };
         DependencyFacade.InsertSection(searchCrit);
         this.Hide();
     }
 }
Ejemplo n.º 17
0
 private void SaveButton_Click(object sender, EventArgs e)
 {
     if (StudyTextbox.Text != "" && YearTextbox.Text != "" && SemTextbox.Text != "")
     {
         Sems sem = new Sems();
         sem.StudyField = StudyTextbox.Text;
         sem.Year       = Convert.ToInt16(YearTextbox.Text);
         sem.Sem        = Convert.ToInt16(SemTextbox.Text);
         DependencyFacade.InsertSem(sem);
         this.Hide();
     }
 }
Ejemplo n.º 18
0
        public AddUser(int windowType, Users user)
        {
            usr = user;
            if (windowType == 0)
            {
                openType = 0;
                InitializeComponent();
                DegreeTextbox.Enabled = false;
                AlbumTextbox.Enabled  = false;
                SemCombobox.Enabled   = false;
                IDTextbox.Enabled     = false;
                IDTextbox.Visible     = false;
                IDLabel.Visible       = false;
                sems = DependencyFacade.GetSems();
                for (int i = 0; i < sems.Length; i++)
                {
                    SemCombobox.Items.Add(sems[i].StudyField + ", " + sems[i].Year + ", semestr " + sems[i].Sem);
                }
                SemCombobox.DropDownStyle = ComboBoxStyle.DropDownList;
                SemCombobox.SelectedIndex = 0;
            }
            else if (windowType == 1)
            {
                openType = 1;
                InitializeComponent();
                DegreeTextbox.Enabled          = false;
                AlbumTextbox.Enabled           = false;
                PswdLabel.Visible              = false;
                PswdTextbox.Visible            = false;
                PswdButton.Visible             = true;
                IDTextbox.Enabled              = false;
                this.Text                      = "Change Data";
                IDTextbox.Text                 = user.ID.ToString();
                NameTextBox.Text               = user.Name;
                SurnameTextbox.Text            = user.Surname;
                LoginTextbox.Text              = user.Login;
                FunctionCombobox.SelectedIndex = Convert.ToInt32(user.TypeOfUser);
                if (FunctionCombobox.SelectedIndex == 2)
                {
                    AlbumTextbox.Text = UserFacade.GetAlbumNumber(Convert.ToInt32(user.ID)).ToString();
                }

                FunctionCombobox.Enabled = false;
                sems = DependencyFacade.GetSems();
                for (int i = 0; i < sems.Length; i++)
                {
                    SemCombobox.Items.Add(sems[i].StudyField + ", " + sems[i].Year + ", semestr " + sems[i].Sem);
                }
                SemCombobox.DropDownStyle = ComboBoxStyle.DropDownList;
                SemCombobox.SelectedIndex = 0;
            }
        }
Ejemplo n.º 19
0
        private void StudentWindow_Load(object sender, EventArgs e)
        {
            Sections sec = new Sections();

            dataGridView1.DataSource = DependencyFacade.GetSections(sec, null);
            for (int i = 2; i < 5; i++)
            {
                DataGridViewColumn col = dataGridView1.Columns[i];
                col.Width = 60;
            }
            dataGridView1.Columns[0].Width = 30;
            dataGridView1.Columns[1].Width = 90;
            dataGridView1.Columns[5].Width = 250;
        }
Ejemplo n.º 20
0
        private void MySecButton_Click(object sender, EventArgs e)
        {
            Sections grp = new Sections();
            Topics   top = new Topics();

            grp = DependencyFacade.GetMySection(LoginPanel.albumNumber);
            if (grp != null && grp.TopicID != null)
            {
                top.ID = (int)grp.TopicID;
                top    = DependencyFacade.GetTopicData(top);
            }
            MoreInfo mri = new MoreInfo(1, grp, top);

            mri.ShowDialog();
        }
Ejemplo n.º 21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            GetControlStyle();
            BindCategories();

            // Select current category
            string categoryId = Request.QueryString["categoryId"];

            if (!string.IsNullOrEmpty(categoryId))
            {
                SelectCategory(categoryId);
            }

            // Add cache dependency
            this.CachePolicy.Dependency = DependencyFacade.GetCategoryDependency();
        }
Ejemplo n.º 22
0
 private void SaveButton_Click(object sender, EventArgs e)
 {
     for (int i = 0; i < presDates.Count; i++)
     {
         for (int j = 0; j < users.Length; j++)
         {
             Students_Groups[] stdgrp = UserFacade.GetGroupStudentID(users[j].ID);
             for (int l = 0; l < stdgrp.Length; l++)
             {
                 if (stdgrp[l].Active == true)
                 {
                     DependencyFacade.UpdatePresences(presDates[i], stdgrp[l].ID, dataGridView1[j, i].Value.ToString());
                 }
             }
         }
     }
     this.Hide();
 }
Ejemplo n.º 23
0
        public TopicSet(int id)
        {
            InitializeComponent();
            SectionTexbox.Text    = id.ToString();
            SectionTexbox.Enabled = false;
            Topics top = new Topics
            {
                ID = 0
            };

            topics = DependencyFacade.GetArrayTopics(LoginPanel.TeacherID);
            for (int i = 0; i < topics.Length; i++)
            {
                TopicCombobox.Items.Add(topics[i].Title);
            }
            TopicCombobox.DropDownStyle = ComboBoxStyle.DropDownList;
            TopicCombobox.SelectedIndex = 0;
        }
Ejemplo n.º 24
0
        private void SaveButton_Click(object sender, EventArgs e)
        {
            searchCrit = new Topics();
            if (TopicTextbox.Text != "" && InfoRichTextbox.Text != "" && TeacherTextbox.Text != "")
            {
                searchCrit.Title       = TopicTextbox.Text;
                searchCrit.Description = InfoRichTextbox.Text;
                searchCrit.TeacherID   = LoginPanel.TeacherID;

                if (IDTextbox.Text != "")
                {
                    searchCrit.ID = Convert.ToInt32(IDTextbox.Text);
                }

                if (StatusCombobox.SelectedItem.ToString() == "Open")
                {
                    searchCrit.Status = "Open";
                }
                else if (StatusCombobox.SelectedItem.ToString() == "Closed")
                {
                    searchCrit.Status = "Close";
                }
                else
                {
                    searchCrit.Status = "Final";
                }

                if (opentype == 1)
                {
                    DependencyFacade.InsertTopic(searchCrit);
                }
                else
                {
                    DependencyFacade.UpdateTopics(searchCrit);
                }
                this.Hide();
            }
            else
            {
                MessageBox.Show("Wrong parameters of topic.", "Warning", MessageBoxButtons.OK);
            }
        }
Ejemplo n.º 25
0
        private void InfoButton_Click(object sender, EventArgs e)
        {
            Sections sec = new Sections();
            Topics   top = new Topics();

            foreach (DataGridViewRow row in dataGridView1.SelectedRows)
            {
                if (row.Cells[4].Value != null)
                {
                    top.ID    = (int)row.Cells[4].Value;
                    top.Title = row.Cells[5].Value.ToString();
                }
                sec.ID = (int)row.Cells[0].Value;
            }
            sec = DependencyFacade.GetSection(sec);
            top = DependencyFacade.GetTopicData(top);
            MoreInfo mri = new MoreInfo(0, sec, top);

            mri.ShowDialog();
        }
        public User findUserInfomation(string id)
        {
            User   users    = null;
            string user_key = "UserReg_User " + id;

            if (enableCaching)
            {
                users = (User)HttpRuntime.Cache[user_key];
            }
            if (users == null)
            {
                users = manager.findUserInfomation(id);
            }
            if (users != null)
            {
                AggregateCacheDependency cd = DependencyFacade.GetUserInfoSelDependency();
                HttpRuntime.Cache.Add(user_key, users, cd, DateTime.Now.AddHours(UserRegTimeout), Cache.NoSlidingExpiration, CacheItemPriority.High, null);
            }
            return(users);
        }
Ejemplo n.º 27
0
        public Order Create(Order order)
        {
            Order groups = null;

            if (!enableCaching)
            {
                return(order);
            }
            string group_key = "Create_Order " + order.ID;

            groups = (Order)HttpRuntime.Cache[group_key];
            // Check if the data exists in the data cache
            if (groups == null && order != null)
            {
                //// If the data is not in the cache then fetch the data from the business logic tier
                AggregateCacheDependency cd = DependencyFacade.GetOrderCreateDependency();
                // Store the output in the data cache, and Add the necessary AggregateCacheDependency object
                HttpRuntime.Cache.Add(group_key, order, cd, DateTime.Now.AddHours(UserRegTimeout), Cache.NoSlidingExpiration, CacheItemPriority.High, null);
            }
            return(order);
        }
Ejemplo n.º 28
0
        /// <summary>
        /// 获取当前ID对应数据
        /// </summary>
        /// <param name="nId"></param>
        /// <returns></returns>
        public static ContentDetailInfo GetModel(object nId)
        {
            ContentDetail bll = new ContentDetail();

            if (!enableCaching)
            {
                return(bll.GetModel(nId));
            }

            string            key  = "contentDetail_" + nId.ToString() + "";
            ContentDetailInfo data = (ContentDetailInfo)HttpRuntime.Cache[key];

            if (data == null)
            {
                data = bll.GetModel(nId);

                AggregateCacheDependency cd = DependencyFacade.GetContentDetailDependency();
                HttpRuntime.Cache.Add(key, data, cd, DateTime.Now.AddHours(contentDetailTimeout), Cache.NoSlidingExpiration, CacheItemPriority.High, null);
            }

            return(data);
        }
Ejemplo n.º 29
0
        /// <summary>
        /// 获取数据分页列表,并返回所有记录数
        /// </summary>
        /// <returns></returns>
        public static List <ContentDetailInfo> GetList(int pageIndex, int pageSize, out int totalCount, string contentType)
        {
            totalCount = 0;
            if (string.IsNullOrEmpty(contentType))
            {
                throw new ArgumentException("参数值不能为空", contentType);
            }

            ContentDetail bll = new ContentDetail();

            SqlParameter parm = new SqlParameter("@TypeCode", SqlDbType.VarChar, 36);

            parm.Value = contentType;

            if (!enableCaching)
            {
                return(bll.GetList(pageIndex, pageSize, out totalCount, "and ct.TypeCode = @TypeCode", parm));
            }

            string key      = "contentDetails_" + contentType + "";
            string keyCount = "contentDetailCount_" + contentType + "";
            List <ContentDetailInfo> data = (List <ContentDetailInfo>)HttpRuntime.Cache[key];

            if (HttpRuntime.Cache[keyCount] != null)
            {
                totalCount = (Int32)HttpRuntime.Cache[key];
            }

            if (data == null)
            {
                data = bll.GetList(pageIndex, pageSize, out totalCount, "and ct.TypeCode = @TypeCode", parm);

                AggregateCacheDependency cd = DependencyFacade.GetContentDetailDependency();
                HttpRuntime.Cache.Add(key, data, cd, DateTime.Now.AddHours(contentDetailTimeout), Cache.NoSlidingExpiration, CacheItemPriority.High, null);
                HttpRuntime.Cache.Add(keyCount, totalCount, cd, DateTime.Now.AddHours(contentDetailTimeout), Cache.NoSlidingExpiration, CacheItemPriority.High, null);
            }

            return(data);
        }
Ejemplo n.º 30
0
        private void GenerateButton_Click(object sender, EventArgs e)
        {
            var exportFolder = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            var exportFile   = System.IO.Path.Combine(exportFolder, "MarkSummary.pdf");

            Users[]           users  = UserFacade.GetStudentsToPDFForm(LoginPanel.TeacherID);
            Students_Groups[] groups = DependencyFacade.GetStudentsGroupsPDF(LoginPanel.TeacherID);
            Table             tab    = new Table(3);

            tab.AddCell("Section number:");
            tab.AddCell("Album number:");
            tab.AddCell("Mark:");

            using (var writer = new PdfWriter(exportFile))
            {
                using (var pdf = new PdfDocument(writer))
                {
                    if (groups != null)
                    {
                        var doc = new Document(pdf);
                        doc.Add(new Paragraph("List of grades for semester:\n\n\n\n\n\n").SetRelativePosition(200, 20, 50, 200));
                        for (int i = 0; i < groups.Length; i++)
                        {
                            tab.AddCell(groups[i].GroupID.ToString());
                            tab.AddCell(groups[i].StudentAlbumNr + ": ");
                            if (!groups[i].Mark.ToString().Equals(null))
                            {
                                tab.AddCell(groups[i].Mark.ToString());
                            }
                            else
                            {
                                tab.AddCell("No mark");
                            }
                        }
                        doc.Add(tab);
                    }
                }
            }
        }