private bool deleteCarOwner(Common.BLL.Entity.GasStation.CarOwner model) { bool result = false; Common.BLL.Logic.GasStation.CarOwner lCarOwner = new Common.BLL.Logic.GasStation.CarOwner(Common.Enum.EDatabase.GasStation); CommandResult opResult = lCarOwner.delete(model); if (opResult.status == BaseDAL.Base.EnumCommandStatus.success) { result = true; } return(result); }
/// <summary> /// Delete Menu /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private 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.CarOwner model = new Common.BLL.Entity.GasStation.CarOwner() { ownerId = id }; Common.BLL.Logic.GasStation.CarOwner lCarOwner = new Common.BLL.Logic.GasStation.CarOwner(Common.Enum.EDatabase.GasStation); CommandResult opResult = lCarOwner.read(model, "ownerId"); if (opResult.status == BaseDAL.Base.EnumCommandStatus.success) { if (deleteLegalOwner(model.id)) { if (deleteCarOwner(model)) { if (deleteCarTag_Tag(model.carId)) { if (deleteCar_Plate(model.carId)) { if (deleteOwner(model.ownerId)) { reload(); } } } } } } } else { MessageBox.Show("رکوردی انتخاب نشده است", "اخطار", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }