Example #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtChapterName.Text.Trim() == string.Empty)
            {
                MessageBox.Show(Constant.NOTIFICATIO_VALIDATION_ALL_FIELD_IS_REQUIRED, Constant.NOTIFICATIO_VALIDATION_ALL_FIELD_IS_REQUIRED, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }

            ChapterDto chapter = new ChapterDto();

            chapter.ChapterName = txtChapterName.Text.Trim();
            chapter.BookID      = Convert.ToInt64(cmbBooks.SelectedValue.ToString());
            chapter.CreatedBy   = MDIParent._UserMasterID;
            chapter.CreatedDate = DateTime.Now;
            chapter.ModifyDate  = DateTime.Now;
            chapter.ModifyedBy  = MDIParent._UserMasterID;
            chapter.Remarks     = rtxtDescription.Text.Trim();

            if (ChapterDao.Insert(chapter))
            {
                txtChapterName.Text  = string.Empty;
                rtxtDescription.Text = string.Empty;

                MessageBox.Show(Constant.NOTIFICATION_SUCCESS_DATA_SAVING, Constant.NOTIFICATION_CAPTION_SAVE, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
            else
            {
                MessageBox.Show(Constant.DBErrorMsg, Constant.NOTIFICATION_ERROR_DATA_SAVING, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #2
0
        void Load_cmbChapter(long BookID)
        {
            List <ChapterDto> Chapterlist = new List <ChapterDto>();

            Chapterlist = ChapterDao.GetByBookID(BookID);

            List <ComboItems> _ItemList = new List <ComboItems>();

            ComboItems Item;

            Item = new ComboItems();
            Item.DisplayMember = "Select";
            Item.ValueMember   = "-1";
            _ItemList.Add(Item);

            foreach (ChapterDto chapter in Chapterlist)
            {
                Item = new ComboItems();
                Item.DisplayMember = chapter.ChapterName;
                Item.ValueMember   = chapter.ChapterID.ToString();
                _ItemList.Add(Item);
            }


            cmbChapter.DataSource    = _ItemList;
            cmbChapter.DisplayMember = "DisplayMember";
            cmbChapter.ValueMember   = "ValueMember";
            cmbChapter.SelectedValue = "-1";
        }
Example #3
0
        private void btnUpload_Click(object sender, EventArgs e)
        {
            if (filePath != string.Empty)
            {
                try
                {
                    PdfReader reder = new PdfReader(filePath);



                    for (int page = 1; page <= reder.NumberOfPages; page++)
                    {
                        ITextExtractionStrategy its = new iTextSharp.text.pdf.parser.LocationTextExtractionStrategy();
                        string s = PdfTextExtractor.GetTextFromPage(reder, page, its);
                        s = Encoding.UTF8.GetString(ASCIIEncoding.Convert(Encoding.Default, Encoding.UTF8, Encoding.Default.GetBytes(s)));

                        ChapterDto chapter = new ChapterDto();
                        chapter.ChapterName = "Page " + page;
                        chapter.BookID      = Convert.ToInt64(cmbBook.SelectedValue.ToString());
                        chapter.CreatedBy   = MDIParent._UserMasterID;
                        chapter.CreatedDate = DateTime.Now;
                        chapter.ModifyDate  = DateTime.Now;
                        chapter.ModifyedBy  = MDIParent._UserMasterID;
                        chapter.Remarks     = rtxtDescreptio.Text.Trim();


                        ChapterDao.Insert(chapter);


                        ContentTextDto ctext = new ContentTextDto();
                        ctext.BookID      = Convert.ToInt64(cmbBook.SelectedValue.ToString());
                        ctext.ChapterID   = page;
                        ctext.Content     = s;
                        ctext.CreatedBy   = MDIParent._UserMasterID;
                        ctext.CreatedDate = DateTime.Now;
                        ctext.ModifyedBy  = MDIParent._UserMasterID;
                        ctext.ModifyDate  = DateTime.Now;
                        ctext.Remarks     = rtxtDescreptio.Text;
                        ContentTextDao.Insert(ctext);
                    }

                    MessageBox.Show(Constant.NOTIFICATION_SUCCESS_DATA_SAVING, Constant.NOTIFICATION_CAPTION_SAVE, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(Constant.DBErrorMsg, Constant.NOTIFICATION_ERROR_DATA_SAVING, MessageBoxButtons.OK, MessageBoxIcon.Error);


                    MessageBox.Show(ex.Message);
                }
            }
        }