Ejemplo n.º 1
0
        /// <param name="args">arg 1 - connection string (in quotes), arg 2 - port</param>
        static void Main(string[] args)
        {
            connectionString = args[0];
            using (var context = new Context(connectionString))
            {
                var tcpListener = new TcpListener(IPAddress.Any, int.Parse(args[1]));
                tcpListener.Start();
                Listen(tcpListener);

                var dictionaryService = new DictionaryService(context);
                while (true)
                {
                    var command = Console.ReadLine();
                    if (command == "create")
                    {
                        Console.WriteLine("Enter file path");
                        dictionaryService.Create(Console.ReadLine());
                    }
                    else if (command == "update")
                    {
                        Console.WriteLine("Enter file path");
                        dictionaryService.Update(Console.ReadLine());
                    }
                    else if (command == "delete")
                    {
                        dictionaryService.Delete();
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void Should_Create_with_DictionaryTable()
        {
            Dictionary dictionary = new Dictionary
            {
                Code             = 100,
                CompanyId        = 1,
                CreatedBy        = 1,
                DateAdded        = DateTime.Now,
                DateUpdated      = DateTime.Now,
                DepartmentId     = 1,
                Description      = "",
                DictionaryType   = "INSERTED",
                FullDescription  = "INSERTED",
                Hierarchy        = 1,
                Id2              = 1,
                Id3              = 1,
                UpdatedBy        = 1,
                IsDeleted        = false,
                DictionaryTypeId = 20
            };

            var ctx = new WorkBenchContext();
            var dictionaryService = new DictionaryService(
                new UnitOfWork(ctx),
                new GenericDataRepository <Dictionary>(new WorkBenchContext())
                );

            Assert.DoesNotThrow(() =>
            {
                dictionaryService.Create(dictionary);
                dictionaryService.Update(dictionary);
                dictionaryService.GetAll();
                dictionaryService.Delete(dictionary);
            });
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 创建dic数据
 /// </summary>
 /// <param name="groupName"></param>
 /// <param name="value"></param>
 public void CreateDictionary(string groupName, string value)
 {
     DAL.DictionaryService dicSvc = new DictionaryService();
     dicSvc.Create(new Dictionary()
     {
         GroupName = groupName, Value = value
     });
 }
Ejemplo n.º 4
0
        public void CreateDictionary()
        {
            var dictionary = new FormModel
            {
                Name     = "Test3",
                Color    = null,
                Type     = 1,
                Value    = null,
                TypeList = new List <Data.Models.Features.SelectModel <int> >(),
            };

            var result = dictionaryService.Create(dictionary);

            Assert.IsNotNull(result);
        }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            using (var context = new Context())
            {
                var dictionaryService = new DictionaryService(context);
                if (args.Length < 1)
                {
                    while (true)
                    {
                        string prefix = String.Empty;
                        var    key    = Console.ReadKey();
                        if (key.Key == ConsoleKey.Escape || key.Key == ConsoleKey.Enter)
                        {
                            return;
                        }

                        prefix += key.KeyChar;
                        prefix += Console.ReadLine();
                        if (string.IsNullOrWhiteSpace(prefix))
                        {
                            return;
                        }
                        dictionaryService.Read(prefix);
                    }
                }

                else if (args.Length == 1)
                {
                    var command = args[0];
                    if (command == "create")
                    {
                        Console.WriteLine("Enter file path");
                        dictionaryService.Create(Console.ReadLine());
                    }
                    else if (command == "update")
                    {
                        Console.WriteLine("Enter file path");
                        dictionaryService.Update(Console.ReadLine());
                    }
                    else if (command == "delete")
                    {
                        dictionaryService.Delete();
                    }
                }
            }
        }