コード例 #1
0
        protected override List <DimensionData> GenerateDimensionData(IVisitAggregationContext context, SegmentMetricsValue metrics, OrderModel orderModel)
        {
            List <DimensionData> dimensionDataList = new List <DimensionData>();

            if (orderModel.Event.Order != null & orderModel.Event.Order.CartLines != null && orderModel.Event.Order.CartLines.Any())
            {
                foreach (var cartLine in orderModel.Event.Order.CartLines)
                {
                    if (orderModel.Event.CustomValues.ContainsKey($"PersonalizationId|{cartLine.ExternalCartLineId}"))
                    {
                        var personalizationId = orderModel.Event.CustomValues[$"PersonalizationId|{cartLine.ExternalCartLineId}"];
                        if (!string.IsNullOrEmpty(personalizationId))
                        {
                            SegmentMetricsValue segmentMetricsValue = metrics.Clone();
                            segmentMetricsValue.Count = 1;
                            DimensionData dimensionData = new DimensionData()
                            {
                                DimensionKey = personalizationId,
                                MetricsValue = segmentMetricsValue
                            };
                            dimensionDataList.Add(dimensionData);
                        }
                    }
                }
            }
            return(dimensionDataList);
        }
コード例 #2
0
ファイル: VismaNet.cs プロジェクト: lulzzz/Visma.Net
        /// <summary>
        ///     Creates a connection using token.
        /// </summary>
        /// <param name="companyId">Company context</param>
        /// <param name="token">The predefined token from Visma.net</param>
        /// <param name="branchId">Branch ID to work with in the Visma.net Company (optional)</param>
        public VismaNet(int companyId, string token, int branchId = 0)
        {
            if (string.IsNullOrEmpty(token))
            {
                throw new InvalidArgumentsException("Token is missing");
            }

            Auth = new VismaNetAuthorization
            {
                Token     = token,
                CompanyId = companyId,
                BranchId  = branchId
            };
            Customers           = new CustomerData(Auth);
            CustomerInvoices    = new CustomerInvoiceData(Auth);
            Suppliers           = new SupplierData(Auth);
            SupplierInvoices    = new SupplierInvoiceData(Auth);
            CashSales           = new CashSaleData(Auth);
            CustomerDocuments   = new CustomerDocumentData(Auth);
            Dimensions          = new DimensionData(Auth);
            Inventory           = new InventoryData(Auth);
            JournalTransactions = new JournalTransactionData(Auth);
            Accounts            = new FinAccountData(Auth);
            Employee            = new EmployeeData(Auth);
            CreditNote          = new CreditNoteData(Auth);
            Shipments           = new ShipmentData(Auth);
            Contacts            = new ContactData(Auth);
            Projects            = new ProjectData(Auth);
            SalesOrder          = new SalesOrderData(Auth);
        }
コード例 #3
0
        public void AddDimension(string dimensionName, float minVal, float maxVal)
        {
            var dataArray = GetDefaultArray();

            dimenstionDataArrays.Add(dataArray);
            lastIndices.Add(0);

            //what are categories?
            var metaData = new DimensionData.Metadata();

            metaData.minValue = minVal;
            metaData.maxValue = maxVal;
            metaData.type     = DataType.Float; //maybe make that adjustable
            int newIndex = dimensionData.Count;

            //for testing
            if (!textualDimensionsList.ContainsKey(dimensionName))
            {
                textualDimensionsList.Add(dimensionName, new Dictionary <int, string>());
                textualDimensionsListReverse.Add(dimensionName, new Dictionary <string, int>());
            }

            var dd = new DimensionData(dimensionName, newIndex, metaData);

            dd.setData(dataArray, textualDimensionsList);
            dimensionData.Add(dd);
            //dataCount += dimensionSizeLimit;
            dataCount = dimensionSizeLimit;
            Debug.Log("AddDimension => " + dd.Identifier + ", " + dd.Index);
        }
コード例 #4
0
        public async Task <IActionResult> Edit(string id, [Bind("Age,Attrition,BusinessTravel,DailyRate,Department,DistanceFromHome,Education,EducationField,EmployeeCount,EmployeeNumber,EnvironmentSatisfaction,Gender,HourlyRate,JobInvolvement,JobLevel,JobRole,JobSatisfaction,MaritalStatus,MonthlyIncome,MonthlyRate,NumCompaniesWorked,Over18,OverTime,PercentSalaryHike,PerformanceRating,RelationshipSatisfaction,StandardHours,StockOptionLevel,TotalWorkingYears,TrainingTimesLastYear,WorkLifeBalance,YearsAtCompany,YearsInCurrentRole,YearsSinceLastPromotion,YearsWithCurrManager")] DimensionData dimensionData)
        {
            if (id != dimensionData.EmployeeNumber)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(dimensionData);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DimensionDataExists(dimensionData.EmployeeNumber))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(dimensionData));
        }
コード例 #5
0
        /// <summary>
        ///     Creates a connection using token.
        /// </summary>
        /// <param name="companyId">Company context</param>
        /// <param name="token">The predefined token from Visma.net</param>
        /// <param name="branchId">Branch ID to work with in the Visma.net Company (optional)</param>
        public VismaNet(int companyId, string token, int branchId = 0)
        {
            if (string.IsNullOrEmpty(token))
            {
                throw new InvalidArgumentsException("Token is missing");
            }

            Auth = new VismaNetAuthorization
            {
                Token     = token,
                CompanyId = companyId,
                BranchId  = branchId
            };
            Attribute                = new AttributeData(Auth);
            Customer                 = new CustomerData(Auth);
            Currency                 = new CurrencyData(Auth);
            CustomerInvoice          = new CustomerInvoiceData(Auth);
            Supplier                 = new SupplierData(Auth);
            SupplierInvoice          = new SupplierInvoiceData(Auth);
            CashSale                 = new CashSaleData(Auth);
            CustomerDocument         = new CustomerDocumentData(Auth);
            Dimension                = new DimensionData(Auth);
            Discount                 = new DiscountData(Auth);
            Inventory                = new InventoryData(Auth);
            JournalTransaction       = new JournalTransactionData(Auth);
            GeneralLedgerTransaction = new GeneralLedgerTransactionData(Auth);
            GeneralLedgerBalance     = new GeneralLedgerBalanceData(Auth);
            Account         = new FinAccountData(Auth);
            FinancialPeriod = new FinancialPeriodData(Auth);
            Employee        = new EmployeeData(Auth);
            Shipment        = new ShipmentData(Auth);
            Contact         = new ContactData(Auth);
            Project         = new ProjectData(Auth);
#pragma warning disable CS0618 // Type or member is obsolete
            SalesOrder = new SalesOrderData(Auth);
#pragma warning restore CS0618 // Type or member is obsolete
            Branch             = new BranchData(Auth);
            Warehouse          = new WarehouseData(Auth);
            Location           = new LocationData(Auth);
            Subaccount         = new SubaccountData(Auth);
            CustomerPayment    = new CustomerPaymentData(Auth);
            Dynamic            = new VismaNetDynamicEndpoint(null, Auth);
            Resources          = new VismaNetDynamicEndpoint(null, Auth, true);
            SupplierDocument   = new SupplierDocumentData(Auth);
            InventoryIssue     = new InventoryIssueData(Auth);
            InventoryReceipt   = new InventoryReceiptData(Auth);
            PurchaseReceipt    = new PurchaseReceiptData(Auth);
            CustomerSalesPrice = new CustomerSalesPriceData(Auth);
            CustomerCreditNote = new CustomerCreditNoteData(Auth);
            PurchaseOrder      = new PurchaseOrderData(Auth);
            CashTransaction    = new CashTransactionData(Auth);
        }
コード例 #6
0
    public void CreateGraph(int indexDimDats, GameObject currParent, Vector3 currPos)
    {
        // Leaf node: Create object then exit
        if (indexDimDats >= dimensionDatas.Count)
        {
            InstantiatePrefab(leafObject.name, leafObject, currParent, currPos);
            return;
        }

        // Get current data
        DimensionData curData = this.dimensionDatas[indexDimDats];

        // Get position change vector
        Vector3 posChange = Vector3.zero;

        switch (curData.dimension)
        {
        case Dimensions.x:
            posChange = new Vector3(curData.posChange, 0, 0);
            break;

        case Dimensions.y:
            posChange = new Vector3(0, curData.posChange, 0);
            break;

        case Dimensions.z:
            posChange = new Vector3(0, 0, curData.posChange);
            break;
        }

        // Each new object in that dimension
        for (int i = 0; i < curData.children; i++)
        {
            // Create new parent for next dimension's objects
            GameObject dimensionParent = InstantiatePrefab(curData.dimension.ToString(), parentObject, currParent, currPos);

            // Continue down the next dimension
            CreateGraph(indexDimDats + 1, dimensionParent, currPos + (posChange * i));
        }
    }
コード例 #7
0
ファイル: VismaNet.cs プロジェクト: Hironiem/Visma.Net
        /// <summary>
        ///     Creates a connection using token.
        /// </summary>
        /// <param name="companyId">Company context</param>
        /// <param name="token">The predefined token from Visma.net</param>
        /// <param name="branchId">Branch ID to work with in the Visma.net Company (optional)</param>
        public VismaNet(int companyId, string token, int branchId = 0)
        {
            if (string.IsNullOrEmpty(token))
            {
                throw new InvalidArgumentsException("Token is missing");
            }

            Auth = new VismaNetAuthorization
            {
                Token     = token,
                CompanyId = companyId,
                BranchId  = branchId
            };
            Customer           = new CustomerData(Auth);
            CustomerInvoice    = new CustomerInvoiceData(Auth);
            Supplier           = new SupplierData(Auth);
            SupplierInvoice    = new SupplierInvoiceData(Auth);
            CashSale           = new CashSaleData(Auth);
            CustomerDocument   = new CustomerDocumentData(Auth);
            Dimension          = new DimensionData(Auth);
            Inventory          = new InventoryData(Auth);
            JournalTransaction = new JournalTransactionData(Auth);
            Account            = new FinAccountData(Auth);
            Employee           = new EmployeeData(Auth);
            CreditNote         = new CreditNoteData(Auth);
            Shipment           = new ShipmentData(Auth);
            Contact            = new ContactData(Auth);
            Project            = new ProjectData(Auth);
            SalesOrder         = new SalesOrderData(Auth);
            Payment            = new PaymentData(Auth);
            Branch             = new BranchData(Auth);
            Warehouse          = new WarehouseData(Auth);
            Location           = new LocationData(Auth);
            Subaccount         = new SubaccountData(Auth);
            CustomerPayment    = new CustomerPaymentData(Auth);
            Dynamic            = new VismaNetDynamicEndpoint(null, Auth);
            Resources          = new VismaNetDynamicEndpoint(null, Auth, true);
        }
コード例 #8
0
        public void AddStringDimension(string dimensionName)
        {
            if (!textualDimensionsList.ContainsKey(dimensionName))
            {
                textualDimensionsList.Add(dimensionName, new Dictionary <int, string>());
                textualDimensionsListReverse.Add(dimensionName, new Dictionary <string, int>());

                var metaData = new DimensionData.Metadata();
                metaData.type     = DataType.String; //maybe make that adjustable
                metaData.minValue = 0;
                metaData.maxValue = dimensionSizeLimit;
                int newIndex = dimensionData.Count;

                var dataArray = GetDefaultArray();
                dimenstionDataArrays.Add(dataArray);
                lastIndices.Add(0);

                var dd = new DimensionData(dimensionName, newIndex, metaData);
                dd.setData(dataArray, textualDimensionsList);
                dimensionData.Add(dd);
                dataCount = dimensionSizeLimit;
                Debug.Log("AddDimension => " + dd.Identifier + ", " + dd.Index);
            }
        }
コード例 #9
0
ファイル: Function.cs プロジェクト: chiumimy/CaxGlobalTek
        public static bool RecordDimension(DisplayableObject[] SheetObj, WorkPartAttribute sWorkPartAttribute, ref List <DimensionData> listDimensionData)
        {
            try
            {
                foreach (DisplayableObject singleObj in SheetObj)
                {
                    //取得尺寸的屬性
                    ObjectAttribute sObjectAttribute = new ObjectAttribute();
                    status = Function.GetObjectAttribute(singleObj, out sObjectAttribute);
                    if (!status)
                    {
                        MessageBox.Show("singleObj屬性取得失敗,無法上傳");
                        return(false);
                    }

                    if (sObjectAttribute.singleObjExcel == "" & sObjectAttribute.singleSelfCheckExcel == "")
                    {
                        continue;
                    }

                    //如果有Non-SelfCheck,則記錄一筆資料
                    if (sObjectAttribute.singleObjExcel != "")
                    {
                        string[] splitExcel = sObjectAttribute.singleObjExcel.Split(',');
                        foreach (string dimenExcelType in splitExcel)
                        {
                            DimensionData cDimensionData = new DimensionData();
                            status = Database.GetDimensionData(dimenExcelType, singleObj, out cDimensionData);
                            if (!status)
                            {
                                continue;
                            }
                            cDimensionData.draftingVer  = sWorkPartAttribute.draftingVer;
                            cDimensionData.draftingDate = sWorkPartAttribute.draftingDate;
                            cDimensionData.keyChara     = sObjectAttribute.keyChara;
                            cDimensionData.productName  = sObjectAttribute.productName;
                            cDimensionData.excelType    = dimenExcelType;
                            cDimensionData.spcControl   = sObjectAttribute.spcControl;
                            if (sObjectAttribute.customerBalloon != "")
                            {
                                cDimensionData.customerBalloon = Convert.ToInt32(sObjectAttribute.customerBalloon);
                            }
                            listDimensionData.Add(cDimensionData);
                        }
                    }
                    //如果有SelfCheck,則記錄一筆資料
                    if (sObjectAttribute.singleSelfCheckExcel != "")
                    {
                        DimensionData cDimensionData = new DimensionData();
                        status = Database.GetDimensionData(sObjectAttribute.singleSelfCheckExcel, singleObj, out cDimensionData);
                        if (!status)
                        {
                            continue;
                        }
                        cDimensionData.draftingVer  = sWorkPartAttribute.draftingVer;
                        cDimensionData.draftingDate = sWorkPartAttribute.draftingDate;
                        cDimensionData.keyChara     = sObjectAttribute.keyChara;
                        cDimensionData.productName  = sObjectAttribute.productName;
                        cDimensionData.excelType    = sObjectAttribute.singleSelfCheckExcel;
                        cDimensionData.spcControl   = sObjectAttribute.spcControl;
                        if (sObjectAttribute.customerBalloon != "")
                        {
                            cDimensionData.customerBalloon = Convert.ToInt32(sObjectAttribute.customerBalloon);
                        }
                        listDimensionData.Add(cDimensionData);
                    }
                }
            }
            catch (System.Exception ex)
            {
                return(false);
            }
            return(true);
        }
コード例 #10
0
ファイル: Dimension.cs プロジェクト: ElliotJScott/TerrariaMod
        public void Generate(GenerationProgress progress)
        {
            switch (dimension)
            {
            /*
             * case Dimensions.Overworld:
             *  progress.Message = "Finishing up overworld";
             *  data = GetCompressedTileData(Main.tile);
             *  //basicTileData = GetCompressedBasicTileData(Main.tile);
             *  //extraTileData = GetExtraTileData(Main.tile);
             *  chest = Main.chest;
             *  sign = Main.sign;
             *  break;
             */
            case Dimensions.Jungle:
                progress.Message = "Generating the Jungle Dimension";
                DimensionData tilej = DimensionBuilder.GenerateJungleDimension(Main.tile.GetLength(0), Main.tile.GetLength(1));
                data           = GetCompressedTileData(tilej.tile);
                chest          = tilej.chest;
                sign           = tilej.sign;
                haveDiscovered = false;
                name           = jungNames[Main.rand.Next(0, jungNames.Length)];
                break;

            case Dimensions.Ice:
                progress.Message = "Generating the Ice Dimension";
                DimensionData tilei = DimensionBuilder.GenerateIceDimension(Main.tile.GetLength(0), Main.tile.GetLength(1));
                data           = GetCompressedTileData(tilei.tile);
                chest          = tilei.chest;
                sign           = tilei.sign;
                haveDiscovered = false;
                name           = iceNames[Main.rand.Next(0, iceNames.Length)];
                break;

            case Dimensions.Asteroid:

                progress.Message = "Generating the Asteroid Dimension";
                DimensionData tilea = DimensionBuilder.GenerateAsteroidDimension(Main.tile.GetLength(0), Main.tile.GetLength(1));
                data           = GetCompressedTileData(tilea.tile);
                chest          = tilea.chest;
                sign           = tilea.sign;
                haveDiscovered = false;
                name           = astNames[Main.rand.Next(0, astNames.Length)];
                break;

            case Dimensions.Overworld:
                progress.Message = "Finishing up the overworld";
                //(BasicTileData, ExtraTileData) data2 = DimensionBuilder.GenerateCompressedEmptyDimension(Main.tile.GetLength(0), Main.tile.GetLength(1));
                //basicTileData = data2.Item1;
                //extraTileData = data2.Item2;
                data           = DimensionBuilder.GenerateCompressedEmptyDimension(Main.tile.GetLength(0), Main.tile.GetLength(1));
                chest          = new Chest[Main.maxChests];
                sign           = new Sign[Main.maxChests];
                name           = Main.worldName;
                haveDiscovered = true;
                break;

            case Dimensions.Travel:
            default:
                name             = "---";
                haveDiscovered   = false;
                progress.Message = "Generating Empty Space";
                //(BasicTileData, ExtraTileData) data2 = DimensionBuilder.GenerateCompressedEmptyDimension(Main.tile.GetLength(0), Main.tile.GetLength(1));
                //basicTileData = data2.Item1;
                //extraTileData = data2.Item2;
                data  = DimensionBuilder.GenerateCompressedEmptyDimension(Main.tile.GetLength(0), Main.tile.GetLength(1));
                chest = new Chest[Main.maxChests];
                sign  = new Sign[Main.maxChests];
                break;
            }
        }