static void Main(string[] args) { Console.WriteLine("Gnosis Repository Test"); try { artistCache = new Cache<Artist>(); workCache = new Cache<Work>(); artistStore = new SQLiteArtistDatabase(); workStore = new SQLiteWorkDatabase(artistCache, workCache); repository = new Repository(artistCache, artistStore, workCache, workStore); repository.Initialize(); //cache = new GlobalCache(); //database = new GlobalDatabase(); //database.Initialize(cache); //repository = new GlobalRepository(cache, database); //AddAlbum(); DisplayInfo(); Console.WriteLine("Artist Count: {0}", artistCache.Entities.Count()); Console.WriteLine("Work Count: {0}", workCache.Entities.Count()); } catch (Exception ex) { Console.WriteLine("ERROR"); Console.WriteLine(ex.Message); Console.WriteLine(ex.StackTrace); } Console.WriteLine("Press ENTER to close"); Console.ReadLine(); }
public void Initialize() { string connection = @"Data Source=(localdb)\ProjectsV12;Initial Catalog=SouthendUni.StudentSite.Database;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False"; _repository = Resolve<IRepository<PermissionLevel,int>>(); _repository.Initialize(connection); }
public void Load(string extraDataKey) { _dynamicExpressionQuery = ObjectFactory.GetInstance<IDynamicExpressionQuery>(); _repository = ObjectFactory.GetNamedInstance<IRepository>("NoFiltersOrInterceptor"); _securityDataService = ObjectFactory.GetInstance<ISecurityDataService>(); _repository.Initialize(); createUser(); _repository.Commit(); }
public static int 批量生成费用(IRepository rep, 车辆产值 票, IEnumerable 箱, string 费用项编号, 收付标志? 收付标志) { int cnt = 0; // 需按照委托人合同和付款合同生成相应费用和费用理论值 // 如果总体来生成,则按照: // 如果费用已经打了完全标志,则不生成。如果相应理论值已经生成过,也不生成。 // 如果单个费用项来生成,则不管理论值是否已经生成过 // Todo: 理论值可能显示生成票的,后来信息完全了再生成箱的,此时要删除票的 //using (IRepository rep = ServiceProvider.GetService<IRepositoryFactory>().GenerateRepository(票.GetType())) { try { rep.BeginTransaction(); IList<业务费用理论值> llzs = (rep as Feng.NH.INHibernateRepository).List<业务费用理论值>(NHibernate.Criterion.DetachedCriteria.For<业务费用理论值>() .Add(NHibernate.Criterion.Expression.Eq("费用实体.ID", 票.ID))); rep.Initialize(票.费用, 票); process_fy_generate.批量生成费用(rep, 票, 箱, 费用项编号, 收付标志, llzs); //// 有几项(发票税,贴息费)要看收款费用 // 不行,会多生成 //批量生成费用付款(rep, 费用实体类型, 票, 箱, 费用项编号, 收付标志, llzs); rep.CommitTransaction(); } catch (Exception ex) { rep.RollbackTransaction(); ServiceProvider.GetService<IExceptionProcess>().ProcessWithNotify(ex); } } return cnt; }
// 返回MinValue:没符合的条件,不生成理论值,不生成费用(内部外部都不生成) // 返回0:符合条件,生成理论值, 但不生成费用(内部外部都不生成) // 返回NULL:符合条件,不生成理论值,但生成空费用记录。在不在生成全部的时候生成看配置,生成单费用项的时候生成 // 返回具体值:生成记录 // 根据相关人不同得到理论值 private static decimal? Get理论值金额(IRepository rep, 合同费用项 htfyx, object entity) { rep.Initialize(htfyx.费用理论值, htfyx); foreach (费用理论值信息 i in htfyx.费用理论值) { string exp; if (i.条件.Contains(System.Environment.NewLine)) { exp = s_feeThoeryGenerate2.Replace("%IFEXPRESSION%", i.条件); } else { exp = s_feeThoeryGenerate.Replace("%IFEXPRESSION%", i.条件); } object ret = Script.ExecuteStatement(exp, new Dictionary<string, object> { { "entity", entity } }); if (ConvertHelper.ToBoolean(ret).Value) { if (string.IsNullOrEmpty(i.结果)) { return null; } else { if (i.结果.Contains(System.Environment.NewLine)) { exp = s_feeThoeryGenerateResult2.Replace("%IFEXPRESSION%", i.结果); } else { exp = s_feeThoeryGenerateResult.Replace("%IFEXPRESSION%", i.结果); } ret = Script.ExecuteStatement(exp, new Dictionary<string, object> { { "entity", entity }, { "rep", rep } }); decimal? d = Feng.Utils.ConvertHelper.ToDecimal(ret); if (d.HasValue) return d.Value; else return null; } } } return decimal.MinValue; }