Пример #1
0
        static void Main(string[] args)
        {
            DotNet_GridCacheAccess.Initialize(new DotNet_GridCacheConfiguration());
            var gridCache = new SophisGridCacheBasicService();
            //var obj = gridCache.get("/root/sophis", "TestHeartBeatServerPARD013447_15628");
            var forexWritten = Forex.CreateBuilder()
                               .SetCommon(CommonFields.CreateBuilder().SetId("EUR").SetName("EUR").SetTimestamp(misysdatamodel.DateTime.DefaultInstance).SetSourceRef("tt").SetInstanceRef("zzz").Build())
                               .AddQuotes(Forex.Types.ForexQuote.CreateBuilder().SetLast(12).Build())
                               .Build();

            gridCache.put(_region, "forex1", new Sophis.GridCache.Contract.SophisGridCacheObject()
            {
                Bytes = forexWritten.ToByteArray()
            });
            gridCache.put(_region, "forex2", new Sophis.GridCache.Contract.SophisGridCacheObject()
            {
                Bytes = forexWritten.ToByteArray()
            });
            var objs = gridCache.getList(_region, new[] { "forex1", "forex2" });

            if (objs != null)
            {
                foreach (var obj in objs)
                {
                    var forexRead = Forex.ParseFrom(obj.Value.Bytes);
                    Console.WriteLine("Got: {0}", forexRead.ToString());
                }
            }
            else
            {
                Console.WriteLine("Not found :(");
            }
        }
Пример #2
0
 public AFieldTable(string name, string discript)
 {
     TableName     = name;
     TableDiscript = discript;
     TableFields.Add(new TableField()
     {
         Name     = "ID",
         Type     = "int identity(1,1) primary key not null",
         IsExtend = true
     });
     CommonFields.AddRange(
         new TableField[] {
         new TableField()
         {
             Name     = "修改人",
             Type     = TableField.FieldTypeList[TableFieldType.文本],
             IsExtend = true,
         },
         new TableField()
         {
             Name     = "修改时间",
             Type     = TableField.FieldTypeList[TableFieldType.日期时间],
             IsExtend = true,
             Value    = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
         },
     });
 }
Пример #3
0
        static void Main(string[] args)
        {
            var cfg = new IgniteClientConfiguration
            {
                Host = "127.0.0.1"
            };

            using (IIgniteClient client = Ignition.StartClient(cfg))
            {
                var cache = client.GetCache <string, Forex>("myCache");

                var forexWritten = Forex.CreateBuilder()
                                   .SetCommon(CommonFields.CreateBuilder().SetId("EUR").SetName("EUR").SetTimestamp(misysdatamodel.DateTime.DefaultInstance).SetSourceRef("tt").SetInstanceRef("zzz").Build())
                                   .AddQuotes(Forex.Types.ForexQuote.CreateBuilder().SetLast(12).Build())
                                   .Build();

                cache.Put("EUR", forexWritten);
                var f = cache.Get("EUR");

                //for (int i = 0; i < 10; i++)
                //    cache.Put(i, i.ToString());

                //for (int i = 0; i < 10; i++)
                //    Console.WriteLine("Got [key={0}, val={1}]", i, cache.Get(i));
            }
        }
Пример #4
0
 public BaseService()
 {
     BaseFields = new CommonFields();
     initSoftDelete();
     this.Repository = GetRepository();
     this.EntityName = GetEntityName();
 }
Пример #5
0
 private void PopulateCommonFields(CommonFields objCommon)
 {
     objCommon.Active       = 1;
     objCommon.CreatedBy    = 1; //TODO - Get user ID
     objCommon.ModifiedBy   = 1; //TODO - Get user ID
     objCommon.DateCreated  = DateTime.Now;
     objCommon.DateModified = DateTime.Now;
     objCommon.BranchId     = _branchID.ToString();
 }
Пример #6
0
 protected override void LoadCommandFields()
 {
     base.LoadCommandFields();
     CommonFields.Clear();
     CommonFields.AddRange(
         FieldUtils.GetModuleFields(
             ModuleInfo.ModuleType,
             CODES.DEFMODFLD.FLDGROUP.SEARCH_EXPORT
             ));
 }
        public void Test_simple_rehydration_scenario_without_Rehydrator()
        {
            const decimal NewPrice0 = (decimal)9.0;
            const decimal NewPrice1 = (decimal)9.1;
            const decimal NewPrice2 = (decimal)9.2;

            // get price records
            IPriceFile record0 = Default_PriceFile.SingleRecord();
            IPriceFile record1 = Default_PriceFile.SingleRecord();

            record1.PROD_ITEM = record1.PROD_ITEM + "_1";

            IPriceFile record2 = Default_PriceFile.SingleRecord();

            record2.PROD_ITEM = record2.PROD_ITEM + "_2";

            List <IPriceFile> PriceFileRecords = new List <IPriceFile>();

            PriceFileRecords.Add(record0);
            PriceFileRecords.Add(record1);
            PriceFileRecords.Add(record2);

            // get common fields with updated info
            PriceFileAdapter adapter0 = new PriceFileAdapter();

            adapter0.Init(record0);
            PriceFileAdapter adapter1 = new PriceFileAdapter();

            adapter1.Init(record1);
            PriceFileAdapter adapter2 = new PriceFileAdapter();

            adapter2.Init(record2);

            ICommonFields cf0 = new CommonFields();
            ICommonFields cf1 = new CommonFields();
            ICommonFields cf2 = new CommonFields();

            cf0.CopyFrom(adapter0);
            cf1.CopyFrom(adapter1);
            cf2.CopyFrom(adapter2);

            // update price info
            cf0.PriceSchedule2_MinPrice = NewPrice0;
            cf1.PriceSchedule2_MinPrice = NewPrice1;
            cf2.PriceSchedule2_MinPrice = NewPrice2;

            adapter0.CopyFrom(cf0);
            adapter1.CopyFrom(cf1);
            adapter2.CopyFrom(cf2);

            Assert.AreEqual(NewPrice0, record0.BOT_PRICE);
            Assert.AreEqual(NewPrice1, record1.BOT_PRICE);
            Assert.AreEqual(NewPrice2, record2.BOT_PRICE);
        }
 public Dictionary <string, object> BindGrid(CommonFields Data)
 {
     try
     {
         var results = Common.Getdata(context.MultipleResults("[dbo].[Sp_BrokerMaster]").With <BindAllFields>().With <BindAllFields2>().Execute("@QueryType", "@UserId", "BindGrid", Dbsecurity.Decrypt(HttpContext.Current.Server.UrlDecode(Data.UserId.Replace("_", "%")))));
         return(results);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #9
0
        static void Main(string[] args)
        {
            var cfg = new IgniteConfiguration
            {
                CacheConfiguration = new[]
                {
                    new CacheConfiguration
                    {
                        Name          = "myCache",
                        QueryEntities = new[]
                        {
                            new QueryEntity
                            {
                                KeyType   = typeof(string),
                                ValueType = typeof(Forex),
                                Fields    = new[]
                                {
                                    new QueryField {
                                        Name = "FINANCING", FieldType = typeof(bool)
                                    }
                                }
                            }
                        }
                    }
                }
            };

            using (var ignite = Ignition.Start(cfg))
            {
                var cache = ignite.GetOrCreateCache <string, Forex>("myCache");

                var forexWritten = Forex.CreateBuilder()
                                   .SetCommon(CommonFields.CreateBuilder().SetId("EUR").SetName("EUR").SetTimestamp(misysdatamodel.DateTime.DefaultInstance).SetSourceRef("tt").SetInstanceRef("zzz").Build())
                                   .SetFinancing(true)
                                   .AddQuotes(Forex.Types.ForexQuote.CreateBuilder().SetLast(12).Build())
                                   .Build();

                cache.Put("EUR", forexWritten);
                var f = cache.Get("EUR");

                var   ff    = cache.Query(new SqlQuery(typeof(Forex), "FINANCING = TRUE")).GetAll();
                int   count = ff.Count;
                Forex f1    = ff.First().Value;

                // Store keys in cache (values will end up on different cache nodes).
                //for (int i = 0; i < 10; i++)
                //    cache.Put(i, $"toto {i}");

                //for (int i = 0; i < 10; i++)
                //    Console.WriteLine("Got [key={0}, val={1}]", i, cache.Get(i));
            }
        }
Пример #10
0
 public Dictionary <string, object> BindAllTabs(CommonFields Data)
 {
     try
     {
         var results = Common.Getdata(context.MultipleResults("[dbo].[sp_linksetup]").With <BindAllTabs>().Execute("@QueryType", "@UserType", "BindAllTabs", Data.UserId));
         return(results);
         // , Dbsecurity.Decrypt(HttpContext.Current.Server.UrlDecode(Data.UserId.Replace("_", "%")))  "@UserId",
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #11
0
 private void Update(CommonFields data)
 {
     AccumQuantity    = data.AccumQuantity;
     BuyOrderMargin   = data.BuyOrderMargin;
     BuyOrderQuantity = data.BuyOrderQuantity;
     OrderMargin      = data.OrderMargin;
     Pnl               = data.Pnl ?? 0;
     PositionMargin    = data.PositionMargin;
     SellOrderMargin   = data.SellOrderMargin;
     SellOrderQuantity = data.SellOrderQuantity;
     TraderBalance     = data.TraderBalance;
     Upnl              = data.Upnl ?? 0;
 }
        //End TrungTT
        protected virtual void LoadCommandFields()
        {
            CommonFields =
                FieldUtils.GetModuleFields(
                    ModuleInfo.ModuleType,
                    CODES.DEFMODFLD.FLDGROUP.COMMON
                    );

            CommonFields.AddRange(
                FieldUtils.GetModuleFields(
                    ModuleInfo.ModuleID,
                    CODES.DEFMODFLD.FLDGROUP.COMMON
                    ));
        }
Пример #13
0
        string FetchInfo(CommonFields field, bool split, int splitPoint)
        {
            string output;

            if (!split)
            {
                output = (string)sysCommonData.GetType().GetField(field.ToString()).GetValue(sysCommonData);
            }
            else
            {
                output = (string)sysCommonData.GetType().GetField(field.ToString()).GetValue(sysCommonData);
                output = output.Split('|')[splitPoint];
            }
            return(output);
        }
Пример #14
0
 protected override void LoadCommandFields()
 {
     base.LoadCommandFields();
     CommonFields.Clear();
     CommonFields.AddRange(
         FieldUtils.GetModuleFields(
             ModuleInfo.ModuleType,
             CODES.DEFMODFLD.FLDGROUP.SEND_MAIL
             ));
     //richEdit = new RichEditControl
     //{
     //    Name = "rtxLoadReport"
     //};
     //mainLayout.Controls.Add(richEdit);
 }
Пример #15
0
        public Dictionary <string, object> BindCustodian(CommonFields Data)
        {
            FAMSEntities context = new FAMSEntities();

            try
            {
                var results = Common.Getdata(context.MultipleResults("[dbo].[Sp_PMSEmployees]").With <BindCustodianFields>()
                                             .Execute("@Querytype", "@UserId", "BindCustodian", Dbsecurity.Decrypt(HttpContext.Current.Server.UrlDecode(Data.UserId.Replace("_", "%")))));
                return(results);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public Dictionary <string, object> BindCustomers(CommonFields Data)
        {
            FAMSEntities context = new FAMSEntities();

            try
            {
                var results = Common.Getdata(context.MultipleResults("[dbo].[Sp_DemoReport]").With <BindCustomerAllFields>()
                                             .Execute("@Querytype", "GetCustomer")); //,  Dbsecurity.Decrypt(HttpContext.Current.Server.UrlDecode(UserId.Replace("_", "%")))
                return(results);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #17
0
 public override void AddField(TableField field)
 {
     foreach (TableField f in TableFields)
     {
         if (f.Name == field.Name)
         {
             f.Value = field.Value;
             return;
         }
     }
     if (CommonFields.Select(f => f.Name).Contains(field.Name))
     {
         field.IsExtend = true;
     }
     TableFields.Add(field);
 }
 public Dictionary <string, object> BindCustomersApi(CommonFields Data)
 {
     return(ObjSRDA.BindCustomers(Data));
 }
        public void Test_simple_rehydration_scenario()
        {
            Rehydrater <PriceFile_Clean, IPriceFile, CommonFields, ICommonFields, PriceFileAdapter
                        , (string SupplierCode, string SupplierPart)> rehydrater;

            rehydrater = new Rehydrater <PriceFile_Clean, IPriceFile, CommonFields, ICommonFields, PriceFileAdapter
                                         , (string SupplierCode, string SupplierPart)>();

            const decimal NewPrice0 = (decimal)9.0;
            const decimal NewPrice1 = (decimal)9.1;
            const decimal NewPrice2 = (decimal)9.2;

            // get price records
            IPriceFile record0 = Default_PriceFile.SingleRecord();
            IPriceFile record1 = Default_PriceFile.SingleRecord();

            record1.PROD_ITEM = record1.PROD_ITEM + "_1";

            IPriceFile record2 = Default_PriceFile.SingleRecord();

            record2.PROD_ITEM = record2.PROD_ITEM + "_2";

            // get common fields with updated info
            PriceFileAdapter adapter0 = new PriceFileAdapter();

            adapter0.Init(record0);
            PriceFileAdapter adapter1 = new PriceFileAdapter();

            adapter1.Init(record1);
            PriceFileAdapter adapter2 = new PriceFileAdapter();

            adapter2.Init(record2);


            ICommonFields cf0 = new CommonFields();
            ICommonFields cf1 = new CommonFields();
            ICommonFields cf2 = new CommonFields();

            cf0.CopyFrom(adapter0);
            cf1.CopyFrom(adapter1);
            cf2.CopyFrom(adapter2);

            // Make sure the common fields being compared to have different info
            cf0.PriceSchedule2_MinPrice = NewPrice0;
            cf1.PriceSchedule2_MinPrice = NewPrice1;
            cf2.PriceSchedule2_MinPrice = NewPrice2;

            List <(IPriceFile IFrom, ICommonFields ITo)> pairs = new List <(IPriceFile, ICommonFields)>();

            pairs.Add(new ValueTuple <IPriceFile, ICommonFields>(record0, cf0));
            pairs.Add(new ValueTuple <IPriceFile, ICommonFields>(record1, cf1));
            pairs.Add(new ValueTuple <IPriceFile, ICommonFields>(record2, cf2));

            rehydrater.From_To_Pairs = pairs;

            rehydrater.UpdateIntegrationRecords();

            Assert.AreEqual(NewPrice0, record0.BOT_PRICE);
            Assert.AreEqual(NewPrice1, record1.BOT_PRICE);
            Assert.AreEqual(NewPrice2, record2.BOT_PRICE);
        }
 public Dictionary <string, object> BindGridApi(CommonFields Data)
 {
     return(ObjDAL.BindGrid(Data));
 }
 public Dictionary <string, object> BindAllTabApi([FromBody] CommonFields Data)
 {
     return(ObjDAL.BindAllTabs(Data));
 }