public void ExportInstance_Constant_Decorated()
        {
            var container = new DependencyInjectionContainer();

            IBasicService basicService = new BasicService {
                Count = 5
            };

            container.Configure(c =>
            {
                c.ExportInstance(basicService);
                c.ExportDecorator(typeof(BasicServiceDecorator)).As(typeof(IBasicService));
            });

            var instance1 = container.Locate <IBasicService>();
            var instance2 = container.Locate <IBasicService>();

            Assert.NotNull(instance1);
            Assert.NotNull(instance2);

            Assert.NotSame(instance1, instance2);

            Assert.IsType <BasicServiceDecorator>(instance1);
            Assert.IsType <BasicServiceDecorator>(instance2);

            Assert.Equal(5, instance1.Count);
            Assert.Equal(5, instance2.Count);
        }
Beispiel #2
0
        public ActionResult storereg(int?id = -1, int?COMPANY_CODE = -1)
        {
            if (SessionHelper.LoginInfo.STORE_CODE != 1 || !(SessionHelper.LoginInfo.STORE.STORE_TYPE == 1 || SessionHelper.LoginInfo.STORE.STORE_TYPE == 4))
            {
                COMPANY_CODE = SessionHelper.LoginInfo.COMPANY_CODE;
            }

            if (SessionHelper.LoginInfo.STORE_CODE != 1 && !(SessionHelper.LoginInfo.STORE.STORE_TYPE == 1 || SessionHelper.LoginInfo.STORE.STORE_TYPE == 4))
            {
                id = SessionHelper.LoginInfo.STORE_CODE;
            }

            T_STORE data = new BasicService().GetStoreList(new T_STORE_COND {
                STORE_CODE = id
            }).FirstOrDefault();

            if (data != null && !string.IsNullOrEmpty(data.PASSWORD))
            {
                data.PASSWORD = "******";
            }
            data = (data == null) ? new T_STORE()
            {
                COMPANY_CODE = COMPANY_CODE, STORE_CODE = -1
            } : data;


            ViewBag.data = data;

            return(View());
        }
Beispiel #3
0
        public FrmDockReport()
        {
            InitializeComponent();

            _errProvider       = new ErrorProvider();
            _basicService      = new BasicService();
            _srvParcel         = new dtxk.business.Services.ServiceParcel(_basicService.dtxkContext);
            _srvPhysicalPerson = new ServicePhysicalPerson(_basicService.dtxkContext);
            _srvLegalPerson    = new ServiceLegalPerson(_basicService.dtxkContext);
            _srvDocPrcl        = new ServiceDocumentedParcel(_basicService.dtxkContext);
            _srvUser           = new ServiceAppUser(_basicService.dtxkContext);
            _businessParam     = new BusinessParam(UserSettings.UserId);



            _workerSearchCadastreNo                     = new BackgroundWorker();
            _workerSearchCadastreNo.DoWork             += new DoWorkEventHandler(_backgroundWorker_DoWork);
            _workerSearchCadastreNo.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_backgroundWorker_RunWorkerCompleted);

            _workerSearchPhysicalPerson                     = new BackgroundWorker();
            _workerSearchPhysicalPerson.DoWork             += new DoWorkEventHandler(_workerSearchPhysicalPerson_DoWork);
            _workerSearchPhysicalPerson.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_workerSearchPhysicalPerson_RunWorkerCompleted);

            _workerSearchLegalPerson                     = new BackgroundWorker();
            _workerSearchLegalPerson.DoWork             += new DoWorkEventHandler(_workerSearchLegalPerson_DoWork);
            _workerSearchLegalPerson.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_workerSearchLegalPerson_RunWorkerCompleted);

            // _workerSearchParcelOwner = new BackgroundWorker();
            // _workerSearchParcelOwner.DoWork += new DoWorkEventHandler(_workerSearchParcelOwner_DoWork);
            //  _workerSearchParcelOwner.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_workerSearchParcelOwner_RunWorkerCompleted);
        }
Beispiel #4
0
        public void FactoryFiveArgWithOutBasicAndOutOfOrderTest()
        {
            var container = new DependencyInjectionContainer();

            var basicService = new BasicService();

            container.Configure(c =>
            {
                c.Export <FiveArgParameterService>().As <IArrayOfObjectsPropertyService>();
                c.ExportInstance(basicService).As <IBasicService>();
            });

            var factory =
                container.Locate <FiveArgParameterService.ActivateWithOutBasicServiceAndOutOfOrder>();

            Assert.NotNull(factory);

            var instance = factory(14.0m, "Blah", 9.0, 5);

            Assert.NotNull(instance);
            Assert.Equal(5, instance.Parameters.Length);
            Assert.Equal("Blah", instance.Parameters[0]);
            Assert.Equal(5, instance.Parameters[1]);
            Assert.Equal(9.0, instance.Parameters[2]);
            Assert.Equal(14.0m, instance.Parameters[3]);
            Assert.Equal(basicService, instance.Parameters[4]);
        }
 public CategoryController(BasicService<Category> categoryService, BasicService<Task> taskService,
     BasicService<SubTask> subTaskService)
 {
     _categoryManager = categoryService;
     _taskManager = taskService;
     _subTaskManager = subTaskService;
 }
Beispiel #6
0
        public object Any(BasicRequest request)
        {
            DTOResponseLayUI dtoResponseLayUi = new DTOResponseLayUI();
            BasicService     service          = new BasicService();
            DTOResponse      response         = new DTOResponse();

            if (request.ACTION == OPAction.QUERY)
            {
                response = service.GetList(request);
            }
            else if (request.ACTION == OPAction.AFFIRM)
            {
                response = service.SaveBasicObject(request);
            }
            else if (request.ACTION == OPAction.OP_01)
            {
                response = service.GetSysparamsList(request);
            }
            else if (request.ACTION == OPAction.OP_02)
            {
                response = service.SaveSysparams(request);
            }
            else
            {
                dtoResponseLayUi.code = -1;
                dtoResponseLayUi.msg  = "未定义的操作类型:" + request.ACTION.ToString();
                return(dtoResponseLayUi);
            }
            return(this.ConvertTo(response));
        }
Beispiel #7
0
        public void FactoryThreeWithOutBasicServiceTest()
        {
            var container = new DependencyInjectionContainer();

            var basicService = new BasicService();

            container.Configure(c =>
            {
                c.Export <ThreeArgParameterService>().As <IArrayOfObjectsPropertyService>();
                c.ExportInstance(basicService).As <IBasicService>();
            });

            var factory =
                container.Locate <ThreeArgParameterService.ActivateWithOutBasicService>();

            Assert.NotNull(factory);

            var instance = factory("Blah", 5);

            Assert.NotNull(instance);

            Assert.Equal(3, instance.Parameters.Length);
            Assert.Equal("Blah", instance.Parameters[0]);
            Assert.Equal(5, instance.Parameters[1]);
            Assert.Equal(basicService, instance.Parameters[2]);
        }
Beispiel #8
0
        public void CanHandleAnAdvancedMaskWithNoSeparators()
        {
            var tokenTable = GenerateTable(Size, Alphabet.Numbers);
            var mask       = Mask.Parse("{{4^}}{{21*}}{{4^}}");
            var service    = new BasicService(new ServiceSettings {
                Mask = mask
            });
            var result = service.Tokenize(TestNumbers, tokenTable);

            Assert.AreEqual(TestNumbers.Length, result.Value.Length);

            var splitTest   = TestNumbers.Split('-');
            var splitResult = result.Value.Split('-');

            for (var i = 0; i < splitTest.Length; i++)
            {
                if (i != 0 && i < splitTest.Length - 1)
                {
                    Assert.AreNotEqual(splitTest[i], splitResult[i]);
                }
                else
                {
                    Assert.AreEqual(splitTest[i], splitResult[i]);
                }
            }
        }
Beispiel #9
0
        public void CanHandleABasicMask()
        {
            var tokenTable = GenerateTable(Size, Alphabet.Numbers);
            var mask       = "****-****-****-****-****-^^^^";
            var service    = new BasicService(new ServiceSettings {
                Mask = Mask.Parse(mask)
            });
            var result = service.Tokenize(TestNumbers, tokenTable);

            Assert.AreEqual(TestNumbers.Length, result.Value.Length);

            var splitTest   = TestNumbers.Split('-');
            var splitResult = result.Value.Split('-');
            var splitMask   = mask.Split('-');

            for (var i = 0; i < splitTest.Length; i++)
            {
                if (splitMask[i] == "****")
                {
                    Assert.AreNotEqual(splitTest[i], splitResult[i]);
                }
                if (splitMask[i] == "^^^^")
                {
                    Assert.AreEqual(splitTest[i], splitResult[i]);
                }
            }
        }
        public void InjectionValueProvider_Test()
        {
            var container = new DependencyInjectionContainer();

            var basicService = new BasicService {
                Count = 15
            };

            container.Configure(c =>
            {
                c.AddInjectionValueProvider(new ValueProvider {
                    BasicService = basicService
                });
                c.Export(typeof(DependentService <>)).As(typeof(IDependentService <>));
                c.Export <MultipleService1>().As <IMultipleService>();
            });

            var valueProvderInstance = container.Locate <IDependentService <IBasicService> >();

            Assert.NotNull(valueProvderInstance);
            Assert.NotNull(valueProvderInstance.Value);
            Assert.Equal(15, valueProvderInstance.Value.Count);

            var nonValueProviderInstance = container.Locate <IDependentService <IMultipleService> >();

            Assert.NotNull(valueProvderInstance);
            Assert.NotNull(nonValueProviderInstance.Value);
        }
Beispiel #11
0
        public void Factory_Depend_On_IExportLocatorScope_IInjectionContext()
        {
            var container = new DependencyInjectionContainer();

            container.Configure(c =>
            {
                c.ExportFactory <IInjectionContext, IBasicService>(context =>
                {
                    var basic = new BasicService {
                        Count = (int)context.GetExtraData("count")
                    };

                    return(basic);
                });
                c.ExportFactory <IExportLocatorScope, IInjectionContext, IDependentService <IBasicService> >(
                    (scope, context) =>
                {
                    var basicService = scope.Locate <IBasicService>(context);
                    return(new DependentService <IBasicService>(basicService));
                });
            });

            var service = container.Locate <IDependentService <IBasicService> >(new { count = 10 });

            Assert.NotNull(service);
            Assert.NotNull(service.Value);
            Assert.Equal(10, service.Value.Count);
        }
Beispiel #12
0
        public void Dynamic_Constructor_Parameter_Returns_Default()
        {
            var container = new DependencyInjectionContainer();

            var basicService = new BasicService {
                Count = 10
            };

            container.Configure(
                c =>
                c.Export <DependentService <IBasicService> >()
                .As <IDependentService <IBasicService> >()
                .WithCtorParam <IBasicService>()
                .IsDynamic()
                .DefaultValue(basicService));

            using (var childScope = container.CreateChildScope())
            {
                var instance = childScope.Locate <IDependentService <IBasicService> >();

                Assert.NotNull(instance);
                Assert.NotNull(instance.Value);
                Assert.Equal(10, instance.Value.Count);

                childScope.Configure(c => c.Export <BasicService>().As <IBasicService>().ImportProperty(b => b.Count).DefaultValue(20));

                instance = childScope.Locate <IDependentService <IBasicService> >();

                Assert.NotNull(instance);
                Assert.NotNull(instance.Value);
                Assert.Equal(20, instance.Value.Count);
            }
        }
Beispiel #13
0
        public void PercentageIs0WhenNoneReplaced()
        {
            var tokenTable = GenerateTable(Size, Alphabet.English);
            var service    = new BasicService(new ServiceSettings());
            var result     = service.Tokenize(TestStringNoneReplaced, tokenTable);

            Assert.AreEqual(0, result.PercentReplaced);
        }
Beispiel #14
0
 public frmHacerDiagnostico()
 {
     InitializeComponent();
     _tableName   = "Diagnostico";
     _idColName   = "ID_DIAGNOSTICO";
     basicService = new BasicService(_tableName, _idColName);
     SetDataList(basicService.MostrarTodo());
 }
Beispiel #15
0
        public void ZeroLengthStringIsHandled()
        {
            var tokenTable = GenerateTable(Size, Alphabet.English);
            var service    = new BasicService(new ServiceSettings());
            var result     = service.Tokenize(string.Empty, tokenTable);

            Assert.AreEqual(0, result.Value.Length);
        }
Beispiel #16
0
        public void FlagIndicatesWhenNotFullyReplaced()
        {
            var tokenTable = GenerateTable(Size, Alphabet.English);
            var service    = new BasicService(new ServiceSettings());
            var result     = service.Tokenize(TestString1, tokenTable);

            Assert.IsFalse(result.AllTextReplaced);
        }
Beispiel #17
0
        public void CanTokeniseABasicString()
        {
            var tokenTable   = GenerateTable(Size, Alphabet.English);
            var service      = new BasicService(new ServiceSettings());
            var resultString = service.Tokenize(TestString1, tokenTable).Value;

            Assert.AreEqual(TestString1.Length, resultString.Length);
            Assert.AreNotEqual(TestString1, resultString);
        }
Beispiel #18
0
        public ActionResult MemberList(int?STORE_CODE)
        {
            var store = new BasicService().GetStoreList(new T_STORE_COND {
                STORE_CODE = STORE_CODE
            }).FirstOrDefault();

            ViewBag.data = store;
            return(View());
        }
Beispiel #19
0
        public void TestCtor()
        {
            DatePriceDescriptor desc = new DatePriceDescriptor(sName, sDescription, DateTime.MaxValue, price);

            s1 = new BasicService(desc);
            Assert.AreEqual(sName, s1.Name);
            Assert.AreEqual(sDescription, s1.Description);
            Assert.AreEqual(price, s1.Price);
        }
Beispiel #20
0
        public ActionResult EmployeeList(int?STORE_CODE)
        {
            var store = new BasicService().GetStoreList(new T_STORE_COND {
                STORE_CODE = Convert.ToInt32(STORE_CODE.ToString(SessionHelper.LoginInfo.EMPLOYEE.STORE_CODE.ToString("")))
            }).FirstOrDefault();

            ViewBag.data = store;
            return(View());
        }
Beispiel #21
0
        public void NullStringIsHandled()
        {
            var    tokenTable = GenerateTable(Size, Alphabet.English);
            var    service    = new BasicService(new ServiceSettings());
            string testString = null;
            var    result     = service.Tokenize(testString, tokenTable);

            Assert.AreEqual(0, result.Value.Length);
        }
Beispiel #22
0
        public void ExtraDataLocate()
        {
            var container = new DependencyInjectionContainer();

            var service = new BasicService();

            var instance = container.Locate <IBasicService>(new { service });

            Assert.Same(service, instance);
        }
Beispiel #23
0
        public JsonResult CompanySave(T_COMPANY Param)
        {
            Param.INSERT_CODE = SessionHelper.LoginInfo.MEMBER.MEMBER_CODE;
            RTN_SAVE_DATA rtn = new BasicService().CompanySave(Param);

            return(new JsonResult()
            {
                Data = rtn
            });
        }
Beispiel #24
0
        public void CanHandleAMaskMismatchForMatchAndKeep()
        {
            var tokenTable = GenerateTable(Size, Alphabet.Numbers);
            var mask       = "****-****-****-****-*****-^^^";
            var service    = new BasicService(new ServiceSettings {
                Mask = Mask.Parse(mask)
            });
            var exception = Assert.ThrowsException <Exception>(() => service.Tokenize(TestNumbers, tokenTable));

            Assert.AreEqual("Mask is set to MustMatchAndKeep does not match. Expected: - Found: 5", exception.Message);
        }
Beispiel #25
0
        public void CanDeTokeniseABasicStringInConsistentMode()
        {
            var tokenTable = GenerateTable(Size, Alphabet.English);
            var service    = new BasicService(new ServiceSettings {
                Behaviour = Behaviour.Consistent
            });
            var resultString = service.Tokenize(TestString1, tokenTable).Value;

            resultString = service.Detokenize(new BasicRequest(resultString), tokenTable).Value;
            Assert.AreEqual(TestString1, resultString);
        }
Beispiel #26
0
        public void CanHandleAMaskMismatch()
        {
            var tokenTable = GenerateTable(Size, Alphabet.Numbers);
            var mask       = "****-****-****-****-****-^^^";
            var service    = new BasicService(new ServiceSettings {
                Mask = Mask.Parse(mask)
            });
            var exception = Assert.ThrowsException <Exception>(() => service.Tokenize(TestNumbers, tokenTable));

            Assert.AreEqual("Mask Length does not match the source string length.", exception.Message);
        }
        public void LocateOrDefault_NonGeneric_Return_Default()
        {
            var container = new DependencyInjectionContainer();

            var basicService = new BasicService();

            var instance = container.LocateOrDefault(typeof(IBasicService), basicService);

            Assert.NotNull(instance);
            Assert.Same(basicService, instance);
        }
Beispiel #28
0
        public BasicServiceTest()
        {
            sName        = "Servizio Base";
            sDescription = "Descrizione del servizio base";
            august1010   = new DateTime(2010, 8, 10);
            august1510   = new DateTime(2010, 8, 15);
            price        = 5.10;
            DatePriceDescriptor desc = new DatePriceDescriptor(sName, sDescription, august1010, august1510, price);

            s1 = new BasicService(desc);
        }
Beispiel #29
0
 private static void eResult(BasicService __service = null)
 {
     if (__service.resultSuccess)
     {
         Debug.Log("==============> success posting " + __service);
     }
     else
     {
         Debug.Log("==============> error posting: " + __service.resultErrorMessage);
     }
 }
Beispiel #30
0
        public void BasicService_Max_ReturnsNullWhenInputIsEmpty()
        {
            // Arrange
            var svc         = new BasicService();
            var stockPrices = new StockPrice[0];

            // Act
            var result = svc.Max(stockPrices);

            // Assert
            Assert.IsFalse(result.HasValue);
        }
Beispiel #31
0
        public void DifferentTablesGenerateDifferentResults()
        {
            var tokenTable = GenerateTable(Size, Alphabet.English);
            var service    = new BasicService(new ServiceSettings());

            var resultString1 = service.Tokenize(TestString1, tokenTable).Value;

            tokenTable = GenerateTable(Size, Alphabet.English);
            var resultString2 = service.Tokenize(TestString1, tokenTable).Value;

            Assert.AreNotEqual(resultString1, resultString2);
        }