public IHttpActionResult Putapp(string name, app app) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (name != app.name) { return(BadRequest()); } db.Entry(app).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!appExists(name)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult Edit(int id, app newapp, HttpPostedFileBase File1) { try { app oldapp = ctx.app.Single <app>(b => b.id_app == id); // TODO: Add update logic here oldapp.id_app = newapp.id_app; oldapp.nom = newapp.nom; oldapp.taille = newapp.taille; if (File1 != null && File1.ContentLength > 0) { newapp.image = new byte[File1.ContentLength]; // file1 to store image in binary formate File1.InputStream.Read(newapp.image, 0, File1.ContentLength); oldapp.image = newapp.image; } oldapp.Liste_OS = newapp.Liste_OS; oldapp.editeur = newapp.editeur; oldapp.categorie = newapp.categorie; oldapp.prix = newapp.prix; ctx.SaveChanges(); return(RedirectToAction("../app_Admin/app_admin")); } catch { return(View("../Error/Error")); } }
private void ExportExcel(DataGridView dgv, string duongDan, string tenTap) { app obj = new app(); obj.Application.Workbooks.Add(Type.Missing); obj.Columns.ColumnWidth = 25; // Lấy cái Header DataGridView for (int i = 1; i < dgv.Columns.Count + 1; i++) { obj.Cells[1, i] = dgv.Columns[i - 1].HeaderText; } // for (int i = 0; i < dgv.Rows.Count; i++) { for (int j = 0; j < dgv.Columns.Count; j++) { if (dgv.Rows[i].Cells[j].Value != null) { obj.Cells[i + 2, j + 1] = dgv.Rows[i].Cells[j].Value.ToString(); } } } obj.ActiveWorkbook.SaveCopyAs(duongDan + tenTap + ".xlsx"); obj.ActiveWorkbook.Saved = true; }
public void getappdata(string appid, string marketplace) { try { string appidurl; string ZuneURL = "http://catalog.zune.net/v3.2/"; appidurl = ZuneURL + marketplace + "/apps/" + appid; string imgprefix = "/primaryImage?width=100&height=100&resize=true"; imageurl = appidurl + imgprefix; var xmlDoc = new XmlDocument(); xmlDoc.Load(appidurl); XmlNodeList nodelist; XmlNamespaceManager nameSpaceManager = new XmlNamespaceManager(xmlDoc.NameTable); nameSpaceManager.AddNamespace("a", "http://www.w3.org/2005/Atom"); nodelist = xmlDoc.SelectNodes("/a:feed", nameSpaceManager); foreach (XmlNode node in nodelist) { app newapp = new app(); XmlNode appnames = node.SelectSingleNode("a:title", nameSpaceManager); newapp.name = appnames.InnerText; appname = appnames.InnerText; XmlNode description = node.SelectSingleNode("a:content", nameSpaceManager); newapp.description = description.InnerText; appdesc = description.InnerText; } XDocument localDoc = XDocument.Load("Apps.xml"); localDoc.Root.Add(new XElement("app", new XAttribute("appid", appid), new XAttribute("marketplace", marketplace), new XAttribute("appname", appname), new XAttribute("description", appdesc), new XAttribute("image", imageurl))); localDoc.Save("Apps.xml"); this.Close(); AppList app = new AppList(); app.Show(); } catch { MessageBox.Show("Oops ! You did something wrong ! Go back and Try Again"); } }
public IHttpActionResult Getapp(int id) { app app = db.app.Find(id); if (app == null) { return(NotFound()); } return(Ok(app)); }
public IHttpActionResult Postapp(app app) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.app.Add(app); db.SaveChanges(); return(Ok()); }
public ActionResult Delete(int id, FormCollection collection) { try { app a = ctx.app.Single <app>(b => b.id_app == id); ctx.app.Remove(a); ctx.SaveChanges(); return(RedirectToAction("../app_Admin /app_admin")); } catch { return(View()); } }
public IHttpActionResult Deleteapp(int id) { app app = db.app.Find(id); if (app == null) { return(NotFound()); } db.app.Remove(app); db.SaveChanges(); return(Ok(app)); }
/// <summary> /// 打开应用 /// </summary> /// <param name="listView"></param> public bool OpenApp(params object[] par) { if (par.Length < 0) { return(false); } try { ListViewEx listView = par[0] as ListViewEx; int index = 0; if (listView.Tag != null && (listView.Tag as List <string>).Count != 0) { foreach (string item in listView.Tag as List <string> ) { if (!index.ToString().Equals(listView.SelectedIndices[0].ToString())) { index++; continue; } else { CheckHWND(item); List <OpenFileInfo> list = Global.FileInfo.FindAll(a => a.Name == item); //MessageBox.Show(list.Count.ToString()); if (list.Count > 1) { app ap = new app(); ap._fileInfo = list; ap.ShowDialog(); } else { OpenSingleApp(item); } break; } } } return(true); } catch (Exception ex) { MessageBox.Show(ex.Message); return(false); } }
public ActionResult Create(app model, HttpPostedFileBase File1) { if (File1 != null && File1.ContentLength > 0) { model.image = new byte[File1.ContentLength]; // file1 to store image in binary formate File1.InputStream.Read(model.image, 0, File1.ContentLength); ctx.app.Add(model); ctx.SaveChanges(); return(RedirectToAction("../app_Admin/app_admin")); } else { return(View("../Error/Error")); } }
public async Task <HttpResponseMessage> CreateUserApp(dynamic data) { int systemuserid = data.systemuserid; string appName = data.appName; app newApp = null; using (var uapps = new userappsEntities()) { using (var sysuser = new exgripEntities()) { if (sysuser.UserProfiles.Any(u => u.UserId == systemuserid)) { if (!uapps.apps.Any(a => a.appname.ToLower().Equals(appName.ToLower()))) { try { uapps.ChangeTracker.DetectChanges(); newApp = new app() { appname = appName, systemuserid = systemuserid }; uapps.apps.Add(newApp); await uapps.SaveChangesAsync(); } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.ToString())); } } } else { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Systemuser does not exist")); } } } return(Request.CreateResponse <app>(newApp)); }
public App(app app = app.Default) { switch (app) { case app.Word: appDoc = null; break; case app.PowerPoint: appPpt = null; break; default: appOb = null; appDoc = null; appPpt = null; break; } }
/** * write a message in the log * @param string app * @param string message * @param int level * @since 4.0.0 * @deprecated 13.0.0 use log of \OCP\ILogger */ public static function writeLog(app, message, level) { context = ['app' => app];
/** * Make OC_Helper::imagePath available as a simple function * * @see \OCP\IURLGenerator::imagePath * * @param string app * @param string image * @return string to the image * @since 8.0.0 * @suppress PhanDeprecatedFunction */ public static function image_path(app, image) { return(\ image_path(app, image)); }
/* * User - END * * -------------------------------------------------------------------------------------------------------------------------------------- */ public int AddApp(app app) { _connection.Insert(app); return(app.id); }
app GetApp(Process process) { var name = process.ProcessName; if (apps.TryGetValue(name, out var app)) { return(app); } var data = db.ExecuteDynamic( @"select id from app where process = @process", new SQLiteParameter("process", name) ).FirstOrDefault(); if (data == null) { if (nextAppId == 0) { nextAppId = (int)(long)db.ExecuteData("select ifnull(max(id),0) + 1 from app")[0][0]; } var text = ""; try { text = process.MainModule.FileVersionInfo.FileDescription; using var iconl = GetIcon(process.MainModule.FileName, true); SaveIcon(iconl, GetIconPath(nextAppId, true)); using var icons = GetIcon(process.MainModule.FileName, false); SaveIcon(icons, GetIconPath(nextAppId, false)); } catch (Win32Exception) { //ignore } catch (FileNotFoundException) { //ignore } if (string.IsNullOrWhiteSpace(text)) { text = process.ProcessName; } db.Execute( "insert into app (id, process, text, tagId) values(@id, @process, @text, 0)", new SQLiteParameter("id", nextAppId), new SQLiteParameter("process", name), new SQLiteParameter("text", text) ); app = new app { id = nextAppId, process = name }; nextAppId++; } else { app = new app { id = data.id, process = name }; } apps.Add(name, app); //fix icons var largeIconPath = GetIconPath(app.id, true); if (!File.Exists(largeIconPath)) { try { using var iconl = GetIcon(process.MainModule.FileName, true); SaveIcon(iconl, largeIconPath); using var icons = GetIcon(process.MainModule.FileName, false); SaveIcon(icons, GetIconPath(app.id, false)); } catch (Win32Exception) { } } return(app); }
public App(app app) { name = app.name; settings = app.settings; image = app.settings; }
set => this.WriteProfile(app, key, value);
// GET: app_Admin/Create public ActionResult Create() { app a = new app(); return(View(a)); }
get => this.ReadProfile(app, key);
public void FromBin(NetSocket.ByteArray bin, app.relation.OperationRelation opera) { switch(opera) { case app.relation.OperationRelation.OPERATION_RELATION_ADD_ID: case app.relation.OperationRelation.OPERATION_RELATION_ADD_NAME: { add_member.FromBin(bin); break; } case app.relation.OperationRelation.OPERATION_RELATION_DELETE: { delete_member.FromBin(bin); break; } case app.relation.OperationRelation.OPERATION_RELATION_NULL: { result_type.FromBin(bin); break; } } }
private void button3_Click(object sender, EventArgs e) { //DirectoryInfo directoryInfo = new DirectoryInfo(System.Environment.CurrentDirectory); DirectoryInfo directoryInfo = new DirectoryInfo(@"D:\PublishWeb\App\Install"); FileInfo[] files = directoryInfo.GetFiles(); string MD5s=string.Empty; List<app> apps = new List<app>(); for(int i=0;i<files.Length;i++) { app app = new app(files[i].Name, Common.GetMD5HashFromFile(files[i].FullName)); apps.Add(app); } txtMD5.Text = JsonConvert.SerializeObject(apps); apps.Clear(); apps = JsonConvert.DeserializeObject<List<app>>(txtMD5.Text); for(int j=0;j<apps.Count;j++) { listBox1.Items.Add(apps[j].name+":"+apps[j].md5); } }
theFactory.app_state = new HttpApplicationState(app, ses);
// GET: app_Admin/Delete/5 public ActionResult Delete(int id) { app a = ctx.app.Single <app>(b => b.id_app == id); return(View(a)); }
public void FillDB(SqLiteService service) { // app var app = new app { name = "KeepScores Complete Edition", }; app.id = service.AddApp(app); // game types. var game = new game { app_id = app.id, Type = new type { name = "Standard", prog_id = "STANDARD" }, unity = true }; service.CreateGame(game); game = new game { app_id = app.id, Type = new type { name = "Claim", prog_id = "CLAIM" }, unity = true }; service.CreateGame(game); game = new game { app_id = app.id, Type = new type { name = "Munchkin", prog_id = "MUNCHKIN" }, unity = true }; service.CreateGame(game); game = new game { app_id = app.id, Type = new type { name = "Solo/Uno", prog_id = "SOLO_UNO" }, unity = true }; service.CreateGame(game); game = new game { app_id = app.id, Type = new type { name = "One Night Ultimate Warewolf", prog_id = "ONENIGHT_WAREWOLF" }, unity = true }; service.CreateGame(game); game = new game { app_id = app.id, Type = new type { name = "Checkers", prog_id = "CHECKERS" }, unity = true }; service.CreateGame(game); game = new game { app_id = app.id, Type = new type { name = "Backgammon", prog_id = "BACKGAMMON" }, unity = true }; service.CreateGame(game); }
private void Awake() { ludumdare39 = this; gamestate = GameState.start; }