Exemplo n.º 1
0
        internal void InitialDataSourceSystem()
        {
            var fileName = HttpContext.Current.Server.MapPath(System.Configuration.ConfigurationManager
                                                              .AppSettings["DataSourceSystem"]);
            ReadFromExcel readFromExcel = new ReadFromExcel();
            //按Row获取当前行的所有数据
            int rowCount = readFromExcel.GetRowCount(fileName);

            for (int i = 2; i <= rowCount; i++)
            {
                var columnData = readFromExcel.ReadRowFromExcel((uint)i, fileName);
                //获取第一个数为来源系统名称
                //数据必须大于等2才是正确的
                if (columnData.Count >= 2)
                {
                    WriteBaseData writeBaseData = new WriteBaseData();
                    //第二列为来源系统Guid
                    DataSourceSystem dataSourceSystem = new DataSourceSystem();
                    dataSourceSystem.Name = columnData.ElementAt(0);
                    dataSourceSystem.ID   = Guid.Parse(columnData.ElementAt(1));
                    //写入数据库
                    dataSourceSystem = writeBaseData.AddDataSourceSystem(dataSourceSystem);
                }
            }
        }
Exemplo n.º 2
0
        public IReadFromExcel CreateReadFromExcel()
        {
            IReadFromExcel result = null;

            result = new ReadFromExcel();
            return(result);
        }
Exemplo n.º 3
0
    public void UpdateBuilState(GameObject[] buildings)
    {
        float ratio = 0.8f;

        foreach (GameObject building in buildings)
        {
            TowerPool tower;
            tower = PoolManager.poolManager.GetTowerParamFromID(ReadFromExcel.ExtractInt(building.name));
            int cost = tower.towerAttri.cost;

            Transform  can  = building.transform.FindChild("Canvas");
            GameObject tex  = can.FindChild("Text").gameObject;
            Text       text = tex.transform.GetComponent <Text>();
            text.text = "$ " + cost.ToString();
            //tex.GetComponent<Text>().text = "$" + cost.ToString();

            if (ScoreControl.CheckResourceSuffi(cost) == false)
            {
                building.GetComponent <SpriteRenderer>().color = new Color(ratio, ratio, ratio, 1.0f);
                text.color = new Color(ratio, ratio, ratio, 1.0f);
                building.GetComponent <BoxCollider2D>().enabled = false;
            }
            else
            {
                building.GetComponent <BoxCollider2D>().enabled = true;
                text.color = Color.white;
                building.GetComponent <SpriteRenderer>().color = Color.white;
            }
        }
    }
Exemplo n.º 4
0
        /// <summary>
        /// 初始化科室类别.
        /// </summary>
        /// <exception cref="NotImplementedException"></exception>
        internal void InitialDepartmentCategory()
        {
            var fileName = HttpContext.Current.Server.MapPath(System.Configuration.ConfigurationManager
                                                              .AppSettings["DepartmentCategory"]);
            //第一列为类别的名称,第二列开始为Guid
            ReadFromExcel readFromExcel = new ReadFromExcel();
            //按Row获取当前行的所有数据
            int rowCount = readFromExcel.GetRowCount(fileName);

            for (int i = 2; i <= rowCount; i++)
            {
                var columnData = readFromExcel.ReadRowFromExcel((uint)i, fileName);
                //获取第一个数为类别
                //第二列为类别的Guid,数据必须大于等2才是正确的
                if (columnData.Count >= 2)
                {
                    //var firstData = columnData.First();
                    WriteBaseData      writeBaseData      = new WriteBaseData();
                    DepartmentCategory departmentCategory = new DepartmentCategory();
                    departmentCategory.Name = columnData.ElementAt(0);
                    departmentCategory.DepartmentCategoryID = Guid.Parse(columnData.ElementAt(1));
                    //写入数据库
                    departmentCategory = writeBaseData.AddDepartmentCategory(departmentCategory);
                }
            }
        }
Exemplo n.º 5
0
        internal void InitialRoleName()
        {
            //从权限Excel表中读取权限名称,加入到权限表中
            var fileName = HttpContext.Current.Server.MapPath(System.Configuration.ConfigurationManager
                                                              .AppSettings["RoleName"]);
            ReadFromExcel readFromExcel = new ReadFromExcel();
            //按Row获取当前行的所有数据
            int rowCount = readFromExcel.GetRowCount(fileName);

            for (int i = 2; i <= rowCount; i++)
            {
                var columnData = readFromExcel.ReadRowFromExcel((uint)i, fileName);
                //数据必须大于等1才有效
                //第1列为权限名称
                if (columnData.Count >= 1)
                {
                    using (ApplicationDbContext context = new ApplicationDbContext())
                    {
                        using (RoleManager <IdentityRole> roleManager = new RoleManager <IdentityRole>(new RoleStore <IdentityRole>(context)))
                        {
                            var roleName = columnData.ElementAt(0);
                            if (!roleManager.RoleExists(roleName))
                            {
                                roleManager.Create(new IdentityRole(roleName));
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 6
0
    public GameObject _Select(GameObject icon)
    {
        int id = ReadFromExcel.ExtractInt(icon.name);

        foreach (UnitTower tower in towers)
        {
            if (ReadFromExcel.ExtractInt(tower.name) == id)
            {
                //Vector3 pos = new Vector3 (0, 0, 0);
                GameObject obj;
                obj = PoolManager.Spawn(tower.gameObject, selectedFlag.transform.position, Quaternion.identity);
                ScoreControl.CoinDecrease(tower.baseTower.cost);
                obj.GetComponent <SpriteRenderer>().sortingLayerName = selectedFlag.GetComponent <SpriteRenderer>().sortingLayerName;
                //GameManager.ShowIndicator(obj.GetComponent<UnitTower>());
                //GameManager.ClearBaseBuildings();
                //buildManager.ClearBuildPoint();
                AudioManager.PlayTowerBuilding();
                PoolManager.Unspawn(selectedFlag);
                selectedFlag = null;
                break;
            }
        }

        //PoolManager.Spawn(
        selectedIcon = icon;

        return(selectedIcon);
    }
Exemplo n.º 7
0
 public override void Start()
 {
     base.Start();
     //ReadFromExcel.readXLS(Application.dataPath+"/YOTTA_param.xls","Visitor");
     visitorAttri.visitorID = ReadFromExcel.ExtractInt(thisObj.name);
     InitVisitor(visitorAttri.visitorID);
 }
Exemplo n.º 8
0
        internal void InitialIndicatorAlgorithm()
        {
            var fileName = HttpContext.Current.Server.MapPath(System.Configuration.ConfigurationManager
                                                              .AppSettings["IndicatorAlgorithm"]);
            ReadFromExcel readFromExcel = new ReadFromExcel();
            //按Row获取当前行的所有数据
            int rowCount = readFromExcel.GetRowCount(fileName);

            for (int i = 2; i <= rowCount; i++)
            {
                var columnData = readFromExcel.ReadRowFromExcel((uint)i, fileName);
                //数据必须大于等5才是正确的
                //第1列为结果项目的Guid,
                //第2列为第一个项目的Guid
                //第3列为第二个项目的Guid
                //第4列为操作符
                //第5列为备注
                if (columnData.Count >= 5)
                {
                    //var firstData = columnData.First();
                    WriteBaseData      writeBaseData      = new WriteBaseData();
                    IndicatorAlgorithm indicatorAlgorithm = new IndicatorAlgorithm();
                    indicatorAlgorithm.ResultOperationID = Guid.Parse(columnData.ElementAt(0));
                    indicatorAlgorithm.FirstOperationID  = Guid.Parse(columnData.ElementAt(1));
                    indicatorAlgorithm.SecondOperationID = Guid.Parse(columnData.ElementAt(2));
                    indicatorAlgorithm.Operation         = columnData.ElementAt(3);
                    indicatorAlgorithm.Remarks           = columnData.ElementAt(4);
                    indicatorAlgorithm.ID = System.Guid.NewGuid();
                    writeBaseData.AddIndicatorAlgorithm(indicatorAlgorithm);
                }
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// 初始化Indicator项目
        /// </summary>
        public void InitialIndicator()
        {
            var           indicatorFile = HttpContext.Current.Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["Indicator"]);
            ReadFromExcel readFromExcel = new ReadFromExcel();
            //按Row获取当前行的所有数据
            //先获Row总数,从第二行开始取数据,第一行为标题
            int rowCount = readFromExcel.GetRowCount(indicatorFile);

            for (int i = 2; i <= rowCount; i++)
            {
                var columnData = readFromExcel.ReadRowFromExcel((uint)i, indicatorFile);
                //将该列按照IndicatorItem录入,再插入到数据库
                if (columnData.Count >= 8)
                {
                    IndicatorItem indicatorItem = new IndicatorItem();
                    //按照顺序填充
                    indicatorItem.Name           = columnData.ElementAt(0);
                    indicatorItem.Unit           = columnData.ElementAt(1);
                    indicatorItem.IsAuto         = columnData.ElementAt(2);
                    indicatorItem.DataSystem     = columnData.ElementAt(3);
                    indicatorItem.Department     = columnData.ElementAt(4);
                    indicatorItem.Remarks        = columnData.ElementAt(5);
                    indicatorItem.DutyDepartment = columnData.ElementAt(6);
                    indicatorItem.GuidId         = Guid.Parse(columnData.ElementAt(7));
                    //写入数据库
                    WriteBaseData writeBaseData = new WriteBaseData();
                    writeBaseData.AddIndicator(indicatorItem);
                }
            }
        }
Exemplo n.º 10
0
 public static void InitEffectTable()
 {
     for (int i = 0; i < 20; ++i)
     {
         for (int j = 0; j < 21; ++j)
         {
             effectTable[i, j] = ReadFromExcel.getIntFromRowColm(j + 6, i + 5);
         }
     }
 }
Exemplo n.º 11
0
    public void InitVisitor(VisitorPool visitorPool, int ID)
    {
        int row, col;

        row = col = 0;

        visitorPool.visitorAttri.visitorType  = (VisitorType)(ID / 100);
        visitorPool.visitorAttri.visitorLevel = (VisitorLevel)(ID % 100);
        switch (visitorPool.visitorAttri.visitorType)
        {
        case VisitorType.em_Kid:
            row = (int)VisitorLineInExcel.em_KidLine;
            break;

        case VisitorType.em_Male:
            row = (int)VisitorLineInExcel.em_MaleLine;
            break;

        case VisitorType.em_Female:
            row = (int)VisitorLineInExcel.em_FemaleLine;
            break;

        case VisitorType.em_Senium:
            row = (int)VisitorLineInExcel.em_SeniumLine;
            break;

        case VisitorType.em_Alien:
            row = (int)VisitorLineInExcel.em_AlienLine;
            break;
        }
        row = row + (int)visitorPool.visitorAttri.visitorLevel - 1;

        col = 2;
        visitorPool.name = ReadFromExcel.getStringFromRowColm(row, col);
        col = 5;
        visitorPool.visitorAttri.description   = ReadFromExcel.getStringFromRowColm(row, col++);
        visitorPool.visitorAttri.bgDescription = ReadFromExcel.getStringFromRowColm(row, col++);
        visitorPool.visitorAttri.initHp        = ReadFromExcel.getFloatFromRowColm(row, col++);
        visitorPool.fullHp = ReadFromExcel.getFloatFromRowColm(row, col++);
        col = 10;
        visitorPool.visitorAttri.normalSpeed = ReadFromExcel.getFloatFromRowColm(row, col++);
        visitorPool.visitorAttri.capacity    = ReadFromExcel.getFloatFromRowColm(row, col++);
        visitorPool.visitorAttri.damage      = ReadFromExcel.getFloatFromRowColm(row, col++);
        col++;
        visitorPool.visitorAttri.decrement     = ReadFromExcel.getFloatFromRowColm(row, col++);
        visitorPool.visitorAttri.defence       = ReadFromExcel.getIntFromRowColm(row, col++);
        visitorPool.visitorAttri.moveReduce    = ReadFromExcel.getFloatFromRowColm(row, col++);
        visitorPool.visitorAttri.angryLimit    = ReadFromExcel.getFloatFromRowColm(row, col++);
        visitorPool.visitorAttri.angryMax      = ReadFromExcel.getFloatFromRowColm(row, col++);
        visitorPool.visitorAttri.speedUpRatio  = ReadFromExcel.getFloatFromRowColm(row, col++);
        visitorPool.visitorAttri.happyLimit    = ReadFromExcel.getIntFromRowColm(row, col++);
        visitorPool.visitorAttri.essencePoints = ReadFromExcel.getIntFromRowColm(row, col++);

        visitorPool.visitorAttri.angrySpeed = visitorPool.visitorAttri.normalSpeed * visitorPool.visitorAttri.speedUpRatio;
    }
Exemplo n.º 12
0
    public void InitTower(TowerPool towerPool, int ID)
    {
        int row, col;

        row = col = 0;

        towerPool.towerAttri.towerType  = (TowerType)(ID / 100);
        towerPool.towerAttri.towerLevel = (TowerLevel)(ID % 100);

        switch (towerPool.towerAttri.towerType)
        {
        case TowerType.em_ScenicSpot:
            row = (int)(TowerLineInExcel.em_ScenicSpotLine);
            break;

        case TowerType.em_Catering:
            row = (int)TowerLineInExcel.em_CateringLine;
            break;

        case TowerType.em_Accommodation:
            row = (int)TowerLineInExcel.em_AccommodationLine;
            break;

        case TowerType.em_Film:
            row = (int)TowerLineInExcel.em_FilmLine;
            break;

        case TowerType.em_Shopping:
            row = (int)TowerLineInExcel.em_ShoppingLine;
            break;

        case TowerType.em_Amusement:
            row = (int)TowerLineInExcel.em_AmusementLine;
            break;
        }
        row = row + (int)towerPool.towerAttri.towerLevel - 1;

        col            = 2;
        towerPool.name = ReadFromExcel.getStringFromRowColm(row, col);
        col            = 5;
        towerPool.towerAttri.description = ReadFromExcel.getStringFromRowColm(row, col++);
        towerPool.towerAttri.cost        = ReadFromExcel.getIntFromRowColm(row, col++);

        //col++;
        towerPool.towerAttri.upgradeCost = ReadFromExcel.getIntFromRowColm(row, col++);
        towerPool.towerAttri.price       = ReadFromExcel.getIntFromRowColm(row, col++);
        towerPool.towerAttri.fixCost     = ReadFromExcel.getIntFromRowColm(row, col++);
        towerPool.towerAttri.durability  = ReadFromExcel.getIntFromRowColm(row, col++);
        towerPool.towerAttri.minRange    = ReadFromExcel.getFloatFromRowColm(row, col++);
        towerPool.towerAttri.maxRange    = ReadFromExcel.getFloatFromRowColm(row, col++);
        col++;
        towerPool.towerAttri.attackInterval = ReadFromExcel.getFloatFromRowColm(row, col++);
        towerPool.towerAttri.range          = towerPool.towerAttri.maxRange;
        //towerPool.towerAttri.influProbability = ReadFromExcel.getFloatFromRowColm(row,col++);
    }
Exemplo n.º 13
0
 public static void InitPrefTable()
 {
     //readXLS(Application.dataPath + "/Yotta_param.xls","Visitor");
     for (int i = 0; i < 20; ++i)
     {
         for (int j = 0; j < 21; ++j)
         {
             prefTable[i, j] = ReadFromExcel.getFloatFromRowColm(i + 5, j + 6);
         }
     }
 }
Exemplo n.º 14
0
 // Use this for initialization
 public override void Start()
 {
     base.Start();
     towerID = ReadFromExcel.ExtractInt(thisObj.name);
     InitTower(towerID);
     //Debug.Log(baseTower.range);
     thisT.FindChild("unitRange").transform.localScale = new Vector3((baseTower.range - 1) * 2 / 6.44f, (baseTower.range - 1) * 2 / 5.32f, 1.0f);
     childRange = thisT.FindChild("unitRange").gameObject;
     childRange.transform.localScale = new Vector3((baseTower.range) * 2 / circleWidth, (baseTower.range) * 2 / circleHeight * 0.7f, 1.0f);
     //childRange.AddComponent<CircleCollider2D> ().radius = baseTower.range;
     //childRange.GetComponent<CircleCollider2D> ().isTrigger = true;
 }
Exemplo n.º 15
0
    public UnitTower _FindUpgrade(int id)
    {
        int upid = id + 1;

        foreach (UnitTower tower in towers)
        {
            if (upid == ReadFromExcel.ExtractInt(tower.name))
            {
                return(tower);
            }
        }
        return(null);
    }
Exemplo n.º 16
0
        public void InitialDepartmentCategoryIndicatorMap()
        {
            var           fileName      = HttpContext.Current.Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["DepartmentCategoryIndicatorMap"]);
            ReadFromExcel readFromExcel = new ReadFromExcel();
            //按Row获取当前行的所有数据
            //第一行为列标题,第二行开始是数据
            int rowCount = readFromExcel.GetRowCount(fileName);

            for (int i = 2; i <= rowCount; i++)
            {
                var columnData = readFromExcel.ReadRowFromExcel((uint)i, fileName);
                //获取第一个数为科室类别
                if (columnData.Count >= 2)
                {
                    var firstData = columnData.First();

                    WriteBaseData      writeBaseData      = new WriteBaseData();
                    DepartmentCategory departmentCategory = new DepartmentCategory();
                    //将第一个数当作类别,找到科室类别
                    departmentCategory.Name = firstData;
                    departmentCategory      = writeBaseData.FindDepartmentCategoryByName(departmentCategory.Name);
                    if (departmentCategory == null)
                    {
                        return;
                    }
                    columnData.Remove(firstData);
                    //第二列及之后的数据为项目名称
                    foreach (var data in columnData)
                    {
                        //依次将第二个列之后的项目插入到科室类别项目表中
                        //如果该项目不在数据库,继续下一个数据
                        var indicator = writeBaseData.FindIndicatorByName(data);
                        if (indicator == null)
                        {
                            continue;
                        }
                        //将Indicator添加进去

                        DepartmentCategoryIndicatorMap item = new DepartmentCategoryIndicatorMap();
                        item.DepartmentCategoryID = departmentCategory.DepartmentCategoryID;
                        item.IndicatorID          = indicator.IndicatorID;
                        writeBaseData.AddDepartmentCategoryIndicatorMap(item);
                    }
                }
            }
        }
Exemplo n.º 17
0
 private void InitParamPool()
 {
     ReadFromExcel.readXLS(Application.dataPath + "/YOTTA_param_V1.2.xls", "Visitor");
     for (int i = 0; i < visitorPool.Length; ++i)
     {
         //visitorList[i].gameObject = visitorObjs[i];
         visitorPool[i].visitorAttri.visitorID = ReadFromExcel.ExtractInt(visitorPool[i].gameObject.name);
         InitVisitor(visitorPool[i], visitorPool[i].visitorAttri.visitorID);
     }
     ReadFromExcel.readXLS(Application.dataPath + "/YOTTA_param_V1.2.xls", "Tower's ATK");
     InitPrefTable();
     ReadFromExcel.readXLS(Application.dataPath + "/YOTTA_param_V1.2.xls", "VisitorEffect");
     InitEffectTable();
     ReadFromExcel.readXLS(Application.dataPath + "/YOTTA_param_V1.2.xls", "Tower");
     for (int i = 0; i < towerPool.Length; ++i)
     {
         //visitorList[i].gameObject = visitorObjs[i];
         towerPool[i].ID = ReadFromExcel.ExtractInt(towerPool[i].gameObject.name);
         InitTower(towerPool[i], towerPool[i].ID);
     }
 }
Exemplo n.º 18
0
        /// <summary>
        /// 初始化科室与科室类别
        /// </summary>
        public void InitialDepartmentAndCategory()
        {
            var departmentCategoryFile = HttpContext.Current.Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["DepartmentCategory"]);
            //第一列为Category,先获取,再填充到
            //从第二列开始,每列为科室,所属类别为第一列
            //获取当前表格的总共Row数
            ReadFromExcel readFromExcel = new ReadFromExcel();
            //按Row获取当前行的所有数据
            int rowCount = readFromExcel.GetRowCount(departmentCategoryFile);

            for (int i = 2; i <= rowCount; i++)
            {
                var columnData = readFromExcel.ReadRowFromExcel((uint)i, departmentCategoryFile);
                //获取第一个数为类别
                if (columnData.Count >= 2)
                {
                    var firstData = columnData.First();

                    WriteBaseData      writeBaseData      = new WriteBaseData();
                    DepartmentCategory departmentCategory = new DepartmentCategory();
                    //将第一个数当作类别,插入科室类别表中
                    departmentCategory.Name = firstData;
                    departmentCategory      = writeBaseData.AddDepartmentCategory(departmentCategory);
                    if (departmentCategory == null)
                    {
                        return;
                    }
                    columnData.Remove(firstData);

                    foreach (var data in columnData)
                    {
                        //依次将第二个列之后的科室名插入到科室表中
                        Department department = new Department();
                        department.DepartmentName       = data;
                        department.DepartmentCategoryID = departmentCategory.DepartmentCategoryID;
                        writeBaseData.AddDepartment(department);
                    }
                }
            }
        }
        private void LoadExcelFileOnClick(object sender, RoutedEventArgs e)
        {
            string fileDirectory = null;

            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            openFileDialog1.InitialDirectory = "c:\\";
            openFileDialog1.Filter           = "xlsx files (*.xlsx)|*.xlsx|All files (*.*)|*.*";
            openFileDialog1.FilterIndex      = 2;
            openFileDialog1.RestoreDirectory = true;

            if (openFileDialog1.ShowDialog() == true)
            {
                fileDirectory = openFileDialog1.FileName;
                VideoGameCatalog videoGameCatalog = ReadFromExcel.getVideoGames(fileDirectory);

                VideoGameCatalogView videoGameCatalogView = new VideoGameCatalogView(videoGameCatalog, fileDirectory);

                App.Current.MainWindow = videoGameCatalogView;
                this.Close();
                videoGameCatalogView.Show();
            }
        }
Exemplo n.º 20
0
        /// <summary>
        /// 初始化科室.
        /// </summary>
        public void InitialDepartment()
        {
            var fileName = HttpContext.Current.Server.MapPath(System.Configuration.ConfigurationManager
                                                              .AppSettings["Department"]);
            //第一列为科室名称,第二列所属科室类别,第三列为科室的Guid
            ReadFromExcel readFromExcel = new ReadFromExcel();
            //按Row获取当前行的所有数据
            int rowCount = readFromExcel.GetRowCount(fileName);

            for (int i = 2; i <= rowCount; i++)
            {
                var columnData = readFromExcel.ReadRowFromExcel((uint)i, fileName);
                //获取第一个数为科室名称
                //数据必须大于等3才是正确的
                if (columnData.Count >= 3)
                {
                    WriteBaseData writeBaseData = new WriteBaseData();
                    //DepartmentCategory departmentCategory = new DepartmentCategory();
                    //第二列为科室类别
                    var name = columnData.ElementAt(1);
                    var departmentCategory = writeBaseData.FindDepartmentCategoryByName(name);
                    if (departmentCategory == null)
                    {
                        return;
                    }
                    Department department = new Department();
                    //第一列为科室名称
                    department.DepartmentName = columnData.ElementAt(0);
                    //第三列为科室Guid
                    department.DepartmentID         = Guid.Parse(columnData.ElementAt(2));
                    department.DepartmentCategoryID = departmentCategory.DepartmentCategoryID;
                    //添加department
                    writeBaseData.AddDepartment(department);
                }
            }
        }
        public void CreateFileWithTestData()
        {
            Driver getDriver = new Driver();

            driver = getDriver.driverChrome();

            LoginPage       = new LoginPage(driver);
            HomePage        = new HomePage(driver);
            DescriptionPage = new DescriptionPage(driver);
            ManagePackages  = new ManagePackages(driver);
            ContentPage     = new ContentPage(driver);
            PreviewPage     = new PreviewPage(driver);
            SearchPage      = new SearchPage(driver);
            PackagesMenu    = new PackagesMenu(driver);
            PricingPage     = new PricingPage(driver);
            CleanData       = new CleanData();
            ApprovePage     = new ApprovePage(driver);

            driver.Navigate().GoToUrl(URL);

            // CreatePackage_AddTwoParts_Approve_SetDiscount_ExportToExcel

            string role               = "Test Package Pricer";
            string mainGroup          = "00 - General";
            string subGroup           = "00 - Vehicle, complete";
            string vehicleType        = "All Scania Vehicles";
            string variantDescription = "VariantDescription";
            string reasonForPackage   = "ReasonForPackage";
            string packageName        = "PackagePriceTwoParts";
            string packageDescription = "PackageDescription";
            string workorderText      = "WorkorderText";
            string invoiceText        = "InvoiceText";
            string parts              = "1110055";
            string quantity           = "2";

            // ---------------------------------------------------------

            LoginPage.LoginAsRealUser();
            verifyPageTitle(HomePage.mainPageTitle, driver);

            // Navigate Packages -> Create
            HomePage.menuPackages.Click();

            // Wait for page to load
            WaitForAjax(driver, 10, true);

            // Click on menu "Create"
            HomePage.menuCreate.Click();

            //Click on button Next
            WaitForElement(SearchPage.buttonNext);
            SearchPage.buttonNext.Click();

            // Fill out description form
            WaitForElement(DescriptionPage.listMainGroup);
            DescriptionPage.ToFillOutDescription(mainGroup, subGroup, vehicleType, variantDescription, reasonForPackage, packageName, packageDescription, workorderText, invoiceText);

            // Click button Next
            DescriptionPage.buttonNext.Click();

            // Choose a part
            WaitForElements(ContentPage.allDropDownLists);
            ContentPage.dropDownSelectPart(parts);
            ContentPage.buttonAddParts.Click();

            // Set quantity
            ContentPage.fieldQty.Clear();
            ContentPage.fieldQty.SendKeys(quantity);

            // Select main part
            WaitForElement(ContentPage.checkbox_MAIN_PART);
            ContentPage.checkbox_MAIN_PART.Click();

            // Click button Next
            DescriptionPage.buttonNext.Click();

            Thread.Sleep(3000);
            PreviewPage.buttonApprove.Click();

            Thread.Sleep(3000);
            PreviewPage.buttonApproveOnConfirmationDialog.Click();

            Thread.Sleep(3000);
            PreviewPage.buttonNext.Click();

            Thread.Sleep(3000);

            // Find and click on the market
            PricingPage.ToFindMarket("Sweden");

            Thread.Sleep(3000);
            PricingPage.buttonPriceForGroup();

            Thread.Sleep(3000);
            WaitForElements(PricingPage.listWithDiscountButtons);

            PricingPage.buttonOpenListWithParts.Click();
            Thread.Sleep(3000);

            // Set discount
            PricingPage.ToSetDiscountPercentage(5.ToString());

            Thread.Sleep(5000);

            WaitForAjax(driver, 2, true);

            driver.FindElement(By.CssSelector("[value=\"Export to Excel\"]")).Click();

            driver.Close();
            driver.Quit();



            ReadFromExcel getDataSource = new ReadFromExcel();
            List <string> dataArray     = getDataSource.GetWorkSheet(pathToFileWithTestData, 1, "A3", "S3");

            qty                               = ToDouble(dataArray[4]);
            cost                              = ToDouble(dataArray[5]);
            distributorCost                   = ToDouble(dataArray[6]);
            retailPrice                       = ToDouble(dataArray[7]);
            discount_Amount                   = ToDouble(dataArray[8]);
            discount_Percentage               = ToDouble(dataArray[9]);
            salesNetPrice                     = ToDouble(dataArray[10]);
            totalNet                          = ToDouble(dataArray[11]);
            totalGross                        = ToDouble(dataArray[12]);
            totalCost                         = ToDouble(dataArray[13]);
            grossProfit_Amount                = ToDouble(dataArray[14]);
            grossProfit_Percentage            = ToDouble(dataArray[15]);
            totalCostDistributor              = ToDouble(dataArray[16]);
            grossProfitDistributor_Amount     = ToDouble(dataArray[17]);
            grossProfitDistributor_Percentage = ToDouble(dataArray[18]);
        }
Exemplo n.º 22
0
    /*
     * public int isPreferable(TowerType type)
     * {
     *      int dividePos = 0;
     *      for(int i=visitorAttri.preferBuilTp.Length-1; i>=0; --i)
     *      {
     *              if((int)type == (visitorAttri.preferBuilTp[i]-'0') && i>dividePos)
     *                      return 1;
     *              if(visitorAttri.preferBuilTp[i] == '0')
     *              {
     *                      dividePos = i;
     *                      continue;
     *              }
     *              if((int)type == (visitorAttri.preferBuilTp[i]-'0') && i<dividePos)
     *                      return -1;
     *
     *      }
     *      return 0;
     * }
     */
    VisitorEffect ScanForTower()
    {
        //Judge the effect
        //use the raycast method
        //repeat the number of the tower times
        //each time, 1. get the whole tower information
        //2. raycast a ray from the current position of the visitor to the tower's position
        //3. the distance is the tower's range
        //4. if hit, then add the current tower to the list of coveredTowers
        //5. check if this is the favorable tower
        //6. ShowFavorble and ClearHateful when : a. covered by a favorable tower, b. the hp is larger than the angrylimit
        //7. ShowHateful and ClearFavorable when : a. covered by no favorable tower, b. covered by a hateful tower
        //8. ClearFavorable and ClearHateful when there is no coveredTower or the coveredTower is all null
        //9. keep in mind that the range is not a circle.
        Collider2D[] towerColliders;
        //this step could be replaced by the "PoolManager.allobject" method, recheck it later
        VisitorEffect tempEffect;

        tempEffect = showEffect;
        showEffect = VisitorEffect.None;

        towerColliders = Physics2D.OverlapAreaAll(GameManager.gameManager.leftBottom, GameManager.gameManager.rightTop,
                                                  LayerMask.GetMask("Tower"));         //need to be reviewed CCat


        //---------------the things that already known
        float yratio = 2.0408163f;         // 1/(0.7^0.7)
        float range;
        int   i = 0;

        foreach (Collider2D towerColli in towerColliders)
        {
            UnitTower tower = towerColli.GetComponent <UnitTower>();
            range = tower.baseTower.range;
            Vector3 dir = towerColli.transform.position - thisT.position;
            //RaycastHit2D hit;
            //if((hit = Physics2D.Raycast(thisT.position, dir, tower.baseTower.range, LayerMask.GetMask("Tower")))!= false)
            if (dir.x * dir.x + dir.y * dir.y * yratio <= range * range)
            {
                if (i == 0)
                {
                    showEffect = VisitorEffect.em_BadEffect;
                }
                VisitorEffect visEffect = (VisitorEffect)PoolManager.GetEffect(ReadFromExcel.ExtractInt(tower.name), ReadFromExcel.ExtractInt(this.name));
                if (visEffect == VisitorEffect.em_GoodEffect)
                {
                    if (HpAttribute.m_curHp < visitorAttri.angryLimit)
                    {
                        visEffect = VisitorEffect.None;
                    }
                }
                if (visEffect != VisitorEffect.None)
                {
                    showEffect = showEffect | visEffect;
                }
                else
                {
                    showEffect = VisitorEffect.None;
                }
                //showEffect = showEffect | visEffect; //need to be checked
                ++i;
            }
        }
        if (tempEffect == showEffect)
        {
            effectChanges = false;
        }
        else
        {
            effectChanges = true;
        }
        return(showEffect);
    }
Exemplo n.º 23
0
    public void _ShowUpgrade(UnitTower tower)
    {
        Vector3 pos;

        if (upgradeUI != null)
        {
            int        upprice = tower.baseTower.upgradeCost;
            Transform  can     = upgradeUI.gameObject.transform.FindChild("Canvas");
            GameObject tex     = can.FindChild("Text").gameObject;
            Text       text    = tex.transform.GetComponent <Text>();
            text.text = "$" + upprice.ToString();
            pos       = tower.thisT.position;
            float height = upgradeUI.GetComponent <BoxCollider2D>().size.y *upgradeUI.transform.localScale.y;

            if (pos.y + tower.GetComponent <BoxCollider2D>().size.y + height / 2 + 0.05f < maxY)
            {
                upgradeUI.transform.position = new Vector3(pos.x, pos.y + tower.GetComponent <BoxCollider2D>().size.y + height / 2 + 0.05f, pos.z);
            }
            else
            {
                float width  = upgradeUI.GetComponent <BoxCollider2D>().size.x *upgradeUI.transform.localScale.x;
                float width2 = tower.GetComponent <BoxCollider2D>().size.x;
                upgradeUI.transform.position = new Vector3(pos.x - width2 / 2 - width / 2 - 0.05f, pos.y, pos.z);
            }
            upgradeUI.GetComponent <Renderer>().enabled = true;
            if (ScoreControl.CheckResourceSuffi(upprice) == true && BuildManager.FindUpgrade(ReadFromExcel.ExtractInt(tower.name)))
            {
                upgradeUI.GetComponent <SpriteRenderer>().color = Color.white;
                text.color = Color.white;
                upgradeUI.GetComponent <BoxCollider2D>().enabled = true;
                Transform child;
                if ((child = upgradeUI.transform.FindChild("mouseOver")) != null)
                {
                    child.GetComponent <Renderer>().enabled = true;
                }
            }
            else
            {
                upgradeUI.GetComponent <SpriteRenderer>().color = new Color(0.8f, 0.8f, 0.8f, 1.0f);
                text.color = new Color(0.8f, 0.8f, 0.8f, 1.0f);
                upgradeUI.GetComponent <BoxCollider2D>().enabled = false;
                Transform child;
                if ((child = upgradeUI.transform.FindChild("mouseOver")) != null)
                {
                    child.GetComponent <Renderer>().enabled = false;
                }
            }
        }
    }