using BWP.B3ClientService.BO;
|
|
using Forks.EnterpriseServices.BusinessInterfaces;
|
|
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<T>(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<T>(long id)
|
|
where T : SyncBase
|
|
{
|
|
return Exist<T>("ID", id);
|
|
}
|
|
|
|
public static bool Exist<T>(string field, object value)
|
|
where T : SyncBase
|
|
{
|
|
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();
|
|
}
|
|
|
|
static WpfUser user;
|
|
public static WpfUser InternalUser
|
|
{
|
|
get
|
|
{
|
|
if (user == null)
|
|
{
|
|
user = BIFactory.Create<IUserBL>().Get(WpfUser.InternalAccountName);
|
|
user.UserTag = WpfUser.InternalUserTag;
|
|
}
|
|
return user;
|
|
}
|
|
}
|
|
}
|
|
}
|