public SelectBaseForm(IBaseRepo repo) { InitializeComponent(); _repo = repo; _item = new BaseBl(); Bind(); }
private void simpleButtonAddBase_Click(object sender, EventArgs e) { var form = new EditBaseForm(_repo); if (form.ShowDialog() == DialogResult.OK) { _item = form._item; Bind(); form.Dispose(); } }
public EditBaseForm(IBaseRepo repo, BaseBl item = null) { InitializeComponent(); _repo = repo; _item = item; if (item != null) { Text = "Редактирование базы"; } else { Text = "Новая база"; _item = new BaseBl(); } textEditName.DataBindings.Add("EditValue", _item, nameof(_item.Name), true, DataSourceUpdateMode.OnPropertyChanged); textEditComment.DataBindings.Add("EditValue", _item, nameof(_item.Comment), true, DataSourceUpdateMode.OnPropertyChanged); }
private void simpleButtonSave_Click(object sender, EventArgs e) { ProcessTabKey(true); if (Validation() == false) { return; } if (_item.Id == 0) { _item = _repo.Add(_item); } else { _repo.Update(_item); } DialogResult = DialogResult.OK; }
private void CreateBaseLabel(BaseBl item) { layoutControl1.BeginUpdate(); try { // Create a layout item that will display a new base SimpleLabelItem simpleLabel = new SimpleLabelItem(); simpleLabel.Parent = layoutControlGroup1; simpleLabel.Name = "simpleLabelBase" + item.Id; simpleLabel.Text = $"{item.Name} ({item.Comment})"; simpleLabel.Tag = item; //simpleLabel.OptionsToolTip.ToolTip = $"{item.Name} ({item.Comment})"; //simpleLabel.OptionsToolTip.ImmediateToolTip = true; simpleLabel.DoubleClick += new System.EventHandler(this.lable_DoubleClick); simpleLabel.Move(layoutControlItemButtonBase, InsertType.Top); } finally { // Unlock and update the layout control. layoutControl1.EndUpdate(); } }
public BaseBl Update(BaseBl item) { var dto = _service.Update(item?.ToDto()); return(dto != null ? new BaseBl(dto) : null); }
public BaseBl Add(BaseBl item) { var dto = _service.Add(item?.ToDto()); return(dto != null ? new BaseBl(dto) : null); }