Ejemplo n.º 1
0
        public bool Save()
        {
            Entertainment.JNews News = new Entertainment.JNews();
            News.GetData(Code);
            News.Code  = Code;
            News.Title = txtTitle.Text;
            News.Body  = txtBody.Text;
            if (Code > 0)
            {
                News.Date = News.Date;
            }
            else
            {
                News.Date = DateTime.Now;
            }

            if (FileUpload.HasFile)
            {
                int ArchiveCode = 0;

                string[] segments = FileUpload.FileName.Split(new char[] { '.' });
                string   fileExt  = segments[segments.Length - 1];

                ArchivedDocuments.JArchiveDocument archive = new ArchivedDocuments.JArchiveDocument(ArchivedDocuments.JConstantArchiveSubjects.ImagesArchiveCode.GetHashCode(), ArchivedDocuments.JConstantArchivePalces.GeneralArchive.GetHashCode());
                ClassLibrary.JFile jFile = new ClassLibrary.JFile();
                jFile.Content   = FileUpload.FileBytes;
                jFile.FileName  = FileUpload.FileName;
                jFile.Extension = ".jpg";

                jFile.FileText = jFile.FileName;

                ArchiveCode = archive.ArchiveDocument(jFile, "AndroidElahiye", WebClassLibrary.SessionManager.Current.MainFrame.CurrentUserCode, "EntNewsPic", true);

                News.ArchiveCode = ArchiveCode;
            }

            if (Code > 0)
            {
                return(News.Update());
            }
            else
            {
                return(News.Insert() > 0 ? true : false);
            }
        }
Ejemplo n.º 2
0
        public void _SetForm()
        {
            if (Code > 0)
            {
                Entertainment.JNews News = new Entertainment.JNews();
                News.GetData(Code);
                txtTitle.Text = News.Title;
                txtBody.Text  = News.Body;

                ArchivedDocuments.JArchiveDocument archive = new ArchivedDocuments.JArchiveDocument(ArchivedDocuments.JConstantArchiveSubjects.ImagesArchiveCode.GetHashCode(), ArchivedDocuments.JConstantArchivePalces.GeneralArchive.GetHashCode());
                archive.GetData(News.ArchiveCode);
                try
                {
                    DataTable Dt = archive.Retrieve("AndroidElahiye", 123456);
                    if (Dt.Rows.Count > 0)
                    {
                        ClassLibrary.JFile image = archive._RetrieveContent(Convert.ToInt32(archive.ArchiveCode));
                        PicStr = "<img src='data:image/jpg;base64," + Convert.ToBase64String(WebClassLibrary.JDataManager.ReadToEnd(image.Stream)) + "' style='max-width:500px'/>";
                    }
                }
                catch { }
            }
        }