Пример #1
0
        /// <summary>
        ///根据背包显示类型返回物品列表
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public List <PGoods> GetPGoodsByType(GoodsType type)
        {
            List <PGoods> goodsShow = new List <PGoods>();

            if (type == GoodsType.Total)
            {
                return(goodsList);
            }
            else if (type == GoodsType.Equip)
            {
                return(RoleEquipList);
            }
            else if (type == GoodsType.Smelt)
            {
                return(SmeltGoodsList);
            }
            else if (type == GoodsType.Pet)
            {
                return(PetGoodsList);
            }
            else if (type == GoodsType.Other)
            {
                return(PropGoodsList);
            }

            return(goodsShow);
        }
Пример #2
0
        // Token: 0x0600DE51 RID: 56913 RVA: 0x003C13FC File Offset: 0x003BF5FC
        public void InitTrainingSkillEvolutionMaterial(GoodsType goodsType, int goodsId, int needCount)
        {
            if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_InitTrainingSkillEvolutionMaterialGoodsTypeInt32Int32_hotfix != null)
            {
                this.m_InitTrainingSkillEvolutionMaterialGoodsTypeInt32Int32_hotfix.call(new object[]
                {
                    this,
                    goodsType,
                    goodsId,
                    needCount
                });
                return;
            }
            BJLuaObjHelper.IsSkipLuaHotfix = false;
            this.m_goodsType = goodsType;
            this.m_goodsId   = goodsId;
            this.m_needCount = needCount;
            ProjectLPlayerContext projectLPlayerContext = GameManager.Instance.PlayerContext as ProjectLPlayerContext;
            int bagItemCountByType = projectLPlayerContext.GetBagItemCountByType(this.m_goodsType, this.m_goodsId);

            this.m_materialHaveCount.text = bagItemCountByType.ToString();
            this.m_materialNeedCount.text = needCount.ToString();
            if (bagItemCountByType >= needCount)
            {
                this.m_materialCountStateCtrl.SetToUIState("Normal", false, true);
            }
            else
            {
                this.m_materialCountStateCtrl.SetToUIState("Red", false, true);
            }
            this.m_materialIconImage.sprite   = AssetUtility.Instance.GetSprite(UIUtility.GetGoodsIconName(this.m_goodsType, this.m_goodsId));
            this.m_materialIconImage.material = AssetUtility.Instance.GetAsset <Material>(UIUtility.GetGoodsIconMaterialName(this.m_goodsType, this.m_goodsId));
            this.m_materialFrameImage.sprite  = AssetUtility.Instance.GetSprite(UIUtility.GetGoodsFrameName(this.m_goodsType, this.m_goodsId));
        }
Пример #3
0
        // Token: 0x06004E2E RID: 20014 RVA: 0x0017C4FC File Offset: 0x0017A6FC
        public static bool IsMoney(GoodsType goodsType)
        {
            switch (goodsType)
            {
            case GoodsType.GoodsType_ArenaTicket:
            case GoodsType.GoodsType_ArenaHonour:
            case GoodsType.GoodsType_FriendshipPoints:
                break;

            default:
                switch (goodsType)
                {
                case GoodsType.GoodsType_SkinTicket:
                case GoodsType.GoodsType_RealTimePVPHonor:
                case GoodsType.GoodsType_MemoryEssence:
                    break;

                default:
                    if (goodsType != GoodsType.GoodsType_Gold && goodsType != GoodsType.GoodsType_Crystal)
                    {
                        return(false);
                    }
                    break;
                }
                break;
            }
            return(true);
        }
Пример #4
0
        // Token: 0x0600D596 RID: 54678 RVA: 0x003A4570 File Offset: 0x003A2770
        public void ShowRewardGoodsDesc(PrefabControllerBase ctrl, GoodsType goodsType, int goodsId, int alignType = 0, GameObject gameObjectForPosCalc = null, bool isNeedAutoClose = true)
        {
            if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_ShowRewardGoodsDescPrefabControllerBaseGoodsTypeInt32Int32GameObjectBoolean_hotfix != null)
            {
                this.m_ShowRewardGoodsDescPrefabControllerBaseGoodsTypeInt32Int32GameObjectBoolean_hotfix.call(new object[]
                {
                    this,
                    ctrl,
                    goodsType,
                    goodsId,
                    alignType,
                    gameObjectForPosCalc,
                    isNeedAutoClose
                });
                return;
            }
            BJLuaObjHelper.IsSkipLuaHotfix = false;
            base.gameObject.SetActive(true);
            PrefabControllerCreater.CreateAllControllers(base.gameObject);
            RewardGoodsDescUIController component = base.gameObject.GetComponent <RewardGoodsDescUIController>();

            component.InitRewardGoodsDescInfo(goodsType, goodsId, isNeedAutoClose);
            if (gameObjectForPosCalc == null)
            {
                gameObjectForPosCalc = ctrl.gameObject;
            }
            component.gameObject.SetActive(true);
            component.StartCoroutine(RewardGoodsDescUIController.Co_ShowRewardGoodsDesc(component, gameObjectForPosCalc, alignType));
        }
Пример #5
0
        private void ShowRewardEffect(GoodsType goods, int count, Vector3 startPos)
        {
            if (goods == GoodsType.KEY)
            {
                ShowRewardKey(goods, count, startPos);
                return;
            }
            if (goods != GoodsType.GOLD && goods != GoodsType.DIAMOND && goods != GoodsType.CAMPSITE_REWARD)
            {
                return;
            }

            int     effectNum = count > m_RewardEffectNum || count < 0 ? m_RewardEffectNum : count;
            TokenUI tokenUi   = Global.gApp.gUiMgr.GetPanelCompent <TokenUI>(Wndid.TokenUI);

            if (tokenUi != null)
            {
                m_IdEffectCountDic[goods] += effectNum;
                tokenUi.UnLockById(goods, false, false);
                for (int i = 0; i < effectNum; i++)
                {
                    RewardEffectUi_RewardItem rewardEffect = RewardItem.GetInstance();
                    float radius = 0f;
                    if (effectNum > 1)
                    {
                        radius = Random.Range(m_RewardEffectRadius * 0.2f, m_RewardEffectRadius);
                    }
                    float   angle     = (float)Random.Range(0, 360);
                    float   x         = radius * Mathf.Cos(angle);
                    float   y         = radius * Mathf.Sin(angle);
                    Vector3 effectPos = new Vector3(startPos.x + x, startPos.y + y, startPos.z);
                    rewardEffect.Init(goods, effectPos, startPos, this, tokenUi);
                }
            }
        }
Пример #6
0
 /// <summary>
 /// Ініціалізує об'єкт товару значеннями
 /// </summary>
 /// /// <see cref="Name"/>
 /// <see cref="Price"/>
 /// <see cref="Date.Day"/>
 /// <see cref="Date.Month"/>
 /// <see cref="GoodsType"/>
 /// <see cref="Date"/>
 /// <param name="name">Ім'я товару</param>
 /// <param name="price">Ціна товару</param>
 /// <param name="date">Дата надходження товару</param>
 /// <param name="type">Тип товару</param>
 public Goods(string name, double price, Date date, GoodsType type)
 {
     Name      = name;
     Price     = price;
     Receiving = date;
     Type      = type;
 }
Пример #7
0
 protected OrderLine(Guid id, GoodsType goodsType, int sKU, string?remark)
 {
     Id        = id;
     GoodsType = goodsType;
     SKU       = sKU;
     Remark    = remark;
 }
Пример #8
0
 // Ctor for entityframework
 protected Order(Guid id, string customerName, string customerAddress, GoodsType goodsType)
 {
     Id              = id;
     CustomerName    = customerName;
     CustomerAddress = customerAddress;
     GoodsType       = goodsType;
 }
Пример #9
0
        private void ShowRewardKey(GoodsType goods, int count, Vector3 startPos)
        {
            if (goods != GoodsType.KEY)
            {
                return;
            }

            int      effectNum = count > m_RewardEffectNum || count < 0 ? m_RewardEffectNum : count;
            CommonUI commonUI  = Global.gApp.gUiMgr.GetPanelCompent <CommonUI>(Wndid.CommonPanel);

            if (commonUI != null)
            {
                m_IdEffectCountDic[goods] += effectNum;
                //tokenUi.UnLockById(goods, false, false);
                for (int i = 0; i < effectNum; i++)
                {
                    var   rewardEffect = RewardKey.GetInstance();
                    float radius       = 0f;
                    if (effectNum > 1)
                    {
                        radius = Random.Range(m_RewardEffectRadius * 0.2f, m_RewardEffectRadius);
                    }
                    float   angle     = (float)Random.Range(0, 360);
                    float   x         = radius * Mathf.Cos(angle);
                    float   y         = radius * Mathf.Sin(angle);
                    Vector3 effectPos = new Vector3(startPos.x + x, startPos.y + y, startPos.z);
                    rewardEffect.Init(effectPos, startPos, this, commonUI);
                }
            }
        }
Пример #10
0
 /// <summary>
 /// 查询某级类别的所有子类
 /// </summary>
 /// <param name="level">类别等级(1,2)</param>
 /// <param name="typeID">TypeID</param>
 /// <returns>List<GoodsType></returns>
 public static List <GoodsType> QueryTypesChild(int level, string typeID)
 {
     try
     {
         level++;
         string tb_name = "tb_goodstype";
         if (level == 2)
         {
             tb_name += "_second";
         }
         else if (level == 3)
         {
             tb_name += "_third";
         }
         string           sql  = "select * from " + tb_name + " where goodsParentTypeID=?typeID;";
         MySqlParameter   para = new MySqlParameter("?typeID", typeID);
         DataTable        dt   = DAL_MysqlHelper.ExecuteDataSet(sql, para).Tables[0];
         List <GoodsType> list = new List <GoodsType>();
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             GoodsType type = new GoodsType();
             type.TypeID    = dt.Rows[i]["goodsTypeID"].ToString();
             type.TypeLevel = level;
             type.TypeName  = dt.Rows[i]["goodsTypeName"].ToString();
             list.Add(type);
         }
         return(list);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Пример #11
0
 /// <summary>
 /// 查询某级类别的所有类别
 /// </summary>
 /// <param name="level">类别等级(1,2,3)</param>
 /// <returns></returns>
 public static List <GoodsType> QueryAlltypes(int level)
 {
     try
     {
         string tb_name = "tb_goodstype";
         if (level == 2)
         {
             tb_name += "_second";
         }
         else if (level == 3)
         {
             tb_name += "_third";
         }
         string           sql  = "select * from " + tb_name + ";";
         DataTable        dt   = DAL_MysqlHelper.ExecuteDataSet(sql).Tables[0];
         List <GoodsType> list = new List <GoodsType>();
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             GoodsType type = new GoodsType();
             type.TypeID    = dt.Rows[i]["goodsTypeID"].ToString();
             type.TypeLevel = level;
             type.TypeName  = dt.Rows[i]["goodsTypeName"].ToString();
             if (level != 1)
             {
                 type.ParentTypeID = dt.Rows[i]["goodsParentTypeID"].ToString();
             }
             list.Add(type);
         }
         return(list);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
        private Thing GenerateSingle(TechLevel techLevel)
        {
            GoodsType first = ItemCollectionGenerator_RandomGeneralGoods.GoodsWeights.RandomElementByWeight((Pair <GoodsType, float> x) => x.Second).First;

            switch (first)
            {
            case GoodsType.Meals:
                return(this.RandomMeals(techLevel));

            case GoodsType.RawFood:
                return(this.RandomRawFood(techLevel));

            case GoodsType.Medicine:
                return(this.RandomMedicine(techLevel));

            case GoodsType.Drugs:
                return(this.RandomDrugs(techLevel));

            case GoodsType.Resources:
                return(this.RandomResources(techLevel));

            default:
                Log.Error("Goods type not handled: " + first);
                return(null);
            }
        }
Пример #13
0
 /// <summary>
 /// 根据TypeID查询某级类别详细信息
 /// </summary>
 /// <param name="level">类别等级(1,2,3)</param>
 /// <param name="typeID">TypeID</param>
 /// <returns>GoodsType</returns>
 public static GoodsType QueryTypeName(int level, string typeID)
 {
     try
     {
         string tb_name = "tb_goodstype";
         if (level == 2)
         {
             tb_name += "_second";
         }
         else if (level == 3)
         {
             tb_name += "_third";
         }
         string         sql  = "select * from " + tb_name + " where goodsTypeID=?typeID;";
         MySqlParameter para = new MySqlParameter("?typeID", typeID);
         DataTable      dt   = DAL_MysqlHelper.ExecuteDataSet(sql, para).Tables[0];
         GoodsType      type = new GoodsType();
         type.TypeID    = typeID;
         type.TypeLevel = level;
         type.TypeName  = dt.Rows[0]["goodsTypeName"].ToString();
         if (level != 1)
         {
             type.ParentTypeID = dt.Rows[0]["goodsParentTypeID"].ToString();
         }
         return(type);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Пример #14
0
        /// <summary>
        /// 单个物品获得效果展示
        /// </summary>
        /// <param name="goods"></param>
        /// <param name="sender"></param>
        public void PlayAddGameGoodsEffect(GameGoodData goods, GameObject sender)
        {
            GoodsType  reward       = goods.type;
            BigInteger reward_count = goods.count;
            int        reward_type  = goods.param;

            switch (reward)
            {
            case GoodsType.CARD:
            case GoodsType.CARD_CHIP:
            {
                //UIMgr.singleton.FindUIObject<ResourceUI>().PlayCollectCardAnim
                //(reward, reward_type, reward_count, sender.transform.position);
            }
            break;

            case GoodsType.GOLD:
            case GoodsType.DIAMOND:
            case GoodsType.KEY:
            {
                int rewardEfCount = reward_count > int.MaxValue ? int.MaxValue : (int)reward_count;
                Global.gApp.gMsgDispatcher.Broadcast(MsgIds.ShowRewardGetEffect, reward, reward_count, sender.transform.position);
            }
            break;
            }
        }
Пример #15
0
        public bool CostGameGoods(GoodsType _type, BigInteger count, int param = -1)
        {
            if (count <= 0)
            {
                return(false);
            }
            switch (_type)
            {
            case GoodsType.DIAMOND:
            {
                PlayerDataMgr.singleton.CostCurrency(CurrencyType.DIAMOND, (int)count);
            }
            break;

            case GoodsType.GOLD:
            {
                PlayerDataMgr.singleton.CostBigCurrency(CurrencyType.GOLD, count);
            }
            break;

            case GoodsType.KEY:
            {
                PlayerDataMgr.singleton.CostCurrency(CurrencyType.KEY, (int)count);
            }
            break;

            default:
                return(false);
            }
            return(true);
        }
Пример #16
0
        /// <summary>
        /// 获得游戏物品名称
        /// </summary>
        /// <param name="type">类型</param>
        /// <param name="value">参数</param>
        /// <returns></returns>
        public string GetGameGoodsName(GoodsType _type, int value = -1)
        {
            switch (_type)
            {
            case GoodsType.DIAMOND:
            case GoodsType.GOLD:
            case GoodsType.KEY:
            {
                var currency     = Goods2Currency(_type);
                var currency_res = TableMgr.singleton.CurrencyTable.GetItemByID((int)currency);
                if (currency_res != null)
                {
                    return(currency_res.name);
                }
            }
            break;

            case GoodsType.CARD:
            {
                var card_res = TableMgr.singleton.GunCardTable.GetItemByID(value);
                if (card_res != null)
                {
                    return(LanguageMgr.GetText(card_res.tid_name));
                }
            }
            break;
            }
            return("");
        }
Пример #17
0
        public Sprite GetGameGoodsIcon(GoodsType _type, int value = -1)
        {
            switch (_type)
            {
            case GoodsType.DIAMOND:
            case GoodsType.GOLD:
            case GoodsType.GOLD_MINUTE:
            case GoodsType.KEY:
            {
                var currency = Goods2Currency(_type);
                return(GetCurrencyIcon(currency));
            }
            break;

            case GoodsType.CAMPSITE_REWARD:
            {
                return(Global.gApp.gResMgr.LoadAssets <Sprite>("ResourcesSprites/Goods/ui_campreward"));
            }

            default:
                break;
            }

            return(null);
        }
Пример #18
0
        // Token: 0x0601322A RID: 78378 RVA: 0x004E12A8 File Offset: 0x004DF4A8
        private void HandleBoxOpenNetTask(GoodsType type, int id, int count)
        {
            if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_HandleBoxOpenNetTaskGoodsTypeInt32Int32_hotfix != null)
            {
                this.m_HandleBoxOpenNetTaskGoodsTypeInt32Int32_hotfix.call(new object[]
                {
                    this,
                    type,
                    id,
                    count
                });
                return;
            }
            BJLuaObjHelper.IsSkipLuaHotfix = false;
            BagItemUseNetTask bagItemUseNetTask = new BagItemUseNetTask(type, id, count);

            bagItemUseNetTask.EventOnStop += delegate(Task task)
            {
                BagItemUseNetTask bagItemUseNetTask2 = task as BagItemUseNetTask;
                if (bagItemUseNetTask2.Result == 0)
                {
                    if (bagItemUseNetTask2.Reward != null && bagItemUseNetTask2.Reward.Count > 0)
                    {
                        GetRewardGoodsUITask.StartUITask(bagItemUseNetTask2.Reward);
                    }
                }
                else
                {
                    CommonUIController.Instance.ShowErrorMessage(bagItemUseNetTask2.Result, 2f, null, true);
                }
            };
            bagItemUseNetTask.Start(null);
        }
Пример #19
0
        public async Task <Response> AddGood(GoodsTypeVM goods)
        {
            var goodsDto = Mapper.Map <GoodsTypeVM, GoodsType>(goods);

            GoodsType goodsExist = await _db.GoodsTypes.Where(x => x.Goods.Trim() == goods.Goods.Trim()).FirstOrDefaultAsync();

            if (goodsExist != null)
            {
                return(GenericResponses <int> .ResponseStatus(true, Constant.MDGNoAlreadyExist, (int)Constant.httpStatus.NoContent, 0));
            }

            _db.GoodsTypes.Add(goodsDto);

            int result = await _db.SaveChangesAsync();

            if (result == 1)
            {
                // Mapper.Initialize(cfg => cfg.CreateMap<User, UserVM>());

                return(GenericResponses <int> .ResponseStatus(false, Constant.MSGRecordFound, (int)Constant.httpStatus.Ok, result));
            }
            else
            {
                return(GenericResponses <int> .ResponseStatus(true, Constant.MDGNoLoginFailed, (int)Constant.httpStatus.NoContent, result));
            }
        }
Пример #20
0
        // Token: 0x0600F9FA RID: 63994 RVA: 0x0041C990 File Offset: 0x0041AB90
        private void HandleBoxOpenNetTask(GoodsType type, int id, int count, Action <List <Goods> > successedCallback, Action failedCallback)
        {
            BagItemUseNetTask bagItemUseNetTask = new BagItemUseNetTask(type, id, count);

            bagItemUseNetTask.EventOnStop += delegate(Task task)
            {
                BagItemUseNetTask bagItemUseNetTask2 = task as BagItemUseNetTask;
                if (bagItemUseNetTask2.Result == 0)
                {
                    if (successedCallback != null)
                    {
                        successedCallback(bagItemUseNetTask2.Reward);
                    }
                }
                else
                {
                    CommonUIController.Instance.ShowErrorMessage(bagItemUseNetTask2.Result, 2f, null, true);
                    if (failedCallback != null)
                    {
                        failedCallback();
                    }
                }
            };
            bagItemUseNetTask.Start(null);
        }
Пример #21
0
 protected void Page_Load(object sender, EventArgs e)
 {
     string strGoodsId = Request.QueryString["id"];
     if (!string.IsNullOrEmpty(strGoodsId) && int.TryParse(strGoodsId, out id))
     {
         gt = GoodsType.findById(id);
     }
     if (!Page.IsPostBack)
     {
         ddlType.DataSource = GoodsCategoryType.findAll();
         ddlType.DataTextField = "CategoryName";
         ddlType.DataValueField = "CategoryName";
         ddlType.DataBind();
         this.DoPageLoad();
         if (gt != null)
         {
             txtColor.Value = gt.ItemColor;
             txtDesc.Value = gt.Description;
             txtGoodsName.Value = gt.ItemName;
             txtHeight.Value = gt.ItemHigh.ToString();
             txtItemNo.Value = gt.ItemSku;
             txtLength.Value = gt.ItemLong.ToString();
             txtPrice.Value = gt.ItemPrice.ToString();
             txtWeight.Value = gt.ItemWeight.ToString();
             txtWidth.Value = gt.ItemWide.ToString();
         }
     }
 }
Пример #22
0
        /// <summary>
        /// 增加商品类别
        /// </summary>
        /// <param name="goodsType"></param>
        /// <param name="errorMessage"></param>
        /// <returns></returns>
        public DataTable addGoodsType(GoodsType goodsType, out string errorMessage)
        {
            int       maxId        = getExcelSheetMaxId(TableId.GoodsTypeForExcel, out errorMessage);
            DataTable dt_goodsType = null;

            if (maxId < 0)
            {
                return(dt_goodsType);
            }
            else
            {
                string sql       = "insert into [" + getExcelSheetNameById(TableId.GoodsTypeForExcel) + "] (id,类别代码,商品类别) values(" + maxId + "," + goodsType.goodsTypeCode + "," + goodsType.goodsTypeName + ")";
                int    execCount = ExcelDataAccess.ExecuteCommand(sql, connectionString, out errorMessage);
                if (execCount < 1)
                {
                    //errorMessage = "增加失败!请检查excel";
                    return(dt_goodsType);
                }
                sql = "select * from [" + getExcelSheetNameById(TableId.GoodsTypeForExcel) + "] ";
                DataSet ds = ExcelDataAccess.GetReader(sql, connectionString);
                if (ds != null)
                {
                    dt_goodsType = ds.Tables[0];
                }
                return(dt_goodsType);
            }
        }
Пример #23
0
        /// <summary>
        /// Инициализация UI-элементов
        /// </summary>
        public void Initialize(GoodsType type, GoodUI uiData, Action <GoodsType, short, int> onClickAction)
        {
            if (_itemIconMaxSize == 0)
            {
                _itemIconMaxSize = itemIconBackgroundRect.rect.width - marginPadding;
            }

            Type  = type;
            Level = uiData.Level;

            iconImg.sprite = uiData.Image;

            if (uiData.Image != null)
            {
                var texture = uiData.Image.texture;
                var ratio   = (float)texture.width / texture.height;
                var scale   = ratio >= 1f
                    ? _itemIconMaxSize / texture.width
                    : _itemIconMaxSize / texture.height;

                itemIconRect.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, texture.width * scale);
                itemIconRect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, texture.height * scale);
            }

            typeTxt.text  = LocalizationManager.Instance.Get(type.GetDescription()).ToUpper();;
            priceTxt.text = uiData.Price.DisplayMoney();

            buyBtn.onClick.RemoveAllListeners();
            buyBtn.onClick.AddListener(() => onClickAction(Type, Level, uiData.Price));
        }
Пример #24
0
        public GoodsType GetByIdGoods(int idGoods)
        {
            GoodsType type;

            try
            {
                OpenConnection();
                string query = "Select GT.idGoodsType, GT.name, GT.profitPercentage, GT.unit from GoodsType as GT "
                               + "inner join Goods on GT.idGoodsType = Goods.idGoodsType "
                               + "where GT.isActive = 1 and Goods.idGoods = " + idGoods.ToString();
                MySqlCommand     cmd     = new MySqlCommand(query, conn);
                MySqlDataAdapter adapter = new MySqlDataAdapter(cmd);
                DataTable        dt      = new DataTable();
                adapter.Fill(dt);
                if (dt.Rows.Count == 1)
                {
                    type = new GoodsType(int.Parse(dt.Rows[0].ItemArray[0].ToString()), dt.Rows[0].ItemArray[1].ToString(),
                                         double.Parse(dt.Rows[0].ItemArray[2].ToString()),
                                         dt.Rows[0].ItemArray[3].ToString(), true);
                    return(type);
                }
                else
                {
                    return(new GoodsType());
                }
            }
            catch
            {
                return(new GoodsType());
            }
            finally
            {
                CloseConnection();
            }
        }
Пример #25
0
        public void Validate(GoodsType entity)
        {
            if (entity.ParentId < 0)
            {
                throw new BusinessException("0001", "فیلد مربوط به پدر نمی تواند دارای مقدار منفی باشد.");
            }


            var query = _goodsTypeRepository.GetAll().Where(z => z.TypeTitle == entity.TypeTitle);
            var cnt   = 0;

            if (entity.Id == 0)
            {
                cnt = query.ToList().Count;
            }
            else if (entity.Id > 0)
            {
                cnt = query.Where(z => z.Id != entity.Id).ToList().Count;
            }

            if (cnt > 0)
            {
                throw new BusinessException("0002", "نوع کالای تکراری می باشد.");
            }
        }
Пример #26
0
        /// <summary>5
        /// 添加商品类型0
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="typeName"></param>
        /// <returns></returns>
        public string AddGoodType(Guid parent, string typeName)
        {
            var       loginUser = (UserInfo)ViewBag.User;;
            Guid      managerId = (Guid)ViewBag.ManagerId;
            GoodsType type      = new GoodsType();

            type.CreateUserId   = managerId;
            type.CreateUserName = loginUser.UserName;
            var parentModel = _manager.GetTypeById(parent);

            type.Id       = Guid.NewGuid();
            type.TypeName = typeName;
            type.IsDelete = false;
            if (parentModel == null)
            {
                type.ParentId   = Guid.Empty;
                type.ParentName = string.Empty;
            }
            else
            {
                type.ParentId   = parentModel.Id;
                type.ParentName = parentModel.TypeName;
            }
            var res = _manager.AddGoodsType(type);

            return(Utils.SerializeObject(res));
        }
Пример #27
0
        public GoodsType GetById(int id)
        {
            GoodsType type;

            try
            {
                OpenConnection();
                string           query   = "Select * from GoodsType where idGoodsType = " + id.ToString();
                MySqlCommand     cmd     = new MySqlCommand(query, conn);
                MySqlDataAdapter adapter = new MySqlDataAdapter(cmd);
                DataTable        dt      = new DataTable();
                adapter.Fill(dt);
                if (dt.Rows.Count == 1)
                {
                    type = new GoodsType(id, dt.Rows[0].ItemArray[1].ToString(),
                                         double.Parse(dt.Rows[0].ItemArray[2].ToString()),
                                         dt.Rows[0].ItemArray[3].ToString(), bool.Parse(dt.Rows[0].ItemArray[4].ToString()));
                    return(type);
                }
                else
                {
                    return(new GoodsType());
                }
            }
            catch
            {
                return(new GoodsType());
            }
            finally
            {
                CloseConnection();
            }
        }
Пример #28
0
 //set goods info
 public void SetGoodsInfo(GameObject tempObj, GoodsType tempGt, int ft, BuildManager buildManager)
 {
     m_floorObj     = tempObj;
     gt             = tempGt;
     m_ft           = ft;
     m_buildManager = buildManager;
 }
Пример #29
0
    public void SetUI(string name, int goodsId, GoodsType type)
    {
        string path = string.Empty;

        switch (type)
        {
        case GoodsType.Equip:
            path = string.Format("Download/Source/UISource/EquipIco/{0}.assetbundle", goodsId);
            break;

        case GoodsType.Item:
            path = string.Format("Download/Source/UISource/ItemIco/{0}.assetbundle", goodsId);
            break;

        case GoodsType.Material:
            path = string.Format("Download/Source/UISource/MaterialIco/{0}.assetbundle", goodsId);
            break;
        }

        AssetBundleMgr.Instance.LoadOrDownload <Texture2D>(path, goodsId.ToString(), (Texture2D obj) =>
        {
            //if (obj == null) return;
            var iconRect   = new Rect(0, 0, obj.width, obj.height);
            var iconSprite = Sprite.Create(obj, iconRect, new Vector2(.5f, .5f));

            imgIco.overrideSprite = iconSprite;
        }, type: 1);

        lblName.SetText(name);
    }
Пример #30
0
 // Token: 0x06011105 RID: 69893 RVA: 0x0046C458 File Offset: 0x0046A658
 public HeroAddExpNetTask(int heroId, GoodsType goodsType, int itemId, int count) : base(10f, null, true)
 {
     this.m_heroId    = heroId;
     this.m_goodsType = goodsType;
     this.m_itemId    = itemId;
     this.m_count     = count;
 }
Пример #31
0
    public static HouseData GetHouseData(GoodsType gt)
    {
        HouseData hd = new HouseData();

        if (gt == GoodsType.TABLE)
        {
            hd.InitData(2.4f, 2.66f, 2, 5, new Vector2(0.7f / 2 + 0.12f, 0.4f / 2 + 0.11f));
        }
        else if (gt == GoodsType.CABINET)
        {
            hd.InitData(2.04f, 2.68f, 2, 5, new Vector2(0.7f / 2, 0.4f / 2 + 0.15f));
        }
        else if (gt == GoodsType.ELECTRICBOX)
        {
            hd.InitData(2.01f, 2.18f, 4, 2, new Vector2(0.5f, 0.4f * 2 - 0.1f));
        }
        else if (gt == GoodsType.OXYGENBOTTLE)
        {
            hd.InitData(1.22f, 2.14f, 2, 2, new Vector2(0.27f, 0.4f / 2 + 0.07f));
        }
        else if (gt == GoodsType.ALLOYCABINET)
        {
            hd.InitData(1.63f, 1.79f, 3, 2, new Vector2(0.38f, 0.45f));
        }
        else if (gt == GoodsType.HIGHSTOVE)
        {
            hd.InitData(1.63f, 1.79f, 3, 3, new Vector2(0.1f, 0.3f));
        }
        else if (gt == GoodsType.ELECTRICCABINET)
        {
            hd.InitData(1.63f, 1.79f, 3, 4, new Vector2(0.1f, 0.3f));
        }
        return(hd);
    }
Пример #32
0
 public Goods(string name, GoodsType type, int money, int saleMoney, string details)
 {
     this.Name = name;
     this.Type = type;
     this.Money = money;
     this.SaleMoney = saleMoney;
     this.Details = details;
 }
Пример #33
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            gt = new GoodsType();
            if (string.IsNullOrEmpty(txtItemNo.Value) || string.IsNullOrEmpty(txtGoodsName.Value))
            {
                return;
            }
            gt.CreateBy = "";
            gt.CreateOn = DateTime.Now;
            gt.CreateUserId = "";
            gt.Description = txtDesc.Value;
            gt.ItemColor = txtColor.Value;
            gt.Enabled = 1;
            gt.ItemSku = txtItemNo.Value;
            gt.ItemColor = txtColor.Value;
            gt.ItemName = txtGoodsName.Value;
            gt.ItemPrice = cvt.ToDouble(txtPrice.Value);
            gt.ItemType = ddlType.SelectedItem.Value;
            gt.ItemLong = cvt.ToDouble(txtLength.Value);
            gt.ItemWide = cvt.ToDouble(txtWidth.Value);
            gt.ItemHigh = cvt.ToDouble(txtHeight.Value);
            gt.ItemWeight = cvt.ToDouble(txtWeight.Value);
            if (fuGoodsImg.HasFile)
            {
                string strDateNow = DateTime.Now.ToString("yyyyMMdd");
                long longTicks = DateTime.Now.Ticks;
                string filePath = Server.MapPath("~/Uploadfiles/ItemImg/") + strDateNow + "/";
                if (!Directory.Exists(filePath))
                {
                    Directory.CreateDirectory(filePath);
                }
                string fileName = fuGoodsImg.FileName;
                string fileType = fileName.Substring(fileName.IndexOf('.'));
                filePath = string.Concat(new object[] { filePath, "/", longTicks, fileType });
                fuGoodsImg.SaveAs(filePath);
                gt.ItemImage = "/Uploadfiles/ItemImg/" + strDateNow + "/" + longTicks.ToString() + fileType;
            }
            gt.SortCode = 0;

            gt.insert();
        }
        /// <summary>
        /// 更新用户库存数量
        /// </summary>
        /// <param name="uid">用户编号</param>
        /// <param name="d">提货 卖</param>
        /// <param name="type">物品类型</param>
        /// <param name="total">数量</param>
        /// <param name="tran"></param>
        public static void UpdateAgentTotal(string uid, Direction d, GoodsType type, decimal total, YicelTransaction tran)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update Trade_Agent set ");
            #region

            if (d == Direction.提货单)
            {
                switch (type)
                {
                    case GoodsType.Au:
                        strSql.Append("Au=Au+@Total ");
                        break;
                    case GoodsType.Ag:
                        strSql.Append("Ag=Ag+@Total ");
                        break;
                    case GoodsType.Pt:
                        strSql.Append("Pt=Pt+@Total ");
                        break;
                    case GoodsType.Pd:
                        strSql.Append("Pd=Pd+@Total ");
                        break;
                }
            }
            else if (d == Direction.卖单)
            {
                switch (type)
                {
                    case GoodsType.Au:
                        strSql.Append("Au_b=Au_b+@Total ");
                        break;
                    case GoodsType.Ag:
                        strSql.Append("Ag_b=Ag_b+@Total ");
                        break;
                    case GoodsType.Pt:
                        strSql.Append("Pt_b=Pt_b+@Total ");
                        break;
                    case GoodsType.Pd:
                        strSql.Append("Pd_b=Pd_b+@Total ");
                        break;
                }
            }
            else if (d == Direction.金店库存同步)
            {
                switch (type)
                {
                    case GoodsType.Au:
                        strSql.Append("Au=Au-@Total ");
                        break;
                    case GoodsType.Ag:
                        strSql.Append("Ag=ag-@Total ");
                        break;
                    case GoodsType.Pt:
                        strSql.Append("Pt=pt-@Total ");
                        break;
                    case GoodsType.Pd:
                        strSql.Append("Pd=pd-@Total ");
                        break;
                }
            }
            #endregion
            strSql.Append("where AgentId=@AgentId");
            SqlParameter[] paras = new SqlParameter[]
            {
            new SqlParameter("@AgentId", uid),
            new SqlParameter("@Total", total)
            };
            DbHelper.ExecuteNonQuery(strSql.ToString(), paras, tran.Transaction);
        }
        /// <summary>
        /// 更新用户库存数量
        /// </summary>
        /// <param name="uid">用户编号</param>
        /// <param name="d">提货 卖</param>
        /// <param name="type">物品类型</param>
        /// <param name="total"></param>
        /// <param name="userEntity">数量</param>
        /// <param name="tran"></param>
        public static void UpdateTotal(string uid, Direction d, GoodsType type, decimal total, StockEntity userEntity, YicelTransaction tran)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update Stock_BZJ set ");
            #region
            if (d == Direction.提货单)
            {
                switch (type)
                {
                    case GoodsType.Au:
                        if (userEntity.AuTotal + total * userEntity.AuPrice >= 0)
                        {
                            strSql.Append("Au=Au+@Total,AuTotal=AuTotal+@Total*AuPrice,AuAmount=AuAmount+@Total ");
                        }
                        else
                        {
                            strSql.Append("Au=Au+@Total,AuTotal=0,AuAmount=0 ");
                        }
                        break;
                    case GoodsType.Ag:
                        if (userEntity.AgTotal + total * userEntity.AgPrice >= 0)
                        {
                            strSql.Append("Ag=Ag+@Total,AgTotal=AgTotal+@Total*AgPrice,AgAmount=AgAmount+@Total ");
                        }
                        else
                        {
                            strSql.Append("Ag=Ag+@Total,AgTotal=0,AgAmount=0 ");
                        }
                        break;
                    case GoodsType.Pt:
                        if (userEntity.PtTotal + total * userEntity.PtPrice >= 0)
                        {
                            strSql.Append("Pt=Pt+@Total,PtTotal=PtTotal+@Total*PtPrice,PtAmount=PtAmount+@Total ");
                        }
                        else
                        {
                            strSql.Append("Pt=Pt+@Total,PtTotal=0,PtAmount=0 ");
                        }
                        break;
                    case GoodsType.Pd:
                        if (userEntity.PdTotal + total * userEntity.PdPrice >= 0)
                        {
                            strSql.Append("Pd=Pd+@Total,PdTotal=PdTotal+@Total*PdPrice,PdAmount=PdAmount+@Total ");
                        }
                        else
                        {
                            strSql.Append("Pd=Pd+@Total,PdTotal=0,PdAmount=0 ");
                        }
                        break;
                }
            }
            else if (d == Direction.卖单)
            {
                switch (type)
                {
                    case GoodsType.Au:
                        strSql.Append("Au_b=Au_b+@Total ");
                        break;
                    case GoodsType.Ag:
                        strSql.Append("Ag_b=Ag_b+@Total ");
                        break;
                    case GoodsType.Pt:
                        strSql.Append("Pt_b=Pt_b+@Total ");
                        break;
                }
            }
            else if (d == Direction.金生金 || d == Direction.到期单 || d == Direction.已生金单 || d == Direction.提成单 || d == Direction.金店库存同步 || d == Direction.库存调整)
            {
                switch (type)
                {
                    case GoodsType.Au:
                        strSql.Append("Au=Au+@Total ");
                        break;
                    case GoodsType.Ag:
                        strSql.Append("Ag=Ag+@Total ");
                        break;
                    case GoodsType.Pt:
                        strSql.Append("Pt=Pt+@Total ");
                        break;
                    case GoodsType.Pd:
                        strSql.Append("Pd=Pd+@Total ");
                        break;
                }
            }
            #endregion
            strSql.Append("where UserId=@UserId");

            SqlParameter[] parms = new SqlParameter[] {
                new SqlParameter("@UserId",uid),
                new SqlParameter("@Total",total)
            };
            DbHelper.ExecuteNonQuery(strSql.ToString(), parms, tran.Transaction);
        }
Пример #36
0
 public AbstractMarketGoods(GoodsType type)
 {
     this.type = type;
 }
Пример #37
0
 public DinnerwareSet(GoodsType type, bool decorated)
     : base(type)
 {
     this.decorated = decorated;
 }
Пример #38
0
 public TableLamp(GoodsType type, Efficiency efficiency)
     : base(type)
 {
     this.efficiency = efficiency;
 }