示例#1
0
		public Cost(Cost another)
		{
			weight = another.weight;
			crewSpace = another.crewSpace;
			passengerSpace = another.passengerSpace;
			timePrice = another.timePrice;
		}
示例#2
0
    public CostNode(Cost cost, Entity entity, int time)
    {
        Entity = entity;
        EntityID = Entity.GetID();

        CostPerHour = cost.costPerHour;
        TimeInMinutes = time;
    }
    /*
     *	Called by building panels 3d when finally purchasing an entity
     */
    public static void Buy(Cost cost, Entity entity)
    {
        money -= cost.costInitial;

        // only add costs when there is a cost per hour
        if (cost.costPerHour > 0)
            AddCost(cost, entity);
    }
    public static void AddCost(Cost cost, Entity entity)
    {
        CostNode node = new CostNode(cost, entity, TimeController.TimeInMinutes + 60);
        costs.Enqueue(node, node.TimeInMinutes);

        // also add to cost per hour
        costPerHour += cost.costPerHour;
    }
        public void TestAddingZeroIsZero()
        {
            Cost none = new Cost();
            none.Add(new Cost());

            var a = new Cost();
            var b = new Cost();
            Assert.IsTrue(a.Equals(b));
            Assert.AreEqual(0, new Cost().GetLoDSum());
        }
示例#6
0
文件: Cost.cs 项目: LeSphax/Famine
 public static String toString(Cost[] costs)
 {
     String result = "";
     for (int i = 0; i < costs.Length-1; i++)
     {
         result += costs[i].ToString() +", ";
     }
     result += costs[costs.Length-1].ToString();
     return result;
 }
示例#7
0
 public double getCost(Cost cost)
 {
     switch (cost)
     {
         case Cost.Heuristic:
             return this.heuristicCost;
         case Cost.Movement:
             return this.movementCost;
         case Cost.Total:
             return this.totalCost;
         default:
             throw new Exception("invalid cost type get");
     }
 }
    public void UpdateOn(Person new_person)
    {
        //buildPanel.Setup (building);
        base.UpdateOn ();

        person = new_person;
        cost = person.gameObject.GetComponent<Cost>();

        originalMaterial = person.gameObject.GetComponent<Renderer>().material;
        person.gameObject.SetActive (true);

        // turn off other interfaces
        this.gameObject.GetComponent<SelectEntity>().Pause();
    }
示例#9
0
 public bool PayCosts(Cost[] costs, int times)
 {
     foreach (Cost cost in costs)
     {
         if (quantities[cost.Name] < cost.Number * times)
         {
             return false;
         }
     }
     foreach (Cost cost in costs)
     {
         quantities[cost.Name] -= cost.Number * times;
     }
     return true;
 }
示例#10
0
 static double MinimumEditDistance(string s, string t, Cost cost)
 {
     var d = new double[s.Length + 1, t.Length + 1];
     for (int i = 0; i <= s.Length; i++)
         d[i, 0] = i * cost.Delete;
     for (int j = 0; j <= t.Length; j++)
         d[0, j] = j * cost.Insert;
     for (int j = 1; j <= t.Length; j++)
         for (int i = 1; i <= s.Length; i++)
             if (s[i - 1] == t[j - 1])
                 d[i, j] = d[i - 1, j - 1];  // no operation
             else
                 d[i, j] = Math.Min(Math.Min(
                     d[i - 1, j] + cost.Delete,
                     d[i, j - 1] + cost.Insert),
                     d[i - 1, j - 1] + cost.Replace);
     return d[s.Length, t.Length];
 }
示例#11
0
 public override Cost DefineCost()
 {
     return(Cost.ActionOthers(this, 1, card => card.HasUnitNameOf(Strings.Get("card_text_unitname_サジ"))) + Cost.ActionOthers(this, 1, card => card.HasUnitNameOf(Strings.Get("card_text_unitname_マジ"))));
 }
示例#12
0
文件: Mediator.cs 项目: TGIfr/courses
 // Constructor
 public Buyer(string name, Cost c = Cost.Low, Quality q = Quality.Low)
     : base(name, c, q)
 {
 }
 public CyclomaticCost(int lineNumber, Cost cyclomaticCost) : base(lineNumber, cyclomaticCost)
 {
 }
示例#14
0
 public override void BeginConsume()
 {
     _cost = new Cost();
 }
示例#15
0
        private async Task AddCost()
        {
            try
            {
                PrepareFactors();
                var cost = new Cost();
                cost.Amount = _amount;

                if (_useExistCost)
                {
                    cost             = _selectedCost;
                    cost.Amount      = _amount;
                    cost.Description = _selectedCost.Description;
                }
                else
                {
                    if (!string.IsNullOrEmpty(_newCategory) && _categories.Any(x => x.Name.ToLower() == _newCategory.ToLower()))
                    {
                        throw new Exception("Kategoria już istnieje");
                    }

                    cost.Category = _selectedCategory ?? new Category {
                        Name = _newCategory
                    };
                    cost.Name = new Name {
                        Value = _newName
                    };

                    if (costDao.IsCostExit(cost))
                    {
                        throw new Exception("Już istnieje taki koszt.");
                    }

                    if (!string.IsNullOrEmpty(_description))
                    {
                        cost.Description = new Description {
                            Value = _description
                        };
                    }
                }

                costDao.AddCost(cost);

                Logger.Log <AddCostComponent>("Nowy wydatek został zapisany w bazie.", Common.LogLevel.INFO);
                await ShowNotification(new NotificationMessage
                {
                    Detail   = "Wydatek został dodany.",
                    Duration = 3000,
                    Severity = NotificationSeverity.Success,
                    Summary  = "Informacja"
                });

                await Task.Delay(2000);

                navigationManager.NavigateTo("/", true);
            }
            catch (Exception ex)
            {
                Logger.Log <AddCostComponent>(ex);
                _disabled = false;

                await ShowNotification(new NotificationMessage
                {
                    Detail   = ex.Message,
                    Duration = 3000,
                    Severity = NotificationSeverity.Error,
                    Summary  = "Informacja"
                });
            }
        }
		Result GetResultFromBlock(BlockStatement block)
		{
			// For a block, we are tracking 4 possibilities:
			// a) context is checked, no unchecked block open
			Cost costCheckedContext = new Cost(0, 0);
			InsertedNode nodesCheckedContext = null;
			// b) context is checked, an unchecked block is open
			Cost costCheckedContextUncheckedBlockOpen = Cost.Infinite;
			InsertedNode nodesCheckedContextUncheckedBlockOpen = null;
			Statement uncheckedBlockStart = null;
			// c) context is unchecked, no checked block open
			Cost costUncheckedContext = new Cost(0, 0);
			InsertedNode nodesUncheckedContext = null;
			// d) context is unchecked, a checked block is open
			Cost costUncheckedContextCheckedBlockOpen = Cost.Infinite;
			InsertedNode nodesUncheckedContextCheckedBlockOpen = null;
			Statement checkedBlockStart = null;
			
			Statement statement = block.Statements.FirstOrDefault();
			while (true) {
				// Blocks can be closed 'for free'. We use '<=' so that blocks are closed as late as possible (goal 4)
				if (costCheckedContextUncheckedBlockOpen <= costCheckedContext) {
					costCheckedContext = costCheckedContextUncheckedBlockOpen;
					nodesCheckedContext = nodesCheckedContextUncheckedBlockOpen + new InsertedBlock(uncheckedBlockStart, statement, false);
				}
				if (costUncheckedContextCheckedBlockOpen <= costUncheckedContext) {
					costUncheckedContext = costUncheckedContextCheckedBlockOpen;
					nodesUncheckedContext = nodesUncheckedContextCheckedBlockOpen + new InsertedBlock(checkedBlockStart, statement, true);
				}
				if (statement == null)
					break;
				// Now try opening blocks. We use '<' so that blocks are opened as early as possible. (goal 4)
				if (costCheckedContext + new Cost(1, 0) < costCheckedContextUncheckedBlockOpen) {
					costCheckedContextUncheckedBlockOpen = costCheckedContext + new Cost(1, 0);
					nodesCheckedContextUncheckedBlockOpen = nodesCheckedContext;
					uncheckedBlockStart = statement;
				}
				if (costUncheckedContext + new Cost(1, 0) < costUncheckedContextCheckedBlockOpen) {
					costUncheckedContextCheckedBlockOpen = costUncheckedContext + new Cost(1, 0);
					nodesUncheckedContextCheckedBlockOpen = nodesUncheckedContext;
					checkedBlockStart = statement;
				}
				// Now handle the statement
				Result stmtResult = GetResult(statement);
				
				costCheckedContext += stmtResult.CostInCheckedContext;
				nodesCheckedContext += stmtResult.NodesToInsertInCheckedContext;
				costCheckedContextUncheckedBlockOpen += stmtResult.CostInUncheckedContext;
				nodesCheckedContextUncheckedBlockOpen += stmtResult.NodesToInsertInUncheckedContext;
				costUncheckedContext += stmtResult.CostInUncheckedContext;
				nodesUncheckedContext += stmtResult.NodesToInsertInUncheckedContext;
				costUncheckedContextCheckedBlockOpen += stmtResult.CostInCheckedContext;
				nodesUncheckedContextCheckedBlockOpen += stmtResult.NodesToInsertInCheckedContext;
				
				statement = statement.GetNextStatement();
			}
			
			return new Result {
				CostInCheckedContext = costCheckedContext, NodesToInsertInCheckedContext = nodesCheckedContext,
				CostInUncheckedContext = costUncheckedContext, NodesToInsertInUncheckedContext = nodesUncheckedContext
			};
		}
 /**
  * @param lineNumber
  *          that the {@code methodCost} was called on for the class that
  *          contains this cost.
  * @param cost
  *          the cost of the method getting called from this {@code LineNumber}
  */
 public ViolationCost(int lineNumber, Cost cost)
 {
     this.lineNumber = lineNumber;
     this.cost = cost;
 }
示例#18
0
 public static void SetBuildCost(BuildingType type, Cost cost)
 {
     costs[(int)CostType.Build][(int)type] = cost;
 }
示例#19
0
 public static void SetUpkeepCost(BuildingType type, Cost cost)
 {
     costs[(int)CostType.Upkeep][(int)type] = cost;
 }
示例#20
0
        private static void InsertNewCost(Cost cost)
        {
            string command = "INSERT INTO " + DBSetup.costTable + " VALUES (NULL, @date, @description, @currency, @value, @receipt);";

            ExecuteDBCommand(command, cost);
        }
示例#21
0
 public string WriteCost()
 {
     return(string.Join(", ", Cost.Select(kvp => $"{kvp.Value} {kvp.Key}")));
 }
示例#22
0
        public WTPAddEditGump(Conditions conditions, int curC, int curL, WorldTeleporter worldTP) : base(0, 0)
        {
            if (!PGSystem.Running)
            {
                return;
            }

            m_Conditions = conditions;
            m_CurCat     = curC;
            m_CurLoc     = curL;
            m_Gate       = worldTP;

            if (!GetFlag(Conditions.Category) || (GetFlag(Conditions.Category) && !GetFlag(Conditions.Adding)))
            {
                m_Cat = PGSystem.CategoryList[curC];
            }
            if (m_Cat != null && (!GetFlag(Conditions.Category) && !GetFlag(Conditions.Adding)))
            {
                m_Loc = m_Cat.Locations[curL];
            }


            string Name = "";

            if (!GetFlag(Conditions.Adding))
            {
                if (GetFlag(Conditions.Category))
                {
                    Name = m_Cat.Name;
                }
                else
                {
                    Name = m_Loc.Name;
                }
            }

            Point3D Loc = new Point3D(0, 0, 0);
            Map     Map = Map.Trammel;
            bool    Gen, Staff, Reds, Charge, Young;
            int     Hue, Cost;

            Gen = Staff = Reds = Charge = Young = false;
            Hue = Cost = 0;

            if (GetFlag(Conditions.Category) && !GetFlag(Conditions.Adding))
            {
                Gen    = m_Cat.GetFlag(EntryFlag.Generate);
                Staff  = m_Cat.GetFlag(EntryFlag.StaffOnly);
                Reds   = m_Cat.GetFlag(EntryFlag.Reds);
                Charge = m_Cat.GetFlag(EntryFlag.Charge);
                Young  = m_Cat.GetFlag(EntryFlag.Young);
                Cost   = m_Cat.Cost;
            }

            if (!GetFlag(Conditions.Category) && !GetFlag(Conditions.Adding))
            {
                Loc    = m_Loc.Location;
                Map    = m_Loc.Map;
                Gen    = m_Loc.GetFlag(EntryFlag.Generate);
                Staff  = m_Loc.GetFlag(EntryFlag.StaffOnly);
                Reds   = m_Loc.GetFlag(EntryFlag.Reds);
                Charge = m_Loc.GetFlag(EntryFlag.Charge);
                Young  = m_Loc.GetFlag(EntryFlag.Young);
                Hue    = m_Loc.Hue;
                Cost   = m_Loc.Cost;
            }

            Closable   = true;
            Disposable = true;
            Dragable   = true;
            Resizable  = false;

            AddPage(0);

            AddBackground(530, 100, 230, 410, 2600);
            AddLabel(602, 120, 0, string.Format("{0} {1}", (GetFlag(Conditions.Adding) ? "Add" : "Edit"), (GetFlag(Conditions.Category) ? "Category" : "Location")));

            AddLabel(625, 145, 0, "Name :");
            AddImage(555, 170, 2446);
            AddTextEntry(565, 170, 160, 20, 0, 2, Name);

            AddLabel(715, 235, 0, ": C");
            AddImage(650, 235, 2443);
            AddTextEntry(655, 235, 55, 20, 0, 15, Cost.ToString());

            if (!GetFlag(Conditions.Category))
            {
                AddLabel(560, 210, 0, "X :");
                AddImage(580, 210, 2443);
                AddTextEntry(585, 210, 55, 20, 0, 3, Loc.X.ToString());

                AddLabel(560, 235, 0, "Y :");
                AddImage(580, 235, 2443);
                AddTextEntry(585, 235, 55, 20, 0, 4, Loc.Y.ToString());

                AddLabel(560, 260, 0, "Z :");
                AddImage(580, 260, 2443);
                AddTextEntry(585, 260, 55, 20, 0, 5, Loc.Z.ToString());

                AddLabel(715, 210, 0, ": H");
                AddImage(650, 210, 2443);
                AddTextEntry(655, 210, 55, 20, 0, 14, Hue.ToString());

                AddLabel(585, 315, 0, "Trammel");
                AddRadio(555, 315, 208, 209, (Map == Map.Trammel ? true : false), 6);

                AddLabel(585, 340, 0, "Felucca");
                AddRadio(555, 340, 208, 209, (Map == Map.Felucca ? true : false), 7);

                AddLabel(685, 315, 0, "Malas");
                AddRadio(655, 315, 208, 209, (Map == Map.Malas ? true : false), 8);

                AddLabel(685, 345, 0, "Ilshenar");
                AddRadio(655, 340, 208, 209, (Map == Map.Ilshenar ? true : false), 9);

                AddLabel(585, 365, 0, "Tokuno");
                AddRadio(555, 370, 208, 209, (Map == Map.Tokuno ? true : false), 10);

                AddLabel(685, 365, 0, "TerMur");
                AddRadio(655, 370, 208, 209, (Map == Map.TerMur ? true : false), 20);
            }


            AddLabel(585, 395, 0, "Generate?");
            AddCheck(555, 395, 210, 211, Gen, 11);

            AddLabel(665, 395, 0, "Young?");
            AddCheck(715, 395, 210, 211, Young, 16);

            AddLabel(585, 420, 0, "Reds?");
            AddCheck(555, 420, 210, 211, Reds, 13);

            AddLabel(658, 420, 0, "Charge?");
            AddCheck(715, 420, 210, 211, Charge, 17);

            AddLabel(585, 445, 0, "Staff Only?");
            AddCheck(555, 445, 210, 211, Staff, 12);

            AddButton(700, 450, 1417, 1417, 1, GumpButtonType.Reply, 0);
            AddLabel(728, 481, 69, "Apply");
        }
示例#23
0
        public string FTP_LAEastBatonRouge(string houseno, string sname, string sttype, string parcelNumber, string searchType, string orderNumber, string ownername, string directParcel)
        {
            GlobalClass.global_orderNo             = orderNumber;
            HttpContext.Current.Session["orderNo"] = orderNumber;
            GlobalClass.global_parcelNo            = parcelNumber;

            string StartTime = "", AssessmentTime = "", TaxTime = "", CitytaxTime = "", LastEndTime = "";

            var driverService = PhantomJSDriverService.CreateDefaultService();

            driverService.HideCommandPromptWindow = true;
            using (driver = new PhantomJSDriver())//PhantomJSDriver
            {
                try
                {
                    StartTime = DateTime.Now.ToString("HH:mm:ss");

                    if (searchType == "titleflex")
                    {
                        string address = houseno + " " + sname + " " + sttype;
                        gc.TitleFlexSearch(orderNumber, parcelNumber, "", address, "LA", "East Baton Rouge");
                        if ((HttpContext.Current.Session["TitleFlex_Search"] != null && HttpContext.Current.Session["TitleFlex_Search"].ToString() == "Yes"))
                        {
                            driver.Quit();
                            return("MultiParcel");
                        }
                        else if (HttpContext.Current.Session["titleparcel"].ToString() == "")
                        {
                            HttpContext.Current.Session["EastbatonLA_NoRecord"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                        parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        searchType   = "parcel";
                    }

                    driver.Navigate().GoToUrl("http://www.ebrpa.org/PageDisplay.asp?p1=1503");
                    Thread.Sleep(2000);
                    IWebElement iframeElement = null;
                    try
                    {
                        iframeElement = driver.FindElement(By.XPath("/html/body/center/div[2]/table/tbody/tr/td[2]/table/tbody/tr/td/table/tbody/tr[2]/td/font/div[1]/iframe"));
                    }
                    catch { }
                    try
                    {
                        if (iframeElement == null)
                        {
                            iframeElement = driver.FindElement(By.XPath("//*[@id='single-blocks']/div[2]/div[2]/div/div/div/div/div/iframe"));
                        }
                    }
                    catch { }
                    Thread.Sleep(2000);
                    driver.SwitchTo().Frame(iframeElement);
                    //if (searchType == "address")
                    //{
                    //    //driver.Navigate().GoToUrl("http://www.ebrpa.org/PageDisplay.asp?p1=1503");
                    //    //Thread.Sleep(2000);

                    //    //IWebElement iframeElement = driver.FindElement(By.XPath("/html/body/center/div[2]/table/tbody/tr/td[2]/table/tbody/tr/td/table/tbody/tr[2]/td/font/div[1]/iframe"));
                    //    //Thread.Sleep(2000);
                    //    driver.SwitchTo().Frame(iframeElement);

                    //    driver.FindElement(By.XPath("/html/body/div[2]/div/div[3]/div/div/form/input[3]")).Click();
                    //    Thread.Sleep(2000);
                    //    driver.FindElement(By.XPath("/html/body/div[2]/div/div[3]/div/div/form/div[2]/div/input[1]")).SendKeys(houseno);
                    //    driver.FindElement(By.XPath("/html/body/div[2]/div/div[3]/div/div/form/div[2]/div/input[2]")).SendKeys(sname);

                    //    driver.FindElement(By.XPath("/html/body/div[2]/div/div[3]/div/div/form/div[5]/button")).Click();
                    //    Thread.Sleep(2000);
                    //    //Screen-Shot
                    //    gc.CreatePdf_WOP(orderNumber, "AddressSearch", driver, "LA", "East Baton Rouge");


                    //    //MultiParcel
                    //    IWebElement MultiParcelTable = driver.FindElement(By.XPath("/html/body/div[2]/div/div[3]/div/div/table/tbody"));
                    //    IList<IWebElement> MultiParcelTR = MultiParcelTable.FindElements(By.TagName("tr"));

                    //    if (MultiParcelTR.Count == 1)
                    //    {
                    //        NavigateUrl(driver);
                    //    }
                    //    else
                    //    {
                    //        try
                    //        {
                    //            string no = driver.FindElement(By.XPath("//*[@id='ng-view']/div/div")).Text;
                    //            if (no.Contains("No results found"))
                    //            {
                    //                HttpContext.Current.Session["EastbatonLA_NoRecord"] = "Yes";
                    //                driver.Quit();
                    //                return "No Data Found";
                    //            }
                    //        }
                    //        catch
                    //        {

                    //        }

                    //        IList<IWebElement> MultiParcelTD;
                    //        foreach (IWebElement multi in MultiParcelTR)
                    //        {
                    //            MultiParcelTD = multi.FindElements(By.TagName("td"));
                    //            if (MultiParcelTD.Count != 0)
                    //            {
                    //                parcelNumber = MultiParcelTD[0].Text;
                    //                Ownername = MultiParcelTD[1].Text;
                    //                Physicaladdrerss = MultiParcelTD[2].Text;
                    //                Multidata = Ownername + "~" + Physicaladdrerss;
                    //                gc.insert_date(orderNumber, parcelNumber, 177, Multidata, 1, DateTime.Now);
                    //            }
                    //            HttpContext.Current.Session["multiParcel_LAEastBatonRouge"] = "Yes";
                    //        }

                    //        if (MultiParcelTR.Count > 25)
                    //        {
                    //            HttpContext.Current.Session["multiParcel_LAEastBatonRouge_Multicount"] = "Maximum";
                    //        }
                    //        driver.Quit();
                    //        return "MultiParcel";
                    //    }
                    //}

                    //else if (searchType == "parcel")
                    //{
                    //    driver.Navigate().GoToUrl("http://www.ebrpa.org/PageDisplay.asp?p1=1503");
                    //    Thread.Sleep(2000);

                    //    IWebElement iframeElement = driver.FindElement(By.XPath("/html/body/center/div[2]/table/tbody/tr/td[2]/table/tbody/tr/td/table/tbody/tr[2]/td/font/div[1]/iframe"));
                    //    driver.SwitchTo().Frame(iframeElement);

                    //    driver.FindElement(By.XPath("/html/body/div[2]/div/div[3]/div/div/form/input[1]")).Click();
                    //    Thread.Sleep(2000);
                    //    driver.FindElement(By.XPath("/html/body/div[2]/div/div[3]/div/div/form/input[7]")).SendKeys(parcelNumber);
                    //    gc.CreatePdf(orderNumber, parcelNumber, "ParcelSearch", driver, "LA", "East Baton Rouge");
                    //    driver.FindElement(By.XPath("/html/body/div[2]/div/div[3]/div/div/form/div[5]/button")).Click();
                    //    Thread.Sleep(2000);

                    //    driver.FindElement(By.XPath("/html/body/div[2]/div/div[3]/div/div/table/tbody/tr/td[4]/a")).Click();
                    //    Thread.Sleep(3000);
                    //    NavigateUrl(driver);
                    //}

                    //else if (searchType == "ownername")
                    //{
                    //    driver.Navigate().GoToUrl("http://www.ebrpa.org/PageDisplay.asp?p1=1503");
                    //    Thread.Sleep(2000);

                    //    IWebElement iframeElement = driver.FindElement(By.XPath("/html/body/center/div[2]/table/tbody/tr/td[2]/table/tbody/tr/td/table/tbody/tr[2]/td/font/div[1]/iframe"));
                    //    driver.SwitchTo().Frame(iframeElement);

                    //    driver.FindElement(By.XPath("/html/body/div[2]/div/div[3]/div/div/form/input[2]")).Click();
                    //    Thread.Sleep(2000);
                    //    driver.FindElement(By.XPath("/html/body/div[2]/div/div[3]/div/div/form/input[7]")).SendKeys(ownername);
                    //    gc.CreatePdf(orderNumber, parcelNumber, "ParcelSearch", driver, "LA", "East Baton Rouge");
                    //    driver.FindElement(By.XPath("/html/body/div[2]/div/div[3]/div/div/form/div[5]/button")).Click();
                    //    Thread.Sleep(2000);
                    //    gc.CreatePdf(orderNumber, outparcelno, "Property_Search", driver, "LA", "East Baton Rouge");
                    //    //MultiParcel
                    //    IWebElement MultiParcelTable = driver.FindElement(By.XPath("/html/body/div[2]/div/div[3]/div/div/table/tbody"));
                    //    IList<IWebElement> MultiParcelTR = MultiParcelTable.FindElements(By.TagName("tr"));

                    //    if (MultiParcelTR.Count == 1)
                    //    {
                    //        NavigateUrl(driver);
                    //    }
                    //    else
                    //    {
                    //        IList<IWebElement> MultiParcelTD;
                    //        foreach (IWebElement multi in MultiParcelTR)
                    //        {
                    //            MultiParcelTD = multi.FindElements(By.TagName("td"));
                    //            if (MultiParcelTD.Count != 0)
                    //            {
                    //                parcelNumber = MultiParcelTD[0].Text;
                    //                Ownername = MultiParcelTD[1].Text;
                    //                Physicaladdrerss = MultiParcelTD[2].Text;
                    //                Multidata = Ownername + "~" + Physicaladdrerss;
                    //                gc.insert_date(orderNumber, parcelNumber, 177, Multidata, 1, DateTime.Now);
                    //            }
                    //        }

                    //        HttpContext.Current.Session["multiParcel_LAEastBatonRouge"] = "Yes";
                    //        if (MultiParcelTR.Count > 25)
                    //        {
                    //            HttpContext.Current.Session["multiParcel_LAEastBatonRouge_Multicount"] = "Maximum";
                    //        }
                    //        driver.Quit();
                    //        return "MultiParcel";
                    //    }

                    //}
                    if (searchType == "address")
                    {
                        driver.FindElement(By.XPath("//*[@id='ng-view']/div/form/input[3]")).Click();
                        Thread.Sleep(2000);
                        driver.FindElement(By.XPath("//*[@id='ng-view']/div/form/div[2]/div/input[1]")).SendKeys(houseno);
                        driver.FindElement(By.XPath("//*[@id='ng-view']/div/form/div[2]/div/input[2]")).SendKeys(sname);
                        gc.CreatePdf_WOP(orderNumber, "Address Search", driver, "LA", "East Baton Rouge");
                        driver.FindElement(By.XPath("//*[@id='ng-view']/div/form/div[5]/button")).Click();
                        Thread.Sleep(2000);
                        //Screen-Shot
                        gc.CreatePdf_WOP(orderNumber, "Address Search Result", driver, "LA", "East Baton Rouge");


                        //MultiParcel
                        IWebElement         MultiParcelTable = driver.FindElement(By.XPath("//*[@id='ng-view']/div/table/tbody"));
                        IList <IWebElement> MultiParcelTR    = MultiParcelTable.FindElements(By.TagName("tr"));

                        if (MultiParcelTR.Count == 1)
                        {
                            NavigateUrl(driver);
                        }
                        else
                        {
                            try
                            {
                                string no = driver.FindElement(By.XPath("//*[@id='ng-view']/div/div")).Text;
                                if (no.Contains("No results found"))
                                {
                                    HttpContext.Current.Session["EastbatonLA_NoRecord"] = "Yes";
                                    driver.Quit();
                                    return("No Data Found");
                                }
                            }
                            catch
                            {
                            }

                            IList <IWebElement> MultiParcelTD;
                            foreach (IWebElement multi in MultiParcelTR)
                            {
                                MultiParcelTD = multi.FindElements(By.TagName("td"));
                                if (MultiParcelTD.Count != 0)
                                {
                                    parcelNumber     = MultiParcelTD[0].Text;
                                    Ownername        = MultiParcelTD[1].Text;
                                    Physicaladdrerss = MultiParcelTD[2].Text;
                                    Multidata        = Ownername + "~" + Physicaladdrerss;
                                    gc.insert_date(orderNumber, parcelNumber, 177, Multidata, 1, DateTime.Now);
                                }
                                HttpContext.Current.Session["multiParcel_LAEastBatonRouge"] = "Yes";
                            }

                            if (MultiParcelTR.Count > 25)
                            {
                                HttpContext.Current.Session["multiParcel_LAEastBatonRouge_Multicount"] = "Maximum";
                            }
                            driver.Quit();
                            return("MultiParcel");
                        }
                    }

                    else if (searchType == "parcel")
                    {
                        //driver.Navigate().GoToUrl("http://www.ebrpa.org/PageDisplay.asp?p1=1503");
                        //Thread.Sleep(2000);

                        //IWebElement iframeElement = driver.FindElement(By.XPath("/html/body/center/div[2]/table/tbody/tr/td[2]/table/tbody/tr/td/table/tbody/tr[2]/td/font/div[1]/iframe"));
                        //driver.SwitchTo().Frame(iframeElement);

                        driver.FindElement(By.XPath("//*[@id='ng-view']/div/form/input[1]")).Click();
                        Thread.Sleep(2000);
                        driver.FindElement(By.XPath("//*[@id='ng-view']/div/form/input[7]")).SendKeys(parcelNumber);
                        gc.CreatePdf(orderNumber, parcelNumber, "ParcelSearch", driver, "LA", "East Baton Rouge");
                        driver.FindElement(By.XPath("//*[@id='ng-view']/div/form/div[5]/button")).Click();
                        Thread.Sleep(2000);

                        driver.FindElement(By.XPath("//*[@id='ng-view']/div/table/tbody/tr/td[4]/a")).Click();
                        Thread.Sleep(3000);
                        NavigateUrl(driver);
                    }

                    else if (searchType == "ownername")
                    {
                        //driver.Navigate().GoToUrl("http://www.ebrpa.org/PageDisplay.asp?p1=1503");
                        //Thread.Sleep(2000);

                        //IWebElement iframeElement = driver.FindElement(By.XPath("/html/body/center/div[2]/table/tbody/tr/td[2]/table/tbody/tr/td/table/tbody/tr[2]/td/font/div[1]/iframe"));
                        //driver.SwitchTo().Frame(iframeElement);

                        driver.FindElement(By.XPath("//*[@id='ng-view']/div/form/input[2]")).Click();
                        Thread.Sleep(2000);
                        driver.FindElement(By.XPath("//*[@id='ng-view']/div/form/input[7]")).SendKeys(ownername);
                        gc.CreatePdf(orderNumber, parcelNumber, "ParcelSearch", driver, "LA", "East Baton Rouge");
                        driver.FindElement(By.XPath("//*[@id='ng-view']/div/form/div[5]/button")).Click();
                        Thread.Sleep(2000);
                        gc.CreatePdf(orderNumber, outparcelno, "Property_Search", driver, "LA", "East Baton Rouge");
                        //MultiParcel
                        IWebElement         MultiParcelTable = driver.FindElement(By.XPath("//*[@id='ng-view']/div/table/tbody"));
                        IList <IWebElement> MultiParcelTR    = MultiParcelTable.FindElements(By.TagName("tr"));

                        if (MultiParcelTR.Count == 1)
                        {
                            NavigateUrl(driver);
                        }
                        else
                        {
                            IList <IWebElement> MultiParcelTD;
                            foreach (IWebElement multi in MultiParcelTR)
                            {
                                MultiParcelTD = multi.FindElements(By.TagName("td"));
                                if (MultiParcelTD.Count != 0)
                                {
                                    parcelNumber     = MultiParcelTD[0].Text;
                                    Ownername        = MultiParcelTD[1].Text;
                                    Physicaladdrerss = MultiParcelTD[2].Text;
                                    Multidata        = Ownername + "~" + Physicaladdrerss;
                                    gc.insert_date(orderNumber, parcelNumber, 177, Multidata, 1, DateTime.Now);
                                }
                            }

                            HttpContext.Current.Session["multiParcel_LAEastBatonRouge"] = "Yes";
                            if (MultiParcelTR.Count > 25)
                            {
                                HttpContext.Current.Session["multiParcel_LAEastBatonRouge_Multicount"] = "Maximum";
                            }
                            driver.Quit();
                            return("MultiParcel");
                        }
                    }

                    //Scrapped Data

                    //Property Deatails
                    outparcelno = driver.FindElement(By.XPath("/html/body/div[3]/div/div[1]/span[2]")).Text;
                    OwnerName   = driver.FindElement(By.XPath("/html/body/div[3]/div/div[2]/div/span[2]")).Text;
                    if (OwnerName.Contains("\r\n"))
                    {
                        OwnerName = OwnerName.Replace("\r\n", ",");
                    }
                    Mailingaddress = driver.FindElement(By.XPath("/html/body/div[3]/div/div[3]/div/span")).Text;
                    if (Mailingaddress.Contains("\r\n"))
                    {
                        Mailingaddress = Mailingaddress.Replace("\r\n", ",");
                    }
                    Property_Type   = driver.FindElement(By.XPath("/html/body/div[3]/div/div[5]/div/span")).Text;
                    Propertyaddress = driver.FindElement(By.XPath("/html/body/div[3]/div/div[7]/div/span[2]")).Text;
                    if (Propertyaddress.Contains("\r\n"))
                    {
                        Propertyaddress = Propertyaddress.Replace("\r\n", ",");
                    }
                    gc.CreatePdf(orderNumber, outparcelno, "Assement", driver, "LA", "East Baton Rouge");

                    //Assessment Details
                    //string year = driver.FindElement(By.XPath("/html/body/div[2]/div/span[1]")).Text;
                    //IWebElement TBAssess = driver.FindElement(By.XPath("/html/body/div[3]/div/div[8]/table/tbody"));
                    string year = "";
                    try
                    {
                        year = driver.FindElement(By.XPath("/html/body/div[2]/div/span")).Text.Replace("Assessment Listing", "").Trim();
                    }
                    catch { }
                    IWebElement         TBAssess = driver.FindElement(By.XPath("//*[@id='parcelDetails']/div[8]/table/tbody"));
                    IList <IWebElement> TRAssess = TBAssess.FindElements(By.TagName("tr"));
                    IList <IWebElement> TDAssess;
                    foreach (IWebElement assess in TRAssess)
                    {
                        TDAssess = assess.FindElements(By.TagName("td"));
                        if (TDAssess.Count != 0)
                        {
                            Property_class   = TDAssess[0].Text;
                            AssedValues      = TDAssess[1].Text;
                            Units            = TDAssess[2].Text;
                            Homestead        = TDAssess[3].Text;
                            Assement_details = year + "~" + Property_class + "~" + AssedValues + "~" + Units + "~" + Homestead;
                            gc.insert_date(orderNumber, outparcelno, 198, Assement_details, 1, DateTime.Now);
                        }
                    }
                    AssessmentTime = DateTime.Now.ToString("HH:mm:ss");

                    //TaxDistribution Details
                    //IWebElement TBTax = driver.FindElement(By.XPath("/html/body/div[3]/div/div[11]/table/tbody"));
                    IWebElement         TBTax = driver.FindElement(By.XPath("//*[@id='parcelDetails']/div[11]/table/tbody"));
                    IList <IWebElement> TRTax = TBTax.FindElements(By.TagName("tr"));
                    IList <IWebElement> TDTax;
                    foreach (IWebElement tax in TRTax)
                    {
                        TDTax = tax.FindElements(By.TagName("td"));
                        if (TDTax.Count != 0)
                        {
                            Millage                = TDTax[0].Text;
                            Mills                  = TDTax[1].Text;
                            Tax                    = TDTax[2].Text;
                            Homestead_Tax          = TDTax[3].Text;
                            TaxDistributionDetails = Millage + "~" + Mills + "~" + Tax + "~" + Homestead_Tax;
                            gc.insert_date(orderNumber, outparcelno, 201, TaxDistributionDetails, 1, DateTime.Now);
                        }
                    }

                    amc.TaxId = outparcelno;
                    //TaxInformation Details
                    driver.Navigate().GoToUrl("http://snstaxpayments.com/ebr");
                    Thread.Sleep(2000);

                    driver.FindElement(By.Id("submit")).SendKeys(Keys.Enter);
                    Thread.Sleep(2000);

                    driver.FindElement(By.XPath("/html/body/div[1]/div[3]/form/div/div/div[1]/div[2]/label/input")).Click();
                    Thread.Sleep(2000);
                    driver.FindElement(By.Id("searchFor1")).SendKeys(outparcelno);
                    gc.CreatePdf(orderNumber, outparcelno, "Tax", driver, "LA", "East Baton Rouge");
                    driver.FindElement(By.Id("searchButton")).SendKeys(Keys.Enter);
                    Thread.Sleep(2000);
                    gc.CreatePdf(orderNumber, outparcelno, "View", driver, "LA", "East Baton Rouge");

                    IWebElement         SelectOption = driver.FindElement(By.Id("taxyear"));
                    IList <IWebElement> Select       = SelectOption.FindElements(By.TagName("option"));
                    List <string>       option       = new List <string>();
                    int Check = 0;
                    foreach (IWebElement Op in Select)
                    {
                        if (Check <= 2)
                        {
                            option.Add(Op.Text);
                            Check++;
                        }
                    }
                    int amccount = 0;
                    foreach (string item in option)
                    {
                        var SelectAddress    = driver.FindElement(By.Id("taxyear"));
                        var SelectAddressTax = new SelectElement(SelectAddress);
                        SelectAddressTax.SelectByText(item);
                        Thread.Sleep(4000);
                        driver.FindElement(By.Id("searchButton")).SendKeys(Keys.Enter);
                        Thread.Sleep(4000);

                        try
                        {
                            driver.FindElement(By.XPath("/html/body/div[1]/div[3]/div[3]/table/tbody/tr/td[1]/button")).Click();
                            Thread.Sleep(7000);
                        }
                        catch
                        { }

                        gc.CreatePdf(orderNumber, outparcelno, "Popup 2015", driver, "LA", "East Baton Rouge");

                        //Open Popup
                        try
                        {
                            Notice = driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div/div/div[3]/div[1]")).Text;
                            Notice = WebDriverTest.After(Notice, "Tax Notice#");

                            Taxyear     = driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div/div/div[3]/div[2]")).Text;
                            Taxyear     = WebDriverTest.After(Taxyear, "Tax Year");
                            amc.TaxYear = Taxyear;

                            TaxPayer = driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div/div/div[4]")).Text;
                            TaxPayer = WebDriverTest.Between(TaxPayer, "Taxpayer", "**** ").Replace("\r\n", " ").Trim();

                            IWebElement         TBOpen    = driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div/div/div[5]"));
                            IList <IWebElement> DivMaster = TBOpen.FindElements(By.TagName("div"));
                            foreach (IWebElement div in DivMaster)
                            {
                                Taxes    = DivMaster[0].Text.Trim();
                                Interest = DivMaster[1].Text.Trim();
                                Cost     = DivMaster[2].Text.Trim();
                                Other    = DivMaster[3].Text.Trim();
                                Paid     = DivMaster[4].Text.Trim();
                                Balance  = DivMaster[5].Text.Trim();
                            }
                            try
                            {
                                IWebElement ITaxsale = driver.FindElement(By.XPath("//*[@id='details']/div[5]"));
                                if (ITaxsale.Text.Contains("Tax Sale Status: "))
                                {
                                    amc.IsDelinquent = "Yes";
                                }
                                double TaxesAmount = 0.00, InterestAmount = 0.00, CostAmount = 0.00, OtherAmount = 0.00, PaidAmount = 0.00, BalanceAmount = 0.00;

                                TaxesAmount    = Convert.ToDouble(Taxes.Replace("Taxes\r\n", "").Trim());
                                InterestAmount = Convert.ToDouble(Interest.Replace("Interest\r\n", "").Trim());
                                PaidAmount     = Convert.ToDouble(Paid.Replace("Paid\r\n", "").Trim());
                                CostAmount     = Convert.ToDouble(Cost.Replace("Cost\r\n", "").Trim());
                                OtherAmount    = Convert.ToDouble(Other.Replace("Other\r\n", "").Trim());
                                BalanceAmount  = Convert.ToDouble(Balance.Replace("Balance\r\n", "").Trim());


                                if (TaxesAmount != 0 && InterestAmount == 0 && CostAmount == 0 && OtherAmount == 0 && PaidAmount != 0 && BalanceAmount == 0)
                                {
                                    amc.Instamount1     = Taxes.Replace("Taxes\r\n", "").Trim();
                                    amc.Instamountpaid1 = Paid.Replace("Paid\r\n", "").Trim();
                                    amc.InstPaidDue1    = "Paid";
                                    amc.IsDelinquent    = "No";
                                }
                                else if (TaxesAmount != 0 && InterestAmount == 0 && CostAmount == 0 && OtherAmount == 0 && PaidAmount == 0 && BalanceAmount != 0 && TaxesAmount == BalanceAmount)
                                {
                                    amc.Instamount1     = Taxes.Replace("Taxes\r\n", "").Trim();
                                    amc.Instamountpaid1 = Balance.Replace("Balance\r\n", "").Trim();
                                    amc.InstPaidDue1    = "Due";
                                    amc.IsDelinquent    = "No";
                                }
                                else if (TaxesAmount != 0 && InterestAmount != 0 && ((CostAmount != 0 || CostAmount == 0) && (OtherAmount == 0 || OtherAmount != 0)) && PaidAmount == 0 && BalanceAmount != 0 && TaxesAmount < BalanceAmount)
                                {
                                    amc.IsDelinquent = "Yes";
                                }
                                else if (TaxesAmount != 0 && InterestAmount != 0 && ((CostAmount != 0 || CostAmount == 0) && (OtherAmount == 0 || OtherAmount != 0)) && PaidAmount != 0 && BalanceAmount == 0 && TaxesAmount < PaidAmount)
                                {
                                    amc.IsDelinquent = "Yes";
                                }
                            }
                            catch { }


                            if (Interest.Replace("Interest\r\n", "") != "0.00" && Balance.Replace("Balance\r\n", "") != "0.00")
                            {
                                Deliquent_Interest      = Interest;
                                Deliquent_Balance       = Balance;
                                Interest                = "";
                                Balance                 = "";
                                DeliquentTaxInformation = Notice + "~" + Taxyear + "~" + TaxPayer + "~" + Taxes.Replace("Taxes\r\n", "") + "~" + Interest.Replace("Interest\r\n", "") + "~" + Cost.Replace("Cost\r\n", "") + "~" + Other.Replace("Other\r\n", "") + "~" + Paid.Replace("Paid\r\n", "") + "~" + Balance.Replace("Balance\r\n", "") + "~" + Deliquent_Interest.Replace("Interest\r\n", "") + "~" + Deliquent_Balance.Replace("Balance\r\n", "");
                                gc.insert_date(orderNumber, outparcelno, 203, DeliquentTaxInformation, 1, DateTime.Now);
                            }
                            else
                            {
                                string TaxInformation = Notice + "~" + Taxyear + "~" + TaxPayer + "~" + Taxes.Replace("Taxes\r\n", "") + "~" + Interest.Replace("Interest\r\n", "") + "~" + Cost.Replace("Cost\r\n", "") + "~" + Other.Replace("Other\r\n", "") + "~" + Paid.Replace("Paid\r\n", "") + "~" + Balance.Replace("Balance\r\n", "") + "~" + Deliquent_Interest.Replace("Interest\r\n", "") + "~" + Deliquent_Balance.Replace("Balance\r\n", "");
                                gc.insert_date(orderNumber, outparcelno, 203, TaxInformation, 1, DateTime.Now);
                            }

                            Legal_Description = driver.FindElement(By.XPath("//*[@id='details']/div[7]")).Text.Replace("Legal", "");

                            if (amccount < 1)
                            {
                                if (amc.IsDelinquent == "Yes")
                                {
                                    gc.InsertAmrockTax(orderNumber, amc.TaxId, null, null, null, null, null, null, null, null, null, null, null, null, amc.IsDelinquent);
                                    amccount++;
                                }

                                if (amc.IsDelinquent == "No")
                                {
                                    gc.InsertAmrockTax(orderNumber, amc.TaxId, amc.Instamount1, amc.Instamount2, amc.Instamount3, amc.Instamount4, amc.Instamountpaid1, amc.Instamountpaid2, amc.Instamountpaid3, amc.Instamountpaid4, amc.InstPaidDue1, amc.InstPaidDue2, amc.instPaidDue3, amc.instPaidDue4, amc.IsDelinquent);
                                    amccount++;
                                }
                            }

                            //Tax History
                            IWebElement         TBHistory = driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div/div/div[9]/table/tbody"));
                            IList <IWebElement> TRHistory = TBHistory.FindElements(By.TagName("tr"));
                            IList <IWebElement> TDHistory;
                            foreach (IWebElement History in TRHistory)
                            {
                                TDHistory = History.FindElements(By.TagName("td"));
                                if (TDHistory.Count != 0)
                                {
                                    Date        = TDHistory[0].Text;
                                    Description = TDHistory[1].Text;
                                    Amount      = TDHistory[2].Text;
                                    TaxHistory  = Date + "~" + Description + "~" + Amount;
                                    gc.insert_date(orderNumber, outparcelno, 202, TaxHistory, 1, DateTime.Now);
                                }
                            }

                            IWebElement ITax = driver.FindElement(By.XPath("//*[@id='details']/div[2]/a"));
                            strTax = ITax.GetAttribute("href");
                            Thread.Sleep(5000);
                            driver.Navigate().GoToUrl(strTax);
                            Actions action = new Actions(driver);
                            action.SendKeys(Keys.Escape).Build().Perform();
                            gc.CreatePdf(orderNumber, outparcelno, "Bill 2015", driver, "LA", "East Baton Rouge");
                            driver.Navigate().Back();
                            Thread.Sleep(2000);
                        }
                        catch
                        { }
                    }
                    try
                    {
                        for (int k = 1; k < 4; k++)
                        {
                            if (k == 1)
                            {
                                try
                                {
                                    var SelectAddress2017    = driver.FindElement(By.Id("taxyear"));
                                    var SelectAddressTax2017 = new SelectElement(SelectAddress2017);
                                    SelectAddressTax2017.SelectByIndex(0);
                                    Thread.Sleep(4000);
                                    driver.FindElement(By.Id("searchButton")).SendKeys(Keys.Enter);
                                    Thread.Sleep(4000);
                                    gc.CreatePdf(orderNumber, outparcelno, "View1", driver, "LA", "East Baton Rouge");
                                    driver.FindElement(By.XPath("/html/body/div[1]/div[3]/div[3]/table/tbody/tr/td[1]/button")).Click();
                                    Thread.Sleep(5000);

                                    IWebElement ITax = driver.FindElement(By.XPath("//*[@id='details']/div[2]/a"));
                                    strTax = ITax.GetAttribute("href");
                                    Thread.Sleep(5000);
                                    driver.Navigate().GoToUrl(strTax);
                                    Actions action = new Actions(driver);
                                    action.SendKeys(Keys.Escape).Build().Perform();
                                    gc.CreatePdf(orderNumber, outparcelno, "Bill 2017", driver, "LA", "East Baton Rouge");
                                    driver.Navigate().Back();
                                    Thread.Sleep(2000);
                                }
                                catch
                                { }
                            }
                            else if (k == 2)
                            {
                                try
                                {
                                    var SelectAddress2016    = driver.FindElement(By.Id("taxyear"));
                                    var SelectAddressTax2016 = new SelectElement(SelectAddress2016);
                                    SelectAddressTax2016.SelectByIndex(1);
                                    Thread.Sleep(4000);
                                    driver.FindElement(By.Id("searchButton")).SendKeys(Keys.Enter);
                                    Thread.Sleep(4000);
                                    gc.CreatePdf(orderNumber, outparcelno, "View2", driver, "LA", "East Baton Rouge");
                                    driver.FindElement(By.XPath("/html/body/div[1]/div[3]/div[3]/table/tbody/tr/td[1]/button")).Click();
                                    Thread.Sleep(5000);

                                    IWebElement ITax = driver.FindElement(By.XPath("//*[@id='details']/div[2]/a"));
                                    strTax = ITax.GetAttribute("href");
                                    Thread.Sleep(5000);
                                    driver.Navigate().GoToUrl(strTax);
                                    Actions action = new Actions(driver);
                                    action.SendKeys(Keys.Escape).Build().Perform();
                                    gc.CreatePdf(orderNumber, outparcelno, "Bill 2016", driver, "LA", "East Baton Rouge");
                                    driver.Close();
                                }
                                catch
                                { }
                            }
                        }
                    }
                    catch
                    { }

                    property_details = OwnerName + "~" + Propertyaddress + "~" + Mailingaddress + "~" + Property_Type + "~" + Legal_Description;
                    gc.insert_date(orderNumber, outparcelno, 197, property_details, 1, DateTime.Now);

                    TaxTime = DateTime.Now.ToString("HH:mm:ss");

                    LastEndTime = DateTime.Now.ToString("HH:mm:ss");
                    gc.insert_TakenTime(orderNumber, "LA", "East Baton Rouge", StartTime, AssessmentTime, TaxTime, CitytaxTime, LastEndTime);

                    driver.Quit();
                    //megrge pdf files
                    gc.mergpdf(orderNumber, "LA", "East Baton Rouge");
                    return("Data Inserted Successfully");
                }
                catch (Exception ex)
                {
                    driver.Quit();
                    GlobalClass.LogError(ex, orderNumber);
                    throw ex;
                }
            }
        }
示例#24
0
 /// <summary>
 /// Constructor that prepares unit, items, and equippeditems list for the hero
 /// </summary>
 /// <param name="color">id of which player gets the hero</param>
 public Hero(Player player, Point position, int localSpriteID, int portraitID, string name, string description, Cost cost) : base(localSpriteID, SPRITECATEGORY)
 {
     Player           = player;
     Items            = new List <Item>();
     EquippedItems    = new Item[7];
     Position         = position;
     CurMovementSpeed = MovementSpeed = 12;
     this.portraitID  = portraitID;
     // Alive = true; TODO: dont set alive here?
     Name        = name;
     Description = description;
     Cost        = cost;
 }
示例#25
0
 public TechPlanetaryScanner(string name, Cost cost, TechRequirements techRequirements, int ranking, TechCategory category) : base(name, cost, techRequirements, ranking, category)
 {
 }
示例#26
0
        Result GetResultFromBlock(BlockStatement block)
        {
            // For a block, we are tracking 4 possibilities:
            // a) context is checked, no unchecked block open
            Cost         costCheckedContext  = new Cost(0, 0);
            InsertedNode nodesCheckedContext = null;
            // b) context is checked, an unchecked block is open
            Cost         costCheckedContextUncheckedBlockOpen  = Cost.Infinite;
            InsertedNode nodesCheckedContextUncheckedBlockOpen = null;
            Statement    uncheckedBlockStart = null;
            // c) context is unchecked, no checked block open
            Cost         costUncheckedContext  = new Cost(0, 0);
            InsertedNode nodesUncheckedContext = null;
            // d) context is unchecked, a checked block is open
            Cost         costUncheckedContextCheckedBlockOpen  = Cost.Infinite;
            InsertedNode nodesUncheckedContextCheckedBlockOpen = null;
            Statement    checkedBlockStart = null;

            Statement statement = block.Statements.FirstOrDefault();

            while (true)
            {
                // Blocks can be closed 'for free'. We use '<=' so that blocks are closed as late as possible (goal 4b)
                if (costCheckedContextUncheckedBlockOpen <= costCheckedContext)
                {
                    costCheckedContext  = costCheckedContextUncheckedBlockOpen;
                    nodesCheckedContext = nodesCheckedContextUncheckedBlockOpen + new InsertedBlock(uncheckedBlockStart, statement, false);
                }
                if (costUncheckedContextCheckedBlockOpen <= costUncheckedContext)
                {
                    costUncheckedContext  = costUncheckedContextCheckedBlockOpen;
                    nodesUncheckedContext = nodesUncheckedContextCheckedBlockOpen + new InsertedBlock(checkedBlockStart, statement, true);
                }
                if (statement == null)
                {
                    break;
                }
                // Now try opening blocks. We use '<=' so that blocks are opened as late as possible. (goal 4a)
                if (costCheckedContext + new Cost(1, 0) <= costCheckedContextUncheckedBlockOpen)
                {
                    costCheckedContextUncheckedBlockOpen  = costCheckedContext + new Cost(1, 0);
                    nodesCheckedContextUncheckedBlockOpen = nodesCheckedContext;
                    uncheckedBlockStart = statement;
                }
                if (costUncheckedContext + new Cost(1, 0) <= costUncheckedContextCheckedBlockOpen)
                {
                    costUncheckedContextCheckedBlockOpen  = costUncheckedContext + new Cost(1, 0);
                    nodesUncheckedContextCheckedBlockOpen = nodesUncheckedContext;
                    checkedBlockStart = statement;
                }
                // Now handle the statement
                Result stmtResult = GetResult(statement);

                costCheckedContext  += stmtResult.CostInCheckedContext;
                nodesCheckedContext += stmtResult.NodesToInsertInCheckedContext;
                costCheckedContextUncheckedBlockOpen  += stmtResult.CostInUncheckedContext;
                nodesCheckedContextUncheckedBlockOpen += stmtResult.NodesToInsertInUncheckedContext;
                costUncheckedContext  += stmtResult.CostInUncheckedContext;
                nodesUncheckedContext += stmtResult.NodesToInsertInUncheckedContext;
                costUncheckedContextCheckedBlockOpen  += stmtResult.CostInCheckedContext;
                nodesUncheckedContextCheckedBlockOpen += stmtResult.NodesToInsertInCheckedContext;

                if (statement is LabelStatement || statement is LocalFunctionDeclarationStatement)
                {
                    // We can't move labels into blocks because that might cause goto-statements
                    // to be unable to jump to the labels.
                    // Also, we can't move local functions into blocks, because that might cause
                    // them to become out of scope from the call-sites.
                    costCheckedContextUncheckedBlockOpen = Cost.Infinite;
                    costUncheckedContextCheckedBlockOpen = Cost.Infinite;
                }

                statement = statement.GetNextStatement();
            }

            return(new Result {
                CostInCheckedContext = costCheckedContext, NodesToInsertInCheckedContext = nodesCheckedContext,
                CostInUncheckedContext = costUncheckedContext, NodesToInsertInUncheckedContext = nodesUncheckedContext
            });
        }
 public MethodInvokationCost(int lineNumber, MethodCost methodCost, Reason costSourceType, Cost invocationCost) : base(lineNumber,invocationCost)
 {
     this.methodCost = methodCost;
     this.costSourceType = costSourceType;
 }
示例#28
0
 public bool IsArmyCostLimitExceeded(Cost armyCost)
 {
     return(armyCost.IsGreaterThan(armyLimit));
 }
 // TODO: (misko) get rid of this method
 public abstract void link(Cost directCost, Cost dependantCost);
        public static string GetRow(string RowId)
        {
            if (HttpContext.Current.Session["UserName"] == null)
            {
                return "Error: You are not logged-in.";
            }

            DBClass db = new DBClass("SCM");
            db.Con.Open();
            db.Com.CommandText = "SELECT [id],[Description] FROM [CostsetupItem] WHERE [id] = '" + RowId + "'";
            SqlDataReader dr = db.Com.ExecuteReader();
            JavaScriptSerializer serailizer = new JavaScriptSerializer();
            Cost Cost = new Cost();
            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    Cost.id = dr[0].ToString();
                    Cost.Description = dr[1].ToString();
                    //Catagory.MarketingOverhead = dr[2].ToString();
                    //Catagory.VariableExpense = dr[3].ToString();
                }
            }

            if (dr.IsClosed == false)
                dr.Close();

            db.Con.Close();
            db = null;
            return serailizer.Serialize(Cost);
        }
示例#31
0
 public static IDictionary <string, decimal> ToPlainDictionary(this Cost cost)
 {
     return(cost.Resources.ToDictionary(x => x.Key.Id, y => y.Value));
 }
示例#32
0
 public override Cost DefineCost()
 {
     return(Cost.ActionSelf(this) + Cost.ActionOthers(this, 1));
 }
示例#33
0
 protected override string ItemDescription()
 {
     return($"Light: {Make}, {Model}, {SerialNumber}, {Cost.AsUsCurrencyString()}, {BatteryType}, {LightBulb}\n");
 }
示例#34
0
    public IEnumerable <Node> GetPath(Node start, Node goal)
    {
        this.Parent[start] = null;
        this.Cost[start]   = 0;
        this.Open.Enqueue(start);

        while (Open.Count > 0)
        {
            Node currentNode = Open.Dequeue();
            if (currentNode.Equals(goal))
            {
                break;
            }


            List <Node> neighbours = new List <Node>
            {
                new Node(currentNode.Row + 1, currentNode.Col),
                new Node(currentNode.Row - 1, currentNode.Col),
                new Node(currentNode.Row, currentNode.Col + 1),
                new Node(currentNode.Row, currentNode.Col - 1)
            };

            foreach (Node neighbour in neighbours)
            {
                if (neighbour.Row >= Map.GetLength(0) || (neighbour.Row < 0))
                {
                    continue;
                }

                if (neighbour.Col >= Map.GetLength(1) || (neighbour.Col < 0))
                {
                    continue;
                }

                if (Map[neighbour.Row, neighbour.Col] == 'W' || Map[neighbour.Row, neighbour.Col] == 'P')
                {
                    continue;
                }

                int newCost = Cost[currentNode] + 1;

                if (!Cost.ContainsKey(neighbour) || Cost[neighbour] > newCost)
                {
                    Cost[neighbour] = newCost;
                    neighbour.F     = newCost + GetH(neighbour, goal);
                    Open.Enqueue(neighbour);
                    Parent[neighbour] = currentNode;
                }
            }
        }

        List <Node> result = new List <Node>();

        Node lastNode = goal;

        if (!Parent.ContainsKey(lastNode))
        {
            result.Add(start);
        }
        else
        {
            result.Add(lastNode);
            while (Parent[lastNode] != null)
            {
                result.Add(Parent[lastNode]);
                lastNode = Parent[lastNode];
            }
        }

        result.Reverse();
        return(result);

        //Node lastNode = goal;
        //if (!Parent.ContainsKey(lastNode))
        //{
        //    yield return start;
        //}
        //else
        //{
        //    yield return lastNode;
        //    while (Parent[lastNode] != null)
        //    {
        //        yield return Parent[lastNode];
        //        lastNode = Parent[lastNode];
        //    }
        //}
    }
示例#35
0
文件: Mediator.cs 项目: TGIfr/courses
 // Constructor
 public User(string name, Cost c = Cost.Low, Quality q = Quality.Low)
 {
     this._name  = name;
     CostWish    = c;
     QualityWish = q;
 }
    public void setStuff()
    {
        //Debug.Log("Setting info \n");
        List <MyLabel> labels = drivers[current_driver].labels;

        bool special_skills_mode = (this is LevelList_Toy_Button_Driver);

        if (show)
        {
            //StatSum statsum = null;
            Rune check_rune = null;
            if (!special_skills_mode)
            {
                check_rune = parent.rune;
                //   statsum = check_rune.GetStats(false);
            }

            for (int i = 0; i < labels.Count; i++)
            {
                if (labels[i].text == null && labels[i].image_labels.Length == 0)
                {
                    continue;
                }

                if (labels[i].type.Equals("info"))
                {
                    if (special_skills_mode)
                    {
                        check_rune = Central.Instance.getHeroRune(labels[i].runetype);
                        //    statsum = (check_rune != null) ? check_rune.GetStats(true) : null;
                    }

                    setInfoLabel(labels[i], check_rune);
                }

                if (labels[i].type.Equals("cost"))
                {
                    if (special_skills_mode)
                    {
                        check_rune = Central.Instance.getHeroRune(labels[i].runetype);
                        // statsum = (check_rune != null) ? check_rune.GetStats(true) : null;
                    }


                    //StatBit statbit = (statsum != null) ? statsum.GetStatBit(labels[i].effect_type) : null;

                    Cost cost = check_rune.GetUpgradeCost(labels[i].effect_type);

                    labels[i].text.text = "";
                    if (cost != null) // && statbit.hasStat())
                    {
                        // Debug.Log(statbit.type + "\n");
                        //labels[i].text.text = statbit.getDetailStats()[0].toCompactString();
                        labels[i].text.text = cost.Amount.ToString();
                    }
                }
            }
        }

        CheckUpgrades();
        // setVerboseLabel();
        updateOtherLabels();
    }
示例#37
0
 protected override string ItemDescription()
 {
     return($"Brake: {Make}, {Model}, {SerialNumber}, {Cost.AsUsCurrencyString()}\n");
 }
示例#38
0
 public ICost Calculate (State state) {
     if (state.parent == null) {
         return new Cost();
     }
     Cost result = new Cost();
     result.facing = CalculateFacing(state);
     result.move = CalculateMove(state);
     result.rest = CalculateRest(state);
     result.double_step = CalculateDoubleStep(state);
     result.crossed = state.limbs_crossed ? CROSSED_COST : 0.0f;
     result.bracket_angle = CalculateBracketAngle(state);
     result.extra_use = CalculateExtraUse(state);
     result.unknown_limb = CalculateUnknownLimb(state);
     result.too_fast = CalculateTooFast(state);
     #region Total Cost
     result.total_cost =
         state.parent.cost.GetTotalCost() +
         result.facing +
         result.move +
         result.rest +
         result.double_step +
         result.crossed +
         result.bracket_angle +
         result.extra_use +
         result.unknown_limb +
         result.too_fast;
     #endregion
     return result;
 }
示例#39
0
        private void SetupData()
        {
            var creator = new CostUser
            {
                Id     = UserIdentity.Id,
                Agency = new Agency
                {
                    Id      = Guid.NewGuid(),
                    Country = new Country
                    {
                        Id   = Guid.NewGuid(),
                        Name = "Afghanistan",
                        Iso  = "AF"
                    }
                }
            };
            var ipmUser = new CostUser()
            {
                Id = Guid.NewGuid(),
            };
            var brandUser = new CostUser()
            {
                Id = Guid.NewGuid(),
            };

            var oeRevisionId = Guid.NewGuid();
            var oeRevision   = new CostStageRevision()
            {
                Id          = oeRevisionId,
                TravelCosts = new List <TravelCost>
                {
                    SetUpTravelCost(),
                },
                CostStageRevisionPaymentTotals = SetUpCostStageRevisionPaymentTotal(),
                CostLineItems   = SetUpCostLineItem(oeRevisionId),
                StageDetails    = SetUpStageDetails(),
                ProductDetails  = SetUpProductDetails(),
                CostFormDetails = SetUpCostFormDetails(oeRevisionId),
                Created         = DateTime.Now.AddDays(-2),
            };

            var fpRevisionId = Guid.NewGuid();
            var fpRevision   = new CostStageRevision()
            {
                Id          = fpRevisionId,
                TravelCosts = new List <TravelCost>
                {
                    SetUpTravelCost(),
                },
                CostStageRevisionPaymentTotals = SetUpCostStageRevisionPaymentTotal(),
                CostLineItems   = SetUpCostLineItem(fpRevisionId),
                StageDetails    = SetUpStageDetails(),
                ProductDetails  = SetUpProductDetails(),
                CostFormDetails = SetUpCostFormDetails(fpRevisionId),
                Created         = DateTime.Now.AddDays(-1),
            };

            var faRevision = new CostStageRevision()
            {
                Id          = RevisionId,
                TravelCosts = new List <TravelCost>
                {
                    SetUpTravelCost(),
                },
                CostStageRevisionPaymentTotals = SetUpCostStageRevisionPaymentTotal(),
                CostLineItems   = SetUpCostLineItem(RevisionId),
                Approvals       = SetUpApprovals(creator, ipmUser, brandUser),
                StageDetails    = SetUpStageDetails(),
                ProductDetails  = SetUpProductDetails(),
                CostFormDetails = SetUpCostFormDetails(RevisionId),
                Created         = DateTime.Now,
            };

            var costTemplateVersion = SetUpCostTemplateVersion();
            var cost = new Cost()
            {
                Id              = CostId,
                Deleted         = false,
                PaymentCurrency = new Currency
                {
                    Code            = "USD",
                    DefaultCurrency = true,
                    Id = CurrencyUsdId,
                },
                Project = new Project
                {
                    Id = Guid.NewGuid()
                },
                CreatedBy = creator,
                Owner     = creator,
                NotificationSubscribers = new List <NotificationSubscriber>()
                {
                    new NotificationSubscriber()
                    {
                        Id = Guid.NewGuid(), CostUser = ipmUser
                    },
                    new NotificationSubscriber()
                    {
                        Id = Guid.NewGuid(), CostUser = brandUser
                    }
                },
                CostStages = new List <CostStage>()
                {
                    new CostStage()
                    {
                        Id = Guid.NewGuid(), CostStageRevisions = new List <CostStageRevision>()
                        {
                            oeRevision
                        }
                    },
                    new CostStage()
                    {
                        Id = Guid.NewGuid(), CostStageRevisions = new List <CostStageRevision>()
                        {
                            fpRevision
                        }
                    },
                    new CostStage()
                    {
                        Id = Guid.NewGuid(), CostStageRevisions = new List <CostStageRevision>()
                        {
                            faRevision
                        }
                    }
                },
                CreatedById           = creator.Id,
                OwnerId               = creator.Id,
                CostTemplateVersion   = costTemplateVersion,
                CostTemplateVersionId = costTemplateVersion.Id
            };

            EFContext.Cost.Add(cost);
            EFContext.SaveChanges();
        }
示例#40
0
 public void setCost(Cost cost, double value)
 {
     switch (cost)
     {
         case Cost.Heuristic:
             this.heuristicCost = value;
             break;
         case Cost.Movement:
             this.movementCost = value;
             break;
         case Cost.Total:
             this.totalCost = value;
             break;
         default:
             throw new Exception("invalid cost type get");
     }
 }
示例#41
0
        public override string ToString()
        {
            string result = $"Quantifier[{PrintName}], #instances: {Instances.Count}, Cost: {Cost.ToString("F")}, #conflicts: {GeneratedConflicts}";

            return(result);
        }
 public override void link(Cost directCost, Cost dependantCost)
 {
     dependantCost.AddDependant(cost);
 }
 public void Setup(Building new_building)
 {
     building = new_building;
     cost = building.gameObject.GetComponent<Cost>();
 }
示例#44
0
 public void SetCostAndColor(Cost cost)
 {
     this._cost = cost;
     Color = cost.ParseColors();
 }
 public void Setup(GridObject grid_object)
 {
     gridObject = grid_object;
     cost = gridObject.gameObject.GetComponent<Cost>();
 }
 public override void link(Cost directCost, Cost dependantCost)
 {
     directCost.Add(getCost());
 }
示例#47
0
        Result GetResultFromBlock(BlockStatement block)
        {
            // For a block, we are tracking 4 possibilities:
            // a) context is checked, no unchecked block open
            Cost         costCheckedContext  = new Cost(0, 0);
            InsertedNode nodesCheckedContext = null;
            // b) context is checked, an unchecked block is open
            Cost         costCheckedContextUncheckedBlockOpen  = Cost.Infinite;
            InsertedNode nodesCheckedContextUncheckedBlockOpen = null;
            Statement    uncheckedBlockStart = null;
            // c) context is unchecked, no checked block open
            Cost         costUncheckedContext  = new Cost(0, 0);
            InsertedNode nodesUncheckedContext = null;
            // d) context is unchecked, a checked block is open
            Cost         costUncheckedContextCheckedBlockOpen  = Cost.Infinite;
            InsertedNode nodesUncheckedContextCheckedBlockOpen = null;
            Statement    checkedBlockStart = null;

            Statement statement = block.Statements.FirstOrDefault();

            while (true)
            {
                // Blocks can be closed 'for free'. We use '<=' so that blocks are closed as late as possible (goal 4b)
                if (costCheckedContextUncheckedBlockOpen <= costCheckedContext)
                {
                    costCheckedContext  = costCheckedContextUncheckedBlockOpen;
                    nodesCheckedContext = nodesCheckedContextUncheckedBlockOpen + new InsertedBlock(uncheckedBlockStart, statement, false);
                }
                if (costUncheckedContextCheckedBlockOpen <= costUncheckedContext)
                {
                    costUncheckedContext  = costUncheckedContextCheckedBlockOpen;
                    nodesUncheckedContext = nodesUncheckedContextCheckedBlockOpen + new InsertedBlock(checkedBlockStart, statement, true);
                }
                if (statement == null)
                {
                    break;
                }
                // Now try opening blocks. We use '<=' so that blocks are opened as late as possible. (goal 4a)
                if (costCheckedContext + new Cost(1, 0) <= costCheckedContextUncheckedBlockOpen)
                {
                    costCheckedContextUncheckedBlockOpen  = costCheckedContext + new Cost(1, 0);
                    nodesCheckedContextUncheckedBlockOpen = nodesCheckedContext;
                    uncheckedBlockStart = statement;
                }
                if (costUncheckedContext + new Cost(1, 0) <= costUncheckedContextCheckedBlockOpen)
                {
                    costUncheckedContextCheckedBlockOpen  = costUncheckedContext + new Cost(1, 0);
                    nodesUncheckedContextCheckedBlockOpen = nodesUncheckedContext;
                    checkedBlockStart = statement;
                }
                // Now handle the statement
                Result stmtResult = GetResult(statement);

                costCheckedContext  += stmtResult.CostInCheckedContext;
                nodesCheckedContext += stmtResult.NodesToInsertInCheckedContext;
                costCheckedContextUncheckedBlockOpen  += stmtResult.CostInUncheckedContext;
                nodesCheckedContextUncheckedBlockOpen += stmtResult.NodesToInsertInUncheckedContext;
                costUncheckedContext  += stmtResult.CostInUncheckedContext;
                nodesUncheckedContext += stmtResult.NodesToInsertInUncheckedContext;
                costUncheckedContextCheckedBlockOpen  += stmtResult.CostInCheckedContext;
                nodesUncheckedContextCheckedBlockOpen += stmtResult.NodesToInsertInCheckedContext;

                statement = statement.GetNextStatement();
            }

            return(new Result {
                CostInCheckedContext = costCheckedContext, NodesToInsertInCheckedContext = nodesCheckedContext,
                CostInUncheckedContext = costUncheckedContext, NodesToInsertInUncheckedContext = nodesUncheckedContext
            });
        }
示例#48
0
	public InventoryItem(InventoryItem another)
	{
		name = another.name;
		type = another.type;
		databaseIndex = another.databaseIndex;
		durabilityInfo = new Durability(another.durabilityInfo);
		costInfo = new Cost(another.costInfo);
		bonusInfo = new Bonus(another.bonusInfo);
		uiInfo = new UIInfo(another.uiInfo);
		extraInfo = new Extra (another.extraInfo);
	}
示例#49
0
 static void Main()
 {
     var cost = new Cost() { Replace = 1.0, Delete = 0.9, Insert = 0.8 };
     string s = "developer", t = "enveloped";
     Console.WriteLine("{0} -> {1} = {2}", s, t, MinimumEditDistance(s, t, cost));
 }
        private async void BtnGuardarMateriasPrimas_Clicked(object sender, EventArgs e)
        {
            string connectionString = ConfigurationManager.AppSettings["ipServer"];

            try
            {
                var PartNoV           = PartNo.Text;
                var tipoMateriaPrimaV = (TiposMaterialesListView)listaTiposMateriales.SelectedItem;
                var DescripcionV      = Descripcion.Text;
                var UnitV             = Unit.Text;
                var CostV             = Cost.Text;
                var tipoDivisionesV   = (DivisionesMateriasPrimasListView)listaDivisionesMateriasPrimas.SelectedItem;

                if (string.IsNullOrEmpty(PartNoV))
                {
                    await DisplayAlert("Validacion", "Ingrese el PartNo de la Materia Prima", "Aceptar");

                    PartNo.Focus();
                    return;
                }
                if (string.IsNullOrEmpty(tipoMateriaPrimaV.ToString()))
                {
                    await DisplayAlert("Validacion", "Verfique la seleccion del Tipo de Material", "Aceptar");

                    listaTiposMateriales.Focus();
                    return;
                }
                if (string.IsNullOrEmpty(DescripcionV))
                {
                    await DisplayAlert("Validacion", "Ingrese el nombre de la Materia Prima", "Aceptar");

                    Descripcion.Focus();
                    return;
                }
                if (string.IsNullOrEmpty(CostV))
                {
                    await DisplayAlert("Validacion", "Ingrese el Cost de la Materia Prima", "Aceptar");

                    Cost.Focus();
                    return;
                }
                if (string.IsNullOrEmpty(tipoDivisionesV.ToString()))
                {
                    await DisplayAlert("Validacion", "Asegurarse de seleccionar la Division", "Aceptar");

                    listaDivisionesMateriasPrimas.Focus();
                    return;
                }
                if (string.IsNullOrEmpty(UnitV.ToString()))
                {
                    await DisplayAlert("Validacion", "Ingrese el Unit de la Materia Primas", "Aceptar");

                    Unit.Focus();
                    return;
                }

                HttpClient client = new HttpClient();
                client.BaseAddress = new Uri(connectionString);

                var materiasPrimas = new MateriaPrima()
                {
                    Materia_PrimaID        = 0,
                    Tipo_MaterialID        = tipoMateriaPrimaV.Tipo_MaterialID,
                    DivisionMateriaPrimaID = tipoDivisionesV.DivisionMateriaPrimaID,
                    PartNo      = PartNoV,
                    Descripcion = DescripcionV,
                    Unit        = UnitV,
                    Cost        = Convert.ToDecimal(CostV)
                };

                //Convetir a Json
                var           json          = JsonConvert.SerializeObject(materiasPrimas);
                StringContent stringContent = new StringContent(json, Encoding.UTF8, "application/json");

                //Ejecutar el api el introduces el metodo
                var request = await client.PostAsync("/api/MateriasPrimas/registrar", stringContent);

                if (request.IsSuccessStatusCode)
                {
                    var responseJson = await request.Content.ReadAsStringAsync();

                    var respuesta = JsonConvert.DeserializeObject <Request>(responseJson);

                    //Status
                    if (respuesta.status)
                    {
                        await MaterialDialog.Instance.AlertAsync(message : "Materia Prima registrado correctamente",
                                                                 title : "Registro",
                                                                 acknowledgementText : "Aceptar");
                    }
                    else
                    {
                        await MaterialDialog.Instance.AlertAsync(message : "Materia Prima no pudo registrarse correctamente",
                                                                 title : "Registro",
                                                                 acknowledgementText : "Aceptar");
                    }
                }
                else
                {
                    await MaterialDialog.Instance.AlertAsync(message : "Error",
                                                             title : "Error",
                                                             acknowledgementText : "Aceptar");
                }
            }
            catch (Exception ex)
            {
                await MaterialDialog.Instance.AlertAsync(message : ex.Message,
                                                         title : "Error",
                                                         acknowledgementText : "Aceptar");
            }
            limpiarCampos();
            await Navigation.PushAsync(new MateriasPrimas.GestionarMateriasPrimas());
        }
示例#51
0
 public Card()
 {
     _cost = new Cost();
 }
示例#52
0
 public override Cost DefineCost()
 {
     return(Cost.ReverseBond(this, 3));
 }
示例#53
0
 public void RefundCost(Cost[] costs)
 {
     foreach (Cost cost in costs)
     {
         quantities[cost.Name] += cost.Number;
     }
 }
示例#54
0
    public void computeAggregate(Player owner)
    {
        aggregate = new ShipDesignAggregate();
        aggregate.setMass(hull.getMass());
        aggregate.setArmor(hull.getArmor());
        aggregate.setShield(0);
        aggregate.setCargoCapacity(0);
        aggregate.setFuelCapacity(hull.getFuelCapacity() == 0 ? 0 : hull.getFuelCapacity());
        aggregate.setColoniser(false);
        aggregate.setCost(hull.getCost());
        aggregate.setSpaceDock(-1);

        foreach (ShipDesignSlot slot in slots)
        {
            if (slot.getHullComponent() != null)
            {
                if (slot.getHullComponent() is TechEngine)
                {
                    aggregate.setEngine((TechEngine)slot.getHullComponent());
                    aggregate.setEngineName(slot.getHullComponent().getName());
                }
                Cost cost = slot.getHullComponent().getCost().multiply(slot.getQuantity());
                cost = cost.add(aggregate.getCost());
                aggregate.setCost(cost);

                aggregate.setMass(aggregate.getMass() + slot.getHullComponent().getMass() * slot.getQuantity());
                if (slot.getHullComponent().getArmor() != 0)
                {
                    aggregate.setArmor(aggregate.getArmor() + slot.getHullComponent().getArmor() * slot.getQuantity());
                }
                if (slot.getHullComponent().getShield() != 0)
                {
                    aggregate.setShield(aggregate.getShield() + slot.getHullComponent().getShield() * slot.getQuantity());
                }
                if (slot.getHullComponent().getCargoBonus() != 0)
                {
                    aggregate.setCargoCapacity(aggregate.getCargoCapacity() + slot.getHullComponent().getCargoBonus() * slot.getQuantity());
                }
                if (slot.getHullComponent().getFuelBonus() != 0)
                {
                    aggregate.setFuelCapacity(aggregate.getFuelCapacity() + slot.getHullComponent().getFuelBonus() * slot.getQuantity());
                }
                if (slot.getHullComponent().isColonisationModule())
                {
                    aggregate.setColoniser(true);
                }
            }
            if (slot.getHullSlot().getTypes().Contains(HullSlotType.SpaceDock))
            {
                aggregate.setSpaceDock(slot.getHullSlot().getCapacity());
            }
            if (slot.getHullSlot().getTypes().Contains(HullSlotType.Cargo))
            {
                aggregate.setCargoCapacity(aggregate.getCargoCapacity() + slot.getHullSlot().getCapacity());
            }
            if (slot.getHullSlot().getTypes().Contains(HullSlotType.Bomb))
            {
                aggregate.setKillPop(aggregate.getKillPop() + slot.getHullSlot().getCapacity());
            }
        }
        computeScanRanges(owner);
    }
 public LoDViolation(int lineNumber, string methodName, Cost lod, int distance) : base(lineNumber, lod)
 {
     this.methodName = methodName;
     this.distance = distance;
 }
示例#56
0
    // 更新・メイン
    void UpdateMain()
    {
        // 敵生成管理の更新
        _enemyGenerator.Update();

        // 配置できるかどうか判定
        if (_cursor.Placeable == false)
        {
            // 配置できないのでここでおしまい
            return;
        }

        // カーソルの下にあるオブジェクトをチェック
        int        mask = 1 << LayerMask.NameToLayer("Tower");
        Collider2D col  = Physics2D.OverlapPoint(_cursor.GetPosition(), mask);

        _selObj = null;
        if (col != null)
        {
            // 選択中のオブジェクトを格納
            _selObj = col.gameObject;
        }

        // マウスクリック判定
        if (Input.GetMouseButtonDown(0) == false)
        {
            //クリックしていないので以下の処理は不要
            return;
        }

        if (_selObj != null)
        {
            // 砲台をクリックした
            // 選択した砲台オブジェクトを取得
            _selTower = _selObj.GetComponent <Tower>();

            // アップグレードモードに移行する
            ChangeSelMode(eSelMode.Upgrade);
        }

        switch (_selMode)
        {
        case eSelMode.Buy:
            if (_cursor.SelObj == null)
            {
                // 所持金を減らす
                int cost = Cost.TowerProduction();
                Global.UseMoney(cost);
                // 何もないので砲台を配置
                Tower.Add(_cursor.X, _cursor.Y);
                // 次のタワーの生産コストを取得する
                int cost2 = Cost.TowerProduction();
                if (Global.Money < cost2)
                {
                    // お金が足りないので通常モードに戻る
                    ChangeSelMode(eSelMode.None);
                }
            }
            break;
        }
    }
示例#57
0
        /// <summary>
        /// Build person entity and all person related entities like: DrugExposures, ConditionOccurrences, ProcedureOccurrences... from raw data sets
        /// </summary>
        public override void Build(Dictionary <string, long> providers)
        {
            var person = BuildPerson(personRecords.ToList());

            if (person == null)
            {
                return;
            }

            var observationPeriodsFromVisits = new List <EraEntity>();

            //Filter out visits with start date before 1999 year
            var visits = CleanVisitOccurrences(visitOccurrencesRaw).ToArray();

            if (!visits.Any())
            {
                return;
            }

            var visitOccurrences = new Dictionary <long, VisitOccurrence>();

            foreach (var visitOccurrence in BuildVisitOccurrences(ApplyTimeFromPrior(visits), null))
            {
                if (!visitOccurrences.ContainsKey(visitOccurrence.Id))
                {
                    visitOccurrences.Add(visitOccurrence.Id, visitOccurrence);
                }
            }

            var death = BuildDeath(deathRecords.ToArray(), visitOccurrences, null);

            //Exclude visits with start date after person death date
            var cleanedVisits = CleanUp(visitOccurrences.Values.ToArray(), death).ToArray();

            visitOccurrences.Clear();

            // Create set of observation period entities from set of visit entities
            var visitIds         = new List <long>();
            var visitsDictionary = new Dictionary <Guid, VisitOccurrence>();

            foreach (var vo in cleanedVisits)
            {
                visitOccurrences.Add(vo.Id, vo);
                visitsDictionary.Add(vo.SourceRecordGuid, vo);
                visitIds.Add(vo.Id);
                observationPeriodsFromVisits.Add(new EraEntity
                {
                    Id        = chunkData.KeyMasterOffset.ObservationPeriodId,
                    PersonId  = vo.PersonId,
                    StartDate = vo.StartDate,
                    EndDate   = vo.EndDate
                });
            }

            long?prevVisitId = null;

            foreach (var visitId in visitIds.OrderBy(v => v))
            {
                if (prevVisitId.HasValue)
                {
                    visitOccurrences[visitId].PrecedingVisitOccurrenceId = prevVisitId;
                }

                prevVisitId = visitId;
            }

            var minYearOfBirth = 9999;
            var maxYearOfBirth = 0;

            // Calculate max/min value of person year of birth
            // MONTH_OF_BIRTH and DAY_OF_BIRTH are not available in Premier,
            // because age is the only available field. YEAR_OF_BIRTH is calculated from the first admission.
            // The admission year minus the age results in the YEAR_OF_BIRTH.
            foreach (var personRecord in personRecords)
            {
                if (!visitsDictionary.ContainsKey(personRecord.SourceRecordGuid))
                {
                    continue;
                }

                var yearOfBirth = visitsDictionary[personRecord.SourceRecordGuid].StartDate.Year - personRecord.YearOfBirth;

                if (yearOfBirth < 1900)
                {
                    continue;
                }

                if (yearOfBirth < minYearOfBirth)
                {
                    minYearOfBirth = yearOfBirth.Value;
                }

                if (yearOfBirth > maxYearOfBirth)
                {
                    maxYearOfBirth = yearOfBirth.Value;
                }
            }

            // If a person has YEAR_OF_BIRTH that varies over two years then those records are eliminated
            if (maxYearOfBirth - minYearOfBirth > 2)
            {
                return;
            }
            var minVOYear = visitOccurrences.Values.Min(vo => vo.StartDate).Year;

            //Person year of birth is after minumum visit start
            if (person.YearOfBirth > minVOYear)
            {
                return;
            }

            person.YearOfBirth = minVOYear - person.YearOfBirth;

            var observationPeriods =
                BuildObservationPeriods(person.ObservationPeriodGap, observationPeriodsFromVisits.Distinct().ToArray())
                .ToArray();

            //Delete any individual that has an OBSERVATION_PERIOD that is >= 2 years prior to the YEAR_OF_BIRTH
            if (Excluded(person, observationPeriods))
            {
                return;
            }

            var payerPlanPeriods =
                CleanUp(BuildPayerPlanPeriods(payerPlanPeriodsRaw.ToArray(), visitOccurrences), death).ToArray();

            var drugExposures =
                CleanUp(BuildDrugExposures(drugExposuresRaw.ToArray(), visitOccurrences, observationPeriods), death)
                .ToArray();
            var conditionOccurrences =
                CleanUp(BuildConditionOccurrences(conditionOccurrencesRaw.ToArray(), visitOccurrences, observationPeriods),
                        death).ToArray();
            var procedureOccurrences =
                CleanUp(BuildProcedureOccurrences(procedureOccurrencesRaw.ToArray(), visitOccurrences, observationPeriods),
                        death).ToArray();
            var observations =
                CleanUp(BuildObservations(observationsRaw.ToArray(), visitOccurrences, observationPeriods), death).ToArray();

            var measurements =
                CleanUp(BuildMeasurement(measurementsRaw.ToArray(), visitOccurrences, observationPeriods), death).ToArray();

            var deviceExposure = CleanUp(BuildDeviceExposure(deviceExposureRaw.ToArray(), visitOccurrences, observationPeriods), death).ToArray();

            // set corresponding ProviderIds
            SetPayerPlanPeriodId(payerPlanPeriods, drugExposures, procedureOccurrences, visitOccurrences.Values.ToArray(), deviceExposure);

            var visitCosts = BuildVisitCosts(visitOccurrences.Values.ToArray()).ToArray();

            foreach (var v5 in visitCosts)
            {
                //if (cost.PaidCopay == null && cost.PaidCoinsurance == null && cost.PaidTowardDeductible == null &&
                //   cost.PaidByPayer == null && cost.PaidByCoordinationBenefits == null && cost.TotalOutOfPocket == null &&
                //   cost.TotalPaid == null)
                //   continue;

                var cost52 = new Cost
                {
                    CostId = chunkData.KeyMasterOffset.VisitCostId,

                    Domain  = "Visit",
                    EventId = v5.Id,

                    CurrencyConceptId      = v5.CurrencyConceptId,
                    TotalCharge            = v5.TotalPaid,
                    TotalCost              = v5.PaidByPayer,
                    RevenueCodeConceptId   = v5.RevenueCodeConceptId,
                    RevenueCodeSourceValue = v5.RevenueCodeSourceValue,
                    DrgConceptId           = v5.DrgConceptId ?? 0,
                    DrgSourceValue         = v5.DrgSourceValue,

                    TypeId = 0
                };

                chunkData.AddCostData(cost52);
            }

            // push built entities to ChunkBuilder for further save to CDM database
            AddToChunk(person, death,
                       observationPeriods,
                       payerPlanPeriods,
                       drugExposures,
                       new DrugCost[0],
                       conditionOccurrences,
                       procedureOccurrences,
                       new ProcedureCost[0],
                       observations,
                       measurements,
                       visitOccurrences.Values.ToArray(), new VisitCost[0], new Cohort[0], deviceExposure, new DeviceCost[0], new Note[0]);
        }
示例#58
0
 public override Cost DefineCost()
 {
     return(Cost.ReverseBond(this, 3) + Cost.DiscardHand(this, 1, card => card.HasUnitNameOf(Strings.Get("card_text_unitname_サーリャ"))));
 }
 public static bool CanBuy(Cost cost)
 {
     return CanBuy(cost.costInitial);
 }
示例#60
0
 public Item(string description, Amount amount, Cost cost)
 {
     this.description = description;
     this.amount = amount;
     this.cost = cost;
 }