public IHttpActionResult PutEventsTable(int id, EventsTable eventsTable)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != eventsTable.EventId)
            {
                return(BadRequest());
            }

            db.Entry(eventsTable).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EventsTableExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Beispiel #2
0
        public JsonResult SaveEvent(EventsTable e)
        {
            var status = false;

            using (Database1Entities dc = new Database1Entities())
            {
                if (e.EventID > 0)
                {
                    //update the event
                    var v = dc.EventsTables.Where(a => a.EventID == e.EventID).FirstOrDefault();
                    if (v != null)
                    {
                        v.Subject     = e.Subject;
                        v.Start       = e.Start;
                        v.End         = e.End;
                        v.Description = e.Description;
                        v.IsFullDay   = e.IsFullDay;
                        v.ThemeColor  = e.ThemeColor;
                    }
                }
                else
                {
                    dc.EventsTables.Add(e);
                }

                dc.SaveChanges();
                status = true;
            }

            return(new JsonResult()
            {
                Data = new { status = status }
            });
        }
        private static GeneratedType buildAppendEventOperation(EventGraph graph, GeneratedAssembly assembly)
        {
            var operationType = assembly.AddType("AppendEventOperation", typeof(AppendEventOperationBase));

            var configure = operationType.MethodFor(nameof(AppendEventOperationBase.ConfigureCommand));

            configure.DerivedVariables.Add(new Variable(typeof(IEvent), nameof(AppendEventOperationBase.Event)));
            configure.DerivedVariables.Add(new Variable(typeof(StreamAction), nameof(AppendEventOperationBase.Stream)));

            var columns = new EventsTable(graph).SelectColumns()

                          // Hokey, use an explicit model for writeable vs readable columns some day
                          .Where(x => !(x is IsArchivedColumn)).ToList();

            var sql =
                $"insert into {graph.DatabaseSchemaName}.mt_events ({columns.Select(x => x.Name).Join(", ")}) values ({columns.Select(_ => "?").Join(", ")})";

            configure.Frames.Code($"var parameters = {{0}}.{nameof(CommandBuilder.AppendWithParameters)}(\"{sql}\");",
                                  Use.Type <CommandBuilder>());

            for (var i = 0; i < columns.Count; i++)
            {
                columns[i].GenerateAppendCode(configure, graph, i);
            }

            return(operationType);
        }
        public IHttpActionResult DeleteEventsTable(int id)
        {
            EventsTable       eventsTable = db.EventsTables.Find(id);
            var               sub         = from n in db.SubscriptionTables where n.Event_Id == id select n;
            var               book        = from n in db.BookingTables where n.EventId == id select n;
            SubscriptionTable st          = (SubscriptionTable)sub.FirstOrDefault();
            BookingTable      bt          = (BookingTable)book.FirstOrDefault();

            if (st != null)
            {
                db.SubscriptionTables.Remove(st);
                db.SaveChanges();
            }
            if (bt != null)
            {
                db.BookingTables.Remove(bt);
                db.SaveChanges();
            }

            //EventsTable eventsTable = db.EventsTables.Find(id);
            if (eventsTable == null)
            {
                return(NotFound());
            }

            db.EventsTables.Remove(eventsTable);
            db.SaveChanges();

            return(Ok(eventsTable));
        }
        private void Button1_Click(object sender, EventArgs e)
        {
            switch (comboBox2.SelectedIndex)
            {
            case 0:
                EventsTable eventsTable = new EventsTable();
                eventsTable.Show();
                break;

            case 1:
                WorkersTable workersTable = new WorkersTable();
                workersTable.Show();
                break;

            case 2:
                DocsTable docsTable = new DocsTable();
                docsTable.Show();
                break;

            case 3:
                AppointmentsTable appointmentsTable = new AppointmentsTable();
                appointmentsTable.Show();
                break;

            case 4:
                CompaniesTable companiesTable = new CompaniesTable();
                companiesTable.Show();
                break;
            }
        }
        public ActionResult DeleteConfirmed(int id)
        {
            EventsTable eventsTable = db.EventsTables.Find(id);

            db.EventsTables.Remove(eventsTable);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #7
0
 public void Initialize()
 {
     OpenConnections();
     Users      = new UsersTable(this);
     Notes      = new NotesTable(this);
     UserEvents = new UserEventsTable(this);
     Insurances = new InsurancesTable(this);
     Events     = new EventsTable(this);
 }
Beispiel #8
0
        public EventModel CreateEvent([FromBody] EventModel em)
        {
            if (em == null)
            {
                throw new HttpResponseException(HttpStatusCode.BadRequest);
            }

            return(EventsTable.Create(em));
        }
 public ActionResult Edit([Bind(Include = "eventID,eventName,eventDescription,creditsToEarn,qrCodeString")] EventsTable eventsTable)
 {
     if (ModelState.IsValid)
     {
         db.Entry(eventsTable).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(eventsTable));
 }
        public async Task <List <BusinessEvent> > GetEvents(DateTimeOffset?lastEventRaised = null)
        {
            var(events, _) = await EventsTable.FoldEventsAsync(
                this.GetPrimaryKey(),
                (result, curr) => { result.Add(curr); return(result); },
                () => new List <BusinessEvent>(),
                lastEventRaised);

            return(events);
        }
        public ActionResult Create([Bind(Include = "eventID,eventName,eventDescription,creditsToEarn,qrCodeString")] EventsTable eventsTable)
        {
            if (ModelState.IsValid)
            {
                db.EventsTables.Add(eventsTable);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(eventsTable));
        }
Beispiel #12
0
        public virtual void Delete()
        {
            if (this.IsNewRecord)
            {
                return;
            }

            KeyValue pkValue = KeyValue.XmlToKey(this.RecordUniqueId);

            EventsTable.DeleteRecord(pkValue);
        }
        public IHttpActionResult GetEventsTable(int id)
        {
            EventsTable eventsTable = db.EventsTables.Find(id);

            if (eventsTable == null)
            {
                return(NotFound());
            }

            return(Ok(eventsTable));
        }
        public async Task <BusinessEvent> RecordEventPayload <T>(int businessEventEnum, T payload)
        {
            var e = new BusinessEvent <T>(businessEventEnum, payload)
            {
                PartitionKey = this.GetPrimaryKey().ToString("D"),
            };

            var tableOperation = TableOperation.Insert(e);
            await EventsTable.ExecuteAsync(tableOperation);

            return(e);
        }
        // GET: EventsTables/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            EventsTable eventsTable = db.EventsTables.Find(id);

            if (eventsTable == null)
            {
                return(HttpNotFound());
            }
            return(View(eventsTable));
        }
 public frmNewEdit(EventsTable obj)
 {
     InitializeComponent();
     db = new EventsEntities();
     if (obj == null)
     {
         eventsTableBindingSource.DataSource = new EventsTable();
         db.EventsTable.Add(eventsTableBindingSource.Current as EventsTable);
     }
     else
     {
         eventsTableBindingSource.DataSource = obj;
         db.EventsTable.Attach(eventsTableBindingSource.Current as EventsTable);
     }
 }
        private static void buildSelectorMethods(StoreOptions options, GeneratedType builderType)
        {
            var sync  = builderType.MethodFor(nameof(EventDocumentStorage.ApplyReaderDataToEvent));
            var async = builderType.MethodFor(nameof(EventDocumentStorage.ApplyReaderDataToEventAsync));

            // The json data column has to go first
            var table   = new EventsTable(options.EventGraph);
            var columns = table.SelectColumns();

            for (var i = 3; i < columns.Count; i++)
            {
                columns[i].GenerateSelectorCodeSync(sync, options.EventGraph, i);
                columns[i].GenerateSelectorCodeAsync(async, options.EventGraph, i);
            }
        }
Beispiel #18
0
        public virtual EventsRecord GetRecord()

        {
            if (this.DataSource != null)
            {
                return(this.DataSource);
            }

            if (this.RecordUniqueId != null)
            {
                return(EventsTable.GetRecord(this.RecordUniqueId, true));
            }

            // Localization.

            throw new Exception(Page.GetResourceValue("Err:RetrieveRec", "OLR"));
        }
Beispiel #19
0
        public virtual void LoadData()
        {
            // Load the data from the database into the DataSource DatabaseOLR_db%dbo.Events record.
            // It is better to make changes to functions called by LoadData such as
            // CreateWhereClause, rather than making changes here.


            // The RecordUniqueId is set the first time a record is loaded, and is
            // used during a PostBack to load the record.
            if (this.RecordUniqueId != null && this.RecordUniqueId.Length > 0)
            {
                this.DataSource = EventsTable.GetRecord(this.RecordUniqueId, true);

                return;
            }

            // This is the first time a record is being retrieved from the database.
            // So create a Where Clause based on the staic Where clause specified
            // on the Query wizard and the dynamic part specified by the end user
            // on the search and filter controls (if any).

            WhereClause wc = this.CreateWhereClause();

            // If there is no Where clause, then simply create a new, blank record.

            if (wc == null || !(wc.RunQuery))
            {
                this.DataSource = new EventsRecord();

                return;
            }

            // Retrieve the record from the database.  It is possible
            EventsRecord[] recList = EventsTable.GetRecords(wc, null, 0, 2);
            if (recList.Length == 0)
            {
                // There is no data for this Where clause.
                wc.RunQuery = false;

                return;
            }

            // Set DataSource based on record retrieved from the database.
            this.DataSource = (EventsRecord)EventsRecord.Copy(recList[0], false);
        }
        public IHttpActionResult PostEventsTable(EventsTable eventsTable)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

                db.EventsTables.Add(eventsTable);

                db.SaveChanges();



                return(CreatedAtRoute("DefaultApi", new { id = eventsTable.EventId }, eventsTable));
            }
            catch
            {
                return(NotFound());
            }
        }
Beispiel #21
0
        public IActionResult UpdateBet(int id)
        {
            RecordOfBets bet      = _context.RecordOfBets.Find(id);
            EventsTable  betEvent = _context.EventsTable.Find(bet.EventId);

            //gets the points spread and use a random number gen to get winner and set score for the eventstable
            betEvent.EventStatus = "STATUS_FINAL";

            //gets base score for both teams, used for all lines
            Random random    = new Random();
            var    baseScore = random.Next(0, 35);

            //sportid: 2 = NFL, 4 = NBA

            betEvent.HomeScore = GenScore(betEvent.SportId);
            betEvent.AwayScore = GenScore(betEvent.SportId);


            _context.EventsTable.Update(betEvent);
            _context.SaveChanges();            //activate BetPayoutCheck();

            return(RedirectToAction("PayoutCheck", "Home", new { eventId = betEvent.EventId }));
        }
Beispiel #22
0
        public double GetBetType(EventsTable betType)

        {
            if (betType != null)
            {
                var currentGameBetSpreadAway = betType.PointSpreadAwayMoney;
                var currentGameBetSpreadHome = betType.PointSpreadHomeMoney;
                var currentGameBetTotalOver  = betType.TotalOverMoney;
                var currentGameBetTotalUnder = betType.TotalUnderMoney;

                foreach (EventsTable entry in _context.EventsTable)
                {
                    //narrow down record
                    if (entry.EventId == betType.EventId && entry.PointSpreadAwayMoney == betType.PointSpreadAwayMoney)
                    {
                        currentGameBetSpreadAway += entry.PointSpreadAwayMoney;
                        return(currentGameBetSpreadAway);
                    }
                    else if (entry.EventId == betType.EventId && entry.PointSpreadHomeMoney == betType.PointSpreadHomeMoney)
                    {
                        currentGameBetSpreadHome += entry.PointSpreadHomeMoney;
                        return(currentGameBetSpreadHome);
                    }
                    else if (entry.EventId == betType.EventId && entry.TotalOverMoney == betType.TotalOverMoney)
                    {
                        currentGameBetTotalOver += entry.TotalOverMoney;
                        return(currentGameBetTotalOver);
                    }
                    else if (entry.EventId == betType.EventId && entry.TotalUnderMoney == betType.TotalUnderMoney)
                    {
                        currentGameBetTotalUnder += entry.TotalUnderMoney;
                        return(currentGameBetTotalUnder);
                    }
                }
            }
            return(0);
        }
Beispiel #23
0
        public IActionResult ViewEvent(string eventId)
        {
            EventsTable temp = _context.EventsTable.Find(eventId);

            return(View(temp));
        }
        private DataTable GroupBy()
        {
            DataView dv = new DataView(EventsTable);

            IEnumerable <string> GroupByCols = _outputColumns.Where(col => !(col is AggregatedOutputColumn) && !(col.Hidden)).Select(col => col.Name);

            //getting distinct values for group columns
            DataTable dtGroup = dv.ToTable(true, GroupByCols.ToArray());

            //Extract AggregatedColumns
            List <AggregatedOutputColumn> outCols = new List <AggregatedOutputColumn>(_outputColumns.Where(col => col is AggregatedOutputColumn).Select(col => new AggregatedOutputColumn(col)));

            //adding columns for the aggregations
            foreach (var col in outCols)
            {
                Type t = null;
                // set the base type on the aggregation:
                // - MIN /MAX means use the base column type
                // - all other aggregations mean Int32
                if (!(col.Aggregation == AggregatedOutputColumn.AggregationType.Max || col.Aggregation == AggregatedOutputColumn.AggregationType.Min))
                {
                    t = typeof(Int32);
                }
                else if (EventsTable.Columns.Contains(col.BaseColumn))
                {
                    t = EventsTable.Columns[col.BaseColumn].DataType;
                }
                else
                {
                    throw new InvalidExpressionException(String.Format("The base column '{0}' for the aggregated column '{1}' was not found. Please correct your expression.", col.BaseColumn, col.Alias));
                }
                dtGroup.Columns.Add(col.Alias, t);
            }

            try
            {
                //looping thru distinct values for the group
                foreach (DataRow dr in dtGroup.Rows)
                {
                    foreach (var col in outCols)
                    {
                        string filterString = " 1 = 1 ";
                        foreach (var grp in GroupByCols)
                        {
                            filterString += String.Format(" AND {0} = '{1}' ", EscapeColumnName(grp), EscapeFilterValue(dr[grp].ToString()));
                        }
                        dr[col.Alias] = EventsTable.Compute(col.Expression, filterString);
                    }
                }
            }
            catch (Exception e)
            {
                logger.Trace(e, "Something went wrong during the aggregation.");
                throw e;
            }

            // Set all columns as visible
            foreach (DataColumn dc in dtGroup.Columns)
            {
                if (dc.ExtendedProperties.Contains("hidden"))
                {
                    dc.ExtendedProperties["hidden"] = false;
                }
                else
                {
                    dc.ExtendedProperties.Add("hidden", false);
                }
            }

            return(dtGroup);
        }
Beispiel #25
0
        public virtual void SetEventId()
        {
            string selectedValue = null;

            // figure out the selectedValue



            // Set the EventId QuickSelector on the webpage with value from the
            // DatabaseOLR_db%dbo.RegistrationTypes database record.

            // this.DataSource is the DatabaseOLR_db%dbo.RegistrationTypes record retrieved from the database.
            // this.EventId is the ASP:QuickSelector on the webpage.

            // You can modify this method directly, or replace it with a call to
            //     base.SetEventId();
            // and add your own custom code before or after the call to the base function.


            if (this.DataSource != null && this.DataSource.EventIdSpecified)
            {
                // If the EventId is non-NULL, then format the value.
                // The Format method will return the Display Foreign Key As (DFKA) value
                selectedValue = this.DataSource.EventId.ToString();
            }
            else
            {
                // EventId is NULL in the database, so use the Default Value.
                // Default Value could also be NULL.
                if (this.DataSource != null && this.DataSource.IsCreated)
                {
                    selectedValue = null;
                }
                else
                {
                    selectedValue = RegistrationTypesTable.EventId.DefaultValue;
                }
            }

            // Add the Please Select item.
            if (selectedValue == null || selectedValue == "")
            {
                MiscUtils.ResetSelectedItem(this.EventId, new ListItem(this.Page.GetResourceValue("Txt:PleaseSelect", "OLR"), "--PLEASE_SELECT--"));
            }


            // Populate the item(s) to the control

            this.EventId.SetFieldMaxLength(50);

            System.Collections.Generic.IDictionary <string, object> variables = new System.Collections.Generic.Dictionary <string, object>();
            FormulaEvaluator evaluator = new FormulaEvaluator();

            if (selectedValue != null &&
                selectedValue.Trim() != "" &&
                !MiscUtils.SetSelectedValue(this.EventId, selectedValue) &&
                !MiscUtils.SetSelectedDisplayText(this.EventId, selectedValue))
            {
                // construct a whereclause to query a record with DatabaseOLR_db%dbo.Events.EventId = selectedValue

                CompoundFilter filter2      = new CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, null);
                WhereClause    whereClause2 = new WhereClause();
                filter2.AddFilter(new BaseClasses.Data.ColumnValueFilter(EventsTable.EventId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, false));
                whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator);

                // Execute the query
                try
                {
                    EventsRecord[] rc = EventsTable.GetRecords(whereClause2, new OrderBy(false, false), 0, 1);
                    System.Collections.Generic.IDictionary <string, object> vars = new System.Collections.Generic.Dictionary <string, object> ();
                    // if find a record, add it to the dropdown and set it as selected item
                    if (rc != null && rc.Length == 1)
                    {
                        EventsRecord itemValue = rc[0];
                        string       cvalue    = null;
                        string       fvalue    = null;
                        if (itemValue.EventIdSpecified)
                        {
                            cvalue = itemValue.EventId.ToString();
                        }
                        Boolean _isExpandableNonCompositeForeignKey = RegistrationTypesTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(RegistrationTypesTable.EventId);
                        if (_isExpandableNonCompositeForeignKey && RegistrationTypesTable.EventId.IsApplyDisplayAs)
                        {
                            fvalue = RegistrationTypesTable.GetDFKA(itemValue, RegistrationTypesTable.EventId);
                        }
                        if ((!_isExpandableNonCompositeForeignKey) || (String.IsNullOrEmpty(fvalue)))
                        {
                            fvalue = itemValue.Format(EventsTable.EventId);
                        }

                        if (fvalue == null || fvalue.Trim() == "")
                        {
                            fvalue = cvalue;
                        }
                        MiscUtils.ResetSelectedItem(this.EventId, new ListItem(fvalue, cvalue));
                    }
                }
                catch
                {
                }
            }

            string url = this.ModifyRedirectUrl("../Events/Events-QuickSelector.aspx", "", true);

            url = this.Page.ModifyRedirectUrl(url, "", true);

            url += "?Target=" + this.EventId.ClientID + "&Formula=" + (this.Page as BaseApplicationPage).Encrypt("=Events.EventName") + "&IndexField=" + (this.Page as BaseApplicationPage).Encrypt("EventId") + "&EmptyValue=" + (this.Page as BaseApplicationPage).Encrypt("--PLEASE_SELECT--") + "&EmptyDisplayText=" + (this.Page as BaseApplicationPage).Encrypt(this.Page.GetResourceValue("Txt:PleaseSelect")) + "&Mode=" + (this.Page as BaseApplicationPage).Encrypt("FieldValueSingleSelection") + "&RedirectStyle=" + (this.Page as BaseApplicationPage).Encrypt("Popup");

            this.EventId.Attributes["onClick"] = "initializePopupPage(this, '" + url + "', " + Convert.ToString(EventId.AutoPostBack).ToLower() + ", event); return false;";
        }
Beispiel #26
0
        public double CalculateTheProbabilty(EventsTable betType)
        {
            return(GetBetType(betType) / (GetBetType(betType) + 100) * 100);

            //return 100 / (GetBetType(betType) + 100) * 100;
        }
Beispiel #27
0
        public IActionResult CreateBet(string _eventId, string _BetType, string _eventTime, string _betTeam, string _odd, float _moneyline)
        {
            //Ivo: Do we need the id of the user anywhere here?

            //ticker stuff
            List <TickerGames> tempTickerGames = new List <TickerGames>();

            //ticker games we have bets on
            foreach (RecordOfBets bets in _context.RecordOfBets.Where(b => b.UserId == User.FindFirst(ClaimTypes.NameIdentifier).Value).ToList())
            {
                TickerGames newTickerGame = new TickerGames();
                EventsTable item          = _context.EventsTable.Find(bets.EventId);

                if (bets.EventId == item.EventId)
                {
                    newTickerGame.FavoritedEvent = true;
                }

                newTickerGame.HomeTeam            = item.HomeTeam;
                newTickerGame.AwayTeam            = item.AwayTeam;
                newTickerGame.TimeOfEvent         = item.EventDate;
                newTickerGame.EventId             = item.EventId;
                newTickerGame.HomeSpread          = (float)item.SpreadHome;
                newTickerGame.AwaySpread          = (float)item.SpreadAway;
                newTickerGame.HomeMoneyline       = (float)item.MoneyLineHome;
                newTickerGame.AwayMoneyline       = (float)item.MoneyLineAway;
                newTickerGame.HomeTotal           = (float)item.TotalHome;
                newTickerGame.AwayTotal           = (float)item.TotalAway;
                newTickerGame.HomeSpreadMoneyLine = (float)item.PointSpreadHomeMoney;
                newTickerGame.AwaySpreadMoneyLine = (float)item.PointSpreadAwayMoney;
                newTickerGame.HomeTotalMoneyLine  = (float)item.TotalUnderMoney;
                newTickerGame.AwayTotalMoneyLine  = (float)item.TotalUnderMoney;
                if (!tempTickerGames.Contains(newTickerGame))
                {
                    tempTickerGames.Add(newTickerGame);
                }
            }

            foreach (EventsTable item in _context.EventsTable.ToList())
            {
                TickerGames newTickerGame = new TickerGames();
                newTickerGame.HomeTeam = item.HomeTeam;
                newTickerGame.AwayTeam = item.AwayTeam;

                newTickerGame.TimeOfEvent = item.EventDate;
                newTickerGame.EventId     = item.EventId;

                newTickerGame.HomeSpread          = (float)item.SpreadHome;
                newTickerGame.AwaySpread          = (float)item.SpreadAway;
                newTickerGame.HomeMoneyline       = (float)item.MoneyLineHome;
                newTickerGame.AwayMoneyline       = (float)item.MoneyLineAway;
                newTickerGame.HomeTotal           = (float)item.TotalHome;
                newTickerGame.AwayTotal           = (float)item.TotalAway;
                newTickerGame.HomeSpreadMoneyLine = (float)item.PointSpreadHomeMoney;
                newTickerGame.AwaySpreadMoneyLine = (float)item.PointSpreadAwayMoney;
                newTickerGame.HomeTotalMoneyLine  = (float)item.TotalUnderMoney;
                newTickerGame.AwayTotalMoneyLine  = (float)item.TotalUnderMoney;

                if (!tempTickerGames.Contains(newTickerGame))
                {
                    tempTickerGames.Add(newTickerGame);
                }
            }
            betPlacingModel.TickerGames = tempTickerGames;


            //event info
            betPlacingModel.BetType      = _BetType;
            betPlacingModel.EventDate    = DateTime.Parse(_eventTime);
            betPlacingModel.Event        = _context.EventsTable.Find(_eventId);
            betPlacingModel.Odd          = _odd;
            betPlacingModel.BetTeam      = _betTeam;
            betPlacingModel.BetMoneyLine = _moneyline;
            betPlacingModel.Event        = _context.EventsTable.Find(_eventId);
            return(View("BetPlacement", betPlacingModel));
        }