public async Task <ListResultDto <CommodityTable> > UpdateComm(CommodityTable commodityTable)
        {
            await _repositoryComm.UpdateAsync(commodityTable);

            var commodity = _repositoryComm.GetAll()
                            .ToListAsync();

            return(new ListResultDto <CommodityTable>(ObjectMapper.Map <List <CommodityTable> >(commodity)));
        }
Example #2
0
 /// <summary>
 /// 添加酒店商品
 /// </summary>
 /// <param name="commodity">要添加的商品信息</param>
 public void AddNewCommodity(CommodityTable commodity)
 {
     if (commodity != null)
     {
         DataRow row = HotelData.Data.Tables["CommodityTable"].NewRow();
         row["Number"]        = HotelData.Data.Tables["CommodityTable"].Rows.Count + 1;
         row["CommodityName"] = commodity.CommodityName;
         row["CommodityUnit"] = commodity.CommodityUnit;
         row["Quantity"]      = commodity.Quantity;
         row["PurchasePice"]  = commodity.PurchasePice;
         row["retail"]        = commodity.Retail;
         row["TypeNumber"]    = commodity.Type.TypeNumber;
         row["Path"]          = commodity.Path;
         HotelData.Data.Tables["CommodityTable"].Rows.Add(row);
     }
 }
Example #3
0
 /// <summary>
 /// 修改指定的商品
 /// </summary>
 /// <param name="commodity">商品编号</param>
 public void AlterCommodity(CommodityTable commodity)
 {
     // 遍历商品列表
     foreach (DataRow row in HotelData.Data.Tables["CommodityTable"].Rows)
     {
         if (commodity.Number == (int)row["Number"])         // 根据编号修改指定的商品
         {
             row["CommodityName"] = commodity.CommodityName;
             row["CommodityUnit"] = commodity.CommodityUnit;
             row["Quantity"]      = commodity.Quantity;
             row["PurchasePice"]  = commodity.PurchasePice;
             row["retail"]        = commodity.Retail;
             row["TypeNumber"]    = commodity.Type.TypeNumber;
             row["Path"]          = commodity.Path;
             break;
         }
     }
 }
Example #4
0
        public void OnPreLoad()
        {
            CommodityData amorous = CommodityData.Get(CommodityTypes.Amorous);

            CommodityData.Add(new CommodityData(
                                  sAmorous2,
                                  amorous.ChangeToneText,
                                  amorous.mIsPositive,
                                  false /*amorous.mIsSymmetric*/,
                                  amorous.mAppearsAsSubMenu,
                                  amorous.EndStanceX,
                                  amorous.EndStanceY,
                                  amorous.NumSocialsDecremented,
                                  amorous.NextCommodity1,
                                  amorous.NextCommodity2,
                                  amorous.X1,
                                  amorous.X2,
                                  amorous.Y1,
                                  amorous.Y2,
                                  amorous.Y3
                                  ));

            CommodityTable.sMap[sAmorous2] = new Dictionary <CommodityTypes, float>();

            CommodityTable.Add(sAmorous2, sAmorous2, 1);

            foreach (CommodityTypes type in Enum.GetValues(typeof(CommodityTypes)))
            {
                if (type == CommodityTypes.Undefined)
                {
                    continue;
                }

                CommodityTable.Add(sAmorous2, type, CommodityTable.Get(CommodityTypes.Amorous, type));

                CommodityTable.Add(type, sAmorous2, CommodityTable.Get(type, CommodityTypes.Amorous));
            }

            foreach (SocialRuleLHS oldRule in new List <SocialRuleLHS>(SocialRuleLHS.Get("GR")))
            {
                if (oldRule.GeneralCommodity != CommodityTypes.Amorous)
                {
                    continue;
                }

                SocialRuleLHS newRule = new SocialRuleLHS(
                    "GR",
                    sAmorous2,
                    oldRule.mSpeechAct,
                    oldRule.ThirdParty,
                    oldRule.STCommodityPositive,
                    new Pair <CommodityTypes, bool>(oldRule.STCommodity.First, oldRule.STCommodity.Second),
                    new Pair <ShortTermContextTypes, bool>(oldRule.STContext.First, oldRule.STContext.Second),
                    oldRule.TargetMood,
                    new Pair <LongTermRelationshipTypes, bool>(oldRule.LTRelationship.First, oldRule.LTRelationship.Second),
                    oldRule.LTRMin,
                    oldRule.LTRMax,
                    "",
                    "",
                    "",
                    oldRule.mSkillLevel,
                    oldRule.mSkillThresholdAbove,
                    "",
                    "",
                    "",
                    "",
                    "",
                    oldRule.Partner,
                    oldRule.WrongGenderPreference,
                    oldRule.Repetition,
                    oldRule.ActorAgeRestrictions,
                    oldRule.TargetAgeRestrictions,
                    oldRule.TargetBetrayed,
                    oldRule.SpecificityOverride,
                    oldRule.STEffectCommodity,
                    oldRule.LTROverride
                    );

                newRule.mActorTraits  = oldRule.mActorTraits;
                newRule.mTargetTraits = oldRule.mTargetTraits;
                newRule.mSkill        = oldRule.mSkill;
                newRule.mActorIncreasedEffectiveness  = oldRule.mActorIncreasedEffectiveness;
                newRule.mActorReducedEffectiveness    = oldRule.mActorReducedEffectiveness;
                newRule.mTargetIncreasedEffectiveness = oldRule.mTargetIncreasedEffectiveness;
                newRule.mTargetReducedEffectiveness   = oldRule.mTargetReducedEffectiveness;
                newRule.ProceduralPrecondition        = oldRule.ProceduralPrecondition;
            }

            SocialRuleLHS.Get("GR").Sort(new Comparison <SocialRuleLHS>(SocialRuleLHS.SortSocialRules));

            CloneSTCData(sFlirty2, sAmorous2, ShortTermContextTypes.Flirty);
            CloneSTCData(sSeductive2, sAmorous2, ShortTermContextTypes.Seductive);
            CloneSTCData(sHot2, sAmorous2, ShortTermContextTypes.Hot);

            STCData.SetNextSTC(sFlirty2, sSeductive2);
            STCData.SetNextSTC(sSeductive2, sHot2);
        }
 public async void InsertComm(CommodityTable commodityTable)
 {
     await _repositoryComm.InsertAsync(commodityTable);
 }
Example #6
0
 /// <summary>
 /// 修改指定的商品
 /// </summary>
 /// <param name="commodity">商品编号</param>
 public void AlterCommodity(CommodityTable commodity)
 {
     service.AlterCommodity(commodity);
 }
Example #7
0
 /// <summary>
 /// 添加酒店商品
 /// </summary>
 /// <param name="commodity">要添加的商品信息</param>
 public void AddNewCommodity(CommodityTable commodity)
 {
     service.AddNewCommodity(commodity);
 }