private void btnInsert_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(txtName.Text) || string.IsNullOrWhiteSpace(txtSurname.Text)) { MessageBox.Show("Preencha todos os campos."); txtName.Clear(); txtSurname.Clear(); txtName.Focus(); } else { Person person = new Person(); person.Name = txtName.Text; person.Surname = txtSurname.Text; PersonBLL personBLL = new PersonBLL(); Response response = personBLL.Insert(person); MessageBox.Show(response.Message); txtName.Clear(); txtSurname.Clear(); txtName.Focus(); TableResponse tableResponse = personBLL.GetNamesOnly(); dataGridView.DataSource = tableResponse.DataTable; dataGridView.Columns["Nome"].Width = 550; QueryResponse <Person> r1 = personBLL.GetAllList(); lblTotalPersons.Text = "Total de pessoas cadastradas: " + r1.Data.Count.ToString(); } }
private void cboxFilter_SelectedIndexChanged(object sender, EventArgs e) { lblTitle.Text = "Selecione a sala desejada para visualizar a lista de participantes."; listBoxStage1.DataSource = null; listBoxStage2.DataSource = null; lblName.Text = "Nome:"; txtSearch.Visible = true; btnSearch.Visible = true; if (cboxFilter.Text == "Treinamento") { lblStage1.Text = "Participantes da etapa 1:"; lblStage2.Text = "Participantes da etapa 2:"; listBoxStage2.Visible = true; lblStage2.Visible = true; SpaceTrainingBLL spaceBLL = new SpaceTrainingBLL(); TableResponse r = spaceBLL.GetAllTable(); dataGridView1.DataSource = r.DataTable; dataGridView1.Columns["Nome"].Width = 375; dataGridView1.Columns["LotaçãoMáxima"].Visible = false; } else { lblStage1.Text = "Participantes da etapa 1 e 2:"; listBoxStage2.Visible = false; lblStage2.Visible = false; SpaceCoffeeBLL spaceBLL = new SpaceCoffeeBLL(); TableResponse r = spaceBLL.GetAllTable(); dataGridView1.DataSource = r.DataTable; dataGridView1.Columns["Nome"].Width = 375; } }
private void btnInsert_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(txtName.Text)) { MessageBox.Show("Preencha o nome."); txtName.Focus(); } else { SpaceCoffee space = new SpaceCoffee(); SpaceCoffeeBLL spaceBLL = new SpaceCoffeeBLL(); space.Name = txtName.Text; Response response = spaceBLL.Insert(space); TableResponse tableResponse = spaceBLL.GetAllTable(); dataGridView.DataSource = tableResponse.DataTable; dataGridView.Columns["Nome"].Width = 270; MessageBox.Show(response.Message); //chamar método que verifica se já tem cadastrado duas salas de café, se já tem, o botão cadastrar ficadesativado Response r0 = spaceBLL.ExistTwoSpaces(); if (r0.Success) { btnInsert.Enabled = false; MessageBox.Show("Duas salas de café cadastradas, vá ao próximo passo."); this.Close(); } txtName.Focus(); txtName.Clear(); } }
private void frmNewSpaceCoffee_Load(object sender, EventArgs e) { lblTitleSpace.Text = "Salas de intervalo para café:"; SpaceCoffeeBLL spaceBLL = new SpaceCoffeeBLL(); TableResponse tableResponse = spaceBLL.GetAllTable(); if (tableResponse.Success) { dataGridView.DataSource = tableResponse.DataTable; dataGridView.Columns["Nome"].Width = 270; } Response r0 = spaceBLL.ExistTwoSpaces(); if (r0.Success) { btnInsert.Enabled = false; MessageBox.Show(r0.Message); this.Close(); } else { MessageBox.Show("Você deve cadastrar dois espaços de intervalo para café informando o nome. Cada espaço irá alocar pelo menos metade das pessoas que participarão do treinamento.", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
/// <summary> /// Generates a task sequence for getting the properties of the table service. /// </summary> /// <param name="setResult">A delegate to receive the service properties.</param> /// <returns>A task sequence that gets the properties of the table service.</returns> private TaskSequence GetServicePropertiesImpl(Action <ServiceProperties> setResult) { HttpWebRequest request = TableRequest.GetServiceProperties(this.BaseUri, this.Timeout.RoundUpToSeconds()); CommonUtils.ApplyRequestOptimizations(request, -1); this.Credentials.SignRequestLite(request); // Get the web response. Task <WebResponse> responseTask = request.GetResponseAsyncWithTimeout(this, this.Timeout); yield return(responseTask); using (HttpWebResponse response = responseTask.Result as HttpWebResponse) using (Stream responseStream = response.GetResponseStream()) using (MemoryStream memoryStream = new MemoryStream()) { // Download the service properties. Task <NullTaskReturn> downloadTask = new InvokeTaskSequenceTask(() => { return(responseStream.WriteTo(memoryStream)); }); yield return(downloadTask); // Materialize any exceptions. NullTaskReturn scratch = downloadTask.Result; // Get the result from the memory stream. memoryStream.Seek(0, SeekOrigin.Begin); setResult(TableResponse.ReadServiceProperties(memoryStream)); } }
private async Task HandleResponseAsync(TableResponse table) { var orderBookItems = table.Data.Select(BitMexModelConverter.ConvertBookItem).ToList(); var groupByPair = orderBookItems.GroupBy(ob => ob.Symbol); switch (table.Action) { case Action.Partial: foreach (var symbolGroup in groupByPair) { await HandleOrderBookSnapshotAsync(symbolGroup.Key, DateTime.UtcNow, orderBookItems); } break; case Action.Update: case Action.Insert: case Action.Delete: foreach (var symbolGroup in groupByPair) { await HandleOrdersEventsAsync(symbolGroup.Key, ActionToOrderBookEventType(table.Action), orderBookItems); } break; default: await Log.WriteWarningAsync(nameof(HandleResponseAsync), "Parsing order book table response", $"Unknown table action {table.Action}"); break; } }
public JsonResult UpdateCooperTitle(CooperationTitle cooperationTitle) { _db.CooperationTitles.Update(cooperationTitle); TableResponse tableResponse = new TableResponse(); tableResponse.Total = _db.SaveChanges(); return(Json(tableResponse)); }
public JsonResult UpdateIndustry(Industry industry) { _db.Industries.Update(industry); TableResponse response = new TableResponse(); response.Total = _db.SaveChanges(); return(Json(response)); }
public JsonResult DeleteIndustries(List <Industry> industries) { _db.Industries.RemoveRange(industries); TableResponse response = new TableResponse(); response.Total = _db.SaveChanges(); return(Json(response)); }
public JsonResult UpdateProduct(Product product) { _db.Products.Update(product); TableResponse response = new TableResponse(); response.Total = _db.SaveChanges(); return(Json(response)); }
public JsonResult DeleteProducts(List <Product> products) { _db.Products.RemoveRange(products); TableResponse response = new TableResponse(); response.Total = _db.SaveChanges(); return(Json(response)); }
public JsonResult DeleteCoopers(List <Cooper> coopers) { _db.Coopers.RemoveRange(coopers); TableResponse response = new TableResponse(); response.Total = _db.SaveChanges(); return(Json(response)); }
public JsonResult UpdateCooperContent(CooperationContent cooperationContent) { _db.CooperationContents.Update(cooperationContent); TableResponse tableResponse = new TableResponse(); tableResponse.Total = _db.SaveChanges(); return(Json(tableResponse)); }
public JsonResult UpdateColor(Color color) { _db.Colors.Update(color); TableResponse response = new TableResponse(); response.Total = _db.SaveChanges(); return(Json(response)); }
private bool ValidateOrder(TableResponse table) { return(table != null && table.Data != null && table.Data.All(item => !string.IsNullOrEmpty(item.Symbol) && !string.IsNullOrEmpty(item.OrderID))); }
public JsonResult UpdateClient(Client client) { _db.Clients.Update(client); TableResponse response = new TableResponse(); response.Total = _db.SaveChanges(); return(Json(response)); }
public JsonResult DeleteClients(List <Client> clients) { _db.Clients.RemoveRange(clients); TableResponse response = new TableResponse(); response.Total = _db.SaveChanges(); return(Json(response)); }
public JsonResult DeleteCooperContents(List <CooperationContent> cooperationContents) { _db.CooperationContents.RemoveRange(cooperationContents); TableResponse tableResponse = new TableResponse(); tableResponse.Total = _db.SaveChanges(); return(Json(tableResponse)); }
public JsonResult DeleteCases(List <Case> cases) { _db.Cases.RemoveRange(cases); TableResponse response = new TableResponse(); response.Total = _db.SaveChanges(); return(Json(response)); }
public void TestGetByName() { Person p6 = new Person(); p6.Name = "Janaina"; TableResponse response = personBLL.GetByName(p6); Assert.AreEqual(true, response.Success); }
public void TestGetByName() { SpaceTraining s1 = new SpaceTraining(); s1.Name = "Sala"; TableResponse response = spaceTBLL.GetByName(s1); Assert.AreEqual(true, response.Success); }
public void TestGetByName() { SpaceCoffee spaceC2 = new SpaceCoffee(); spaceC2.Name = "Sala"; TableResponse response = spaceCBLL.GetByName(spaceC2); Assert.AreEqual(true, response.Success); }
public void TestGetByNameViewModel() { Person p1 = new Person(); p1.FullName = "Janaina Mai"; TableResponse tableResponse = personBLL.GetByNameViewModel(p1); Assert.AreEqual(true, tableResponse.Success); }
public void TestGetByCoffeeID() { SpaceCoffee spaceC1 = new SpaceCoffee(); spaceC1.ID = 1; TableResponse response = personBLL.GetAllByCoffeeID(spaceC1); Assert.AreEqual(true, response.Success); }
public void TestGetByStage2ID() { SpaceTraining spaceT5 = new SpaceTraining(); spaceT5.ID = 1; TableResponse response = personBLL.GetAllByStage2ID(spaceT5); Assert.AreEqual(true, response.Success); }
private void frmNewPerson_Load(object sender, EventArgs e) { PersonBLL personBLL = new PersonBLL(); QueryResponse <Person> r1 = personBLL.GetAllList(); lblTotalPersons.Text = "Total de pessoas cadastradas: " + r1.Data.Count.ToString(); TableResponse tableResponse = personBLL.GetNamesOnly(); dataGridView.DataSource = tableResponse.DataTable; dataGridView.Columns["Nome"].Width = 460; }
public void TestGetAllByStage1IDASC() { Person person2 = new Person(); person2.Name = "Pessoa"; person2.Surname = "Dois"; personBLL.Insert(person2); TableResponse response = personBLL.GetAllByStage1IDASC(); Assert.AreEqual(true, response.Success); }
private void btnShowAll_Click(object sender, EventArgs e) { PersonBLL personBLL = new PersonBLL(); TableResponse tableResponse = personBLL.GetViewModel(); dataGridView.DataSource = tableResponse.DataTable; dataGridView.Columns["Participante"].Width = 350; dataGridView.Columns["SalaUm"].Width = 180; dataGridView.Columns["SalaDois"].Width = 180; dataGridView.Columns["Café"].Width = 180; }
public JsonResult UpdateCooper(int id) { TableResponse response = new TableResponse(); var data = _db.Coopers.SingleOrDefault(x => x.ID == id); if (data != null) { data.AlreadyRead = AlreadyRead.AlreadyRead; } response.Total = _db.SaveChanges(); return(Json(response)); }
public JsonResult TableCaseData(int page, int limit) { var datas = _db.Cases.Skip((page - 1) * limit).Take(limit).Select(x => new { x.ID, x.Cover, x.Name }).ToList(); TableResponse response = new TableResponse(); response.Data = datas; return(Json(response)); }
public static void GetCaseList(HttpContext context) { try { APetaPoco.SetConnectionString("cn1"); string username = context.Request["username"]; if (string.IsNullOrEmpty(username)) throw new Exception("No refresh provided"); string status = context.Request["status"]; if (string.IsNullOrEmpty(status)) throw new Exception("No status provided"); string conditionString = string.Format("[username] = '{0}' and [status] = '{1}'", username, status); var bm = APetaPoco.PpRetrieveList<DbCase>("Cases", conditionString); var resp = new TableResponse(); resp.Name = status + " Cases"; if (bm.Success) { resp.Cases = (List<DbCase>)bm.Data; foreach(var c in resp.Cases) { c.study_list = GetStudiesForCase(c.case_id); } } else { AF.BoolMessageRespond(context, bm); } bm = APetaPoco.PpGetScalar<int>("select count([Id]) from Cases where [username] = '" + username + "' and [status] = 'PENDING'"); if (bm.Success) { resp.PendingCount = (int)bm.Data; } else { AF.BoolMessageRespond(context, bm); } bm = APetaPoco.PpGetScalar<int>("select count([Id]) from Cases where [username] = '" + username + "' and [status] = 'COMPLETED'"); if (bm.Success) { resp.CompletedCount = (int)bm.Data; } else { AF.BoolMessageRespond(context, bm); } bm = APetaPoco.PpGetScalar<int>("select count([Id]) from Cases where [username] = '" + username + "' and [status] = 'ERROR'"); if (bm.Success) { resp.ErrorCount = (int)bm.Data; } else { AF.BoolMessageRespond(context, bm); } AF.StandardJSON(true, "Successfully retrieved cases for username: " + username, context, resp); } catch (System.Threading.ThreadAbortException) { return; } catch (Exception ex) { AF.ExceptionRespond(context, ex); } }