/// <summary> /// Update a Port. /// </summary> public void Update(Model.Port port) { // // todo: add other logic here. // accessor.Update(port); }
/// <summary> /// Insert a Port. /// </summary> public void Insert(Model.Port port) { // // todo:add other logic here // accessor.Insert(port); }
public bool ExistsExcept(Model.Port e) { Hashtable paras = new Hashtable(); paras.Add("newId", e.Id); paras.Add("oldId", Get(e.PortId) == null?null:Get(e.PortId).Id); return(sqlmapper.QueryForObject <bool>("Port.existsexcept", paras)); }
private void barButtonItem3_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (this.bindingSource1.Current != null) { if (MessageBox.Show("確定刪除?", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK) { Model.Port port = this.bindingSource1.Current as Model.Port; portManager.Delete(port.PortId); this.RefreshData(); } } }
private void ControlInitial() { port = this.bindingSource1.Current as Model.Port; if (port != null) { this.txt_Id.Text = port.Id; this.txt_PortName.Text = port.PortName; } else { this.txt_Id.Text = ""; this.txt_PortName.Text = ""; } }
private void barButtonItem4_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (string.IsNullOrEmpty(this.txt_PortName.Text.Trim()) || string.IsNullOrEmpty(this.txt_Id.Text.Trim())) { MessageBox.Show("編號,名稱不能為空!", "提示", MessageBoxButtons.OK); return; } try { BL.V.BeginTransaction(); if (this.State == "insert") { port = new Book.Model.Port(); port.PortId = Guid.NewGuid().ToString(); port.Id = this.txt_Id.Text; port.PortName = this.txt_PortName.Text; this.portManager.Insert(port); } else if (this.State == "update") { port.Id = this.txt_Id.Text; port.PortName = this.txt_PortName.Text; this.portManager.Update(port); } BL.V.CommitTransaction(); MessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK); } catch (Exception ex) { BL.V.RollbackTransaction(); MessageBox.Show(ex.Message, "錯誤", MessageBoxButtons.OK); return; } this.State = "view"; this.StateChanged(); this.RefreshData(); }
public bool ExistsExcept(Model.Port e) { return(accessor.ExistsExcept(e)); }
public void Update(Model.Port e) { this.Update <Model.Port>(e); }
public void Insert(Model.Port e) { this.Insert <Model.Port>(e); }