/// <summary> /// Constructor. Creates root department with 0 as parent dept ID, /// and with 0 workers and 0 subdepartments. Adds it to the collection of all departments /// </summary> /// <param name="orgName">Name of the organization. It is assigned to the root dept name.</param> public Organization(string name) { Name = name; Departments = new List <BaseDepartment>(); Workers = new List <Worker>(); _positions = new PositionsTable(this); }
public ActionResult <PositionsTable> AddPositions([FromBody] PositionsTable incomingPositions) { var db = new ScheduleQuikDbContext(); db.Positions.Add(incomingPositions); db.SaveChanges(); return(incomingPositions); }
public void Initialice(string applicationPath, string applicationDataPath) { this.m_comLockObj = Guid.NewGuid(); this.m_applicationPath = applicationPath; this.m_applicationDataPath = applicationDataPath; this.m_masterData = new Working.MasterData(); this.m_supplier = new Working.Supplier(); this.m_position = new Working.Positions(); this.m_materialCategoryTable = BasicTable.OpenDataTable <MaterialCategoryTable>(applicationDataPath); this.m_manufacturerTable = BasicTable.OpenDataTable <ManufacturerTable>(applicationDataPath); this.m_supplierTable = BasicTable.OpenDataTable <SupplierTable>(applicationDataPath); this.m_positionsTable = BasicTable.OpenDataTable <PositionsTable>(applicationDataPath); }
public ActionResult UpdatePositions([FromRoute] int id, [FromBody] PositionsTable newInformation) { var db = new ScheduleQuikDbContext(); // find the position var positions = db.Positions.FirstOrDefault(f => f.Id == id); if (positions != null) { positions.PositionName = newInformation.PositionName; db.SaveChanges(); } else { return(NotFound()); } return(Ok(positions)); }
private void PositionForm_Activated(object sender, EventArgs e) { using (var context = new PineappleContext()) { PositionsTable.DataSource = null; PositionsTable.Rows.Clear(); PositionsTable.Refresh(); context.Positions.Load(); DbSet <Position> positions = context.Positions; int i = 0; PositionsTable.RowCount = positions.Count(); foreach (Position position in positions) { PositionsTable[0, i].Value = position.Id; PositionsTable[1, i].Value = position.Name; i++; } } }
private void ok_button_Click(object sender, EventArgs e) { int numShares = 0; int stopPercentage = 0; decimal buyPrice = 0; decimal fixedStopPrice = 0; bool useTrailingStop = false; bool useDividends = false; bool useOptions = false; try { numShares = int.Parse(shares_textBox.Text); } catch (FormatException) { MessageBox.Show("Number of shares is not a valid number"); return; } try { buyPrice = decimal.Parse(buyPrice_textBox.Text); } catch (FormatException) { MessageBox.Show("Buy price is not a valid number"); return; } if (fixedPrice_radioButton.Checked) { try { fixedStopPrice = decimal.Parse(fixedStopPrice_textBox.Text); } catch (FormatException) { MessageBox.Show("Fixed stop price is not a valid number"); return; } } else { try { stopPercentage = int.Parse(stopLossPercentage_textBox.Text); } catch (FormatException) { MessageBox.Show("Stop loss percentage is not a valid number"); return; } useTrailingStop = useTrailingStop_checkBox.Checked; useDividends = useDividends_checkBox.Checked; useOptions = useOptionSales_checkBox.Checked; } // Add position to the database PositionsTable.AddRecord( symbol_textBox.Text, stopPercentage, useTrailingStop, buy_dateTimePicker.Value, numShares, buyPrice, useDividends, useOptions, fixedStopPrice ); Close(); }