コード例 #1
0
        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();
        }
コード例 #2
0
        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;
        }
コード例 #3
0
        public bool Remove(SdWorkDto work)
        {
            ResponseDto response = WorkServiceAdapter.Execute(s => s.Delete(work));

            if (response.Response.HasException)
            {
                return(false);
            }
            return(true);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
            }
        }
コード例 #6
0
        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();
            }
        }
コード例 #7
0
        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);
                }
            }
        }