private void iTransToolBar1_SaveRecord(object sender, EventArgs e) { if (mode == TransMode.EditRecord) { work.Title = txtTitle.Text; int n = 0; int.TryParse(txtTime.Text, out n); work.EstimateTime = n; presenter.Update(work); Bs.EndEdit(); Bs.ResetBindings(false); } if (mode == TransMode.NewRecord) { work = new SdWorkDto(); work.Title = txtTitle.Text; work.SdServiceCatId = serviceCatId; int n = 0; int.TryParse(txtTime.Text, out n); work.EstimateTime = n; presenter.Insert(work); Bs.Add(work); } this.ParentForm.Close(); }
private void iTransToolBar1_SaveAndNewRecord(object sender, EventArgs e) { if (mode == TransMode.EditRecord) { work.Title = txtTitle.Text; int n = 0; int.TryParse(txtTime.Text, out n); work.EstimateTime = n; presenter.Update(work); Bs.EndEdit(); } if (mode == TransMode.NewRecord) { work = new SdWorkDto(); work.Title = txtTitle.Text; int n = 0; int.TryParse(txtTime.Text, out n); work.EstimateTime = n; work.SdServiceCatId = serviceCatId; presenter.Insert(work); Bs.Add(work); } txtTime.Text = string.Empty; txtTitle.Text = string.Empty; mode = TransMode.NewRecord; work = null; }
public bool Remove(SdWorkDto work) { ResponseDto response = WorkServiceAdapter.Execute(s => s.Delete(work)); if (response.Response.HasException) { return(false); } return(true); }
public SdWorkDto Insert(SdWorkDto work) { SdWorkDto result = (SdWorkDto)WorkServiceAdapter.Execute(s => s.Insert(work)); if (result.Response.HasException) { return(null); } work.WorkId = result.WorkId; return(work); }
private void iGridToolBar1_EditRecord(object sender, EventArgs e) { SdWorkDto work = (SdWorkDto)this.iGridEX1.CurrentRow.DataRow; if (work != null) { UCWorkEntry entry = new UCWorkEntry(work, ClassLibrary.TransMode.EditRecord, Bs); ISE.UILibrary.Utils.UIUtils.SetFrmTrans(entry, "تعریف کار", FormBorderStyle.Sizable); } }
public UCWorkEntry(SdWorkDto work, TransMode mode, BindingSource bsource) { this.Bs = bsource; this.work = work; this.mode = mode; InitializeComponent(); if (mode != TransMode.NewRecord) { txtTitle.Text = work.Title; txtTime.Text = work.EstimateTime.ToString(); } }
private void iGridToolBar1_DeleteRecord(object sender, EventArgs e) { SdWorkDto work = (SdWorkDto)this.iGridEX1.CurrentRow.DataRow; if (work != null) { WorkPresenter presenter = new WorkPresenter(); if (presenter.Remove(work)) { Bs.Remove(work); } } }