public OpenPosition GetPositionForReqId(string reqId) { OpenPosition pos = GeneratePosition(); pos.ReqId = reqId; return(pos); }
// GET: OpenPositions/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } OpenPosition openPosition = db.OpenPositions.Find(id); if (openPosition == null) { return(HttpNotFound()); } if (User.IsInRole("Manager")) { //if you're a manager, only see your locations var currentUserId = User.Identity.GetUserId(); ViewBag.LocationID = new SelectList( db.Locations.Where(x => x.ManagerID == currentUserId), "LocationID", "StoreNumber", openPosition.LocationID); } else { //Admin sees all locations ViewBag.LocationID = new SelectList(db.Locations, "LocationID", "StoreNumber", openPosition.LocationID); } ViewBag.PositionID = new SelectList(db.Positions, "PositionID", "Title", openPosition.PositionID); return(View(openPosition)); }
public ActionResult Create([Bind(Include = "OpenPositionID,PositionID,LocationID")] OpenPosition openPosition) { if (ModelState.IsValid) { db.OpenPositions.Add(openPosition); db.SaveChanges(); return(RedirectToAction("Index")); } //if you landed here, it's because there was an error with your new object if (User.IsInRole("Manager")) { //if you're a manager, only see your locations var currentUserId = User.Identity.GetUserId(); ViewBag.LocationID = new SelectList( db.Locations.Where(x => x.ManagerID == currentUserId), "LocationID", "StoreNumber", openPosition.LocationID); } else { //Admin sees all locations ViewBag.LocationID = new SelectList(db.Locations, "LocationID", "StoreNumber", openPosition.LocationID); } ViewBag.PositionID = new SelectList(db.Positions, "PositionID", "Title", openPosition.PositionID); return(View(openPosition)); }
public ActionResult Edit([Bind(Include = "OpenPositionID,PositionID,LocationID")] OpenPosition openPosition) { if (ModelState.IsValid) { db.Entry(openPosition).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } if (User.IsInRole("Manager")) { //if you're a manager, only see your locations var currentUserId = User.Identity.GetUserId(); ViewBag.LocationID = new SelectList( db.Locations.Where(x => x.ManagerID == currentUserId), "LocationID", "StoreNumber", openPosition.LocationID); } else { //Admin sees all locations ViewBag.LocationID = new SelectList(db.Locations, "LocationID", "StoreNumber", openPosition.LocationID); } ViewBag.PositionID = new SelectList(db.Positions, "PositionID", "Title", openPosition.PositionID); return(View(openPosition)); }
public ActionResult CreateFor(int positionId, bool isFetch) { if (isFetch) { string managerId = User.Identity.GetUserId(); int managerLocationId = db.Locations.Where(m => m.ManagerId == managerId).Select(l => l.LocationId).Single(); OpenPosition openPosition = new OpenPosition() { PositionId = positionId, LocationId = managerLocationId }; db.OpenPositions.Add(openPosition); db.SaveChanges(); return(Content("{\"success\": true}", "application/json")); } else { OpenPosition openPosition = new OpenPosition() { PositionId = positionId }; ViewBag.LocationId = new SelectList(db.Locations, "LocationId", "FullSummary"); ViewBag.PositionId = new SelectList(db.Positions, "PositionId", "Title", openPosition.PositionId); return(View("Create", openPosition)); } }
public ActionResult Create([Bind(Include = "OpenPositionId,PositionId,LocationId")] OpenPosition openPosition) { if (ModelState.IsValid) { if (User.IsInRole("Manager")) { string managerId = User.Identity.GetUserId(); int managerLocationId = db.Locations.Where(m => m.ManagerId == managerId).Select(l => l.LocationId).Single(); openPosition.LocationId = managerLocationId; } db.OpenPositions.Add(openPosition); db.SaveChanges(); return(RedirectToAction("Index")); } if (User.IsInRole("Manager")) { string managerId = User.Identity.GetUserId(); ViewBag.LocationId = new SelectList(db.Locations.Where(l => l.ManagerId == managerId), "LocationId", "FullSummary", openPosition.LocationId); } else { ViewBag.LocationId = new SelectList(db.Locations, "LocationId", "FullSummary", openPosition.LocationId); } ViewBag.PositionId = new SelectList(db.Positions, "PositionId", "Title", openPosition.PositionId); return(View(openPosition)); }
public ActionResult Create([Bind(Include = "OpenPositionID,PositionID,LocationID")] OpenPosition openPosition) { string userID = User.Identity.GetUserId(); var locations = db.Locations.Where(x => true); if (!User.IsInRole("Admin")) { // the user is not an admin locations = locations.Where(x => x.ManagerID == userID); } if (locations.Count() == 0) { return(RedirectToAction("ErrorNotAManager")); } var locationCheck = from x in locations where x.LocationID == openPosition.LocationID select x; if (locationCheck.Count() == 0) { return(new HttpStatusCodeResult(HttpStatusCode.Forbidden)); } if (ModelState.IsValid) { db.OpenPositions.Add(openPosition); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.LocationID = new SelectList(locations, "LocationID", "LocationName", openPosition.LocationID); ViewBag.PositionID = new SelectList(db.Positions, "PositionID", "Title", openPosition.PositionID); return(View(openPosition)); }
// GET: OpenPositions/Details/5 public ActionResult Details(int?id) { //check to see if user has already applied string userId = User.Identity.GetUserId(); bool applied = false; var apps = db.Applications.Where(y => y.OpenPositionId == id).ToList(); foreach (var x in apps) { if (x.UserId == userId) { applied = true; } } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } OpenPosition openPosition = db.OpenPositions.Find(id); if (openPosition == null) { return(HttpNotFound()); } ViewBag.Hasapplied = applied; return(View(openPosition)); }
public ActionResult OneClickApply(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } OpenPosition openPosition = db.OpenPositions.Find(id); if (openPosition == null) { return(HttpNotFound()); } string currentUserID = User.Identity.GetUserId(); Application app = new Application(); app.OpenPositionId = openPosition.OpenPositionId; app.UserId = currentUserID; app.ApplicationDate = DateTime.Now; app.ApplicationStatus = 2; UserDetail userDeets = db.UserDetails.Where(x => x.UserId == currentUserID).Single(); app.ResumeFilename = userDeets.ResumeFilename; db.Applications.Add(app); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create([Bind(Include = "OpenPositionID,PositionID,LocationID")] OpenPosition openPosition) { if (User.IsInRole("Manager")) { if (ModelState.IsValid) { db.OpenPositions.Add(openPosition); db.SaveChanges(); return(RedirectToAction("Index")); } string myUserID = User.Identity.GetUserId(); var mgrLocations = db.Locations.Where(l => l.ManagerID == myUserID); ViewBag.LocationID = new SelectList(mgrLocations, "LocationID", "City", openPosition.LocationID); ViewBag.PositionID = new SelectList(db.Positions, "PositionID", "Title", openPosition.PositionID); return(View(openPosition)); } else { if (ModelState.IsValid) { db.OpenPositions.Add(openPosition); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.LocationID = new SelectList(db.Locations, "LocationID", "City", openPosition.LocationID); ViewBag.PositionID = new SelectList(db.Positions, "PositionID", "Title", openPosition.PositionID); return(View(openPosition)); } }
// GET: OpenPositions/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } OpenPosition openPosition = db.OpenPositions.Find(id); if (openPosition == null) { return(HttpNotFound()); } if (User.IsInRole("Manager")) { string currentUserID = User.Identity.GetUserId(); var managerLocations = db.Locations.Where(loc => loc.ManagerId == currentUserID); ViewBag.LocationId = new SelectList(managerLocations, "LocationId", "City"); ViewBag.Message = "You can't edit this Position."; } ViewBag.LocationId = new SelectList(db.Locations, "LocationId", "City", openPosition.LocationId); ViewBag.PositionId = new SelectList(db.Positions, "PositionId", "Title", openPosition.PositionId); return(View(openPosition)); }
public ActionResult DeleteConfirmed(int id) { OpenPosition openPosition = db.OpenPositions.Find(id); db.OpenPositions.Remove(openPosition); db.SaveChanges(); return(RedirectToAction("Index")); }
//Metod za Dodavanje na pozicii vo clasata na pozicii public void AddtoPossitions(OpenPosition open) { var possition = new JobPosition() { Status = true, Title = open.Name }; db.positions.Add(possition); }
private static void Session_OpenPositionUpdate(UpdateAction action, OpenPosition obj) { if (action != UpdateAction.Insert) { return; } Console.WriteLine( $"{Enum.GetName(typeof(UpdateAction), action)} Trade ID: {obj.TradeId}; Amount: {obj.AmountK}; Rate: {obj.Open}"); SyncResponseEvent.Set(); PostTradeIdToQueue(obj.TradeId); }
public ActionResult DeleteConfirmed(int id) { OpenPosition openPosition = db.OpenPositions.Find(id); if (openPosition.Location.ManagerID != User.Identity.GetUserId() && !User.IsInRole("Admin")) { return(new HttpStatusCodeResult(HttpStatusCode.Forbidden)); } db.OpenPositions.Remove(openPosition); db.SaveChanges(); return(RedirectToAction("Index")); }
private OpenPosition CreatePosition(string instrument, int level, string desciption) { var newPos = new OpenPosition { SkillLevel = level, Details = desciption, ApprovalMode = 1, Talent = instrument, Status = 1 }; return(newPos); }
public ActionResult Edit([Bind(Include = "OpenPositionId,PositionId,LocationId")] OpenPosition openPosition) { if (ModelState.IsValid) { db.Entry(openPosition).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.LocationId = new SelectList(db.Locations, "LocationId", "StoreNumber", openPosition.LocationId); ViewBag.PositionId = new SelectList(db.Positions, "PositionId", "Title", openPosition.PositionId); return(View(openPosition)); }
public ActionResult Create([Bind(Include = "OpenPositionID,PositionID,LocationID,IsFeature")] OpenPosition openPosition) { if (ModelState.IsValid) { db.OpenPositions.Add(openPosition); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.LocationID = new SelectList(db.Locations, "LocationID", "StoreNumber", openPosition.LocationID); ViewBag.PositionID = new SelectList(db.Positions, "PositionID", "Title", openPosition.PositionID); return(View(openPosition)); }
public void InsertOrUpdate(OpenPosition openPosition) { if (openPosition.OpenPositionId == default(int)) { // New entity context.OpenPositions.Add(openPosition); } else { // Existing entity context.Entry(openPosition).State = EntityState.Modified; } }
public static double?CalculatePL(OpenPosition openPosition) { Contract.Requires(openPosition != null); if (openPosition.Position.Direction == "BUY") { return((openPosition.Market.Bid - openPosition.Position.Level) * openPosition.Position.Size); } else { return((openPosition.Position.Level - openPosition.Market.Offer) * openPosition.Position.Size); } }
private async Task SendNewPostingConfirmationMessage(IDialogContext context, OpenPosition pos) { IMessageActivity reply = context.MakeMessage(); reply.Attachments = new List <Attachment>(); reply.Text = $"Your position has been created. Please also upload the job description now."; ThumbnailCard positionCard = CardHelper.CreateCardForPosition(pos, false); reply.Attachments.Add(positionCard.ToAttachment()); await context.PostAsync(reply); }
// GET: OpenPositions/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } OpenPosition openPosition = db.OpenPositions.Find(id); if (openPosition == null) { return(HttpNotFound()); } return(View(openPosition)); }
public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } OpenPosition openPosition = db.OpenPositions.Find(id); if (openPosition == null | (User.IsInRole("Manager") && openPosition.Location.ManagerId != User.Identity.GetUserId())) { return(HttpNotFound()); } return(View(openPosition)); }
public static double?CalculatePL(OpenPosition openPosition, Streaming.Model.MarketData marketData) { Contract.Requires(openPosition != null); Contract.Requires(marketData != null); if (openPosition.Position.Direction == "BUY") { return((marketData.Bid - openPosition.Position.Level) * openPosition.Position.Size); } else { return((openPosition.Position.Level - marketData.Offer) * openPosition.Position.Size); } }
public OpenPosition CreatePosition(string title, int level, string location, string hiringManager) { OpenPosition pos = new OpenPosition() { HiringManager = hiringManager, Level = level, Location = location, Title = title, Applicants = 0, DaysOpen = 0, ReqId = (10082082 + new Random().Next(100)).ToString() }; return(pos); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } OpenPosition openPosition = db.OpenPositions.Find(id); if (openPosition == null) { return(HttpNotFound()); } ViewBag.LocationId = new SelectList(db.Locations, "LocationId", "StoreNumber", openPosition.LocationId); ViewBag.PositionId = new SelectList(db.Positions, "PositionId", "Title", openPosition.PositionId); return(View(openPosition)); }
public ActionResult Delete(int?id, string divId) { ViewBag.Scroll = divId; if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } OpenPosition openPosition = db.OpenPositions.Find(id); if (openPosition == null) { return(HttpNotFound()); } return(View(openPosition)); }
public ActionResult Create([Bind(Include = "OpenPositionID,LocationID,PositionID")] OpenPosition openPosition) { if (ModelState.IsValid) { if (User.IsInRole("Manager")) { string userID = User.Identity.GetUserId(); openPosition.LocationID = db.Locations.Where(op => op.ManagerID == userID).Select(x => x.LocationID).FirstOrDefault(); } db.OpenPositions.Add(openPosition); db.SaveChanges(); return(RedirectToAction("Index", new { divId = "ScrollDivID" })); } ViewBag.LocationID = new SelectList(db.Locations, "LocationID", "StoreNumber", openPosition.LocationID); ViewBag.PositionID = new SelectList(db.Positions, "PositionID", "Title", openPosition.PositionID); return(View(openPosition)); }
public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } OpenPosition openPosition = db.OpenPositions.Find(id); if (openPosition == null) { return(HttpNotFound()); } if (openPosition.Location.ManagerID != User.Identity.GetUserId() && !User.IsInRole("Admin")) { return(new HttpStatusCodeResult(HttpStatusCode.Forbidden)); } return(View(openPosition)); }
private OpenPosition GeneratePosition() { Random r = new Random(); var faker = new Faker(); OpenPosition p = new OpenPosition() { Title = faker.PickRandom(Constants.Titles), DaysOpen = r.Next() % 10, HiringManager = $"{faker.Name.FirstName()} {faker.Name.LastName()}", Applicants = r.Next() % 5, ReqId = Guid.NewGuid().ToString().Split('-')[0].ToUpper(), Level = r.Next(7, 10), Location = faker.PickRandom(Constants.Locations) }; return(p); }
public static void CorvergenceCheck(List <ProbaStruct> ZigZagCollectionMain, List <ProbaStruct> ZigZagCollectionOff, ProbaStruct NewZigZagValue, double converGap, double converPrice, DateTime time, ref ProbaStruct CorvergenceHandle, ref int convergence_counter, double gap, double RatioConver, ref List <Position> Position, object locker, ModelsAT.BrokerMT tradeTerminal, ref OpenPosition openpos, ILogger logger, string name, bool LoggNeeded) { if (ZigZagCollectionMain.Last().GapValue < NewZigZagValue.GapValue && ZigZagCollectionMain.Last().price < NewZigZagValue.price) { convergence_counter++; CorvergenceHandle.GapValue = converGap; CorvergenceHandle.price = converPrice; CorvergenceHandle.time = time; if (ZigZagCollectionOff.Count != 0) { double R = Math.Abs(NewZigZagValue.GapValue - gap); double R1 = Math.Abs(NewZigZagValue.GapValue - ZigZagCollectionOff.Last().GapValue); double Ratio = R / R1; /* if (LoggNeeded) * logger.LogEvent(time, name + " Ratio: " + Ratio); * if (RatioConver <= Ratio) * { * if (Position.Count > 0) * { * lock (locker) * { * logger.LogEvent(time, name + " Аварийный выход с рынка"); * tradeTerminal.ClosePosition(Position[0].index); * openpos = OpenPosition.NONE; * } * Position.Clear(); * } * }*/ } //if (LoggNeeded) // logger.LogEvent(time, name + " Медвежья конвергенция "); } else { convergence_counter = 0; } }