public ClientsService(IDbConnectionFactory dbConnectionFactory)
 {
     Repository = new OrmLiteRepository<Client>(dbConnectionFactory.Open());
 }
 public MetroiLinksService(IDbConnectionFactory dbConnectionFactory)
 {
     Repository = new OrmLiteRepository<MetroiLinks>(dbConnectionFactory.Open());
 }
 public FolderService(IDbConnectionFactory dbConnectionFactory)
 {
     Repository = new OrmLiteRepository<Folder>(dbConnectionFactory.Open());
 }
Ejemplo n.º 4
0
        public static void CreateTransactionTable()
        {
            Transaction transaction = new Transaction();
            transaction.Id = Guid.NewGuid();
            transaction.Name = "Name";
            transaction.ActivationDate = DateTime.Now;
            transaction.CreatedOn = DateTime.Now;
            transaction.Amount = 100;
            transaction.ExpiredDate = DateTime.Now.AddDays(10);
            transaction.CardAccountId = new Guid("c9867a69-257c-4c96-b328-be2c79abab1a");

            OrmLiteRepository<Transaction> repo = new OrmLiteRepository<Transaction>();
            repo.SafeAdd(transaction);
        }
Ejemplo n.º 5
0
        public static void CreateTables()
        {
            var serializer = new JSSerializer();
            OrmLiteRepository<LocalRestriction> table = new OrmLiteRepository<LocalRestriction>();
            LocalRestriction ent = new LocalRestriction();
            ent.LookupItemId = new Guid("c6eb436e-1021-45a5-b937-30b6b7be1970");
            ent.Name = "LocalRestriction от бога";
            ent.RuleId = new Guid("B999488A-9D27-4318-BE06-99DB84B25139");
            ent.Production = true;
            ent.Sandbox = true;

            var settings = new Dictionary<string, object>();
            settings.Add("Date", DateTime.Now);
            ent.Settings = serializer.Serialize(settings);

            ent.CreatedOn = DateTime.Now;

            table.SafeAdd(ent);
        }
Ejemplo n.º 6
0
        public static void CreateRule()
        {
            var serializer = new JSSerializer();
            OrmLiteRepository<Rule> table = new OrmLiteRepository<Rule>();

            Rule rule = new Rule();
            rule.ActivateBonusInDays = 1;
            rule.ChargeAmount = 100;
            rule.BonusLifeTime = 30;
            rule.Production = true;
            rule.Sandbox = true;
            rule.ActivateInDate = DateTime.Now;
            rule.ActivateOnCharge = true;
            rule.ChargePercent = 50;
            rule.LifeTimeFrom = DateTime.Now;
            rule.LifeTimeTo = DateTime.Now.AddDays(40);
            rule.Priority = 2;
            rule.Name = "Rule 2";

            ConditionGroup mainGroup = new ConditionGroup();
            mainGroup.ExpressionType = ExpressionType.AND;

            Condition cond1 = new Condition(new BaseCondition());
            Dictionary<string, object> cond1Settings = new Dictionary<string, object>();
            cond1Settings.Add("Date", DateTime.Now.AddDays(-40));
            cond1.ConditionItem.Settings = cond1Settings;
            cond1.ConditionItem.ConditionId = new Guid("2be12ef8-00b9-47c5-a0cb-d6f15fb02aa5");
            mainGroup.Add(cond1);

            ConditionGroup subGroup1 = new ConditionGroup();
            subGroup1.ExpressionType = ExpressionType.AND;

            Condition cond2 = new Condition(new BaseCondition());
            Dictionary<string, object> cond2Settings = new Dictionary<string, object>();
            cond2Settings.Add("Date", DateTime.Now.AddDays(-40));
            cond2.ConditionItem.Settings = cond2Settings;
            cond2.ConditionItem.ConditionId = new Guid("2be12ef8-00b9-47c5-a0cb-d6f15fb02aa5");
            subGroup1.Add(cond2);
            mainGroup.Add(subGroup1);
            var conditionJson = serializer.Serialize(mainGroup);

            rule.Conditions = conditionJson;

            LocalRestrictionBase localRestriction = new LocalRestrictionBase();
            localRestriction.RestrictionId = new Guid("C6EB436E-1021-45A5-B937-30B6B7BE1970");
            localRestriction.Name = "LocalRestriction от бога";

            var restrictionSettings = new Dictionary<string, object>();
            restrictionSettings.Add("Date", DateTime.Now);
            localRestriction.Settings = restrictionSettings;

            LocalActionBase localAction = new LocalActionBase();
            localAction.ActionId = new Guid("EB54BD15-D953-4986-AC89-47A9F5E527C0");
            localAction.Name = "LocalAction от бога";

            var actionSettings = new Dictionary<string, object>();
            actionSettings.Add("Date", DateTime.Now);
            localAction.Settings = actionSettings;

            List<LocalRestrictionBase> restrictionList = new List<LocalRestrictionBase>();
            restrictionList.Add(localRestriction);

            List<LocalActionBase> actionList = new List<LocalActionBase>();
            actionList.Add(localAction);

            rule.LocalActions = serializer.Serialize(actionList);
            rule.LocalRestrictions = serializer.Serialize(restrictionList);

            table.SafeAdd(rule);

            //Console.WriteLine(json);
            //Console.ReadKey();
        }
Ejemplo n.º 7
0
        public static void CreateKVSTable()
        {
            KVSUncommitedPurchase purchase = new KVSUncommitedPurchase();
            purchase.Id = Guid.NewGuid();
            purchase.serializedData = "";
            purchase.CreatedOn = DateTime.Now;

            OrmLiteRepository<KVSUncommitedPurchase> repo = new OrmLiteRepository<KVSUncommitedPurchase>();
            repo.SafeAdd(purchase);
        }