private void DataClient_OnResponseReceived(object sender, SpeechResponseEventArgs e) { try { var firstResult = e.PhraseResponse.Results.First(); // _parts.Add(firstResult.LexicalForm); var content = new Content(); content.MeetingId = currentMeetingId; content.EmployeeId = Guid.Parse("BF49B343-97C2-4544-AC07-8964C269280D"); content.Sequence = 159; content.Line = firstResult.LexicalForm; content.CategoryId = Guid.Parse("61027F10-21A9-4C91-B4C1-7E7E99A29853"); using (var db = new AzureDb("Server=lofndb.database.windows.net;Database=lofn2;User Id=lofn;Password=Passw0rd; ")) { db.Contents.Add(content); db.SaveChanges(); // TODO: Handle transaction and failures. } } catch (Exception ex) { throw; } }
// GET api/employees public IEnumerable <Employee> Get() { using (var db = new AzureDb("Server=lofndb.database.windows.net;Database=lofn2;User Id=lofn;Password=Passw0rd; ")) { return(db.Employees.ToList()); } }
// GET api/locations public IEnumerable <string> Get() { using (var db = new AzureDb("Server=lofndb.database.windows.net;Database=lofn2;User Id=lofn;Password=Passw0rd; ")) { return(db.Meetings.Select(i => i.Location).Distinct().ToList()); } }
// POST api/values public Guid Post([FromBody] CreateMeetingViewModel data) // I know....we should use viewmodels... =O) { return(Guid.Empty); // TODO: Validate for the love of G*d... try { var meeting = new Meeting(); meeting.Name = data.Name; meeting.Location = data.Location; meeting.StartDate = DateTime.UtcNow; var loc = LocationsController.GetLocation(meeting.Location); meeting.Latitude = loc.Key; meeting.Longitude = loc.Value; using (var db = new AzureDb("Server=lofndb.database.windows.net;Database=lofn2;User Id=lofn;Password=Passw0rd; ")) { db.Meetings.Add(meeting); bool isOrganizer = true; foreach (var p in data.ParticipantList) { var participant = new Participant { EmployeeId = p, MeetingId = meeting.Id, Organizer = isOrganizer }; db.Participants.Add(participant); isOrganizer = false; } db.SaveChanges(); // TODO: Handle transaction and failures. } return(meeting.Id); } catch (Exception ex) { throw; } }
private void CreateDataTable() { if (document == null) { return; } var section = document.AddSection(); var paragraph = section.AddParagraph("Tabela danych"); paragraph.AddBookmark("Tabela"); paragraph.Style = "Title"; paragraph = section.AddParagraph(); // Create the item table var table = section.AddTable(); table.Style = "Table"; table.Borders.Color = getColor(System.Drawing.Color.Black); table.Borders.Width = 0.25; table.Borders.Left.Width = 0.5; table.Borders.Right.Width = 0.5; table.Rows.LeftIndent = 0; // Before you can add a row, you must define the columns var column = table.AddColumn("2.5cm"); column.Format.Alignment = ParagraphAlignment.Left; column = table.AddColumn("2.5cm"); column.Format.Alignment = ParagraphAlignment.Left; column = table.AddColumn("2.5cm"); column.Format.Alignment = ParagraphAlignment.Left; column = table.AddColumn("2.5cm"); column.Format.Alignment = ParagraphAlignment.Left; column = table.AddColumn("2.5cm"); column.Format.Alignment = ParagraphAlignment.Left; column = table.AddColumn("2.5cm"); column.Format.Alignment = ParagraphAlignment.Left; // Create the header of the table var row = table.AddRow(); row.HeadingFormat = true; row.Format.Alignment = ParagraphAlignment.Center; row.Format.Font.Bold = true; row.Shading.Color = getColor(System.Drawing.Color.LightBlue); string[] headers = new string[] { "ID", "Imię", "Drugie imię", "Nazwisko", "e-mail", "Hasło" }; for (int i = 0; i < headers.Length; i++) { row.Cells[i].AddParagraph(headers[i]); row.Cells[i].Format.Font.Bold = false; row.Cells[i].Format.Alignment = ParagraphAlignment.Center; row.Cells[i].VerticalAlignment = VerticalAlignment.Center; row.Cells[i].MergeDown = 1; } row = table.AddRow(); row.Shading.Color = getColor(System.Drawing.Color.LightBlue); table.SetEdge(0, 0, 6, 2, Edge.Box, BorderStyle.Single, 0.75, getColor(System.Drawing.Color.Black));//ustawienie tabeli 5 - ilość kolumn using (AzureDb context = new AzureDb()) { int k = 0; foreach (var item in context.Customer) { row = table.AddRow(); row.Cells[0].AddParagraph(item.CustomerID.ToString()); row.Cells[1].AddParagraph(item.FirstName); row.Cells[2].AddParagraph(item.MiddleName == null ? "" : item.MiddleName); row.Cells[3].AddParagraph(item.LastName); row.Cells[4].AddParagraph(item.EmailAddress == null ? "" : item.EmailAddress); row.Cells[5].AddParagraph(item.PasswordHash); if (k % 2 == 0) { row.Format.Shading.Color = getColor(System.Drawing.Color.LightGray); } else { row.Format.Shading.Color = getColor(System.Drawing.Color.NavajoWhite); } k++; } } }