protected void Button2_Click(object sender, EventArgs e)
        {
            Document_fragment_model document_fragment_model = new Document_fragment_model()
            {
                DocumentFragmentTitle      = Text_name.Text,
                DocumentFragmentVersion    = float.Parse(Text_version.Text),
                DocumentFragmentCreateDate = Convert.ToDateTime(Text_date.Text),
                DocumentFragmentContent    = Text_content.Text,
                Keywords = Text_keywords.Text.Split(',').ToList(),
                List_documentFragmentAuthor = Text_authors.Text.Split(',').ToList()
            };

            dbget = Db4oFactory.OpenFile(path.addressofDocumentFragment);
            IList <Document_fragment_model> dbquery = dbget.Query <Document_fragment_model>();

            if (dbquery.Count > 0)
            {
                foreach (Document_fragment_model document_Fragment_Model in dbquery)
                {
                    if (document_fragment_model.DocumentFragmentTitle.Equals(document_Fragment_Model.DocumentFragmentTitle) && document_fragment_model.DocumentFragmentVersion.Equals(document_Fragment_Model.DocumentFragmentVersion))
                    {
                        flag              = 0;
                        Text_name.Text    = "";
                        Text_version.Text = "";
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Fragment Already present')", true);
                    }
                }
            }
            dbget.Close();

            if (flag == 1)
            {
                db = Db4oFactory.OpenFile(path.addressofDocumentFragment);
                db.Store(document_fragment_model);
                db.Close();

                Text_name.Text     = "";
                Text_version.Text  = "";
                Text_date.Text     = "";
                Text_content.Text  = "";
                Text_keywords.Text = "";
                Text_authors.Text  = "";

                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Fragment Saved Sucessfully')", true);
            }
        }
        protected void flatten_Click(object sender, EventArgs e)
        {
            dbget = Db4oFactory.OpenFile(path.addressofDocumentFragment);
            foreach (ListItem item in CheckBoxList1.Items)
            {
                if (item.Selected)
                {
                    IList <Document_fragment_model> dbqury = dbget.Query <Document_fragment_model>();
                    List <String> compare = new List <string>();
                    compare = item.Value.Split(':').ToList();
                    if (dbqury.Count > 0)
                    {
                        foreach (Document_fragment_model document_fragment_detail in dbqury)
                        {
                            if (document_fragment_detail.DocumentFragmentTitle.Equals(compare[0]) && document_fragment_detail.DocumentFragmentVersion.Equals(float.Parse(compare[1])))
                            {
                                document_model.List_documentFragment.Add(document_fragment_detail);
                            }
                        }
                    }
                }
            }

            Document_fragment_model documentFragmentModel = new Document_fragment_model()
            {
                DocumentFragmentTitle       = document_model.DocumentTitle,
                DocumentFragmentVersion     = document_model.DocumentVersion,
                DocumentFragmentCreateDate  = document_model.DocumentCreateDate,
                List_documentFragmentAuthor = document_model.List_documentAuthor,
                Keywords = document_model.List_documentKeywords
            };

            foreach (Document_fragment_model document_detail in document_model.List_documentFragment)
            {
                documentFragmentModel.DocumentFragmentContent += document_detail.DocumentFragmentContent;
            }
            dbget.Close();


            dbget = Db4oFactory.OpenFile(path.addressofDocumentFragment);
            IList <Document_fragment_model> dbqurycheck = dbget.Query <Document_fragment_model>();

            if (dbqurycheck.Count > 0)
            {
                foreach (Document_fragment_model document_fragment_detail in dbqurycheck)
                {
                    if (document_fragment_detail.DocumentFragmentTitle.Equals(documentFragmentModel.DocumentFragmentTitle) && document_fragment_detail.DocumentFragmentVersion.Equals(documentFragmentModel.DocumentFragmentVersion))
                    {
                        flag = 1;
                    }
                }
            }
            if (flag == 1)
            {
                dbget.Close();
                Page.RegisterStartupScript("Alert&Redirect", "<script>alert('DocumentFragment already present'); location.href='./Document.aspx';</script>");
            }
            else
            {
                dbget.Store(documentFragmentModel);
                dbget.Close();
                Page.RegisterStartupScript("Alert&Redirect", "<script>alert('Fragment Created and Saved Sucessfully'); location.href='./Document.aspx';</script>");
            }
        }