public async Task <IActionResult> PutUserLine([FromRoute] string id, [FromBody] UserLine userLine) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != userLine.UserName) { return(BadRequest()); } _context.Entry(userLine).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserLineExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostUserLine([FromBody] UserLine userLine) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.UserLine.Add(userLine); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (UserLineExists(userLine.UserName)) { return(new StatusCodeResult(StatusCodes.Status409Conflict)); } else { throw; } } return(CreatedAtAction("GetUserLine", new { id = userLine.UserName }, userLine)); }
//Fournisseurs private void pictureBox10_Click(object sender, EventArgs e) { UserLine.Hide(); UnitesLine.Hide(); VentesLine.Hide(); StatLine.Hide(); DisLine.Show(); AchatsLine.Hide(); ProduitLine.Hide(); Fournisseurs.BringToFront(); }
//Recebe os usuários do celular pelo plugin //Gera os botões com a lista de usuários public void SetupUserList() { for (int i = 0; i < usersCount; i++) { UserLine userBtn = (UserLine)Instantiate(userLinePrefab, content).GetComponent <UserLine>(); string username = usersList[i].username; string email = usersList[i].email; userBtn.buttonText.text = email; string token = usersList[i].token = GenerateToken(); string link = URL_BASE + token; userBtn.buttonComponent.onClick.AddListener(delegate { sendMail.Send(username, email, link); }); } }
private void pictureBox1_Click(object sender, EventArgs e) { WelcomePage.BringToFront(); About.SendToBack(); Contact.SendToBack(); Header.BringToFront(); UserLine.Hide(); UnitesLine.Hide(); VentesLine.Hide(); StatLine.Hide(); DisLine.Hide(); AchatsLine.Hide(); ProduitLine.Hide(); AboutLine.Hide(); ContactLine.Hide(); }
private void logout_Click_1(object sender, EventArgs e) { Login.Show(); About.SendToBack(); Contact.SendToBack(); Header.Show(); UserLine.Hide(); UnitesLine.Hide(); VentesLine.Hide(); StatLine.Hide(); DisLine.Hide(); AchatsLine.Hide(); ProduitLine.Hide(); AboutLine.Hide(); ContactLine.Hide(); }
private void UpdateLineCache(UserLine line) { line.CachedLines = new List <CachedLine>(); line.CachedWrapAt = CharsPerLine; int len = 0; CachedLine cachedLine = null; foreach (var origSpan in line.Spans) { if (cachedLine == null) { cachedLine = new CachedLine(line); line.CachedLines.Add(cachedLine); } if ((origSpan.Text.Length + len) < CharsPerLine) { cachedLine.Spans.Add(origSpan); len += origSpan.Text.Length; } else { string spanText = origSpan.Text; while (spanText.Length > 0) { string substring = spanText.Substring(0, Math.Min(CharsPerLine - len, spanText.Length)); spanText = spanText.Substring(Math.Min(CharsPerLine - len, spanText.Length)); len = 0; var cachedSpan = new Span(substring, origSpan.ForegroundColour, origSpan.BackgroundColour); cachedLine.Spans.Add(cachedSpan); if (spanText.Length > 0) { cachedLine = new CachedLine(line); line.CachedLines.Add(cachedLine); cachedLine.Spans.Add(line.IsOutput ? PromptOutputWrap : PromptWrap); len += line.IsOutput ? PromptOutputWrap.Text.Length : PromptWrap.Text.Length; } } } } }
private IEnumerable <CachedLine> GetLinesToDrawOnCurrentPageReverse(int rowsOnPage) { int rowsReturned = 0; LinkedListNode <UserLine> current = m_lines.First; UpdateLineCache(m_currentLine); foreach (var cachedLine in m_currentLine.CachedLines.Reverse()) { if (rowsReturned >= rowsOnPage) { break; } yield return(cachedLine); rowsReturned++; } while ((current != null) && (rowsReturned < rowsOnPage)) { UserLine line = current.Value; if ((line.CachedLines == null) || (line.CachedLines.Count == 0) || (line.CachedWrapAt != CharsPerLine)) { UpdateLineCache(line); Debug.Assert(line.CachedLines != null); } foreach (var cachedLine in line.CachedLines.Reverse()) //TODO this is slow, do do a reverse { if (rowsReturned >= rowsOnPage) { break; } yield return(cachedLine); rowsReturned++; } current = current.Next; } }
public void Can_Remove_User() { User user = new User(); // Действие user.AddItem(); user.AddItem(); user.AddItem(); UserLine u = user.Lines.ElementAt(1); user.RemoveLine(u); List <UserLine> results = user.Lines.ToList(); // Утверждение Assert.AreEqual(user.Lines.Where(c => c == u).Count(), 0); Assert.AreEqual(user.Lines.Count(), 2); Assert.AreEqual(results[0].UserId, 1); Assert.AreEqual(results[1].UserId, 3); }
public void WriteOutput(string text, Colour foregroundColour, Colour backgroundColour) { ResetHistoryNavigation(); var outputLines = Regex.Split(text, @"\r\n|\r|\n"); foreach (string outputLine in outputLines) { var line = new UserLine(); line.IsOutput = true; line.Spans.Add(PromptOutput); var span = new Span(outputLine, foregroundColour, backgroundColour); line.Spans.Add(span); UpdateMaxHistoryItems(); m_lines.AddFirst(line); } m_currentLine = new UserLine(); m_currentLine.Spans.Add(Prompt); }
//Statistiques private void pictureBox11_Click(object sender, EventArgs e) { int i = 0; DateTime today = DateTime.Today; TODAYDATE.Text = today.ToString("yyyy-MM-dd"); // TODAYDATE.Text = DateTime.Now.ToLongDateString(); UserLine.Hide(); UnitesLine.Hide(); VentesLine.Hide(); StatLine.Show(); DisLine.Hide(); AchatsLine.Hide(); ProduitLine.Hide(); Statistiques.BringToFront(); //==> TOP 5 PRODUCTS SqlCommand cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "select top(5) product, SUM(Total) from Commande GROUP BY product order by SUM(Total) desc"; cmd.ExecuteNonQuery(); DataTable dt9 = new DataTable(); SqlDataAdapter da9 = new SqlDataAdapter(cmd); da9.Fill(dt9); dataGridView5.DataSource = dt9; //==> NUMBER OF ORDERS DONE TODAY SqlCommand cmd1 = con.CreateCommand(); cmd1.CommandType = CommandType.Text; cmd1.CommandText = "SELECT COUNT( DISTINCT id), COUNT(DISTINCT product), COUNT( DISTINCT order_id), SUM(Total) FROM Commande WHERE ComDate ='" + TODAYDATE.Text + "'"; cmd1.ExecuteNonQuery(); DataTable dt11 = new DataTable(); SqlDataAdapter da11 = new SqlDataAdapter(cmd1); da11.Fill(dt11); // dataGridView6.DataSource = dt11; NumCommande.Text = dt11.Rows[0][0].ToString(); NumProducts.Text = dt11.Rows[0][1].ToString(); ClientsToday.Text = dt11.Rows[0][2].ToString(); TotalAmountToday.Text = dt11.Rows[0][3].ToString(); //==> NUMBER OF CLIENTS AND PRODUCTS MONTH SqlCommand cmd2 = con.CreateCommand(); cmd2.CommandType = CommandType.Text; cmd2.CommandText = "SELECT COUNT(DISTINCT product), COUNT( DISTINCT order_id) FROM Commande WHERE month(ComDate) ='" + DateTime.Now.Month + "'"; cmd2.ExecuteNonQuery(); DataTable dt3 = new DataTable(); SqlDataAdapter da3 = new SqlDataAdapter(cmd2); da3.Fill(dt3); NumProdMonth.Text = dt3.Rows[0][0].ToString(); NumClientMonth.Text = dt3.Rows[0][1].ToString(); //==> Linear Chart datatable /* SqlCommand cmd3 = con.CreateCommand(); * cmd3.CommandType = CommandType.Text; * cmd3.CommandText = "select Distinct ComDate, SUM(Total) from Commande group by ComDate"; * cmd3.ExecuteNonQuery(); * DataTable dt4 = new DataTable(); * SqlDataAdapter da4 = new SqlDataAdapter(cmd3); * da4.Fill(dt4);*/ /*chart2.DataSource = v_SalesTableAdapter; * * * * chart2.Series["Series1"].XValueMember= "ComDate"; * chart2.Series["Series1"].YValueMembers =" Total"; * * * chart2.DataBind();*/ //==> /* SqlCommand cmd2 = con.CreateCommand(); * cmd2.CommandType = CommandType.Text; * cmd2.CommandText = "SELECT COUNT(product) FROM Commande WHERE ComDate ='" + TODAYDATE.Text + "'"; * cmd2.ExecuteNonQuery(); * DataTable dt10 = new DataTable(); * SqlDataAdapter da10 = new SqlDataAdapter(cmd2); * da11.Fill(dt10); * // dataGridView6.DataSource = dt10;*/ // NumCommande.Text = dataGridView6.Rows[0].Cells[0].Value.ToString(); MonthNow1.Text = DateTime.Now.ToString("MMMM"); MonthNow2.Text = DateTime.Now.ToString("MMMM"); //==> CHART /* SqlCommand cmd4 = con.CreateCommand(); * cmd4.CommandType = CommandType.Text; * cmd4.CommandText = "SELECT Total FROM Commande "; * cmd4.ExecuteNonQuery(); * DataTable dt4 = new DataTable(); * SqlDataAdapter da4 = new SqlDataAdapter(cmd4); * da4.Fill(dt4);*/ }
private void ClearCurrentLine() { m_currentLine = new UserLine(); m_currentLine.Spans.Add(Prompt); }
private void ShowHistoryItem() { m_currentLine = new UserLine(m_historyItem.Value); }
public void CreateUserLine(UserLine userLine) { ctx.UserLine.Add(userLine); Save(); }