Пример #1
0
        protected override void Delete()
        {
            if (this.workHouselog == null)
            {
                return;
            }
            if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
            {
                return;
            }
            try
            {
                this.workHouselogManager.Delete(this.workHouselog.WorkhouselogID);
                this.workHouselog = this.workHouselogManager.GetNext(this.workHouselog);
                if (this.workHouselog == null)
                {
                    this.workHouselog = this.workHouselogManager.GetLast();
                }
            }
            catch
            {
                throw new Exception("");
            }

            return;
        }
Пример #2
0
 private void Validate(Model.Workhouselog workHouselog)
 {
     if (string.IsNullOrEmpty(workHouselog.WorkHouseId))
     {
         throw new Helper.RequireValueException(Model.Workhouselog.PROPERTY_WORKHOUSEID);
     }
 }
Пример #3
0
 /// <summary>
 /// Update a Workhouselog.
 /// </summary>
 public void Update(Model.Workhouselog workhouselog)
 {
     //
     // todo: add other logic here.
     //
     Validate(workhouselog);
     workhouselog.UpdateTime = DateTime.Now;
     accessor.Update(workhouselog);
 }
Пример #4
0
 /// <summary>
 /// Insert a Workhouselog.
 /// </summary>
 public void Insert(Model.Workhouselog workhouselog)
 {
     //
     // todo:add other logic here
     //
     Validate(workhouselog);
     workhouselog.InsertTime     = DateTime.Now;
     workhouselog.WorkhouselogID = Guid.NewGuid().ToString();
     accessor.Insert(workhouselog);
 }
Пример #5
0
        protected override void MoveNext()
        {
            Model.Workhouselog workHouselog = this.workHouselogManager.GetNext(this.workHouselog);
            if (workHouselog == null)
            {
                throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows);
            }

            this.workHouselog = workHouselog;
        }
Пример #6
0
        public override void Refresh()
        {
            if (this.workHouselog == null)
            {
                this.workHouselog = new Book.Model.Workhouselog();
                this.action       = "insert";
            }
            this.bindingSource1.DataSource = this.workHouselogManager.Select();
            if (this.workHouselog.WorkHouse != null)
            {
                this.newChooseWorkHouseId.EditValue = this.workHouselog.WorkHouse as Model.WorkHouse;
            }
            if (global::Helper.DateTimeParse.DateTimeEquls(this.workHouselog.Workhouselogdate, global::Helper.DateTimeParse.NullDate))
            {
                this.dateWorkhouselogdate.EditValue = null;
            }
            else
            {
                this.dateWorkhouselogdate.EditValue = this.workHouselog.Workhouselogdate;
            }
            this.textWorkhouselogcontent.Text = this.workHouselog.Workhouselogcontent;
            switch (this.action)
            {
            case "insert":

                this.newChooseWorkHouseId.ShowButton             = true;
                this.newChooseWorkHouseId.ButtonReadOnly         = false;
                this.textWorkhouselogcontent.Properties.ReadOnly = false;
                this.dateWorkhouselogdate.Properties.ReadOnly    = false;
                break;

            case "update":
                this.newChooseWorkHouseId.ShowButton             = true;
                this.newChooseWorkHouseId.ButtonReadOnly         = false;
                this.textWorkhouselogcontent.Properties.ReadOnly = false;
                this.dateWorkhouselogdate.Properties.ReadOnly    = false;
                break;

            case "view":
                this.newChooseWorkHouseId.ShowButton             = true;
                this.newChooseWorkHouseId.ButtonReadOnly         = false;
                this.textWorkhouselogcontent.Properties.ReadOnly = true;
                this.dateWorkhouselogdate.Properties.ReadOnly    = true;
                break;

            default:
                break;
            }
            base.Refresh();
        }
Пример #7
0
        //gridview单击事件
        private void gridView1_Click(object sender, EventArgs e)
        {
            GridView    view    = sender as GridView;
            GridHitInfo hitInfo = view.CalcHitInfo(view.GridControl.PointToClient(Cursor.Position));

            if (hitInfo.InRow && !view.IsGroupRow(hitInfo.RowHandle))
            {
                Model.Workhouselog workHouselog = this.bindingSource1.Current as Model.Workhouselog;
                if (workHouselog != null)
                {
                    this.workHouselog = workHouselog;
                    this.action       = "view";
                    this.Refresh();
                }
            }
        }
Пример #8
0
 public Model.Workhouselog GetNext(Model.Workhouselog e)
 {
     return(accessor.GetNext(e));
 }
Пример #9
0
 public Model.Workhouselog GetPrev(Model.Workhouselog e)
 {
     return(accessor.GetPrev(e));
 }
Пример #10
0
 public bool HasRowsAfter(Model.Workhouselog e)
 {
     return(accessor.HasRowsAfter(e));
 }
Пример #11
0
 public bool HasRowsBefore(Model.Workhouselog e)
 {
     return(accessor.HasRowsBefore(e));
 }
Пример #12
0
 protected override void AddNew()
 {
     this.workHouselog = new Model.Workhouselog();
 }
Пример #13
0
 public EditForm(Model.Workhouselog workHouselog, string action)
 {
     this.workHouselog = workHouselog;
     this.action       = action;
 }
Пример #14
0
 public EditForm(Model.Workhouselog workHouselog)
 {
     this.workHouselog = workHouselog;
     this.action       = "update";
 }
Пример #15
0
 protected override void MoveLast()
 {
     this.workHouselog = this.workHouselogManager.GetLast();
 }