56 lines
1.5 KiB
C#
56 lines
1.5 KiB
C#
|
using CarServiceContracts.BusinessLogicsContracts;
|
|||
|
|
|||
|
namespace CarServiceView
|
|||
|
{
|
|||
|
public partial class FormUpdateItemForRepairTest : Form
|
|||
|
{
|
|||
|
IItemLogic _itemLogic;
|
|||
|
IRepairRequestLogic _repairRequestLogic;
|
|||
|
IItemForRepairLogic _itemForRepairLogic;
|
|||
|
public FormUpdateItemForRepairTest(IItemLogic itemLogic, IRepairRequestLogic repairRequestLogic, IItemForRepairLogic itemForRepairLogic)
|
|||
|
{
|
|||
|
_itemLogic = itemLogic;
|
|||
|
_repairRequestLogic = repairRequestLogic;
|
|||
|
_itemForRepairLogic = itemForRepairLogic;
|
|||
|
InitializeComponent();
|
|||
|
}
|
|||
|
|
|||
|
private void FormAddItemForRepairTest_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
LoadData();
|
|||
|
}
|
|||
|
private void LoadData()
|
|||
|
{
|
|||
|
//загружаем заказы
|
|||
|
var listRR = _repairRequestLogic.ReadList(null);
|
|||
|
if (listRR != null)
|
|||
|
{
|
|||
|
comboBoxRepairRequest.DisplayMember = "Id";
|
|||
|
comboBoxRepairRequest.ValueMember = "Id";
|
|||
|
comboBoxRepairRequest.DataSource = listRR;
|
|||
|
comboBoxRepairRequest.SelectedItem = null;
|
|||
|
}
|
|||
|
//загружаем статьи затрат
|
|||
|
var listI = _itemLogic.ReadList(null);
|
|||
|
if (listI != null)
|
|||
|
{
|
|||
|
comboBoxItem.DisplayMember = "Name";
|
|||
|
comboBoxItem.ValueMember = "Id";
|
|||
|
comboBoxItem.DataSource = listI;
|
|||
|
comboBoxItem.SelectedItem = null;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void buttonUpdate_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
_itemForRepairLogic.Update(new()
|
|||
|
{
|
|||
|
Id = 1,
|
|||
|
Count = Convert.ToInt32(textBoxCount.Text),
|
|||
|
ItemId = Convert.ToInt32(comboBoxItem.SelectedValue),
|
|||
|
RepairRequestId = Convert.ToInt32(comboBoxRepairRequest.SelectedValue)
|
|||
|
});
|
|||
|
}
|
|||
|
}
|
|||
|
}
|