public async Task<DataRespond> updatetAsync([FromForm]LineProductRequest lineProduct) { DataRespond data = new DataRespond(); try { LineProduct lp = m_lineProduct.getById(lineProduct.lineid); lp.linename = lineProduct.linename; lp.linenote = lineProduct.linenote; DateTime createday = DateTime.ParseExact(lineProduct.createday, "dd/MM/yyyy", CultureInfo.InvariantCulture); lp.createday = createday; if (lineProduct.picture != null) { m_image.deleteFile(lp.picture); lp.picture = await m_image.uploadFilelineproduct(lineProduct.picture); } data.success = true; m_lineProduct.update(lp); data.messger = "Update success"; }catch(Exception e) { data.success = false; data.error = e; data.messger = e.Message; } return data; }
public async Task<string> upfileAsync([FromForm] LineProductRequest file) { LineProduct lineProduct = new LineProduct(); try { lineProduct.linename = file.linename; lineProduct.linenote = file.linenote; lineProduct.createday = DateTime.ParseExact(file.createday, "dd/MM/yyyy", CultureInfo.InvariantCulture); lineProduct.picture = await m_image.uploadFilelineproduct(file.picture); } catch (Exception e) { lineProduct.picture = e.Message; } return "update khong thanh chong"; }
private void txtTotal_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == Convert.ToChar(Keys.Return)) { double amt = 0.0; LineProduct line = new LineProduct(new Equipment(txtProductId.Text), Convert.ToDouble(txtQuantity.Text), Convert.ToDouble(txtTotal.Text)); Order o = new Order(txtOrderId.Text, amt = new Order().addToOrder(line, txtOrderId.Text)); clearText(); o.UpdateOrder(); lbbTotal.Text = amt.ToString(); if (txtOrderId.Text != "") { dgvOrderDetails.DataSource = new Order().addToList(txtOrderId.Text); } } }
public async Task<DataRespond> insertAsync([FromForm]LineProductRequest lineProduct) { DataRespond data = new DataRespond(); try { LineProduct l = new LineProduct(); l.linename = lineProduct.linename; l.linenote = lineProduct.linenote; DateTime createday = DateTime.ParseExact(lineProduct.createday, "dd/MM/yyyy", CultureInfo.InvariantCulture); l.createday = createday;//2019-12-10 l.picture = await m_image.uploadFilelineproduct(lineProduct.picture); data.success = true; data.messger = "update success"; m_lineProduct.insert(l); }catch(Exception e) { data.success = false; data.error = e; data.messger = e.Message; } return data; }
public override string ToString() { return(LineProduct.ToString() + "=" + Amount); }