private void FrmLaneInfo_OnUpdateQuery(LaneInfoVM vm) { var item = _laneInfoList.SingleOrDefault(x => x.LANEINFO_PK == vm.LANEINFO_PK); Common.Helper.CopyProperties(vm, item); LaneNumberSort(); }
private void InitControls() { _vm = new LaneInfoVM(); DataBinding(txtLaneInfoPk, "Text", Masco.Core.Helper.Refrection.GetPropName <LaneInfoVM>(x => x.LANEINFO_PK)); DataBinding(txtCheckListPK, "Text", Masco.Core.Helper.Refrection.GetPropName <LaneInfoVM>(x => x.CHECKLIST_PK)); DataBinding(txtDirection, "Text", Masco.Core.Helper.Refrection.GetPropName <LaneInfoVM>(x => x.DIRECTION)); DataBinding(txtImageCode, "Text", Masco.Core.Helper.Refrection.GetPropName <LaneInfoVM>(x => x.IMAGE_CODE)); DataBinding(txtImageName, "Text", Masco.Core.Helper.Refrection.GetPropName <LaneInfoVM>(x => x.IMAGE_NAME)); DataBinding(txtLaneName, "Text", Masco.Core.Helper.Refrection.GetPropName <LaneInfoVM>(x => x.LANE_NAME)); DataBinding(txtNumber, "Text", Masco.Core.Helper.Refrection.GetPropName <LaneInfoVM>(x => x.NUMBER)); }
private void btnLaneInfoAdd_Click(object sender, EventArgs e) { var dlg = new FrmLaneInfo(); InitDialog(dlg); var item = new LaneInfoVM(); item.CHECKLIST_PK = _vm.CHECKLIST_PK; dlg.Setup(item); dlg.OnInsertQuery = FrmLaneInfo_OnInsertQuery; dlg.ShowDialog(this); }
public void Setup(LaneInfoVM vm) { if (vm.LANEINFO_PK > 0) { btnInsert.Enabled = false; } else { btnUpdate.Enabled = false; btnDelete.Enabled = false; } Common.Helper.CopyProperties(vm, _vm); }
private void FrmLaneInfo_OnInsertQuery(LaneInfoVM vm) { //var pos = 0; //if (_laneInfoList.Count == 0) // _laneInfoList.Add(vm); //else //{ // for (int idx = 0; idx < _laneInfoList.Count(); idx++) // { // if (vm.NUMBER >= _laneInfoList[idx].NUMBER) // { // _laneInfoList.Insert(idx, vm); // break; // } // } //} _laneInfoList.Add(vm); LaneNumberSort(); }