public async Task <ActionResult <ClientCommandLine> > PostClientCommandLine(ClientCommandLine clientCommandLine)
        {
            _context.ClientCommandLines.Add(clientCommandLine);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetClientCommandLine", new { id = clientCommandLine.Id }, clientCommandLine));
        }
        public async Task <IActionResult> PutClientCommandLine(int id, ClientCommandLine clientCommandLine)
        {
            if (id != clientCommandLine.Id)
            {
                return(BadRequest());
            }

            _context.Entry(clientCommandLine).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ClientCommandLineExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Beispiel #3
0
        private async void ValidateBtn_Click(object sender, EventArgs e)
        {
            clientCommand.ClientId = int.Parse(CBClient.SelectedValue.ToString());
            clientCommand.Date     = DateTime.Now;
            clientCommand.Status   = "En cours";
            bool success = await ClientCommand.CreateClientCommandAsync(clientCommand);

            foreach (ClientCommandLine clientCommandLine in clientCommand.ClientCommandLines)
            {
                bool successLine = await ClientCommandLine.CreateClientCommandLineAsync(clientCommandLine);
            }
            ClickBtn(((Button)sender).Name);
        }
Beispiel #4
0
        private async void UpdateList()
        {
            StatutCommande.Text      = Program.ClientCommandValue.ClientCommandValueStatus;
            DateCommande.Text        = Program.ClientCommandValue.ClientCommandValueDate;
            IdCommande.Text          = Program.ClientCommandValue.ClientCommandValueId;
            ClientNom.Text           = Program.ClientCommandValue.ClientCommandValueName;
            dataGridView1.DataSource = await ClientCommandLine.GetClientCommandLinesAsync();

            Program.ClientCommandValue.ClientCommandValueStatus = "";
            Program.ClientCommandValue.ClientCommandValueDate   = "";
            Program.ClientCommandValue.ClientCommandValueId     = "";
            Program.ClientCommandValue.ClientCommandValueName   = "";
        }
Beispiel #5
0
        private async void AddLineBtn_Click(object sender, EventArgs e)
        {
            ClientCommandLine clientCommandLine = new ClientCommandLine();

            clientCommandLine.ItemId = int.Parse(ItemBox.SelectedValue.ToString());
            Item item = await Item.GetOneItemAsync(clientCommandLine.ItemId);

            clientCommandLine.ItemName = item.Name + " " + item.Year;
            if (int.TryParse(TextQte.Text, out int result))
            {
                clientCommandLine.Quantity = result;
            }
            else
            {
                string message = "La quantité doit être un nombre entier.";
            }


            if (clientCommandLine.Quantity >= 6)
            {
                clientCommandLine.UnitPrice = item.BoxPrice;
            }
            else
            {
                clientCommandLine.UnitPrice = item.UnitPrice;
            }
            clientCommandLine.TotalPrice = clientCommandLine.UnitPrice * clientCommandLine.Quantity;

            if (clientCommand.ClientCommandLines == null)
            {
                clientCommand.ClientCommandLines = new List <ClientCommandLine>();
            }
            clientCommand.ClientCommandLines.Add(clientCommandLine);
            dataGridView1.DataSource = clientCommand.ClientCommandLines;
            ItemBox.Text             = String.Empty;
            TextQte.Text             = String.Empty;
        }