Пример #1
0
        public static bool Update(ContentTextDto content)
        {
            string        sql = " UPDATE tblContentText SET ChapterID=@ChapterID,Content=@Content,Remarks=@Remarks,CreatedDate=@CreatedDate,CreatedBy=@CreatedBy,ModifyDate=@ModifyDate,ModifyedBy=@ModifyedBy,BookID=@BookID  WHERE ContentID=@ContentID";
            SqlConnection con = new SqlConnection(Properties.Settings.Default.BlindEyeDBConStr);
            SqlCommand    cmd = new SqlCommand(sql, con);

            cmd.Parameters.AddWithValue("@ChapterID", content.ChapterID);
            cmd.Parameters.AddWithValue("@Remarks", content.Remarks);
            cmd.Parameters.AddWithValue("@BookId", content.ContentID);
            cmd.Parameters.AddWithValue("@CreatedDate", content.CreatedDate);
            cmd.Parameters.AddWithValue("@CreatedBy", content.CreatedBy);
            cmd.Parameters.AddWithValue("@ModifyDate", content.ModifyDate);
            cmd.Parameters.AddWithValue("@ModifyedBy", content.ModifyedBy);
            cmd.Parameters.AddWithValue("@Content", content.Content);

            try
            {
                con.Open();
                cmd.ExecuteNonQuery();
                return(true);
            }
            catch (Exception ex)
            {
                Constant.DBErrorMsg = ex.Message;

                return(false);
            }

            finally
            {
                con.Close();
            }
        }
        public async Task <IViewComponentResult> InvokeAsync(string id)
        {
            var cts = TaskHelper.CreateChildCancellationTokenSource(ClientDisconnectedToken());

            ContentTextDto data = await Service.GetByIdAsync(id, cts.Token);

            return(View(data));
        }
Пример #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            ContentTextDto ctext = new ContentTextDto();

            ctext.BookID      = Convert.ToInt64(cmbBook.SelectedValue.ToString());
            ctext.ChapterID   = Convert.ToInt64(cmbChapter.SelectedValue.ToString());
            ctext.Content     = rtxtContent.Text;
            ctext.CreatedBy   = MDIParent._UserMasterID;
            ctext.CreatedDate = DateTime.Now;
            ctext.ModifyedBy  = MDIParent._UserMasterID;
            ctext.ModifyDate  = DateTime.Now;
            ctext.Remarks     = rtxtRemarksForText.Text;

            if (ContentTextDao.Insert(ctext))
            {
                MessageBox.Show(Constant.NOTIFICATION_SUCCESS_DATA_SAVING, Constant.NOTIFICATION_CAPTION_SAVE, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                // ini();
            }
            else
            {
                MessageBox.Show(Constant.DBErrorMsg, Constant.NOTIFICATION_ERROR_DATA_SAVING, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }



            //under cn

            if (txtBrowesAudio.Text.Trim() != string.Empty)
            {
                ContentAudioDto caudio = new ContentAudioDto();
                caudio.BookID      = Convert.ToInt64(cmbBook.SelectedValue.ToString());
                caudio.ChapterID   = Convert.ToInt64(cmbChapter.SelectedValue.ToString());
                caudio.Content     = buffAudioData;
                caudio.CreatedBy   = MDIParent._UserMasterID;
                caudio.CreatedDate = DateTime.Now;
                caudio.ModifyedBy  = MDIParent._UserMasterID;
                caudio.ModifyDate  = DateTime.Now;
                ctext.Remarks      = rtxtRemarksForAudio.Text;
                if (ContentAudioDao.Insert(caudio))
                {
                    MessageBox.Show(Constant.NOTIFICATION_SUCCESS_DATA_SAVING, Constant.NOTIFICATION_CAPTION_SAVE, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    ini();
                }
                else
                {
                    MessageBox.Show(Constant.DBErrorMsg, Constant.NOTIFICATION_ERROR_DATA_SAVING, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            rtxtContent.Text         = string.Empty;
            cmbBook.SelectedIndex    = 0;
            cmbChapter.SelectedIndex = 0;
            tbcUpload.SelectedIndex  = 0;
        }
Пример #4
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);
                }
            }
        }
Пример #5
0
        public static List <ContentTextDto> GetAll()
        {
            List <ContentTextDto> contentList = new List <ContentTextDto>();
            ContentTextDto        content;

            string sql = "SELECT * FROM tblContentText";

            Console.WriteLine(sql);
            SqlConnection con = new SqlConnection(Properties.Settings.Default.BlindEyeDBConStr);
            SqlCommand    cmd = new SqlCommand(sql, con);

            //BookID,BookName,AuthorName,ReleseYear,Remarks,CreatedDate,CreatedBy,ModifyDate,ModifyedBy
            try
            {
                con.Open();
                SqlDataReader rdr = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    content           = new ContentTextDto();
                    content.ContentID = Convert.ToInt64(rdr["contentID"]);

                    content.Content   = Convert.ToString(rdr["Content"]);
                    content.ChapterID = Convert.ToInt64(rdr["ChapterID"]);

                    content.BookID      = Convert.ToInt64(rdr["BookID"]);
                    content.Remarks     = Convert.ToString(rdr["Remarks"]);
                    content.CreatedDate = Convert.ToDateTime(rdr["CreatedDate"]);
                    content.CreatedBy   = Convert.ToInt64(rdr["CreatedBy"]);
                    content.ModifyDate  = Convert.ToDateTime(rdr["ModifyDate"]);
                    content.ModifyedBy  = Convert.ToInt64(rdr["ModifyedBy"]);


                    contentList.Add(content);
                }
                return(contentList);
            }
            catch (Exception ex)
            {
                Utilities.Constant.DBErrorMsg = ex.Message;
                return(contentList);
            }
            finally
            {
                con.Close();
            }
        }
Пример #6
0
        private void button3_Click(object sender, EventArgs e)
        {
            ContentTextDto ctext = new ContentTextDto();

            ctext.BookID = Convert.ToInt64(cmbBook.SelectedValue.ToString());
            try
            {
                ctext.ChapterID = Convert.ToInt64(cmbChapter.SelectedValue.ToString());
            }
            catch (Exception)
            {
                MessageBox.Show("Select Book Name", "Book Name not selected", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }

            //uncomplete join is not needed
            //This query is used for only projecet show join and sub query
            //Original query is not Same and no complex
            string sql = "select tblContentText.content as ContentText from tblContentText join tblChapter "
                         + "on tblChapter.ChapterID=tblContentText.ChapterID and "
                         + "tblContentText.BookId in(select tblBook.BookID from tblBook join tblChapter "
                         + "on tblBook.BookID=tblChapter.BookId and   tblBook.BookID=" + Convert.ToInt64(cmbBook.SelectedValue) + ");";
            string s = "";

            //  MessageBox.Show(sql);
            list = ExtrafaltuClass.FaltuqueryForfrmBookReader(sql);


            if (list.Count >= 0)
            {
                lblBookName.Text = "Book Name : " + this.cmbBook.GetItemText(this.cmbBook.SelectedItem);
                lblChapter.Text  = "Chapter Name : " + this.cmbChapter.GetItemText(this.cmbChapter.SelectedItem);
                try
                {
                    rtxtContent.Text = list[countChapter];
                    countChapter++;
                }
                catch (Exception)
                {
                    MessageBox.Show("Chapter not founf", "Not found", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
            }
        }
Пример #7
0
        public static bool Insert(ContentTextDto content)
        {
            string sql = " INSERT INTO tblContentText (ChapterID,Content,Remarks,CreatedDate,CreatedBy,ModifyDate,ModifyedBy,BookID) " +
                         "VALUES " +
                         " ( @ChapterID,@Content,@Remarks,@CreatedDate,@CreatedBy,@ModifyDate,@ModifyedBy,@BookID)";

            Console.WriteLine(sql);
            SqlConnection con = new SqlConnection(Properties.Settings.Default.BlindEyeDBConStr);
            SqlCommand    cmd = new SqlCommand(sql, con);

            cmd.Parameters.AddWithValue("@ChapterID", content.ChapterID);
            cmd.Parameters.AddWithValue("@Remarks", content.Remarks);
            cmd.Parameters.AddWithValue("@BookId", content.BookID);
            cmd.Parameters.AddWithValue("@CreatedDate", content.CreatedDate);
            cmd.Parameters.AddWithValue("@CreatedBy", content.CreatedBy);
            cmd.Parameters.AddWithValue("@ModifyDate", content.ModifyDate);
            cmd.Parameters.AddWithValue("@ModifyedBy", content.ModifyedBy);
            cmd.Parameters.AddWithValue("@Content", content.Content);

            try
            {
                con.Open();
                cmd.ExecuteNonQuery();
                return(true);
            }
            catch (Exception ex)
            {
                Constant.DBErrorMsg = ex.Message;

                return(false);
            }

            finally
            {
                con.Close();
            }
        }