public AppReleaseInfo(AppRelease r) { Id = r.Id; AppVersion = r.AppVersion; LastUpdateTime = r.LastUpdateTime; ZipUrl = "/Project/AppReleasePackage/" + Id; }
internal void UpdateAppRelease(AppRelease release, HttpPostedFileBase file) { CheckIsAdmin(); UpdateAppReleaseFile(release, file); release.LastUpdateTime = DateTime.Now; db.UpdateObject(release); }
internal void UpdateAppReleaseFileFromUrl(AppRelease release, string url) { CheckIsAdmin(); var rid = release.Id; System.Threading.ThreadPool.QueueUserWorkItem(delegate { string file = Path.GetTempFileName(); try { System.Net.WebClient wc = new System.Net.WebClient(); wc.DownloadFile(url, file); string filePath = release.ZipPath; string dir = Path.GetDirectoryName(filePath); if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } if (File.Exists(filePath)) { File.Delete(filePath); } File.Move(file, filePath); using (var db = DataConnection.GetConnection()) { var r = db.SelectObjectById <AppRelease> (rid); r.LastUpdateTime = DateTime.Now; db.UpdateObject(r); } } finally { File.Delete(file); } }); }
public ActionResult UploadAssemblies(AppRelease release) { AppRelease rp = CurrentUserModel.GetAppRelease (release.Id); rp.AppVersion = release.AppVersion; rp.AddinRootVersion = release.AddinRootVersion; CurrentUserModel.UpdateAppRelease (rp, Request.Files.Count > 0 ? Request.Files[0] : null); return RedirectToAction ("Index", "Admin"); }
public ActionResult UpdateRelease(AppRelease release) { AppRelease rp = CurrentUserModel.GetAppRelease (release.Id); rp.AppVersion = release.AppVersion; rp.AddinRootVersion = release.AddinRootVersion; rp.CompatibleAppReleaseId = release.CompatibleAppReleaseId; if (release.ZipUrl != null) CurrentUserModel.UpdateAppReleaseFileFromUrl (rp, release.ZipUrl); else CurrentUserModel.UpdateAppRelease (rp, Request.Files.Count > 0 ? Request.Files[0] : null); return RedirectToAction ("Index", "Admin"); }
public AppReleaseInfo(UserModel m, AppRelease r) { Id = r.Id; AppVersion = r.AppVersion; AddinRootVersion = r.AddinRootVersion; LastUpdateTime = r.LastUpdateTime; if (r.CompatibleAppReleaseId != null) { var cr = m.GetAppRelease (r.CompatibleAppReleaseId.Value); CompatibleAppVersion = cr.AppVersion; } ZipUrl = "/Project/AppReleasePackage/" + Id; }
void UpdateAppReleaseFile(AppRelease release, HttpPostedFileBase file) { if (file != null && file.ContentLength > 0) { string filePath = release.ZipPath; string dir = Path.GetDirectoryName(filePath); if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } file.SaveAs(filePath); } }
internal void CreateAppRelease(AppRelease release, HttpPostedFileBase file) { CheckIsAdmin(); release.ApplicationId = application.Id; release.LastUpdateTime = DateTime.Now; db.InsertObject(release); if (release.ZipUrl != null) { UpdateAppReleaseFileFromUrl(release, release.ZipUrl); } else { UpdateAppReleaseFile(release, file); } }
public void CreateAppRelease(LoginInfo login, string version, string addinsVersion, string compatibleVersion) { using (UserModel m = GetUserModel (login)) { AppRelease rel = new AppRelease (); rel.AppVersion = version; rel.AddinRootVersion = addinsVersion; if (!string.IsNullOrEmpty (compatibleVersion)) { var compatRel = m.GetAppReleases ().FirstOrDefault (r => r.AppVersion == compatibleVersion); if (compatRel != null) rel.CompatibleAppReleaseId = compatRel.Id; else throw new Exception ("Invalid compatible release number. Release '" + compatibleVersion + "' not found"); } m.CreateAppRelease (rel, null); } }
internal void UpdateAppRelease(AppRelease release, HttpPostedFileBase file) { release.LastUpdateTime = DateTime.Now; db.UpdateObject (release); string filePath = release.ZipPath; string dir = Path.GetDirectoryName (filePath); if (!Directory.Exists (dir)) Directory.CreateDirectory (dir); file.SaveAs (filePath); }
// // GET: /AppRelease/Create public ActionResult Create() { AppRelease rel = new AppRelease (); ViewData["Creating"] = true; return View("Edit", rel); }
public ActionResult CreateRelease(AppRelease release) { CurrentUserModel.CreateAppRelease (release, Request.Files.Count > 0 ? Request.Files[0] : null); return RedirectToAction ("Index", "Admin"); }
void UpdateAppReleaseFile(AppRelease release, HttpPostedFileBase file) { if (file != null) { string filePath = release.ZipPath; string dir = Path.GetDirectoryName (filePath); if (!Directory.Exists (dir)) Directory.CreateDirectory (dir); file.SaveAs (filePath); } }
internal void UpdateAppRelease(AppRelease release, HttpPostedFileBase file) { CheckIsAdmin (); release.LastUpdateTime = DateTime.Now; db.UpdateObject (release); UpdateAppReleaseFile (release, file); }
internal void CreateAppRelease(AppRelease release, HttpPostedFileBase file) { CheckIsAdmin (); release.ApplicationId = application.Id; release.LastUpdateTime = DateTime.Now; db.InsertObject (release); UpdateAppReleaseFile (release, file); }
internal void CreateAppRelease(AppRelease release, HttpPostedFileBase file) { CheckIsAdmin (); release.ApplicationId = application.Id; release.LastUpdateTime = DateTime.Now; db.InsertObject (release); if (release.ZipUrl != null) UpdateAppReleaseFileFromUrl (release, release.ZipUrl); else UpdateAppReleaseFile (release, file); }
internal void UpdateAppReleaseFileFromUrl(AppRelease release, string url) { CheckIsAdmin (); var rid = release.Id; System.Threading.ThreadPool.QueueUserWorkItem (delegate { string file = Path.GetTempFileName (); try { System.Net.WebClient wc = new System.Net.WebClient (); wc.DownloadFile (url, file); string filePath = release.ZipPath; string dir = Path.GetDirectoryName (filePath); if (!Directory.Exists (dir)) Directory.CreateDirectory (dir); if (File.Exists (filePath)) File.Delete (filePath); File.Move (file, filePath); using (var db = DataConnection.GetConnection ()) { var r = db.SelectObjectById<AppRelease> (rid); r.LastUpdateTime = DateTime.Now; db.UpdateObject (r); } } finally { File.Delete (file); } }); }