Example #1
0
 public static ICollection <vInvoiceList> getInvoiceList()
 {
     using (var db = new PTContext())
     {
         return(db.vInvoiceList.ToList());
     }
 }
Example #2
0
 public static ICollection <vEmployeeList> getEmployeeList()
 {
     using (var db = new PTContext())
     {
         return(db.vEmployeeList.ToList());
     }
 }
Example #3
0
 public static ICollection <vContactList> getContactList()
 {
     using (var db = new PTContext())
     {
         return(db.vContactList.ToList());
     }
 }
Example #4
0
 public static IList <species> getSpeciesList()
 {
     using (var db = new PTContext())
     {
         return(db.species.ToList());
     }
 }
Example #5
0
 public static void newReservation(reservation reservation)
 {
     using (var db = new PTContext())
     {
         db.reservation.Add(reservation);
         db.SaveChanges();
     }
 }
Example #6
0
 public static ICollection <vPriceList> getPriceList()
 {
     using (var db = new PTContext())
     {
         var result = db.vPriceList.ToList();
         return(result);
     }
 }
Example #7
0
        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);
        }
Example #8
0
 public static IList <reservation> getReservationList()
 {
     using (var db = new PTContext())
     {
         return(db.reservation
                .Include(x => x.customer)
                .Include(x => x.species)
                .ToList());
     }
 }
Example #9
0
 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();
     }
 }
Example #10
0
 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());
     }
 }
Example #11
0
 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());
     }
 }
Example #12
0
File: Program.cs Project: S4njay/pt
        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();
            }
        }
Example #13
0
File: Program.cs Project: S4njay/pt
        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();
 }
Example #15
0
 public CityRepository()
 {
     _Context = new PTContext();
 }
Example #16
0
 public CompaniesRepository(PTContext context)
 {
     _context = context;
 }
Example #17
0
 public PortfolioController(PTContext dbContext)
 {
     _dbContext = dbContext;
 }
Example #18
0
 public CountryImporter(PTContext context)
 {
     _context = context;
 }
Example #19
0
 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();
 }
Example #22
0
 public ProjectInteractor(PTContext db)
 {
     this._db = db;
 }
Example #23
0
 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;
 }
Example #26
0
 public RulesController(PTContext context)
 {
     _context = context;
 }
 public ReadOnlyController(PTContext context)
 {
     _context = context;
 }
Example #28
0
 public EffortInteractor(PTContext db)
 {
     this._db = db;
 }
Example #29
0
 public AccountsRepository(PTContext context)
 {
     _context = context;
 }
 public ResourceInteractor(PTContext db)
 {
     this._db = db;
 }