Пример #1
0
 /// <summary>
 /// Deprecated Method for adding a new object to the UploadedFilesOftanks EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToUploadedFilesOftanks(UploadedFilesOftank uploadedFilesOftank)
 {
     base.AddObject("UploadedFilesOftanks", uploadedFilesOftank);
 }
Пример #2
0
        private void openFileDialog1_FileOk(object sender, CancelEventArgs e)
        {
            OpenFileDialog objOFD = sender as OpenFileDialog;
            if (sender == null || objOFD.Files == null || objOFD.Files.Count == 0)
            {
            return;
            }

            Gizmox.WebGUI.Common.Resources.FileHandle objFile = null;
            if (objOFD.Files[0] == null || !(objOFD.Files[0] is Gizmox.WebGUI.Common.Resources.FileHandle))
            {
            return;
            }

            // Display original file name, of the first uploaded file, on a label.

            string newguid = Guid.NewGuid().ToString();
            string path = ConfigurationManager.AppSettings["uploadfilepath"].ToString() +newguid;

            DirectoryInfo objDirectoryInfo = Directory.CreateDirectory(path);

            for (int intIndex = 0; intIndex < objOFD.Files.Count; intIndex++)
            {
            objOFD.Files[intIndex].SaveAs(Path.Combine(objDirectoryInfo.FullName,
                                                   ((Gizmox.WebGUI.Common.Resources.HttpPostedFileHandle)(objOFD.Files[intIndex])).PostedFileName));
            objFile = objOFD.Files[intIndex] as Gizmox.WebGUI.Common.Resources.FileHandle;
            LinkLabel linkLabel1 = new LinkLabel();
            linkLabel1.Text = objFile.OriginalFileName;
            linkLabel1.Url = "files/" + newguid + "/" + objFile.OriginalFileName;

            flowLayoutPanel1.Controls.Add(linkLabel1);

            // ad values to database
            using (GazOnDevEntities db = new GazOnDevEntities())
            {
            UploadedFilesOftank newfile = new UploadedFilesOftank();
            newfile.filename = objFile.OriginalFileName;
            newfile.filepath = "files/" + newguid + "/" + objFile.OriginalFileName;
            newfile.tankfixid = tanktofix.Id.ToString();
            db.AddToUploadedFilesOftanks(newfile);
            db.SaveChanges();
            }
            }
        }
Пример #3
0
 /// <summary>
 /// Create a new UploadedFilesOftank object.
 /// </summary>
 /// <param name="id">Initial value of the id property.</param>
 public static UploadedFilesOftank CreateUploadedFilesOftank(global::System.Int32 id)
 {
     UploadedFilesOftank uploadedFilesOftank = new UploadedFilesOftank();
     uploadedFilesOftank.id = id;
     return uploadedFilesOftank;
 }