public JsonResult AddNewSectorLocation(SectorLocation request) { request.TraderId = this.LoggedUser.TraderId; var response = this.sectorManagement.AddNewSectorLocation(request); return(Json(response)); }
public void Add(SectorLocation sectorLocation) { if (sectorLocation == null) { throw new ArgumentNullException(nameof(sectorLocation)); } this.dbSet.Add(sectorLocation); }
public SectorManagementResponse AddNewSectorLocation(SectorLocation request) { try { this.unitOfWork.SectorLocationRepository.Add(request); this.unitOfWork.Commit(); return(new SectorManagementResponse(true)); } catch (Exception) { return(new SectorManagementResponse(false)); } }
private void ResultsDataList_ItemCommand(object source, System.Web.UI.WebControls.DataListCommandEventArgs e) { string xml = e.CommandArgument as String; XmlSerializer xs = new XmlSerializer(typeof(ItemLocation)); object o = xs.Deserialize(new StringReader(xml)); if (o is WorldLocation) { WorldLocation worldLocation = o as WorldLocation; Point coords = Astrometrics.LocationToCoordinates(worldLocation.Sector, worldLocation.World); double x = coords.X - 0.5; double y = coords.Y - (((coords.X % 2) == 0) ? 0.5 : 0); ViewState["x"] = x; ViewState["y"] = y; ViewState["scale"] = (double)64; } else if (o is SubsectorLocation) { SubsectorLocation subsectorLocation = o as SubsectorLocation; int nIndex = (subsectorLocation.Index - 'A'); int hx = (int)((Math.Floor(nIndex % 4.0) + 0.5) * (Astrometrics.SectorWidth / 4)); int hy = (int)((Math.Floor(nIndex / 4.0) + 0.5) * (Astrometrics.SectorHeight / 4)); Point coords = Astrometrics.LocationToCoordinates(subsectorLocation.SectorLocation, new Point(hx, hy)); ViewState["x"] = (double)coords.X; ViewState["y"] = (double)coords.Y; ViewState["scale"] = (double)32; } else if (o is SectorLocation) { SectorLocation sectorLocation = o as SectorLocation; Point coords = Astrometrics.LocationToCoordinates(sectorLocation.SectorCoords, new Point(Astrometrics.SectorWidth / 2, Astrometrics.SectorHeight / 2)); ViewState["x"] = (double)coords.X; ViewState["y"] = (double)coords.Y; ViewState["scale"] = (double)6; } Refresh(); }