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; }
private void Validate(Model.Workhouselog workHouselog) { if (string.IsNullOrEmpty(workHouselog.WorkHouseId)) { throw new Helper.RequireValueException(Model.Workhouselog.PROPERTY_WORKHOUSEID); } }
/// <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); }
/// <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); }
protected override void MoveNext() { Model.Workhouselog workHouselog = this.workHouselogManager.GetNext(this.workHouselog); if (workHouselog == null) { throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows); } this.workHouselog = workHouselog; }
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(); }
//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(); } } }
public Model.Workhouselog GetNext(Model.Workhouselog e) { return(accessor.GetNext(e)); }
public Model.Workhouselog GetPrev(Model.Workhouselog e) { return(accessor.GetPrev(e)); }
public bool HasRowsAfter(Model.Workhouselog e) { return(accessor.HasRowsAfter(e)); }
public bool HasRowsBefore(Model.Workhouselog e) { return(accessor.HasRowsBefore(e)); }
protected override void AddNew() { this.workHouselog = new Model.Workhouselog(); }
public EditForm(Model.Workhouselog workHouselog, string action) { this.workHouselog = workHouselog; this.action = action; }
public EditForm(Model.Workhouselog workHouselog) { this.workHouselog = workHouselog; this.action = "update"; }
protected override void MoveLast() { this.workHouselog = this.workHouselogManager.GetLast(); }