public virtual void New() { if (Dirty) { var resultBtn = MessageForm.Ask(this, Resources.title_information, Resources.dirty_form); if (resultBtn == DialogResult.No) { return; } //if (CurrentModel != null && CurrentModel.Id > 0) Save(); } StateChange = EnumStateChange.Insert; CrudState = EnumStateChange.Insert; rbData_New.Enabled = true; rbData_Save.Enabled = true; rbData_Delete.Enabled = false; tbxSearch_Code.Clear(); RefreshToolbarState(); //kalau dipanggil di masing-masing form aja ok kan? //ClearForm(); CurrentModel = new T(); EnabledForm(true); BeforeNew(); }
private void Void(object sender, ItemClickEventArgs e) { var model = CurrentModel as ShipmentModel; if (model == null) { return; } if (!model.Voided) { var dialog = MessageForm.Ask(form, Resources.void_confirm, Resources.void_confirm_msg); if (dialog == DialogResult.Yes) { model.Voided = true; model.Tariff = 0; model.HandlingFeeTotal = 0; model.TariffTotal = 0; model.DiscountPercent = 0; model.DiscountTotal = 0; model.TariffNet = 0; model.OtherFee = 0; model.GoodsValue = 0; model.InsuranceFee = 0; model.Total = 0; model.Rowversion = DateTime.Now; model.ModifiedPc = Environment.MachineName; model.Modifiedby = BaseControl.UserLogin; model.Modifieddate = DateTime.Now; new ShipmentDataManager().Update <ShipmentModel>(model); PerformFind(); } } }
protected virtual void NewRecord(object sender, EventArgs e) { if (Dirty) { var result = (MessageBox.Show( Resources.message_save_changes , Resources.title_confirmation , MessageBoxButtons.YesNoCancel , MessageBoxIcon.Question)); switch (result) { case DialogResult.No: case DialogResult.Cancel: return; } } if (Dirty) { var resultBtn = MessageForm.Ask(this, Resources.title_information, Resources.dirty_form); if (resultBtn == DialogResult.No) { return; } } EnabledForm(true); CrudState = EnumStateChange.Insert; Dirty = false; }
public virtual void Delete() { var dialog = MessageForm.Ask(form, Resources.delete_confirm, Resources.delete_confirm_msg); if (dialog == DialogResult.Yes) { ((T2)DataManager).DeActive(CurrentModel.Id, BaseControl.UserLogin, DateTime.Now); AfterDelete(); } }
protected virtual void BindDataSource <T>() where T : IBaseModel { if (Dirty) { var resultBtn = MessageForm.Ask(this, Resources.title_information, Resources.dirty_form); if (resultBtn == DialogResult.No) { return; } } CurrentModel = LoadModel <T>(); Dirty = false; }
void btnOK_Click(object sender, EventArgs e) { var discardValues = true; if (avecMain.MaybeDiscardValues()) { var result = MessageForm.Ask("Discard the specified values?", MessageBoxButtons.YesNoCancel); if (result == DialogResult.Cancel) { return; } if (result == DialogResult.No) { discardValues = false; } } avecMain.ApplyChanges(discardValues); DialogResult = DialogResult.OK; Close(); }