public static Boolean CreatePropertyBandInTariff(PropertyBandInTariff tariff) { Boolean flag = false; if ((IsExistingPropertyBandInTariff(tariff))) { using (TransactionScope scope = new TransactionScope()) { using (var context = new SycousCon()) { try { context.PropertyBandInTariffs.AddObject(tariff); context.SaveChanges(); scope.Complete(); context.AcceptAllChanges(); flag = true; } catch (Exception ex) { context.Dispose(); throw; } } } } return flag; }
public static bool IsExistingPropertyBandInTariff(PropertyBandInTariff tariff) { using (var context = new SycousCon()) { try { PropertyBandInTariff objtariff = context.PropertyBandInTariffs.SingleOrDefault(p => p.TariffID == tariff.TariffID && p.BandID == tariff.BandID && p.IsDeleted == 0); if (objtariff != null) { return false; } else { return true; } } catch (Exception ex) { context.Dispose(); throw; } } }
public static Boolean UpdatePropertyBandInTariff(PropertyBandInTariff tariff) { using (TransactionScope scope = new TransactionScope()) { Boolean bol = false; using (var context = new SycousCon()) { try { var Update = context.PropertyBandInTariffs.Where(c => c.ID == tariff.ID); foreach (PropertyBandInTariff p in Update) { if (tariff.ReleaseDate!= null) { p.ReleaseDate = tariff.ReleaseDate; } if (tariff.IsDeleted != null) { p.IsDeleted = tariff.IsDeleted; } p.ModifyDate = DateTime.Now; p.ModifyBy = tariff.ModifyBy; }// context.SaveChanges(); context.AcceptAllChanges(); scope.Complete(); context.Dispose(); bol = true; } catch (Exception ex) { context.Dispose(); throw; } }// using return bol; } //trans }
Boolean IMapping.UpdateMapping(Object Mappingobj) { Boolean flag = false; PropertyBandInTariffClass mapping = (PropertyBandInTariffClass)Mappingobj; try { PropertyBandInTariff _mapping = new PropertyBandInTariff(); if (mapping.MapID != null) { _mapping.ID = Convert.ToInt64(mapping.MapID); } if (mapping.ReleaseDate != null) { _mapping.ReleaseDate = Common.DateGB(mapping.ReleaseDate); } _mapping.IsDeleted = 2; _mapping.ModifyBy = mapping.modifyBy; _mapping.ModifyDate = DateTime.Now; if ((_mapping.ID != null)) { flag = DAL.DALTariff.UpdatePropertyBandInTariff(_mapping); } } catch (Exception ex) { throw; } return flag; }
Boolean IMapping.CreateMapping(Object Mappingobj) { Boolean flag = false; PropertyBandInTariffClass mapping = (PropertyBandInTariffClass)Mappingobj; try { PropertyBandInTariff _mapping = new PropertyBandInTariff(); if (mapping.BandID != null) { _mapping.BandID = Convert.ToInt32(mapping.BandID); } if (mapping.TariffID != null) { _mapping.TariffID = Convert.ToInt32(mapping.TariffID); } if (mapping.AssignDate != null) { _mapping.AssignDate = Common.DateGB(mapping.AssignDate); } if (mapping.ReleaseDate != null) { _mapping.ReleaseDate = Common.DateGB(mapping.ReleaseDate); } _mapping.TransDate = DateTime.Now; _mapping.CreateBy = mapping.CreateBy; _mapping.CreateDate = DateTime.Now; if ((_mapping.BandID != null) && (_mapping.TariffID != null)) { flag = DAL.DALTariff.CreatePropertyBandInTariff(_mapping); } } catch (Exception ex) { throw; } return flag; }
/// <summary> /// Create a new PropertyBandInTariff object. /// </summary> /// <param name="id">Initial value of the ID property.</param> /// <param name="transDate">Initial value of the TransDate property.</param> /// <param name="isDeleted">Initial value of the IsDeleted property.</param> public static PropertyBandInTariff CreatePropertyBandInTariff(global::System.Int64 id, global::System.DateTime transDate, global::System.Int32 isDeleted) { PropertyBandInTariff propertyBandInTariff = new PropertyBandInTariff(); propertyBandInTariff.ID = id; propertyBandInTariff.TransDate = transDate; propertyBandInTariff.IsDeleted = isDeleted; return propertyBandInTariff; }
/// <summary> /// Deprecated Method for adding a new object to the PropertyBandInTariffs EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToPropertyBandInTariffs(PropertyBandInTariff propertyBandInTariff) { base.AddObject("PropertyBandInTariffs", propertyBandInTariff); }