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); } }
public bool Save() { ClassLibrary.JDataBase Db = new ClassLibrary.JDataBase(); int CuArchiveCode = 0; 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, "EntPicGalleryLvl1", true); CuArchiveCode = ArchiveCode; } if (Code > 0) { Db.setQuery(@"update EntPicGalleryLvl1 set Name = N'" + txtTitle.Text + "' ,ArchiveCode=" + CuArchiveCode + " where Code = " + Code); } else { Db.setQuery(@"INSERT INTO [EntPicGalleryLvl1] ([Name],[ArchiveCode]) VALUES (N'" + txtTitle.Text + @"'," + CuArchiveCode.ToString() + ") "); } if (Db.Query_Execute() >= 0) { return(true); } else { return(false); } }
public bool Save() { if (FileUpload.HasFile) { Entertainment.JPicGallery PicGallery = new Entertainment.JPicGallery(); PicGallery.Code = Code; PicGallery.Text = txtText.Text; PicGallery.ClassName = "AndroidElahiye"; 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", 123456, "EntPicGalleryPic", true); PicGallery.ArchiveCode = ArchiveCode; if (Code > 0) { return(PicGallery.Update()); } else { return(PicGallery.Insert() > 0 ? true : false); } } else { return(false); } }
public bool Save() { ClassLibrary.JDataBase Db = new ClassLibrary.JDataBase(); int CuArchiveCode = 0; 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, "EntProjects", true); CuArchiveCode = ArchiveCode; } if (Code > 0) { Db.setQuery(@"Update [dbo].[Android_Apartments] Set [ProjectName] = N'" + txtTitle.Text + @"' , [Metraj] = N'" + txtMetraj.Text + @"' , [TedadeVahed] = N'" + txtTedadVahed.Text + @"' , [TedadKhab] = N'" + txtTedadKhab.Text + @"' , [ShomareVahed] = N'" + txtShomareVahed.Text + @"' , [Tabaghe] = N'" + txtTabaghe.Text + @"' , [Emkanat] = N'" + txtEmkanat.Text + @"' , [Gheymat] = N'" + txtGheymat.Text + @"' ,ArchiveCode=" + CuArchiveCode + @" where Code = " + Code); } else { Db.setQuery(@"INSERT INTO [dbo].[Android_Apartments] ([ProjectName] ,[Metraj] ,[TedadeVahed] ,[TedadKhab] ,[ShomareVahed] ,[Tabaghe] ,[Emkanat] ,[Gheymat],ArchiveCode) VALUES (N'" + txtTitle.Text + @"' ,N'" + txtMetraj.Text + @"' ,N'" + txtTedadVahed.Text + @"' ,N'" + txtTedadKhab.Text + @"' ,N'" + txtShomareVahed.Text + @"' ,N'" + txtTabaghe.Text + @"' ,N'" + txtEmkanat.Text + @"' ,N'" + txtGheymat.Text + @"'," + CuArchiveCode + @")"); } if (Db.Query_Execute() >= 0) { return(true); } else { return(false); } }