public void ViewAction(FoundItem actionToView) { Act act = (Act)actionToView.OriginObject; RepositoryItemBase Parent = actionToView.ParentItemToSave; ActionEditPage w; if (mContext == eContext.RunsetPage) { w = new ActionEditPage(act, General.RepositoryItemPageViewMode.View); } else if (Parent is BusinessFlow) { w = new ActionEditPage(act, General.RepositoryItemPageViewMode.Child, Parent as BusinessFlow); } else if (Parent is Activity) { w = new ActionEditPage(act, General.RepositoryItemPageViewMode.Child, actParentActivity: Parent as Activity);// add save handeling to save activity if not null } else { w = new ActionEditPage(act, General.RepositoryItemPageViewMode.SharedReposiotry); } if (w.ShowAsWindow(eWindowShowStyle.Dialog) == true) { RefreshFoundItemField(actionToView); } }
public int CountType(int ItemID, int Color = -1, int Cont = 0) { int itemcnt = ScanItems(true); if (Cont == 0) { Cont = BackpackID; } int Stack = 0; for (int i = 0; i < itemcnt; i++) { FoundItem item = GetItem(i); if (item != null) { if (IgnoreList.Contains(item.ID)) { continue; } if (item.Type == ItemID && item.ContID == Cont && (item.Col == Color || Color == -1)) { Stack += item.Stack; } } } return(Stack); }
private void ViewBusinessFlow(FoundItem businessFlowToViewFoundItem) { BusinessFlow businessFlow = (BusinessFlow)businessFlowToViewFoundItem.OriginObject; RepositoryItemBase Parent = (RepositoryItemBase)businessFlowToViewFoundItem.ParentItemToSave; BusinessFlowPage w = null; if (mContext == eContext.RunsetPage) { w = new BusinessFlowPage(businessFlow, false, General.RepositoryItemPageViewMode.View); } else if (mContext == eContext.AutomatePage) { w = new BusinessFlowPage(businessFlow, false, General.RepositoryItemPageViewMode.Automation); } else { w = new BusinessFlowPage(businessFlow, false, General.RepositoryItemPageViewMode.Standalone); } w.Width = 1000; w.Height = 800; if (w.ShowAsWindow() == true) { RefreshFoundItemField(businessFlowToViewFoundItem); } }
public IActionResult Put([FromBody] FoundItem item) { try { FoundItem itemCheck = db.FoundItems.SingleOrDefault(x => x.Id.Equals(item.Id)); // check if username exists if (itemCheck == null) { return(BadRequest()); } // set creation date item.ModifiedAt = DateTime.UtcNow; db.Update(item); db.SaveChanges(); return(Ok(new { message = "item modified successefully", item })); } catch (Exception ex) { return(BadRequest(ex)); } }
public async Task <IActionResult> GetAsync(int id) { var item = db.FoundItems .Include(c => c.Comments) .Where(c => c.Id == id); if (item == null) { return(NotFound()); } FoundItem owner = await db.FoundItems.FindAsync(id); int UserId = owner.UserId; string token = GenerateJSONWebToken(UserId); var client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); var response = await client.GetAsync("https://ifind-auth.herokuapp.com/api/v1/users/"); var stringJson = await response.Content.ReadAsStringAsync(); var result = JsonConvert.DeserializeObject <object>(stringJson); return(Ok(new { item, owner = result })); }
/// <summary> /// Execute the command. /// </summary> public override ServerResponse Execute ( ClientQuery clientQuery ) { Sure.NotNull(clientQuery, nameof(clientQuery)); ServerResponse result = base.Execute(clientQuery); result.GetReturnCode(); if (result.ReturnCode == 0) { int expected = result.RequireInt32(); FoundCount = expected; List <FoundItem> foundList = FoundItem .ParseServerResponse(result, expected) .ThrowIfNull("Found"); Found = foundList; _FetchRemaining(result, expected); if (!_subCommand && FirstRecord == 1 && NumberOfRecords == 0) { Debug.Assert ( foundList.Count == expected, "Found.Count != expected in total" ); } } return(result); }
public FoundItem FindItem(int ID, int containerID = 0) { ClearFoundVars(); int itemcnt = ScanItems(true); // if (ID.GetType() == typeof(int)) for (int i = 0; i < itemcnt; i++) { FoundItem item = GetItem(i); if (item != null) { if (IgnoreList.Contains(item.ID)) { continue; } if ((item.ID == ID || ID == 0) && (containerID == 0 || item.ContID == containerID)) { SetFoundVars(item); return(item); } } } return(null); }
public void UseType(int TYPE, int Color = -1, int Cont = 0) { int itemcnt = ScanItems(true); if (Cont == 0) { Cont = BackpackID; } int Serial = 0; for (int i = 0; i < itemcnt; i++) { FoundItem item = GetItem(i); if (item != null) { if (IgnoreList.Contains(item.ID)) { continue; } if (item.Type == TYPE && item.ContID == Cont && (item.Col == Color || Color == -1)) { Serial = item.ID; break; } } } LObjectID = Serial; EventMacro(17, 0); }
public FoundItem GetItem(int index) { DLL.NativeMethods.SetTop(Handle, 0); DLL.NativeMethods.PushStrVal(Handle, "Call"); DLL.NativeMethods.PushStrVal(Handle, "GetItem"); DLL.NativeMethods.PushInteger(Handle, index); if (DLL.NativeMethods.Execute(Handle) != 0) { return(new FoundItem()); } FoundItem item = new FoundItem { ID = DLL.NativeMethods.GetInteger(Handle, 1), Type = DLL.NativeMethods.GetInteger(Handle, 2), Kind = DLL.NativeMethods.GetInteger(Handle, 3), ContID = DLL.NativeMethods.GetInteger(Handle, 4), X = DLL.NativeMethods.GetInteger(Handle, 5), Y = DLL.NativeMethods.GetInteger(Handle, 6), Z = DLL.NativeMethods.GetInteger(Handle, 7), Stack = DLL.NativeMethods.GetInteger(Handle, 8), Rep = DLL.NativeMethods.GetInteger(Handle, 9), Col = DLL.NativeMethods.GetInteger(Handle, 10) }; return(item.ID > 0 ? item : null); }
public IActionResult Post([FromBody] FoundItem item) { try { FoundItem itemCheck = db.FoundItems.SingleOrDefault(x => x.Id.Equals(item.Id)); // check if item exists if (itemCheck != null) { return(Conflict()); } item.UserId = int.Parse(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.NameIdentifier).Value); // set creation date item.CreatedAt = DateTime.UtcNow; item.ModifiedAt = DateTime.UtcNow; db.FoundItems.Add(item); db.SaveChanges(); return(Ok(new { item })); } catch (Exception ex) { return(BadRequest(ex)); } }
private void EnableDisableReplaceControlsAndFillReplaceComboBox() { if (xFoundItemsGrid != null && xFoundItemsGrid.CurrentItem != null) { FoundItem FI = (FoundItem)xFoundItemsGrid.CurrentItem; PropertyInfo PI = FI.ItemObject.GetType().GetProperty(FI.FieldName); if (PI.PropertyType.BaseType == typeof(Enum) || PI.PropertyType == typeof(bool)) { xReplaceValueTextBox.Visibility = Visibility.Collapsed; xReplaceValueComboBox.Visibility = Visibility.Visible; GingerCore.General.FillComboFromList(xReplaceValueComboBox, FI.OptionalValuesToRepalce); } else { xReplaceValueTextBox.Visibility = Visibility.Visible; xReplaceValueComboBox.Visibility = Visibility.Collapsed; } } else { if (xReplaceValueTextBox != null && xReplaceValueComboBox != null) { xReplaceValueTextBox.Visibility = Visibility.Visible; xReplaceValueComboBox.Visibility = Visibility.Collapsed; } } }
public async Task <IActionResult> PutFoundItem(string id, FoundItem foundItem) { if (id != foundItem.Id) { return(BadRequest()); } _context.Entry(foundItem).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FoundItemExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public List <FoundItem> FindInCont(object TYPE, int Color = -1, int containerID = -1) { ClearFoundVars(); int itemcnt = ScanItems(true); if (containerID == -1) { containerID = BackpackID; } List <FoundItem> items = new List <FoundItem>(); if (TYPE.GetType() == typeof(int)) { for (int i = 0; i < itemcnt; i++) { FoundItem item = GetItem(i); if (item != null) { if (IgnoreList.Contains(item.ID)) { continue; } if ((item.Type == (int)TYPE || (int)TYPE == 0) && (item.ContID == containerID) && (item.Col == Color || Color == -1)) { items.Add(item); } } } } else { for (int i = 0; i < itemcnt; i++) { FoundItem item = GetItem(i); if (item != null) { if (IgnoreList.Contains(item.ID)) { continue; } if ((((int[])TYPE).Contains(item.Type)) && (item.ContID == containerID) && (item.Col == Color || Color == -1)) { items.Add(item); } } } } if (items.Count > 0) { SetFoundVars(items[0]); return(items); } return(null); }
public ActionResult DeleteConfirmed(long id) { FoundItem foundItem = db.FoundItems.Find(id); db.FoundItems.Remove(foundItem); db.SaveChanges(); return(RedirectToAction("Index")); }
private void ViewRunSet(FoundItem runSetToViewFoundItem) { RunSetConfig runSetConfig = (RunSetConfig)runSetToViewFoundItem.OriginObject; NewRunSetPage w = new NewRunSetPage(runSetConfig, NewRunSetPage.eEditMode.View); w.Width = 1000; w.Height = 800; w.ShowAsWindow(); }
private void ViewBusinessFlow(FoundItem businessFlowToViewFoundItem) { BusinessFlow businessFlow = (BusinessFlow)businessFlowToViewFoundItem.OriginObject; RepositoryItemBase Parent = (RepositoryItemBase)businessFlowToViewFoundItem.ParentItemToSave; BusinessFlowPage w = new BusinessFlowPage(businessFlow, false, General.RepositoryItemPageViewMode.View); w.Width = 1000; w.Height = 800; w.ShowAsWindow(); //Do we want to enable view Business flow window with save option also? }
public ActionResult Edit([Bind(Include = "FoundItemId,DateItemFound,CategoryId,SubCategoryId,Title,Description,Color,Brand,SerialNumber,Model,ItemImage,CreatedBy,DateCreated,DateLastModified,LastModifiedBy")] FoundItem foundItem) { if (ModelState.IsValid) { db.Entry(foundItem).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CategoryId = new SelectList(db.Category, "CategoryId", "Name", foundItem.CategoryId); ViewBag.SubCategoryId = new SelectList(db.SubCategories, "SubCategoryId", "Name", foundItem.SubCategoryId); return(View(foundItem)); }
public IActionResult Delete(int id) { FoundItem item = db.FoundItems.Find(id); db.FoundItems.Remove(item); db.SaveChanges(); return(Ok(new { message = "item deleted succesefully.", item })); }
public List <FoundItem> process() { List <FoundItem> found = new List <FoundItem>(); if (totalResults == 0) { return(found); } //namespace !!! string nameSp = @"{http://webservices.amazon.com/AWSECommerceService/2011-08-01}"; int fWsPage = 0; int lWsPage = 0; int feInFWsPage = 0; int leInLWsPage = 0; computeNeededPages(this.wpNr, 13, out fWsPage, out lWsPage, out feInFWsPage, out leInLWsPage); for (int a = fWsPage; a <= lWsPage; a++) { string sUrl = makeSignedUrl(a.ToString()); XDocument xdoc = XDocument.Load(sUrl); //TODO - start and end idx foreach (XElement xe in xdoc.Root.Descendants(nameSp + "Item")) { FoundItem fi = new FoundItem(); fi.asin = xe.Element(nameSp + "ASIN").Value; fi.title = xe.Element(nameSp + "ItemAttributes").Element(nameSp + "Title").Value; IEnumerable <XElement> xePrices = xe.Descendants(nameSp + "Amount"); if (xePrices != null) { foreach (XElement xeAmount in xePrices) { fi.price = xeAmount.Value; } } found.Add(fi); } } //for query each page //in this point we have n*WsPages list //how many pages int pCount = lWsPage - fWsPage; //jump to last used element int pIdx = (pCount * wsPageSize) + leInLWsPage + 1; //cut the tail found.RemoveRange(pIdx, found.Count - pIdx); //we cut it from beginning to first needed idx found.RemoveRange(0, feInFWsPage); return(found); }
public IHttpActionResult DeleteFoundItem(int id) { FoundItem foundItem = _db.FoundItems.Find(id); if (foundItem == null) { return(NotFound()); } _db.FoundItems.Remove(foundItem); _db.SaveChanges(); return(Ok(foundItem)); }
// GET: FoundItems/Details/5 public ActionResult Details(long?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } FoundItem foundItem = db.FoundItems.Find(id); if (foundItem == null) { return(HttpNotFound()); } return(View(foundItem)); }
//public int TileCount { get { return _TileCount; } } private void SetFoundVars(FoundItem item) { //_Found = item; Global._FoundID = item.ID; Global._FoundType = item.Type; Global._FoundX = item.X; Global._FoundY = item.Y; Global._FoundZ = item.Z; Global._FoundKind = item.Kind; Global._FoundStack = item.Stack; Global._FoundCont = item.ContID; Global._FoundRep = item.Rep; Global._FoundCol = item.Col; Global._FoundDist = Math.Max(Math.Abs(Global._FoundX - CharPosX), Math.Abs(Global._FoundY - CharPosY)); }
private void tryMoveIce(IMyGasGenerator target) { //show("Attempting to move ice into "+target.CustomName); FoundItem item = findItem(new ItemProfile("ore/ice")); if (item != null) { MyFixedPoint amt = min(item.item.Amount, 1000); moveItem(item.source, target.GetInventory(), item.item, amt); } else { //show("Not found."); } }
private void tryPrepareEjection(ItemProfile p) { FoundItem f = findItem(p); if (f != null) { foreach (IMyShipConnector conn in ejectors) { if (conn.Enabled && moveItem(f.source, conn.GetInventory(), f.item)) { conn.ThrowOut = true; } } } }
public async Task <IActionResult> Create(FoundItemViewModel item) { ViewBag.StateList = await staterepository.GetAllStates(); var user = await userManager.GetUserAsync(HttpContext.User); if (ModelState.IsValid) { Image image = null; if (item.Photo != null) { if (!utility.IsSizeAllowed(item.Photo)) { ModelState.AddModelError("Photo", "Your file is too large, maximum allowed size is: 5MB"); return(View(item)); } if (!utility.IsImageExtensionAllowed(item.Photo)) { ModelState.AddModelError("Photo", "Please only file of type:.jpg, .jpeg, .gif, .png, .bmp are allowed"); return(View(item)); } var photopath = utility.SaveImageToFolder(item.Photo); image = new Image { ImagePath = photopath }; } user.PhoneNumber = item.PhoneNumber; FoundItem itemm = new FoundItem { FoundItemUser = user, NameOfFoundItem = item.Name, //State = item.State, Description = item.Description, Colour = item.Colour, DateFound = item.DateFound, WhereItemWasFound = item.WhereItemWasFound, ExactArea = item.ExactArea, Image = image, LocalGovernmentId = item.LocalGovernmentId, }; repository.Create(itemm); repository.Save(); ViewBag.StateList = staterepository.GetAllStates(); return(RedirectToAction(nameof(Index))); } return(View(item)); }
// GET: FoundItems/Edit/5 public ActionResult Edit(long?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } FoundItem foundItem = db.FoundItems.Find(id); if (foundItem == null) { return(HttpNotFound()); } ViewBag.CategoryId = new SelectList(db.Category, "CategoryId", "Name", foundItem.CategoryId); ViewBag.SubCategoryId = new SelectList(db.SubCategories, "SubCategoryId", "Name", foundItem.SubCategoryId); return(View(foundItem)); }
public FoundItem FindType(object TYPE, int Color = -1, int containerID = 0) { ClearFoundVars(); int itemcnt = ScanItems(true); if (TYPE.GetType() == typeof(int)) { for (int i = 0; i < itemcnt; i++) { FoundItem item = GetItem(i); if (item != null) { if (IgnoreList.Contains(item.ID)) { continue; } if ((item.Type == (int)TYPE || (int)TYPE == 0) && (containerID == 0 || item.ContID == containerID) && (item.Col == Color || Color == -1)) { SetFoundVars(item); return(item); } } } } else if (TYPE.GetType() == typeof(int[]) || TYPE.GetType() == typeof(List <int>)) { for (int i = 0; i < itemcnt; i++) { FoundItem item = GetItem(i); if (item == null || IgnoreList.Contains(item.ID)) { continue; } if ((((int[])TYPE).Contains(item.Type)) && (containerID == 0 || item.ContID == containerID) && (item.Col == Color || Color == -1)) { SetFoundVars(item); return(item); } } } return(null); }
private void RefreshFoundItemField(FoundItem actionToView) { Type PII = actionToView.OriginObject.GetType(); PropertyInfo PI = actionToView.OriginObject.GetType().GetProperty(actionToView.FoundField); if (PI != null) { dynamic newValue = null; newValue = PI.GetValue(actionToView.OriginObject); if (newValue.ToString() != actionToView.FieldValue) { actionToView.Status = FoundItem.eStatus.Saved; actionToView.OnPropertyChanged(nameof(actionToView.OriginObjectName)); actionToView.FieldValue = newValue.ToString(); } } }
private void ViewApplicationModel(FoundItem applicationModelToViewFoundItem) { ApplicationModelBase applicationModelToView = (ApplicationModelBase)mCurrentItem.OriginObject; if (applicationModelToView is ApplicationAPIModel) { ApplicationAPIModel applicationAPIModel = applicationModelToView as ApplicationAPIModel; APIModelPage w = new APIModelPage(applicationAPIModel); if (mContext == eContext.RunsetPage) { w.ShowAsWindow(eWindowShowStyle.Free, true, APIModelPage.eEditMode.View); } else { w.ShowAsWindow(eWindowShowStyle.Free, true, APIModelPage.eEditMode.FindAndReplace); } } }
public async Task <IActionResult> PostAsync([FromBody] Comments comment, int id) { FoundItem item = await db.FoundItems.FindAsync(id); if (item == null) { return(NotFound()); } comment.UserId = int.Parse(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.NameIdentifier).Value); // set creation date comment.CreatedAt = DateTime.UtcNow; comment.FoundItem = item; db.Comments.Add(comment); //item.Comments.Add(comment); db.SaveChanges(); return(Ok(new { comment, item })); }
public List<FoundItem> process() { List<FoundItem> found = new List<FoundItem>(); if (totalResults == 0) return found; //namespace !!! string nameSp = @"{http://webservices.amazon.com/AWSECommerceService/2011-08-01}"; int fWsPage=0; int lWsPage=0; int feInFWsPage=0; int leInLWsPage=0; computeNeededPages(this.wpNr,13, out fWsPage, out lWsPage, out feInFWsPage, out leInLWsPage); for (int a = fWsPage; a <= lWsPage; a++) { string sUrl = makeSignedUrl(a.ToString()); XDocument xdoc = XDocument.Load(sUrl); //TODO - start and end idx foreach (XElement xe in xdoc.Root.Descendants(nameSp + "Item")) { FoundItem fi = new FoundItem(); fi.asin = xe.Element(nameSp + "ASIN").Value; fi.title = xe.Element(nameSp + "ItemAttributes").Element(nameSp + "Title").Value; IEnumerable<XElement> xePrices = xe.Descendants(nameSp + "Amount"); if (xePrices != null) { foreach (XElement xeAmount in xePrices) fi.price = xeAmount.Value; } found.Add(fi); } } //for query each page //in this point we have n*WsPages list //how many pages int pCount = lWsPage - fWsPage; //jump to last used element int pIdx = (pCount * wsPageSize)+leInLWsPage+1; //cut the tail found.RemoveRange(pIdx, found.Count - pIdx); //we cut it from beginning to first needed idx found.RemoveRange(0, feInFWsPage); return found; }