public void Save(MaintenanceVehicleObject maintenanceVehicle) { SqlCommand cmd = null; try { ExecuteNonQuery(out cmd, false, "MaintenanceVehicle_SAVE", CreateParameter("@maintvehID", SqlDbType.UniqueIdentifier, maintenanceVehicle.MaintVehID, ParameterDirection.InputOutput), CreateParameter("@vehID", SqlDbType.UniqueIdentifier, maintenanceVehicle.Vehicle == null ? Guid.Empty : maintenanceVehicle.Vehicle.VehID), CreateParameter("@empIDExecutor", SqlDbType.UniqueIdentifier, maintenanceVehicle.Executor == null ? Guid.Empty : maintenanceVehicle.Executor.EmpID), CreateParameter("@StartMaintenance", SqlDbType.VarChar, PROF_IT.Common.Convert.DateFunctions.DateToLongStrDate(maintenanceVehicle.StartMaintenance)), CreateParameter("@Remark", SqlDbType.VarChar, maintenanceVehicle.Remark) ); maintenanceVehicle.MaintVehID = (Guid)cmd.Parameters["@maintvehID"].Value; } catch (Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } finally { if (cmd != null) { cmd.Dispose(); } cmd = null; } }
public bool Remove(MaintenanceVehicleObject maintenanceVehicle) { SqlCommand cmd = null; try { ExecuteNonQuery(out cmd, false, "MaintenanceVehicle_DELETE", CreateParameter("@maintvehID", SqlDbType.UniqueIdentifier, maintenanceVehicle.MaintVehID, ParameterDirection.Input) ); return(true); } catch (Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } finally { if (cmd != null) { cmd.Dispose(); } cmd = null; } }
public void Save(MaintenanceVehicleObject maintenanceVehicle) { try { CheckTransaction(); new MaintenanceVehicleDataService(Transaction).Save(maintenanceVehicle); if (IsOwner) { Transaction.Commit(); } } catch (Exception exception1) { if (IsOwner) { Transaction.Rollback(); } Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } finally { if (IsOwner) { Connection.Close(); } } }
void IEditableObject.EndEdit() { try { if (_inTxn) { _loadedMaintenanceVehicle = MaintenanceVehicle; _loadedMaterial = Material; _loadedExecutor = Executor; _loadedRemark = Remark; _loadedStartMaintenance = StartMaintenance; _loadedMaterialRevisions = MaterialRevisions; _inTxn = true; } } catch (Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } }