public static ICollection <vInvoiceList> getInvoiceList() { using (var db = new PTContext()) { return(db.vInvoiceList.ToList()); } }
public static ICollection <vEmployeeList> getEmployeeList() { using (var db = new PTContext()) { return(db.vEmployeeList.ToList()); } }
public static ICollection <vContactList> getContactList() { using (var db = new PTContext()) { return(db.vContactList.ToList()); } }
public static IList <species> getSpeciesList() { using (var db = new PTContext()) { return(db.species.ToList()); } }
public static void newReservation(reservation reservation) { using (var db = new PTContext()) { db.reservation.Add(reservation); db.SaveChanges(); } }
public static ICollection <vPriceList> getPriceList() { using (var db = new PTContext()) { var result = db.vPriceList.ToList(); return(result); } }
public static bool DatabaseHaveAllMigrations(PTContext context) { var migrazioniApplicate = context.Database.GetAppliedMigrations().ToList(); var migrazioniPreviste = context.Database.GetMigrations().ToList(); var tutteMigrazioniAppliate = migrazioniPreviste.All(x => migrazioniApplicate.Contains(x)); return(tutteMigrazioniAppliate); }
public static IList <reservation> getReservationList() { using (var db = new PTContext()) { return(db.reservation .Include(x => x.customer) .Include(x => x.species) .ToList()); } }
public static void editReservation(reservation reservation) { using (var db = new PTContext()) { reservation.customer.customerID = reservation.customerID; db.Entry(reservation).State = EntityState.Modified; db.Entry(reservation.customer).State = EntityState.Modified; db.SaveChanges(); } }
public static reservation getReservation(int id) { using (var db = new PTContext()) { return(db.reservation .Include(x => x.customer) .Include(x => x.species) .Where(x => x.reservationID == id) .Single()); } }
public static reservation getReservation(string code) { using (var db = new PTContext()) { return(db.reservation .Include(x => x.customer) .Include(x => x.species) .Where(x => x.code == code) .Single()); } }
private static void UpdateSuper() { var dir = @"C:\Users\Trappist\Downloads\"; var files = Directory.GetFiles(dir, "ActivityStatement.*.html"); using (var dbContext = new PTContext()) { foreach (var file in files) { Console.Write(file); string date = file .Replace(dir, "") .Replace("ActivityStatement.", "") .Replace(".html", ""); Console.Write(date); var fileContents = File.ReadAllText(file); HtmlDocument doc = new HtmlDocument(); doc.LoadHtml(fileContents); var table = doc.GetElementbyId("tblOpenPositions_U1688065Body"); var tbodies = table.ChildNodes .Where(a => a.Name == "div").First() .ChildNodes.Where(a => a.Name == "table").First() .ChildNodes.Where(a => a.Name == "tbody"); foreach (var tbody in tbodies) { var row = tbody.ChildNodes.Where(a => a.Name == "tr").First(); if (row?.Attributes["class"]?.Value == "row-summary no-details") { var tds = row.ChildNodes.Where(a => a.Name == "td").ToList(); var ib = new Ib(); if (date.Length < 8) { date = date + "28"; } ib.Dateimported = DateTime.ParseExact(date, "yyyyMMdd", CultureInfo.InvariantCulture); ib.Symbol = tds[0].InnerText; ib.Quantity = Convert.ToInt32(tds[1].InnerText); ib.Mult = tds[2].InnerText; ib.CostPrice = Convert.ToDecimal(tds[3].InnerText); ib.CostBasis = Convert.ToDecimal(tds[4].InnerText); ib.ClosePrice = Convert.ToDecimal(tds[5].InnerText); ib.Value = Convert.ToDecimal(tds[6].InnerText); ib.UnrealizedPL = Convert.ToDecimal(tds[7].InnerText); ib.Code = tds[8].InnerText; dbContext.Ib.Add(ib); } } File.Move(file, @"C:\Data\Imported\" + file.Replace(dir, "")); } dbContext.SaveChanges(); } }
static void Main(string[] args) { Console.WriteLine($"Options provided {(args?.Length > 0 ? args[0] : "None")}"); if (args?.Length > 0 ? args[0] == "super": false) { UpdateSuper(); return; } var refreshTimespan = new TimeSpan(4, 0, 0); using (var dbContext = new PTContext()) { var program = new Program(); var tickers = dbContext.Ticker.Where(t => !string.IsNullOrWhiteSpace(t.Url)); foreach (var ticker in tickers) { var lastTickerRecorded = dbContext.TickerHistory .Where(a => a.SchemeCode == ticker.SchemeCode) .Max(a => a.Daterecorded); if (lastTickerRecorded.HasValue && (DateTime.Now - lastTickerRecorded.Value) < refreshTimespan) { continue; } var nav = program.GetTickerUpdate(ticker.Url); nav.Wait(); if (nav != null) { var tickerHistory = new TickerHistory() { Daterecorded = DateTime.Now, SchemeCode = ticker.SchemeCode, Value = nav.Result }; dbContext.TickerHistory.Add(tickerHistory); } var task = Task.Delay(1000 * 10); task.Wait(); } dbContext.SaveChanges(); } //PTContext.ConnectionString = "Data Source=TRAPPIST-PC\\SQLEXPRESS;Initial Catalog=PT;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=True;ApplicationIntent=ReadWrite;MultiSubnetFailover=False"; }
public StateRepository() { _Context = new PTContext(); }
public CityRepository() { _Context = new PTContext(); }
public CompaniesRepository(PTContext context) { _context = context; }
public PortfolioController(PTContext dbContext) { _dbContext = dbContext; }
public CountryImporter(PTContext context) { _context = context; }
public LookUpInteractor(PTContext db) { this._db = db; }
/// <summary> /// By this constructer iniciate class object and call sp. The sp Result is converted in Json Array. /// </summary> /// <param name="objModelAttribute">detila of table corresponding to the Business Object.</param> /// <param name="objectParameters">list all parameters corresponding to the Business Object.</param> /// <param name="_dbContext">Database Context refference </param> public Generic(ModelAttribute objModelAttribute, List <ObjectParameter> objectParameters, PTContext _dbContext) { var list = ((IObjectContextAdapter)_dbContext) .ObjectContext .ExecuteFunction <U> ("sp_" + objModelAttribute.TableName + "_select", objectParameters.ToArray()).ToList(); var josnArry = JsonConvert.SerializeObject(list); Jsonarr = new JArray { josnArry }; }
public BaseRepoistory() { _dbContext = new PTContext(); }
public ProjectInteractor(PTContext db) { this._db = db; }
public EarningsController(PTContext context) { _context = context; }
public TaskInteractor(PTContext db, FileUploadManager fileManager, IEmailInteractor emailInteractor) { this._db = db; this._fileManager = fileManager; this._emailServer = emailInteractor; }
public ServiceRepository(PTContext context) { _context = context; }
public RulesController(PTContext context) { _context = context; }
public ReadOnlyController(PTContext context) { _context = context; }
public EffortInteractor(PTContext db) { this._db = db; }
public AccountsRepository(PTContext context) { _context = context; }
public ResourceInteractor(PTContext db) { this._db = db; }