public static async Task HttpStart( [EventGridTrigger] EventGridEvent eventGridEvent, [OrchestrationClient] DurableOrchestrationClient starter, ILogger log) { var eventGridData = (dynamic)eventGridEvent.Data; var operation = eventGridEvent.EventType; var apiReference = (string)eventGridData.apiReference; await starter.PurgeInstanceHistoryAsync(apiReference); if (operation == Events.ReferenceDelete) { var eventGrid = new EventGrid( EnvironmentVariables.EventGridReferenceUpdatedEndpoint, EnvironmentVariables.EventGridReferenceUpdatedKey); await eventGrid.SendReferenceEvent(apiReference, Events.ReferenceDelete); } else { await starter.StartNewAsync( Functions.Orchestrator, apiReference, null ); } }
private async void GridView_ItemClick(object sender, ItemClickEventArgs e) { Event ev = e.ClickedItem as Event; var contentDialog = new ContentDialog() { Content = new EventDialog(ev), PrimaryButtonText = "确定", FullSizeDesired = false }; contentDialog.Style = transparent; contentDialog.Closed += async(_s, _e) => { await EventGrid.Blur(value : 0, duration : 0, delay : 0).StartAsync(); contentDialog.Hide(); }; contentDialog.PrimaryButtonClick += async(_s, _e) => { await EventGrid.Blur(value : 0, duration : 0, delay : 0).StartAsync(); contentDialog.Hide(); }; await EventGrid.Blur(value : 7, duration : 100, delay : 0).StartAsync(); await contentDialog.ShowAsync(); }
// idea to have cells broadcast to each other instead of iterating and checking public void Run(ICollection <Coordinate> initialState, int dimensions) { var grid = new EventGrid(dimensions, (Coordinate c, Cell cell, bool isAlive) => { Console.SetCursorPosition(c.X, c.Y); Console.Write(isAlive ? "o" : " "); Thread.Sleep(100); Debug.WriteLine("Writing {0},{1} with {2} and {3} neighbors", c.X, c.Y, isAlive, cell.Neighbors); }, new HashSet <Coordinate>(initialState)); }
public void Populate(EventGrid pMessage) { ServiceError error = ServiceError.GetFromXml<ServiceError>( pMessage.FormatedMessage .AnyMessage); lblMachine.Text = error.Machine; lblSource.Text = error.Source; lblErrorId.Text = error.ErrorId; lblErrorType.Text = error.Type; lblUser.Text = error.UserName; txtMessage1.Text = error.Message + Environment.NewLine + error.InnerMessageException; }
public static async Task Trigger([ActivityTrigger] PreprocessorActivityInput input, ILogger log) { var eventGrid = new EventGrid( EnvironmentVariables.EventGridReferenceRequestedEndpoint, EnvironmentVariables.EventGridReferenceRequestedKey ); var eventType = input.IsPreview == "true" ? Events.ReferencePreview : Events.ReferenceInitialize; await eventGrid.SendReferenceEvent(input.Codename, eventType, input.IsTest); }
//protected void AjaxFileUpload1_imageupload(object sender, AjaxFileUploadEventArgs e) //{ // string filename = e.FileName; // string strDestPath = Server.MapPath("~/Images/Events/"); // AjaxFileUpload1.SaveAs(@strDestPath + filename); //} protected void buttonSave_Click(object sender, EventArgs e) { try { string name = txtEventName.Text; string date = txtEventDate.Text; string time = txtEventTime.Text; string venue = VenueIDDd.SelectedValue; //string status = txtEventStatus.Text; string category = SelectEventCategory.SelectedValue; string description = txtDescription.Text; //string images = "/httpdocs/Images/Events/" + ddlImage.SelectedValue; // string sstatus = "Available"; Event ticket = new Event(name, date, time, venue, "Available", category, description, "TEST"); int eid = Connection.AddEvents(ticket); tempTable = (DataTable)Session["SeatLeveltable"]; // Create the eventid column DataColumn nce; nce = new DataColumn(); nce.DataType = System.Type.GetType("System.Int32"); nce.ColumnName = "EventId"; nce.DefaultValue = eid; tempTable.Columns.Add(nce); // Add the above into gridview EventGrid.DataSource = tempTable; EventGrid.DataBind(); // Add SeatSection and eventid from gridview to SeatCategory table foreach (GridViewRow e1 in EventGrid.Rows) { string section = e1.Cells[0].Text; int eventid = Int32.Parse(e1.Cells[3].Text); //SeatCategory slv = new SeatCategory(eventid, section, sstatus); int scatID = Connection.AddSeatCat(eventid, section); Connection.AddSeat(Int32.Parse(e1.Cells[1].Text), e1.Cells[2].Text, scatID); } lbOutPut.Text = "Upload successful!"; ClearTextFields(); } catch (Exception) { lbOutPut.Text = "Upload failed!"; } }
public static async Task EventGridStart( [EventGridTrigger] EventGridEvent eventGridEvent, [OrchestrationClient] DurableOrchestrationClient starter, ILogger log) { var eventGridData = (dynamic)eventGridEvent.Data; var blobUrl = (string)eventGridData.url; var instanceId = blobUrl .Split("/") .Last() .Split(".") .First(); await starter.RaiseEventWithRetryAsync(instanceId, blobUrl); if (!blobUrl.Contains("preview")) { var eventGrid = new EventGrid( EnvironmentVariables.EventGridReferenceUpdatedEndpoint, EnvironmentVariables.EventGridReferenceUpdatedKey); await eventGrid.SendReferenceEvent(instanceId, Events.ReferenceUpdated); } }
public void Populate(EventGrid pEventGrid) { txtMessage1.Text = pEventGrid.FormatedMessage.AnyMessage; }
protected void price_Click(object sender, EventArgs e) { try { int ssection = Int32.Parse(SeatDropDown.SelectedValue); int seatprice = Int32.Parse(txtPrice.Text); int svenueid = Int32.Parse(VenueIDDd.SelectedValue); int seattotal = Connection.GetFromVenueInfo(ssection, svenueid); DataColumn Col; DataRow Ro; if (Session["SeatLeveltable"] != null) { tempTable = (DataTable)Session["SeatLeveltable"]; } else { // Create a new DataTable tempTable = new DataTable(); // Create a new column in gridview Col = new DataColumn(); Col.DataType = System.Type.GetType("System.Int32"); Col.ColumnName = ("SeatSection"); tempTable.Columns.Add(Col); // Create a new column in gridview Col = new DataColumn(); Col.DataType = System.Type.GetType("System.Int32"); Col.ColumnName = ("TotalSeat"); tempTable.Columns.Add(Col); // Create a 3rd column in gridview Col = new DataColumn(); Col.DataType = System.Type.GetType("System.Double"); Col.ColumnName = ("Price"); tempTable.Columns.Add(Col); } //Create new DataRow objects and add to DataTable Ro = tempTable.NewRow(); Ro["SeatSection"] = ssection; Ro["TotalSeat"] = seattotal; Ro["Price"] = seatprice; tempTable.Rows.Add(Ro); EventGrid.DataSource = tempTable; EventGrid.DataBind(); Session["SeatLeveltable"] = tempTable; lbPrice.Text = "Upload successful!"; //ClearSeatSection(); } catch (Exception) { lbPrice.Text = "Upload failed!"; } }
public void Populate(EventGrid pEventGrid) { txtMessage1.Text = pEventGrid.FormatedMessage.Request; txtMessage2.Text = pEventGrid.FormatedMessage.Response; }
protected void price_Click(object sender, EventArgs e) { double n; if (!double.TryParse(txtPrice.Text, out n) || double.Parse(txtPrice.Text) <= 0 || !Regex.IsMatch(txtPrice.Text, @"^\$?([0-9]{1,3},([0-9]{3},)*[0-9]{3}|[0-9]+)(.[0-9][0-9])?$")) { lbPrice.Text = "Invalid Price!!"; lbPrice.ForeColor = Color.Red; } else { try { int ssection = Int32.Parse(SeatDropDown.SelectedValue); int seatprice = Int32.Parse(txtPrice.Text); int svenueid = Int32.Parse(VenueIDDd.SelectedValue); int seattotal = Connection.GetFromVenueInfo(ssection, svenueid); DataColumn Col; DataRow Ro; if (Session["SeatLeveltable"] != null) { tempTable = (DataTable)Session["SeatLeveltable"]; } else { // Create a new DataTable tempTable = new DataTable(); // Create a new column in gridview Col = new DataColumn(); Col.DataType = System.Type.GetType("System.Int32"); Col.ColumnName = ("SeatSection"); tempTable.Columns.Add(Col); // Create a new column in gridview Col = new DataColumn(); Col.DataType = System.Type.GetType("System.Int32"); Col.ColumnName = ("TotalSeat"); tempTable.Columns.Add(Col); // Create a 3rd column in gridview Col = new DataColumn(); Col.DataType = System.Type.GetType("System.Double"); Col.ColumnName = ("Price"); tempTable.Columns.Add(Col); } int section = Int32.Parse(SeatDropDown.SelectedValue); if (tempTable.AsEnumerable().Any(row => section == row.Field <int>("SeatSection"))) { //lbSeatOutput.Text = "This Section already exits."; //lbSeatOutput.ForeColor = Color.Red; EventGrid.Visible = true; this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Can not have multiple price for the same section.')", true); EventGrid.Visible = true; lbPrice.Text = ""; } else { //Create new DataRow objects and add to DataTable Ro = tempTable.NewRow(); Ro["SeatSection"] = ssection; Ro["TotalSeat"] = seattotal; Ro["Price"] = seatprice; tempTable.Rows.Add(Ro); EventGrid.DataSource = tempTable; EventGrid.DataBind(); Session["SeatLeveltable"] = tempTable; lbPrice.Text = "Upload successful!"; lbPrice.ForeColor = Color.Blue; //ClearSeatSection(); EventGrid.Visible = true; } } catch (Exception) { lbPrice.Text = "Upload failed!"; } } }
protected void buttonSave_Click(object sender, EventArgs e) { if (Session["SeatLeveltable"] == null) { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Price is missing from the Seat Level. Please enter the price and try it again.')", true); } else { tempTable = (DataTable)Session["SeatLeveltable"]; DateTime d; string filename; try { // string sstatus = "Available"; filename = Path.GetFileName(FileUpload1.FileName); FileUpload1.SaveAs(Server.MapPath("~/Images/Events/") + filename); } catch (Exception) { lbOutPut.Text = "Please upload the Image!"; lbOutPut.ForeColor = Color.Red; lbPrice.Text = ""; return; } if (!(DateTime.TryParseExact(txtEventDate.Text, "MM/dd/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out d) || DateTime.TryParseExact(txtEventDate.Text, "M/d/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out d))) { } else if (!(Regex.IsMatch(txtEventTime.Text, @"^(?:0?[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$") || Regex.IsMatch(txtEventTime.Text, @"^(?:0?[0-9]|1[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]$"))) { } else if (tempTable.Rows.Count == 0) { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Price is missing from the Seat Level. Please enter the price and try it again.')", true); } else if (!isImage(filename)) { lbOutPut.Text = "Invalid Image"; lbOutPut.ForeColor = Color.Red; lbPrice.Text = ""; } else if (DateTime.Parse(txtEventDate.Text) <= DateTime.Now) { lbOutPut.Text = "Event date must be after the current date"; lbOutPut.ForeColor = Color.Red; lbPrice.Text = ""; } else { try { string name = txtEventName.Text; string date = txtEventDate.Text; string time = txtEventTime.Text; string venue = VenueIDDd.SelectedValue; //string status = txtEventStatus.Text; string category = SelectEventCategory.SelectedValue; string description = txtDescription.Text; Event ticket = new Event(name, date, time, venue, "Available", category, description, "../Images/Events/" + filename); int eid = Connection.AddEvents(ticket); tempTable = (DataTable)Session["SeatLeveltable"]; // Create the eventid column DataColumn nce; nce = new DataColumn(); nce.DataType = System.Type.GetType("System.Int32"); nce.ColumnName = "EventId"; nce.DefaultValue = eid; tempTable.Columns.Add(nce); // Add the above into gridview EventGrid.DataSource = tempTable; EventGrid.DataBind(); // Add SeatSection and eventid from gridview to SeatCategory table foreach (DataRow e1 in tempTable.Rows) { int section = e1.Field <int>(0); int eventid = e1.Field <int>(3); //SeatCategory slv = new SeatCategory(eventid, section, sstatus); int scatID = Connection.AddSeatCat(eventid, section); Connection.AddSeat(e1.Field <int>(1), e1.Field <double>(2), scatID); } lbOutPut.Text = "Upload successful!"; lbOutPut.ForeColor = Color.Blue; ClearTextFields(); GridView1.DataBind(); Session["SeatLeveltable"] = null; EventGrid.Visible = false; lbPrice.Text = ""; } catch (Exception exc) { lbOutPut.Text = "Upload failed!"; lbOutPut.ForeColor = Color.Red; } } } }
public static void Initialize(IConfigurationRoot configurationExtension) { Repositories.Load(configurationExtension); SendGrid.Load(configurationExtension); EventGrid.Load(configurationExtension); }