/// <summary> /// Deprecated Method for adding a new object to the FORECAST_ORDER EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToFORECAST_ORDER(FORECAST_ORDER fORECAST_ORDER) { base.AddObject("FORECAST_ORDER", fORECAST_ORDER); }
public static string Update(FORECAST_ORDER fc, TAC_KANBANEntities ceRef = null) { String results = null; bool isSuccess = false; bool isRootTransaction = true; TAC_KANBANEntities ce; if (ceRef == null) { //using new entity object ce = new TAC_KANBANEntities(); } else { //using current entity object ce = ceRef; isRootTransaction = false; } // Start transaction for update a Lease Admin record. try { using (TransactionScope trans = EntityUtils.CreateTransactionScope()) { if (isRootTransaction) { // Manually open connection to prevent EF from auto closing // connection and causing issues with future queries. ce.Connection.Open(); } // Checking for version ce.AttachUpdated(fc); ce.SaveChanges(System.Data.Objects.SaveOptions.DetectChangesBeforeSave); isSuccess = true; trans.Complete(); // Transaction complete } } catch (OptimisticConcurrencyException oex) { // Log error in ELMAH for any diagnostic needs. results = "The current record has been modifed since you have " + "last retrieved it. Please reload the record and " + "attempt to save it again."; } catch (Exception ex) { // Error occurs // Log error in ELMAH for any diagnostic needs. isSuccess = false; results = "An error occurred saving the record. Please try again."; } finally { if (isRootTransaction) { ce.Connection.Dispose(); } } // Finally accept all changes from the transaction. if (isSuccess && isRootTransaction) { ce.Dispose(); } return results; }
/// <summary> /// Create a new FORECAST_ORDER object. /// </summary> /// <param name="id">Initial value of the ID property.</param> public static FORECAST_ORDER CreateFORECAST_ORDER(global::System.Int32 id) { FORECAST_ORDER fORECAST_ORDER = new FORECAST_ORDER(); fORECAST_ORDER.ID = id; return fORECAST_ORDER; }