public static Boolean CreateFlowTemperatures(FlowTemperature Flow) { Boolean flag = false; if (!(IsExistingFlowTemperature(Flow))) { using (TransactionScope scope = new TransactionScope()) { using (var context = new SycousCon()) { try { context.FlowTemperatures.AddObject(Flow); context.SaveChanges(); scope.Complete(); context.AcceptAllChanges(); flag = true; } catch (Exception ex) { context.Dispose(); throw; } }// }// using }//if return flag; }
public bool CreateRecord(Object _Flowobj) { Boolean flag = false; FlowTemperaturesClass Flow = (FlowTemperaturesClass)_Flowobj; try { DAL.FlowTemperature _Flow = new FlowTemperature(); if (Flow.ClientID != null) { _Flow.ClientID = Convert.ToInt64(Flow.ClientID); } if (Flow.SiteID != null) { _Flow.SiteID = Convert.ToInt64(Flow.SiteID); } if (Flow.LowestFlowTemperature != null) { _Flow.LowestFlowTemperature = Convert.ToDecimal(Flow.LowestFlowTemperature); } if (Flow.FromDate != null) { _Flow.FormDate = BAL.Common.DateGB(Flow.FromDate); } else { _Flow.FormDate = null; } if (Flow.ToDate != null) { _Flow.ToDate = BAL.Common.DateGB(Flow.ToDate); } else { _Flow.ToDate = null; } _Flow.CreateBy = Flow.CreateBy; _Flow.CreateDate = DateTime.Now; if ((_Flow.ClientID != null) && (_Flow.SiteID != null) ) { flag = DAL.DALFlowTemperatures.CreateFlowTemperatures(_Flow); } } catch (Exception ex) { throw; } return flag; }
public static FlowTemperature EditFlowTemperature(Int64 FlowID) { FlowTemperature Flow = new FlowTemperature(); using (var context = new SycousCon()) { try { Flow = context.FlowTemperatures.SingleOrDefault(s => s.ID == FlowID); } catch (Exception ex) { context.Dispose(); throw; } } return Flow; }
public static Boolean UpdateFlowTemperatures(FlowTemperature Flow) { using (TransactionScope scope = new TransactionScope()) { Boolean bol = false; using (var context = new SycousCon()) { try { var Update = context.FlowTemperatures.Where(c => c.ID == Flow.ID); foreach (FlowTemperature p in Update) { if (Flow.ClientID != null) { p.ClientID = Flow.ClientID; } if (Flow.SiteID != null) { p.SiteID = Flow.SiteID; } if (Flow.LowestFlowTemperature != null) { p.LowestFlowTemperature = Flow.LowestFlowTemperature; } if (Flow.FormDate != null) { p.FormDate = Flow.FormDate; } else { p.FormDate = null; } if (Flow.ToDate != null) { p.ToDate = Flow.ToDate; } else { p.ToDate = null; } p.ModifyBy = Flow.ModifyBy; p.ModifyDate = DateTime.Now; }// context.SaveChanges(); context.AcceptAllChanges(); scope.Complete(); context.Dispose(); bol = true; } catch (Exception ex) { context.Dispose(); throw; } }// using return bol; } //trans }
public static bool IsExistingFlowTemperature(FlowTemperature Flow) { using (var context = new SycousCon()) { try { FlowTemperature objFlow = context.FlowTemperatures.SingleOrDefault(p => p.ClientID == Flow.ClientID && p.SiteID == Flow.SiteID ); if (objFlow != null) { return true; } else { return false; } } catch (Exception ex) { context.Dispose(); throw; } } }
/// <summary> /// Deprecated Method for adding a new object to the FlowTemperatures EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToFlowTemperatures(FlowTemperature flowTemperature) { base.AddObject("FlowTemperatures", flowTemperature); }
/// <summary> /// Create a new FlowTemperature object. /// </summary> /// <param name="id">Initial value of the ID property.</param> /// <param name="isDeleted">Initial value of the IsDeleted property.</param> public static FlowTemperature CreateFlowTemperature(global::System.Int64 id, global::System.Int32 isDeleted) { FlowTemperature flowTemperature = new FlowTemperature(); flowTemperature.ID = id; flowTemperature.IsDeleted = isDeleted; return flowTemperature; }