public static Boolean CreateSiteCreditControl(SiteCreditControl site) { Boolean flag = false; if (!(IsExistingSiteCreditControl(site))) { using (TransactionScope scope = new TransactionScope()) { using (var context = new SycousCon()) { try { context.SiteCreditControls.AddObject(site); context.SaveChanges(); scope.Complete(); context.AcceptAllChanges(); flag = true; } catch (Exception ex) { context.Dispose(); throw; } }// }// using }//if return flag; }
public static SiteCreditControl EditSiteCreditControl(Int64 creditId) { SiteCreditControl control = new SiteCreditControl(); using (var context = new SycousCon()) { try { control = context.SiteCreditControls.SingleOrDefault(s => s.ID == creditId); } catch (Exception ex) { context.Dispose(); throw; } } return control; }
public bool CreateRecord(Object _Creditobj) { Boolean flag = false; SiteCreditControlClass credit = (SiteCreditControlClass)_Creditobj; try { SiteCreditControl _credit = new SiteCreditControl(); if (credit.SiteID != null) { _credit.SiteID = credit.SiteID; } if (credit.Residential!= null) { _credit.Residential = Convert.ToInt32(credit.Residential); } if (credit.Commercial != null) { _credit.Commercial = Convert.ToInt32(credit.Commercial); } if (credit.Residential2 != null) { _credit.Residential2 = Convert.ToInt32(credit.Residential2); } if (credit.Commercial2 != null) { _credit.Commercial2 = Convert.ToInt32(credit.Commercial2); } _credit.CreateBy = credit.CreateBy; _credit.CreateDate = DateTime.Now; if (_credit.SiteID != null) { flag = DAL.DALCreditControl.CreateSiteCreditControl(_credit); } } catch (Exception ex) { throw; } return flag; }
public static bool IsExistingSiteCreditControl(SiteCreditControl site) { using (var context = new SycousCon()) { try { SiteCreditControl objcontrol = context.SiteCreditControls.SingleOrDefault(p => p.SiteID == site.SiteID); if (objcontrol != null) { return true; } else { return false; } } catch (Exception ex) { context.Dispose(); throw; } } }
public static Boolean UpdateSiteCreditControl(SiteCreditControl site) { using (TransactionScope scope = new TransactionScope()) { Boolean bol = false; using (var context = new SycousCon()) { try { var Update = context.SiteCreditControls.Where(c => c.ID == site.ID && c.IsDeleted==0); foreach (SiteCreditControl p in Update) { p.Residential = site.Residential; p.Commercial = site.Commercial; p.Residential2 = site.Residential2; p.Commercial2 = site.Commercial2; p.ModifyDate = DateTime.Now; p.ModifyBy = site.ModifyBy; }// context.SaveChanges(); context.AcceptAllChanges(); scope.Complete(); context.Dispose(); bol = true; } catch (Exception ex) { context.Dispose(); throw; } }// using return bol; } //trans }
/// <summary> /// Create a new SiteCreditControl object. /// </summary> /// <param name="id">Initial value of the ID property.</param> /// <param name="isDeleted">Initial value of the IsDeleted property.</param> public static SiteCreditControl CreateSiteCreditControl(global::System.Int64 id, global::System.Int32 isDeleted) { SiteCreditControl siteCreditControl = new SiteCreditControl(); siteCreditControl.ID = id; siteCreditControl.IsDeleted = isDeleted; return siteCreditControl; }
/// <summary> /// Deprecated Method for adding a new object to the SiteCreditControls EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToSiteCreditControls(SiteCreditControl siteCreditControl) { base.AddObject("SiteCreditControls", siteCreditControl); }