public static SqlCommand NewCmd_usp_Service_Init(DI.usp_Service_InitParameters p)
		{
			SqlCommand cmd = new SqlCommand("[usp].[Service_Init]");
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.Parameters.Add(new SqlParameter("RETURN_VALUE", System.Data.SqlDbType.Int, 0, ParameterDirection.ReturnValue, false, 0, 0, null, DataRowVersion.Current, null));
			return cmd;
		}
		public static SqlCommand NewCmd_usp_Service_Insert(DI.usp_Service_InsertParameters p)
		{
			SqlCommand cmd = new SqlCommand("[usp].[Service_Insert]");
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.Parameters.Add(new SqlParameter("RETURN_VALUE", System.Data.SqlDbType.Int, 0, ParameterDirection.ReturnValue, false, 0, 0, null, DataRowVersion.Current, null));
			if (p.CheckIsServiceTypeIDChanged())
			{
				cmd.Parameters.Add(new SqlParameter("ServiceTypeID", System.Data.SqlDbType.Int, 4, ParameterDirection.Input, false, 10, 0, "ServiceTypeID", DataRowVersion.Current, null));
			}
			if (p.CheckIsCreateTimeChanged())
			{
				cmd.Parameters.Add(new SqlParameter("CreateTime", System.Data.SqlDbType.DateTime2, 8, ParameterDirection.Input, false, 27, 7, "CreateTime", DataRowVersion.Current, null));
			}
			if (p.CheckIsNameChanged())
			{
				cmd.Parameters.Add(new SqlParameter("Name", System.Data.SqlDbType.NVarChar, 50, ParameterDirection.Input, false, 0, 0, "Name", DataRowVersion.Current, null));
			}
			if (p.CheckIsVersionChanged())
			{
				cmd.Parameters.Add(new SqlParameter("Version", System.Data.SqlDbType.Int, 4, ParameterDirection.Input, false, 10, 0, "Version", DataRowVersion.Current, null));
			}
			if (p.CheckIsFilePathChanged())
			{
				cmd.Parameters.Add(new SqlParameter("FilePath", System.Data.SqlDbType.NVarChar, 250, ParameterDirection.Input, false, 0, 0, "FilePath", DataRowVersion.Current, null));
			}
			if (p.CheckIsDescriptionChanged())
			{
				cmd.Parameters.Add(new SqlParameter("Description", System.Data.SqlDbType.NVarChar, -1, ParameterDirection.Input, false, 0, 0, "Description", DataRowVersion.Current, null));
			}
			return cmd;
		}
示例#3
0
 protected UMLNode(UMLDiagram ownerDiagram, DI.GraphNode graphNode)
     : base(ownerDiagram, graphNode)
 {
     // hack para evitar un bug...
     // si no hago esto al setear Width repinta todo, con lo cual borra el Height
     _layout_suspended = true;
     _graph_node = graphNode;
      			Width = graphNode.Size.Width;
     Height = graphNode.Size.Height;
     _layout_suspended = false;
     Move (graphNode.Position.X, graphNode.Position.Y);
 }
示例#4
0
        public void TestInjetedInvokerCallsInvoked()
        {
            var wasInvoked = false;

            DI.MapSingleton <TestInvoker>();
            DI.Get <TestInvoker>().Invoked += (sender, e) =>
            {
                wasInvoked = true;
            };

            DI.Get <TestInvoker>().Invoke(new TestInvokerArgs("Hello World"));

            Assert.IsTrue(wasInvoked);
        }
示例#5
0
        protected virtual void btnSave_Click(object sender, EventArgs e)
        {
            obj.Validate(true);
            ErrorList valErr = obj.GetValidationErrors();

            errors.List.DataSource = valErr.Errors;
            errors.List.DataBind();
            if (valErr.HasErrors())
            {
                return;
            }

            ISalesOrderService svcSalesOrder = DI.Resolve <ISalesOrderService>();

            try
            {
                // for new objects create the object and store its key
                if (IsNew)
                {
                    SalesOrderDetail_CreateInput inDetail_Create = new SalesOrderDetail_CreateInput();
                    obj.ToDataContract(inDetail_Create);
                    SalesOrderDetail_CreateOutput outDetail_Create;
                    using (TimeTracker.ServiceCall)
                        outDetail_Create = svcSalesOrder.Detail_Create(inDetail_Create);
                    obj.FromDataContract(outDetail_Create);
                    IsNew = false;
                }
                else
                {
                    SalesOrderDetail_UpdateInput_Data inDetail_Update_Data = new SalesOrderDetail_UpdateInput_Data();
                    obj.ToDataContract(inDetail_Update_Data);
                    using (TimeTracker.ServiceCall)
                        svcSalesOrder.Detail_Update((int)obj.SalesOrderDetailIdProperty.TransportValue, inDetail_Update_Data);
                }
                obj.SetModified(false, true);
                OnSaved(EventArgs.Empty);
            }
            catch (Exception ex)
            {
                errors.List.DataSource = ErrorList.FromException(ex).Errors;
                errors.List.DataBind();
            }
            finally
            {
                if (svcSalesOrder is IDisposable)
                {
                    ((IDisposable)svcSalesOrder).Dispose();
                }
            }
        }
示例#6
0
        public void ClassesShouldDefaultToResolvingToThemselves()
        {
            DI.Init(_testAssembly);

            var libraryClass = _testAssembly.Resolve <LibraryClass>(GetType());

            Assert.IsTrue(libraryClass.Is <LibraryClass>(GetType()), $"Expected {nameof(LibraryClass)} but was {libraryClass?.GetType().Name ?? "<null>"}");
            var myBaseClass = _testAssembly.Resolve <MyBaseClass>(GetType());

            Assert.IsTrue(myBaseClass.Is <MyBaseClass>(GetType()), $"Expected {nameof(MyBaseClass)} but was {myBaseClass?.GetType().Name ?? "<null>"}");
            var myClass = _testAssembly.Resolve <MyClass>(GetType());

            Assert.IsTrue(myClass.Is <MyClass>(GetType()), $"Expected {nameof(MyClass)} but was {myClass?.GetType().Name ?? "<null>"}");
        }
示例#7
0
        public void ExplicitNameTest()
        {
            configuration.Register <I, Impl1>(name: "1");
            configuration.Register <I, Impl2>(name: "2");

            DI = new DI(configuration);

            var actual = DI.Resolve <I>("1");

            Assert.AreEqual(typeof(Impl1), actual.GetType());

            actual = DI.Resolve <I>("2");
            Assert.AreEqual(typeof(Impl2), actual.GetType());
        }
        public void POCOImport()
        {
            var typeStructure = new TypeStructure
            {
                IsArray     = false,
                IsSytemType = false,
                Name        = "Person",
                TypeName    = "PersonType"
            };

            var jsCode = ((JSRenderble)DI.Get <IImport>(typeStructure)).GetText();

            Assert.AreEqual(jsCode, "import {PersonType} from \"./PersonType.js\";");
        }
        public void Simulate()
        {
            if (picker.PickCompleted)
            {
                var picked = picker.GetPickedTest();
                DI.Get <EngineTestState>().SetActiveTest(picked.TestMethod);
            }

            if (TW.Graphics.Keyboard.IsKeyPressed(Key.F5))
            {
                //TODO: disable all user input for simulators?
                picker.ShowTestPicker();
            }
        }
示例#10
0
        public void Export()
        {
            var typeStructure = new TypeStructure
            {
                IsArray = false,
                IsSytemType = false,
                Name = "Person",
                TypeName = "PersonType"
            };
           
            var jsCode = ((JSRenderble)DI.Get<IExport>(typeStructure)).GetText();

            Assert.AreEqual(jsCode, "export {PersonType};");
        }
        private void LoadMagicData()
        {
            if (Magic is null)
            {
                return;
            }

            var mc = DI.Fetch <MagicController>();

            foreach (var magicId in Magic)
            {
                mc.LearnMagic(magicId);
            }
        }
示例#12
0
        public void Scopes()
        {
            var scope = DI.NewScope();


            var scope2 = DI.NewScope();


            var child = DI.Get <IChild>(scope);

            var child2 = DI.Get <IChild>(scope2);

            Assert.AreNotEqual(child, child2);
        }
        private async void SaveExecute(object obj)
        {
            IEncounterConfigurationManager host;

            if (DI.TryGetService <IEncounterConfigurationManager>(out host))
            {
                var saveData = new EncounterConfigurationData()
                {
                    MappingKey = BossMapping,
                    Templates  = Templates.ToList()
                };
                await host.SaveAsync(saveData);
            }
        }
示例#14
0
        /// <returns>Returns random room within specific level range</returns>
        // TODO: Move to ILevelFiltrable
        public static LootTableData GetLootTable()
        {
            // Get current level of dungeon, defaults to 1
            var level = DI.Fetch <SavableGame>()?.World.DungeonFloor ?? 1;

            // Fetches all rooms that are within the range of current level
            var filteredOutTables = Repository.Raw.Where(s =>
                                                         s.Value.SpawnOnLevelsInRangeOf.min <= level && s.Value.SpawnOnLevelsInRangeOf.max >= level).ToList();

            // Returns random room, or null on fail
            return(filteredOutTables.Count == 0
                ? null
                : filteredOutTables[R.RandomRange(0, filteredOutTables.Count)].Value);
        }
示例#15
0
 // This method gets called by the runtime. Use this method to add services to the container.
 public void ConfigureServices(IServiceCollection services)
 {
     DI.AddConfig(services);
     services.AddControllers().AddNewtonsoftJson(options => {
         options.SerializerSettings.NullValueHandling = NullValueHandling.Ignore;
         options.SerializerSettings.Converters.Add(new StringEnumConverter());
     });
     services.AddSwaggerGen(c =>
     {
         c.SwaggerDoc("v1", new OpenApiInfo {
             Title = "Assignment API", Version = "v1"
         });
     });
 }
示例#16
0
    public override void OnStart(Action callback)
    {
        gameObject.SetActive(true);
        guiSound = new GuiSound();

        NextLevelButton.onClick.AddListener(() =>
        {
            AudioManager.Instance.PlaySound(guiSound);
            DI.Resolve <LoadLevelState>().NextLevel();
            GameStatesManager.EnableState(DI.Resolve <LoadLevelState>());
        });

        callback?.Invoke();
    }
示例#17
0
        public void Delete_ShouldUnassignFromCtegories()
        {
            //Arrange
            ResetDataBase();
            ProductsBL productsBL = DI.Resolve <ProductsBL>();

            //Act
            productsBL.Delete(1);

            //Assert
            bool isDeleted = EntityFrameworkDbContext.Products.Where(product => product.Id == 1).Select(product => product.IsDeleted).Single();

            Assert.That(isDeleted, Is.True);
        }
示例#18
0
 void Start()
 {
     _inner5 = DI.Get().Resolve <InnerClass5>();
     Debug.Log("---- start InjectCodeTest ----");
     if (_inner5 != null)
     {
         _inner5.ShowMessage();
     }
     else
     {
         Debug.LogWarning("_inner5 is NULL");
     }
     Debug.Log("---- end InjectCodeTest ----\n");
 }
示例#19
0
        public void GetParentCategories()
        {
            //Arrange
            ResetDataBase();
            ProductCategoriesRepository productCategoriesRepository = DI.Resolve <ProductCategoriesRepository>();

            //Act
            IList <ProductCategory> productCategories = productCategoriesRepository.GetParentCategories(13);

            //Asserts
            Assert.That(productCategories.Count, Is.EqualTo(2));
            Assert.That(productCategories[0].Id, Is.EqualTo(7));
            Assert.That(productCategories[1].Id, Is.EqualTo(12));
        }
示例#20
0
    private static object Resolve(Type type)
    {
        object obj;

        if (!DI.m_instancesMap.TryGetValue(type, out obj))
        {
            return(DI.AddCreate(type));
        }
        if (DI.m_placeholder == obj)
        {
            throw new Exception("Cyclic dependency " + type);
        }
        return(obj);
    }
示例#21
0
        public void GetActualRate_2()
        {
            //Arrange
            ResetDataBase();

            DateTime date = DateTime.Now;
            ICurrencyRatesRepository currencyRatesRepository = DI.Resolve <ICurrencyRatesRepository>();

            //Act
            CurrencyRate currencyRate = currencyRatesRepository.GetActualRate(3, date);

            //Asserts
            Assert.That(currencyRate.Id, Is.EqualTo(1));
        }
 /// <summary>
 /// Deserializes all attributes for given object from the stream
 /// </summary>
 public void DeserializeAttributes(IModelObject obj, SectionedStreamReader strm)
 {
     while (strm.CurrentSection == "EntityAttributes")
     {
         try
         {
             readAttribute(obj, strm);
         }
         catch (Exception ex)
         {
             DI.Get <IErrorLogger>().Log(ex, "Can't deserialize attribute!");
         }
     }
 }
示例#23
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {


            services.AddControllersWithViews()
            .AddNewtonsoftJson(x =>
            
            
            
             {
                 x.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
                 x.SerializerSettings.ContractResolver = new DefaultContractResolver
    {
       NamingStrategy = new DefaultNamingStrategy()
    };
             });
 

            // In production, the React files will be served from this directory
            services.AddSpaStaticFiles(configuration =>
            {
                configuration.RootPath = "ClientApp/build";
            });
            

               

DI.Config(services);


/*
string conString = Microsoft
    .Extensions
    .Configuration
    .ConfigurationExtensions
    .GetConnectionString(this.Configuration, "KhInventoryContext");*/

services.AddDbContext<KhInventoryDbContext>(options =>
    options.UseSqlServer(Configuration.GetConnectionString("KhInventoryContext")));
    //options.UseSqlite("Data Source=(localdb)\\MSSQLLocalDB;Database=KhosrowshahDb"));
//options.UseInMemoryDatabase("KhInventoryContext"));
            //options.UseSqlServer(Configuration.GetConnectionString("KhInventoryContext")));
            ;



    // Register the Swagger services
    services.AddSwaggerDocument();

        }
示例#24
0
    public override void OnStart(Action callback)
    {
        guiSound    = new GuiSound();
        playerShips = Resources.LoadAll <PlayerShip>("");
        if (selectedIndex == 0)
        {
            SelectedShip = playerShips[selectedIndex];
        }


        LeftButton.onClick.AddListener(() => {
            AudioManager.Instance.PlaySound(guiSound);
            if (selectedIndex == 0)
            {
                selectedIndex = playerShips.Length - 1;
            }
            else
            {
                selectedIndex--;
            }
            SelectedShip = playerShips[selectedIndex];
        });


        RightButton.onClick.AddListener(() => {
            AudioManager.Instance.PlaySound(guiSound);
            if (selectedIndex == playerShips.Length - 1)
            {
                selectedIndex = 0;
            }
            else
            {
                selectedIndex++;
            }
            SelectedShip = playerShips[selectedIndex];
        });


        StartButton.onClick.AddListener(() => {
            AudioManager.Instance.PlaySound(guiSound);
            DI.Resolve <LoadLevelState>().SetLevel(0);
            DI.Resolve <LoadLevelState>().SetPlayerShip(selectedShip);
            GameStatesManager.EnableState(DI.Resolve <LoadLevelState>());
        });


        gameObject.SetActive(true);
        callback?.Invoke();
    }
示例#25
0
        private void btnEditar_Click(object sender, EventArgs e)
        {
            if (dgvDatos.SelectedRows.Count == 0)
            {
                return;
            }

            DataGridViewRow        r = dgvDatos.SelectedRows[0];
            var                    necesidadListDto = r.Tag as NecesidadEspecialListDto;
            var                    necesidadCopia   = (NecesidadEspecialListDto)necesidadListDto.Clone();
            frmNecesidadEspecialAE frm = DI.Create <frmNecesidadEspecialAE>();

            frm.Titulo("Editar Necesidad Especial");
            NecesidadEspecialEditDto necesidadEditDto = mapper.Map <NecesidadEspecialEditDto>(necesidadListDto);

            frm.SetNecesidadEspecial(necesidadEditDto);
            DialogResult dr = frm.ShowDialog(this);

            if (dr == DialogResult.Cancel)
            {
                return;
            }

            necesidadEditDto = frm.GetNecesidadESpecial();
            if (servicio.Existe(necesidadEditDto))
            {
                frmMessageBox messageBox = new frmMessageBox();
                messageBox.Show();
                messageBox.ShowError("Necesidad Especial Existente", $"{necesidadEditDto.Descripcion} ya existe en la base de datos");
                SetearFila(r, necesidadCopia);
                return;
            }
            try
            {
                servicio.Guardar(necesidadEditDto);
                var nListDto = mapper.Map <NecesidadEspecialListDto>(necesidadEditDto);
                SetearFila(r, nListDto);
                frmMessageBox messageBox = new frmMessageBox();
                messageBox.Show();
                messageBox.ShowInfo("Necesidad Especial Editada", $"{nListDto.Descripcion} " +
                                    $"ah sido editada correctamente");
            }
            catch (Exception)
            {
                frmMessageBox messageBox = new frmMessageBox();
                messageBox.Show();
                messageBox.ShowError("Error", $"Ocurrio un problema no se pudo completar la transaccion. Intentelo nuevamente.");
            }
        }
示例#26
0
        private void btnEditar_Click(object sender, EventArgs e)
        {
            if (dgvDatos.SelectedRows.Count == 0)
            {
                return;
            }

            DataGridViewRow  r          = dgvDatos.SelectedRows[0];
            var              labListDto = r.Tag as LaboratorioListDto;
            var              labCopia   = (LaboratorioListDto)labListDto.Clone();
            frmLaboratorioAE frm        = DI.Create <frmLaboratorioAE>();

            frm.Titulo("Editar Laboratorio");
            LaboratorioEditDto labEditDto = mapper.Map <LaboratorioEditDto>(labListDto);

            frm.SetLaboratorio(labEditDto);
            DialogResult dr = frm.ShowDialog(this);

            if (dr == DialogResult.Cancel)
            {
                return;
            }

            labEditDto = frm.GetLaboratorio();
            if (servicio.Existe(labEditDto))
            {
                frmMessageBox messageBox = new frmMessageBox();
                messageBox.Show();
                messageBox.ShowError("Laboratorio Existente", $"{labEditDto.Descripcion} ya existe en la base de datos");
                SetearFila(r, labCopia);
                return;
            }
            try
            {
                servicio.Guardar(labEditDto);
                var lListDto = mapper.Map <LaboratorioListDto>(labEditDto);
                SetearFila(r, lListDto);
                frmMessageBox messageBox = new frmMessageBox();
                messageBox.Show();
                messageBox.ShowInfo("Laboratorio Editada", $"{lListDto.Descripcion} " +
                                    $"ah sido editada correctamente");
            }
            catch (Exception)
            {
                frmMessageBox messageBox = new frmMessageBox();
                messageBox.Show();
                messageBox.ShowError("Error", $"Ocurrio un problema no se pudo completar la transaccion. Intentelo nuevamente.");
            }
        }
示例#27
0
        private void btnEditar_Click(object sender, EventArgs e)
        {
            if (dgvDatos.SelectedRows.Count == 0)
            {
                return;
            }

            DataGridViewRow r = dgvDatos.SelectedRows[0];
            var             provinciaListDto = r.Tag as ProvinciaListDto;
            var             provinciaCopia   = (ProvinciaListDto)provinciaListDto.Clone();
            frmProvinciasAE frm = DI.Create <frmProvinciasAE>();

            frm.Titulo("Editar Provincia");
            ProvinciaEditDto provinciaEditDto = mapper.Map <ProvinciaEditDto>(provinciaListDto);

            frm.SetProvincia(provinciaEditDto);
            DialogResult dr = frm.ShowDialog(this);

            if (dr == DialogResult.Cancel)
            {
                return;
            }

            provinciaEditDto = frm.GetProvincia();
            if (servicio.Existe(provinciaEditDto))
            {
                frmMessageBox messageBox = new frmMessageBox();
                messageBox.Show();
                messageBox.ShowError("Provincia Existente", $"{provinciaEditDto.NombreProvincia} ya existe en la base de datos");
                SetearFila(r, provinciaCopia);
                return;
            }
            try
            {
                servicio.Guardar(provinciaEditDto);
                var pListDto = mapper.Map <ProvinciaListDto>(provinciaEditDto);
                SetearFila(r, pListDto);
                frmMessageBox messageBox = new frmMessageBox();
                messageBox.Show();
                messageBox.ShowInfo("Provincia Editada", $"{pListDto.NombreProvincia} " +
                                    $"ah sido editada correctamente");
            }
            catch (Exception)
            {
                frmMessageBox messageBox = new frmMessageBox();
                messageBox.Show();
                messageBox.ShowError("Error", $"Ocurrio un problema no se pudo completar la transaccion. Intentelo nuevamente.");
            }
        }
示例#28
0
        private void btnEditar_Click(object sender, EventArgs e)
        {
            if (dgvDatos.SelectedRows.Count == 0)
            {
                return;
            }

            DataGridViewRow        r            = dgvDatos.SelectedRows[0];
            var                    formaListDto = r.Tag as FormaFarmaceuticaListDto;
            var                    formaCopia   = (FormaFarmaceuticaListDto)formaListDto.Clone();
            frmFormaFarmaceuticaAE frm          = DI.Create <frmFormaFarmaceuticaAE>();

            frm.Titulo("Editar Forma Farmaceutica");
            FormaFarmaceuticaEditDto formaEditDto = mapper.Map <FormaFarmaceuticaEditDto>(formaListDto);

            frm.SetForma(formaEditDto);
            DialogResult dr = frm.ShowDialog(this);

            if (dr == DialogResult.Cancel)
            {
                return;
            }

            formaEditDto = frm.GetForma();
            if (servicio.Existe(formaEditDto))
            {
                frmMessageBox messageBox = new frmMessageBox();
                messageBox.Show();
                messageBox.ShowError("Forma Farmaceutica Existente", $"{formaEditDto.Descripcion} ya existe en la base de datos");
                SetearFila(r, formaCopia);
                return;
            }
            try
            {
                servicio.Agregar(formaEditDto);
                var fListDto = mapper.Map <FormaFarmaceuticaListDto>(formaEditDto);
                SetearFila(r, fListDto);
                frmMessageBox messageBox = new frmMessageBox();
                messageBox.Show();
                messageBox.ShowInfo("Forma Farmaceutica Editada", $"{fListDto.Descripcion} " +
                                    $"ah sido editada correctamente");
            }
            catch (Exception)
            {
                frmMessageBox messageBox = new frmMessageBox();
                messageBox.Show();
                messageBox.ShowError("Error", $"Ocurrio un problema no se pudo completar la transaccion. Intentelo nuevamente.");
            }
        }
示例#29
0
        private void btnEditar_Click(object sender, EventArgs e)
        {
            if (dgvDatos.SelectedRows.Count == 0)
            {
                return;
            }

            DataGridViewRow r = dgvDatos.SelectedRows[0];
            var             clienteListDto = r.Tag as ClienteListDto;
            var             clienteCopia   = (ClienteListDto)clienteListDto.Clone();
            frmClienteAE    frm            = DI.Create <frmClienteAE>();

            frm.Titulo("Editar Cliente");
            ClienteEditDto clienteEditDto = servicio.GetClientePorId(clienteListDto.ClienteId);

            frm.SetCliente(clienteEditDto);
            DialogResult dr = frm.ShowDialog(this);

            if (dr == DialogResult.Cancel)
            {
                return;
            }

            clienteEditDto = frm.GetCliente();
            if (servicio.Existe(clienteEditDto))
            {
                frmMessageBox messageBox = new frmMessageBox();
                messageBox.Show();
                messageBox.ShowError("Cliente Existente", $" { clienteEditDto.Apellido}, { clienteEditDto.Nombre}ya existe en la base de datos");
                SetearFila(r, clienteCopia);
                return;
            }
            try
            {
                servicio.Guardar(clienteEditDto);
                var cListDto = mapper.Map <ClienteListDto>(clienteEditDto);
                SetearFila(r, cListDto);
                frmMessageBox messageBox = new frmMessageBox();
                messageBox.Show();
                messageBox.ShowInfo("Cliente Editado", $"{cListDto.Nombre}" +
                                    $"ah sido editada correctamente");
            }
            catch (Exception)
            {
                frmMessageBox messageBox = new frmMessageBox();
                messageBox.Show();
                messageBox.ShowError("Error", $"Ocurrio un problema no se pudo completar la transaccion. Intentelo nuevamente.");
            }
        }
示例#30
0
        public void TestBasicForce()
        {
            DI.Get <TestSceneBuilder>().Setup = () => createVertices(2);
            DI.Get <TestSceneBuilder>().EnsureTestSceneLoaded();

            var g     = new BidirectionalGraph <MyVertex, MyEdge>();
            var edges = new List <MyEdge>();
            var verts = TW.Data.Get <Data>().Vertices;

            edges.Add(new MyEdge {
                Source = verts[0], Target = verts[1]
            });

            runRelaxTest(g, verts, edges);
        }
示例#31
0
        private static Result Process(ProcessOptions options)
        {
            IContainer container = DI.InjectUpdating(options, new ContainerBuilder()).Build();

            using var scope = container.BeginLifetimeScope();
            try
            {
                return(ResolveScope(scope, options));
            }
            catch (Exception e)
            {
                logger.Debug(e);
                return(Result.Error("Unepected error. View log file to see a stacktrace"));
            }
        }
        /// <summary>
        /// UI Design
        /// </summary>
        private void OnGUI()
        {
            if (_spawners == null || _spawners.Count > 0)
            {
                return;
            }

            GUI.depth = -5;
            GUI.skin  = Theme;

            if (GUI.Button(new Rect(Screen.width - 150, 60, 130, 40), T.Translate("Next floor"), "btn_next_floor"))
            {
                DI.Fetch <WorldController>()?.EndGame();
            }
        }
示例#33
0
        public override IController CreateController(RequestContext requestContext, string controllerName)
        {
            // Thanks DefaultControllerFactory!
            var controllerType = GetControllerType(requestContext, controllerName);

            // Attempt to create an instance with injected parameters
            var controller = DI.Instantiate <IController>(controllerType, requestContext.HttpContext.Items["Context"]);

            // Return the injected instance or a regular parameterless controller
            if (controller != null)
            {
                return(controller);
            }
            return(GetControllerInstance(requestContext, controllerType));
        }
示例#34
0
文件: Collocated.cs 项目: externl/ice
    private static int run(string[] args, Ice.Communicator communicator)
    {
        communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
        Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
        Ice.Object d = new DI();
        adapter.add(d, communicator.stringToIdentity("d"));
        adapter.addFacet(d, communicator.stringToIdentity("d"), "facetABCD");
        Ice.Object f = new FI();
        adapter.addFacet(f, communicator.stringToIdentity("d"), "facetEF");
        Ice.Object h = new HI(communicator);
        adapter.addFacet(h, communicator.stringToIdentity("d"), "facetGH");

        AllTests.allTests(communicator);

        return 0;
    }
		/// <summary>
		/// 
		/// </summary>
		/// <returns>int</returns>
		public static int usp_Service_Init(DI.usp_Service_InitParameters p)
		{
			SqlCommand cmd = DC.NewCmd_usp_Service_Init(p);
			SQLHelper.ExecuteNonQuery(cmd);
			string s = cmd.Parameters["RETURN_VALUE"].Value.ToString();
			if (string.IsNullOrEmpty(s))
			{
				p.SetReturnValue(0);
				return 0;
			}
			else
			{
				p.SetReturnValue(int.Parse(s));
				return p._ReturnValue;
			}
		}
示例#36
0
文件: RawPrint.cs 项目: neonTW/AWPS
        // SendBytesToPrinter()
        // Takes the IntPtr and printer name sent from print and listen makes a handle
        // for the printer and sends the bytes to the printer raw.
        //
        public static bool SendBytesToPrinter(string szPrinterName, IntPtr pBytes, Int32 dwCount)
        {
            Int32 dwWritten = 0;
            IntPtr hPrinter = new IntPtr(0);
            DI di = new DI();
            di.pDocName = "AWinPS document";
            di.pDataType = "Raw";

            //The functions invoked above all use bool, so why not take advantage?
            if (OpenPrinter(szPrinterName.Normalize(), out hPrinter, IntPtr.Zero)
                && (StartDocPrinter(hPrinter, 1, di))
                && (StartPagePrinter(hPrinter))
                && (WritePrinter(hPrinter, pBytes, dwCount, out dwWritten))
                && (EndPagePrinter(hPrinter))
                && (EndDocPrinter(hPrinter))
                && (ClosePrinter(hPrinter)))
                return true;
            else return false;
        }
示例#37
0
    public InitialI(Ice.ObjectAdapter adapter)
    {
        _adapter = adapter;
        _b1 = new BI();
        _b2 = new BI();
        _c = new CI();
        _d = new DI();
        _e = new EI();
        _f = new FI(_e);

        _b1.theA = _b2; // Cyclic reference to another B
        _b1.theB = _b1; // Self reference.
        _b1.theC = null; // Null reference.

        _b2.theA = _b2; // Self reference, using base.
        _b2.theB = _b1; // Cyclic reference to another B
        _b2.theC = _c; // Cyclic reference to a C.

        _c.theB = _b2; // Cyclic reference to a B.

        _d.theA = _b1; // Reference to a B.
        _d.theB = _b2; // Reference to a B.
        _d.theC = null; // Reference to a C.
    }
示例#38
0
        // modifies both points, "from" and "to".
        private void CalculateRoute(
			double xf0, double xf1,
			double yf0, double yf1,
			double xt0, double xt1,
			double yt0, double yt1,
			DI.Point f, DI.Point t)
        {
            double x, y;
            // X
            if (xf1 < xt0)
            {
                f.X = xf1;
                t.X = xt0;
            }
            else if (xt1 < xf0)
            {
                f.X = xf0;
                t.X = xt1;
            }
            else if (xt0 <= xf1)
            {
                x = Math.Max(xf0, xt0);
                f.X = x + (Math.Min(xf1, xt1) - x) / 2;
                t.X = f.X;
            }
            else if (xf0 <= xt1)
            {
                x = Math.Max(xf1, xt1);
                f.X = x + (Math.Min(xf0, xt0) - x) / 2;
                t.X = f.X;
            }
            // Y
            if (yf1 < yt0)
            {
                if (xf1 < xt0)
                {
                    f.Y = yf1;
                    t.Y = yt0;
                }
                else
                {
                    f.Y = yf1;
                    t.Y = yt0;
                }
            }
            else if (yt1 < yf0)
            {
                if (xf1 < xt0)
                {
                    f.Y = yf0;
                    t.Y = yt1;
                }
                else
                {
                    f.Y = yf0 ;
                    t.Y = yt1;
                }
            }
            else if (yt0 <= yf1)
            {
                y= Math.Max(yf0, yt0);
                f.Y = y + (Math.Min(yf1, yt1) - y) / 2;
                t.Y = f.Y;
            }
            else if (yf0 <= yt1)
            {
                f.Y = yf0 + (yt1 -yf0) / 2;
                t.Y = f.Y;
            }
        }
示例#39
0
 public UMLEdge(UMLDiagram ownerDiagram, DI.GraphEdge graphEdge)
     : this(ownerDiagram, graphEdge, true)
 {
 }
示例#40
0
 protected UMLEdge(UMLDiagram ownerDiagram, DI.GraphEdge graphEdge, bool forceRedraw)
     : base(ownerDiagram, graphEdge)
 {
     _graphEdge = graphEdge;
     DI.GraphConnector connector;
     _ends0 = new ArrayList (2);
     _ends1 = new ArrayList (2);
     connector = (DI.GraphConnector)graphEdge.Anchor [0];
     _from_element = ownerDiagram.GetUmlcanvasElement (connector.GraphElement);
     connector = (DI.GraphConnector)graphEdge.Anchor [1];
     _to_element = ownerDiagram.GetUmlcanvasElement (connector.GraphElement);
     _control_points = new ArrayList ();
     // control points and line segments
     //CreateControlPoints ();
     CreateLineSegments ();
     // From and To elements
     _from_element.Moved += FromNodeMoved;
     _from_element.Resized += FromNodeResized;
     _to_element.Moved += ToNodeMoved;
     _to_element.Resized += ToNodeResized;
     if (forceRedraw) { ForceRedraw (); }
 }
示例#41
0
 private static double GetAngle(DI.Point p0, DI.Point p1)
 {
     double dy = p1.Y - p0.Y;
     double dx = p1.X - p0.X;
     double a;
     if (dy == 0)
     {
         a = (dx >= 0 ? Math.PI : 0D);
     }
     else if (dx == 0)
     {
         a = (dy >= 0 ? Math.PI + Math.PI / 2D : Math.PI / 2D);
     }
     else
     {
         a = Math.Atan (dy / dx);
         if (dx > 0)
         {
             a += Math.PI;
         }
     }
     //System.Console.WriteLine ("UMLEdge.GetAngle> dx: {0}, dy: {1}, a: {2}", dx, dy, a);
     return a;
 }
示例#42
0
文件: DITest.cs 项目: kolbasik/NBDD
 public TestBase()
 {
     Fixture = new Fixture();
     Container = new DI(new CompositionContainer());
 }
		/// <summary>
		/// 
		/// </summary>
		/// <returns>int</returns>
		public static int usp_Service_Update(DI.usp_Service_UpdateParameters p)
		{
			SqlCommand cmd = DC.NewCmd_usp_Service_Update(p);
			if (p.CheckIsOriginal_ServiceIDChanged())
			{
				object o = p.Original_ServiceID;
				if (o == null) cmd.Parameters["Original_ServiceID"].Value = DBNull.Value;
				else cmd.Parameters["Original_ServiceID"].Value = o;
			}
			if (p.CheckIsServiceTypeIDChanged())
			{
				object o = p.ServiceTypeID;
				if (o == null) cmd.Parameters["ServiceTypeID"].Value = DBNull.Value;
				else cmd.Parameters["ServiceTypeID"].Value = o;
			}
			if (p.CheckIsNameChanged())
			{
				object o = p.Name;
				if (o == null) cmd.Parameters["Name"].Value = DBNull.Value;
				else cmd.Parameters["Name"].Value = o;
			}
			if (p.CheckIsVersionChanged())
			{
				object o = p.Version;
				if (o == null) cmd.Parameters["Version"].Value = DBNull.Value;
				else cmd.Parameters["Version"].Value = o;
			}
			if (p.CheckIsFilePathChanged())
			{
				object o = p.FilePath;
				if (o == null) cmd.Parameters["FilePath"].Value = DBNull.Value;
				else cmd.Parameters["FilePath"].Value = o;
			}
			if (p.CheckIsDescriptionChanged())
			{
				object o = p.Description;
				if (o == null) cmd.Parameters["Description"].Value = DBNull.Value;
				else cmd.Parameters["Description"].Value = o;
			}
			SQLHelper.ExecuteNonQuery(cmd);
			string s = cmd.Parameters["RETURN_VALUE"].Value.ToString();
			if (string.IsNullOrEmpty(s))
			{
				p.SetReturnValue(0);
				return 0;
			}
			else
			{
				p.SetReturnValue(int.Parse(s));
				return p._ReturnValue;
			}
		}
		/// <summary>
		/// 
		/// </summary>
		/// <returns>int</returns>
		public static int usp_ServiceInstance_Insert_TCPIP(DI.usp_ServiceInstance_Insert_TCPIPParameters p)
		{
			SqlCommand cmd = DC.NewCmd_usp_ServiceInstance_Insert_TCPIP(p);
			if (p.CheckIsServiceIDChanged())
			{
				object o = p.ServiceID;
				if (o == null) cmd.Parameters["ServiceID"].Value = DBNull.Value;
				else cmd.Parameters["ServiceID"].Value = o;
			}
			if (p.CheckIsCreateTimeChanged())
			{
				object o = p.CreateTime;
				if (o == null) cmd.Parameters["CreateTime"].Value = DBNull.Value;
				else cmd.Parameters["CreateTime"].Value = o;
			}
			if (p.CheckIsDescriptionChanged())
			{
				object o = p.Description;
				if (o == null) cmd.Parameters["Description"].Value = DBNull.Value;
				else cmd.Parameters["Description"].Value = o;
			}
			SQLHelper.ExecuteNonQuery(cmd);
			string s = cmd.Parameters["RETURN_VALUE"].Value.ToString();
			if (string.IsNullOrEmpty(s))
			{
				p.SetReturnValue(0);
				return 0;
			}
			else
			{
				p.SetReturnValue(int.Parse(s));
				return p._ReturnValue;
			}
		}
示例#45
0
			/// <summary>
			/// 创建某字段的某种运算的表达式
			/// </summary>
			public dbo_uf_Split(DI.dbo_uf_Split column, SQLHelper.Operators operate, object value) : base(column, operate, value) { }
示例#46
0
 public UMLObjectDiagram(DI.Diagram diagram, Widgets.NoteBook notebook)
     : base(diagram, notebook)
 {
 }