фиксес
This commit is contained in:
parent
8bb0d37211
commit
464ab47941
@ -13,7 +13,8 @@ namespace BusinessLogic.BusinessLogic
|
||||
public GeneratedBarcode CreateBarcode(ProductBindingModel model, bool save)
|
||||
{
|
||||
var barCode = IronBarCode.BarcodeWriter.CreateBarcode(model.Id.ToString(), BarcodeEncoding.Code128);
|
||||
if (save) return barCode.SaveAsPng($"product{model.Id}.png");
|
||||
var path = $"product{model.Id}.png";
|
||||
if (save) return barCode.SaveAsPng(path);
|
||||
return barCode;
|
||||
}
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ namespace DatabaseImplement.Implements
|
||||
product.Update(model);
|
||||
context.SaveChanges();
|
||||
transaction.Commit();
|
||||
return product.GetViewModel;
|
||||
return new();
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
@ -100,12 +100,16 @@ namespace WinFormsApp
|
||||
IsBeingSold = checkBoxIsSold.Checked,
|
||||
};
|
||||
var operationResult = _id.HasValue ? _productLogic.Update(model) : _productLogic.Create(model);
|
||||
if (!_id.HasValue)
|
||||
{
|
||||
var lastProductCreated = _productLogic.ReadList(null).Last();
|
||||
_barcodeLogic.CreateBarcode(new ProductBindingModel()
|
||||
{
|
||||
Id = lastProductCreated.Id,
|
||||
Name = lastProductCreated.Name,
|
||||
}, true);
|
||||
|
||||
}
|
||||
_id = null;
|
||||
if (!operationResult)
|
||||
{
|
||||
@ -230,6 +234,7 @@ namespace WinFormsApp
|
||||
numericUpDownPrice.Value = Convert.ToDecimal(product.Price);
|
||||
numericUpDownAmount.Value = product.Amount;
|
||||
checkBoxIsSold.Checked = product.IsBeingSold;
|
||||
_id = product.Id;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user