public BasePriceParser(IReader reader, PriceFormalizationInfo priceInfo, bool saveInCore = false)
        {
            _logger = LogManager.GetLogger(GetType());
            _reader = reader;

            _priceInfo   = priceInfo;
            _loggingStat = new FormLog(priceInfo);

            _connection = new MySqlConnection(ConnectionHelper.GetConnectionString());
            dsMyDB      = new DataSet();

            priceItemId   = _priceInfo.PriceItemId;
            parentSynonym = _priceInfo.ParentSynonym;
            costType      = _priceInfo.CostType;

            string selectCostFormRulesSQL;

            if (costType == CostTypes.MultiColumn)
            {
                selectCostFormRulesSQL = String.Format("select *, (exists(select * from usersettings.pricesregionaldata prd where prd.pricecode=pc.pricecode and prd.basecost=pc.costcode limit 1)) as NewBaseCost from usersettings.PricesCosts pc, farm.CostFormRules cfr where pc.PriceCode={0} and cfr.CostCode = pc.CostCode", _priceInfo.PriceCode);
            }
            else
            {
                selectCostFormRulesSQL = String.Format("select *, (exists(select * from usersettings.pricesregionaldata prd where prd.pricecode=pc.pricecode and prd.basecost=pc.costcode limit 1)) as NewBaseCost from usersettings.PricesCosts pc, farm.CostFormRules cfr where pc.PriceCode={0} and cfr.CostCode = pc.CostCode and pc.CostCode = {1}", _priceInfo.PriceCode, _priceInfo.CostCode.Value);
            }
            var daPricesCost = new MySqlDataAdapter(selectCostFormRulesSQL, _connection);
            var dtPricesCost = new DataTable("PricesCosts");

            daPricesCost.Fill(dtPricesCost);
            _reader.CostDescriptions = dtPricesCost.Rows.Cast <DataRow>().Select(r => new CostDescription(r)).ToList();
            _logger.DebugFormat("Загрузили цены {0}.{1}", _priceInfo.PriceCode, _priceInfo.CostCode);
            _saveInCore = saveInCore;
        }
Example #2
0
        public ActionResult DeleteConfirmed(Guid id)
        {
            CostTypes costTypes = db.CostTypes.Find(id);

            db.CostTypes.Remove(costTypes);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #3
0
 public Node(bool walkable, Vector3 worldPos, int gridX, int gridY, CostTypes costType)
 {
     m_walkable = walkable;
     m_worldPos = worldPos;
     m_gridX    = gridX;
     m_gridY    = gridY;
     m_costType = costType;
 }
 public void Awake()
 {
     purchaseInteraction             = GetComponent <PurchaseInteraction>();
     purchaseInteraction.costType    = CostTypes.getCostTypeIndex(MoreShrines.costTypeDefShrineDisorder);
     purchaseInteraction.cost        = 1;
     purchaseInteraction.Networkcost = 1;
     purchaseInteraction.onPurchase.AddListener((interactor) =>
     {
         AddShrineStack(interactor);
     });
 }
Example #5
0
 public override bool Contains(CostTypes t)
 {
     foreach (Cost ct in CostList)
     {
         if (ct.Contains(t))
         {
             return(true);
         }
     }
     return(false);
 }
Example #6
0
        /// <summary>
        /// 按照类别获取公式集合
        /// </summary>
        /// <param name="costKind"></param>
        /// <param name="costType"></param>
        /// <param name="onlyDisplayUsable"></param>
        /// <param name="whereClause"></param>
        /// <param name="paras"></param>
        /// <returns></returns>
        public List <CostFormularEntity> GetList(CostKinds costKind, CostTypes costType, Logics onlyDisplayUsable, string whereClause, params IDbDataParameter[] paras)
        {
            if (string.IsNullOrEmpty(whereClause))
            {
                whereClause = " 1=1 ";
            }

            whereClause += string.Format(" AND CostKind={0} AND CostType={1} ", (int)costKind, (int)costType);

            return(base.GetList(onlyDisplayUsable, whereClause, 0, string.Empty, paras));
        }
Example #7
0
        public void UpdateCostTypes(List <CostType> existingCostTypes, IList <CostType> allCostTypes)
        {
            var incomingCostTypes = new List <CostType>();

            CostTypes.ForEach(x => incomingCostTypes.Add(new CostType(x)));
            var databaseEntities = HttpRequestStorage.DatabaseEntities;

            existingCostTypes.Merge(incomingCostTypes,
                                    allCostTypes,
                                    (x, y) => x.CostTypeName == y.CostTypeName,
                                    databaseEntities);
        }
        public void Awake()
        {
            purchaseInteraction = GetComponent <PurchaseInteraction>();

            purchaseInteraction.costType = (CostTypeIndex)CostTypes.getCostTypeIndex(MoreShrines.costTypeDefShrineFallen);

            purchaseInteraction.onPurchase.AddListener((interactor) =>
            {
                AddShrineStack(interactor);
            });

            On.RoR2.CharacterMaster.RespawnExtraLife += CharacterMaster_RespawnExtraLife;
        }
Example #9
0
        // GET: CostTypes/Edit/5
        public ActionResult Edit(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CostTypes costTypes = db.CostTypes.Find(id);

            if (costTypes == null)
            {
                return(HttpNotFound());
            }
            return(View(costTypes));
        }
Example #10
0
        public void Awake()
        {
            purchaseInteraction = GetComponent<PurchaseInteraction>();
            purchaseInteraction.onPurchase.AddListener((interactor) =>
            {
                AddShrineStack(interactor);
            });
            purchaseInteraction.costType = CostTypes.getCostTypeIndex(MoreShrines.costTypeDefShrineHeresy);

            possiblePicks.Add(RoR2Content.Items.LunarPrimaryReplacement);
            possiblePicks.Add(RoR2Content.Items.LunarSecondaryReplacement);
            possiblePicks.Add(RoR2Content.Items.LunarSpecialReplacement);
            possiblePicks.Add(RoR2Content.Items.LunarUtilityReplacement);
        }
Example #11
0
        public async Task<IActionResult> OnGetAsync(int? id)
        {
            if (id == null)
            {
                return NotFound();
            }

            CostTypes = await _context.CostTypes.FirstOrDefaultAsync(m => m.CostTypeId == id);

            if (CostTypes == null)
            {
                return NotFound();
            }
            return Page();
        }
Example #12
0
        public async Task<IActionResult> OnPostAsync(int? id)
        {
            if (id == null)
            {
                return NotFound();
            }

            CostTypes = await _context.CostTypes.FindAsync(id);

            if (CostTypes != null)
            {
                _context.CostTypes.Remove(CostTypes);
                await _context.SaveChangesAsync();
            }

            return RedirectToPage("./Index");
        }
Example #13
0
        public ActionResult Edit([Bind(Include = "CostTypeID,Name,Description")] CostTypesViewModel CostTypesViewModel)
        {
            if (ModelState.IsValid)
            {
                CostTypes model = db.CostTypes.Find(CostTypesViewModel.CostTypeID);

                model.Name        = CostTypesViewModel.Name;
                model.Description = CostTypesViewModel.Description;

                model.DateModified = DateTime.Now;
                model.ModifiedBy   = Guid.Parse(User.Identity.GetUserId());

                db.Entry(model).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(CostTypesViewModel));
        }
Example #14
0
        public ActionResult Create([Bind(Include = "Name,Description")] CostTypes costTypes)
        {
            if (ModelState.IsValid)
            {
                costTypes.CostTypeID = Guid.NewGuid();

                costTypes.DateCreated  = DateTime.Now;
                costTypes.DateModified = costTypes.DateCreated;

                costTypes.CreatedBy  = Guid.Parse(User.Identity.GetUserId());
                costTypes.ModifiedBy = costTypes.CreatedBy;

                db.CostTypes.Add(costTypes);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(costTypes));
        }
Example #15
0
        public static CardCost Parse(CostTypes ct, string strct)
        {
            CardCost cc = new CardCost(ct);

            int    start  = strct.IndexOf("<") + 1;
            int    end    = strct.IndexOf(">", start);
            string result = strct.Substring(start, end - start);

            string[] tmp = result.Split('/');
            if (tmp.Length != 2)
            {
                throw new Exception("cost card target parsing error");
            }
            if (tmp [0] == "X")
            {
                //TODO: unknow what to do with this X
            }
            else
            {
                cc.Count = int.Parse(tmp [0]);
            }
            cc.validTargets = CardTarget.ParseTargets(tmp [1]);
            if (cc.CostType == CostTypes.Discard)
            {
                foreach (CardTarget c in cc.validTargets.OfType <CardTarget>())
                {
                    c.ValidGroup += CardGroupEnum.Hand;
                    c.Controler   = ControlerType.You;
                }
            }
            else
            {
                foreach (CardTarget c in cc.validTargets.OfType <CardTarget>())
                {
                    c.ValidGroup += CardGroupEnum.InPlay;
                    c.Controler   = ControlerType.You;
                }
            }
            return(cc);
        }
Example #16
0
        public static DBClub AddClub(string clubName, string clubWebsite, CostTypes clubCost, string addressStreet, string addressCity, string addressState, string addressCountry, string addressZip, string contactName, string contactTitle, string contactPhone, string contactEmail, string clubDescription = "Dragon Boat Club that is open for all")
        {
            var dbClub = new DBClub
            {
                ClubName        = clubName,
                ClubWebsite     = clubWebsite,
                ClubCost        = clubCost,
                AddressStreet   = addressStreet,
                AddressCity     = addressCity,
                AddressCountry  = addressCountry,
                AddressState    = addressState,
                AddressZip      = addressZip,
                ContactName     = contactName,
                ContactTitle    = contactTitle,
                ContactPhone    = contactPhone,
                ContactEmail    = contactEmail,
                ClubDescription = clubDescription
            };

            datbas.DBClubs.Add(dbClub);
            datbas.SaveChanges();
            return(dbClub);
        }
Example #17
0
 public Cost2(CostTypes type)
 {
     CostType = type;
     Count    = 0;
 }
Example #18
0
 public CardCost(CostTypes _type)
     : base(_type)
 {
 }
Example #19
0
 public virtual bool Contains(CostTypes ct)
 {
     return(this.CostType == ct ? true : false);
 }
Example #20
0
 public Cost(CostTypes _type)
 {
     CostType = _type;
 }
        public void Awake()
        {
            purchaseInteraction = GetComponent <PurchaseInteraction>();
            combatDirector      = GetComponent <CombatDirector>();
            combatSquad         = GetComponent <CombatSquad>();

            purchaseInteraction.Networkcost = 1;
            purchaseInteraction.cost        = 1;



            combatDirector.shouldSpawnOneWave = false;

            combatDirector.resetMonsterCardIfFailed = true;

            if (NetworkServer.active)
            {
                acceptNext = UnityEngine.Random.Range(1, 100) > 40;

                if (acceptNext == false)
                {
                    combatDirector.teamIndex = TeamIndex.Monster;
                }

                var rand = UnityEngine.Random.Range(1, 100);

                purchaseInteraction.costType = CostTypes.getCostTypeIndex(MoreShrines.costTypeDefWispWhite);

                if (rand <= 40)
                {
                    purchaseInteraction.costType = CostTypes.getCostTypeIndex(MoreShrines.costTypeDefWispGreen);
                    tier = 2;
                }

                if (rand <= 5)
                {
                    purchaseInteraction.costType = CostTypes.getCostTypeIndex(MoreShrines.costTypeDefWispRed);
                    tier = 3;
                    var particleSystem = symbolTransform.GetComponent <ParticleSystem>();
                    //particleSystem.colorOverLifetime.color.colorMin.r = 1.0f;
                    Gradient grad = new Gradient();
                    grad.SetKeys(new GradientColorKey[] { new GradientColorKey(new Color(1.0f, 0.31f, 0f), 0.0f), new GradientColorKey(new Color(0.75f, 0f, 0.14f), 1.0f) }, new GradientAlphaKey[] { new GradientAlphaKey(1.0f, 0.0f), new GradientAlphaKey(1.0f, 1.0f) });
                    var colorOverLifetime = particleSystem.colorOverLifetime;
                    colorOverLifetime.color = grad;
                    var emission = particleSystem.emission;
                    emission.rateOverTime = 20f;
                    var main = particleSystem.main;
                    main.maxParticles = 80;
                }

                purchaseInteraction.onPurchase.AddListener((interactor) =>
                {
                    AddShrineStack(interactor);
                });

                combatDirector.onSpawnedServer.AddListener((gameobject) =>
                {
                    OnSpawnedServer(gameObject);
                });

                if (!acceptNext)
                {
                    combatSquad.onMemberDefeatedServer += CombatSquad_onMemberDefeatedServer;
                }
            }

            //gameObject.GetComponent<CustomDirector>().countToSpawn = wispCount;
            // On.RoR2.CombatDirector.PrepareNewMonsterWave += CombatDirector_PrepareNewMonsterWave;
        }