public ActionResult Edit(int symbolId, int symbolType) { if (Session["logged_in"] == null) return RedirectToAction("Index", "Index"); if(symbolId != 0) { SymbolBLL symbols = new SymbolBLL(); Symbol toEdit = symbols.GetExactByID(symbolId); if(toEdit != null) { if(symbolType == 0) { SymbolTypeBLL types = new SymbolTypeBLL(); types.SetStandardForSymID(toEdit.symId); } else { TypeCodes type = new TypeCodes(); switch (symbolType) { case 1: type = TypeCodes.INDICATOR; break; case 2: type = TypeCodes.NUMERICAL; break; case 3: type = TypeCodes.LATIN; break; } SymbolTypeBLL types = new SymbolTypeBLL(); if(types.GetExactBySymID(toEdit.symId) != null) { types.UpdateTypeForSymID(toEdit.symId, type); } else { types.SetLanguageForSymID(toEdit.symId, type); } } TempData["msg"] = "Symbol with id " + symbolId + " was successfully edited!"; } else { TempData["msg"] = "Could find and edit symbol with id " + symbolId; } } else { TempData["msg"] = "SymbolId is not valid."; } return RedirectToAction("Index"); }
public ActionResult AddAsBaseSymbol(int rawId, int symbolType) { if (Session["logged_in"] == null) return RedirectToAction("Index", "Index"); RawSymbolImportBLL rawImport = new RawSymbolImportBLL(); RawSymbolImport toConvert = rawImport.GetExact(rawId); SymbolBLL symbols = new SymbolBLL(); var returnedId = symbols.Insert(toConvert.rawName, toConvert.rawJpeg); if (returnedId != -1) { TempData["msg"] = "Success"; RawSymbolImportBLL raws = new RawSymbolImportBLL(); var ok = raws.DeleteExact(rawId); if (!ok) { TempData["msg"] += ", but could not delete symbol from raw list."; } if(symbolType != 0) { SymbolTypeBLL symbolTypes = new SymbolTypeBLL(); TypeCodes type; if (symbolType == 1) { type = TypeCodes.INDICATOR; } else if (symbolType == 2) { type = TypeCodes.NUMERICAL; } else { type = TypeCodes.LATIN; } symbolTypes.SetLanguageForSymID(returnedId, type); } } else { TempData["msg"] = "Could not add symbol as base."; } return RedirectToAction("Index", "Symbol"); }