using BWP.B3ClientService.BO; using Forks.EnterpriseServices.DomainObjects2; using Forks.EnterpriseServices.DomainObjects2.DQuery; using System; using System.Collections.Generic; using System.Linq; using System.Text; using TSingSoft.WebPluginFramework; namespace BWP.B3ClientService { public interface IWithRowVersion { long ID { get; set; } int RowVersion { get; set; } } public static class ClientServiceUtils { public static bool RowVersionSame(int rowVersion, long id) where T : IWithRowVersion { var query = new DQueryDom(new JoinAlias(typeof(T))); query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("ID", id), DQCondition.EQ("RowVersion", rowVersion))); return query.EExists(); } public static bool Exist(long id) where T : SyncBase { return Exist("ID", id); } public static bool Exist(string field, object value) { var query = new DQueryDom(new JoinAlias(typeof(T))); query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ(field, value), DQCondition.EQ("DeleteState", false))); return query.EExists(); } } }