/// <summary> /// Delete menu /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void deleteMenu_Click(object sender, EventArgs e) { if ((null != resultGrid.CurrentRow) && (MessageBox.Show(this, "آیا برای حذف اطمینان دارید؟", "حذف رکورد", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)) { int id; // Get id id = Convert.ToInt32(resultGrid.CurrentRow.Cells["id"].Value); Common.BLL.Entity.GasStation.Base__CarColor model = new Common.BLL.Entity.GasStation.Base__CarColor() { id = id }; Common.BLL.Logic.GasStation.Base__CarColor lCarColor = new Common.BLL.Logic.GasStation.Base__CarColor(Common.Enum.EDatabase.GasStation); CommandResult opResult = lCarColor.delete(model); if (opResult.status == BaseDAL.Base.EnumCommandStatus.success) { reload(); } } else { MessageBox.Show("رکوردی انتخاب نشده است", "اخطار", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
/// <summary> /// Modify menu /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void modifyMenu_Click(object sender, EventArgs e) { if (null != resultGrid.CurrentRow) { int id; // Get id id = Convert.ToInt32(resultGrid.CurrentRow.Cells["id"].Value); Common.BLL.Entity.GasStation.Base__CarColor model = new Common.BLL.Entity.GasStation.Base__CarColor() { id = id }; CarColorEntryForm form = new CarColorEntryForm(model); if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK) { reload(); } } else { MessageBox.Show("رکوردی انتخاب نشده است", "اخطار", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
/// <summary> /// Constructor /// </summary> public CarColorEntryForm(Common.BLL.Entity.GasStation.Base__CarColor model = null) { InitializeComponent(); // Set data this.model = model; init(); }
private void btnSave_Click(object sender, EventArgs e) { Common.BLL.Logic.GasStation.Base__CarColor lColorCar = new Common.BLL.Logic.GasStation.Base__CarColor(Common.Enum.EDatabase.GasStation); Common.BLL.Entity.GasStation.Base__CarColor Colorcar = new Common.BLL.Entity.GasStation.Base__CarColor(); CommandResult result; Colorcar.color = txtColor.Text.Trim(); Colorcar.insertedById = 4; Colorcar.insertDate = DateTime.Now; result = lColorCar.create(Colorcar); }
/// <summary> /// Prepare /// </summary> private void prepare() { if (null == model) { model = new Common.BLL.Entity.GasStation.Base__CarColor(); } else { // Load model data from db Common.BLL.Logic.GasStation.Base__CarColor lCarColor = new Common.BLL.Logic.GasStation.Base__CarColor(Common.Enum.EDatabase.GasStation); CommandResult opResult = lCarColor.read(model); ///TODO: CHECK ERRORS } // Fill Controls BaseBLL.General.FormModelHelper <Common.BLL.Entity.GasStation.Base__CarColor> .fillControl(dataGroupBox, model); }