Exemplo n.º 1
0
        public async void MainForm_Load(object sender, EventArgs e)
        {
            lblCash.Text       = $"Счёт: {Cash.ToString()} тенге";
            lblName.Text       = UserName;
            lblOnUpdating.Text = "Идёт обновление...";

            await Task.Run(() => UpdateLine?.Invoke());

            lblOnUpdating.Text = string.Empty;

            this.Fill();
        }
Exemplo n.º 2
0
        public async Task <JObject> Update(UpdateLine postUpdateLine)
        {
            try
            {
                var  distributor = GetDistributorById(postUpdateLine.DistributorId);
                var  inventory   = distributor.Inventory;
                bool updated     = false;

                inventory.ForEach(delegate(Line line)
                {
                    if (line.Id.Equals(postUpdateLine.OldLineId))
                    {
                        line    = postUpdateLine.NewLine;
                        updated = true;
                    }
                });

                if (updated)
                {
                    return(await UpdateInventoryList(postUpdateLine.DistributorId, inventory));
                }
                else
                {
                    return
                        (JObject.FromObject(
                             new
                    {
                        status = "false",
                        result = false,
                        message = "Could not update inventory. Line item in inventory not found."
                    }
                             ));
                }
            }
            catch (Exception ex)
            {
                return
                    (JObject.FromObject(
                         new
                {
                    status = "Exception Thrown",
                    result = false,
                    message = ex.Message
                }
                         ));
            }
        }
Exemplo n.º 3
0
 private async void UpdateLineAsync(object sender, EventArgs e)
 {
     await Task.Run(() => UpdateLine?.Invoke());
 }
Exemplo n.º 4
0
 public IHttpActionResult Update(UpdateLine postUpdateLine)
 {
     return(Ok(_lineServiceClient.Update(postUpdateLine)));
 }
Exemplo n.º 5
0
 public Task <JObject> Update(UpdateLine postUpdateLine)
 {
     return(_inventoryServiceClient.Update(postUpdateLine));
 }