Beispiel #1
0
 private static void FillBusinessmanCollection(IslandCollection islandCollection, SqlCommand cmd)
 {
     cmd.CommandText = QueryCollection.SELECT_BUSINESSMAN_QUERY;
     using (SqlDataReader reader = cmd.ExecuteReader())
     {
         while (reader.Read())
         {
             string      surname          = reader.GetString(0);
             string      name             = reader.GetString(1);
             string      nameCraft        = reader.GetString(2);
             string      craftDescription = reader.GetString(3);
             int         workmans         = reader.GetInt32(4);
             Businessman businessman      = new Businessman(surname, name, nameCraft, craftDescription, workmans);
             islandCollection.AddBusinessman(businessman);
         }
     }
 }
        public void CsParse()
        {
            var web   = CQ.CreateFromUrl("https://ej.by/rating/business2018/");
            var image = web.Select(".member-list .visual img");

            if (image != null)
            {
                foreach (var img in image)
                {
                    Businessman businessman = new Businessman();
                    businessman.Photo = "ej.by" + img.Attributes.GetAttribute("src");
                    businessmans.Add(businessman);
                }
            }

            var mark = web.Select(".member-list .visual .mark");

            if (mark != null)
            {
                for (int i = 0; i < mark.Length; i++)
                {
                    businessmans[i].Position = mark[i].FirstChild.ToString();
                }
            }

            var information = web.Select(".member-list .text-holder .title2 .name-link");

            if (information != null)
            {
                for (int i = 0; i < information.Length; i++)
                {
                    businessmans[i].Name = information[i].FirstChild.ToString();
                }
            }

            var age = web.Select(".member-list .text-holder .title2 span");

            if (age != null)
            {
                for (int i = 0; i < age.Length; i++)
                {
                    businessmans[i].Age = age[i].FirstChild.ToString();
                }
            }
        }
 public void AddBusinessman(Businessman businessman)
 {
     _businessmanCollection.Add(businessman);
 }
Beispiel #4
0
        public int AddTravelPaper(string buyerBusinessman,
                                  string startTripNumber, string endTripNumber, string useOffice, string iataCode,
                                  string ticketCompanyName, string tripRemark)
        {
            string BusinessmanCode    = currentUser.Code;
            string BusinessmanName    = currentUser.BusinessmanName;
            int    dataCount          = -1;
            string strMsg             = string.Empty;
            string useBusinessmanCode = string.Empty;
            string useBusinessmanName = string.Empty;

            if (string.IsNullOrEmpty(buyerBusinessman))
            {
                strMsg = "分配商户名称或者商户号不能为空!";
            }
            else if (string.IsNullOrEmpty(BusinessmanCode))
            {
                strMsg = "供应商户号不能为空!";
            }
            else if (string.IsNullOrEmpty(BusinessmanName))
            {
                strMsg = "供应商户号不能为空!";
            }
            else if (string.IsNullOrEmpty(startTripNumber) ||
                     string.IsNullOrEmpty(endTripNumber) ||
                     startTripNumber.Trim().Length != 10 ||
                     endTripNumber.Trim().Length != 10
                     )
            {
                strMsg = "行程单号段数据不完整!";
            }
            else if (string.IsNullOrEmpty(useOffice))
            {
                strMsg = "行程单号终端号不能为空!";
            }
            else if (string.IsNullOrEmpty(iataCode))
            {
                strMsg = "航协号不能为空!";
            }
            else if (string.IsNullOrEmpty(ticketCompanyName))
            {
                strMsg = "填开单位不能为空!";
            }
            else
            {
                if (!string.IsNullOrEmpty(startTripNumber) && !string.IsNullOrEmpty(endTripNumber))
                {
                    int start = int.Parse(startTripNumber.Substring(6, 4));
                    int end   = int.Parse(endTripNumber.Substring(6, 4));
                    if (start > end)
                    {
                        strMsg = "行程单号段范围有误!";
                    }
                }
            }
            //判断商户号是否存在
            Businessman businessman = this.m_businessmanRepository.FindAll(p => p.Code == buyerBusinessman || p.Name == buyerBusinessman).FirstOrDefault();

            if (businessman == null)
            {
                strMsg = "分配商户号或者商户名称不存在!";
            }
            else
            {
                useBusinessmanCode = businessman.Code;
                useBusinessmanName = businessman.Name;
            }
            //useBusinessmanCode = "caigou";//businessman.Code;
            //useBusinessmanName = "采购";//businessman.Name;
            if (string.IsNullOrEmpty(useBusinessmanCode))
            {
                strMsg = "分配商户号或者商户名称不存在!";
            }
            if (string.IsNullOrEmpty(strMsg))
            {
                string StartCode = startTripNumber.Substring(0, 6);
                string start     = startTripNumber.Substring(6, 4);
                string end       = endTripNumber.Substring(6, 4);
                tripRemark = tripRemark.Replace("'", "");
                //分配行程单
                dataCount = unitOfWorkRepository.ExecuteCommand(
                    "EXEC [dbo].[TravelPaperImport] @p0,@p1,@p2,@p3,@p4,@p5,@p6,@p7,@p8,@p9,@p10,@p11,@p12 ",
                    "0",
                    StartCode,
                    start,
                    end,
                    useOffice,
                    iataCode,
                    ticketCompanyName,
                    BusinessmanCode,
                    BusinessmanName,
                    useBusinessmanCode,
                    useBusinessmanName,
                    tripRemark,
                    ""
                    );
                if (dataCount > 0)
                {
                    TravelGrantRecord travelGrantRecord = new TravelGrantRecord();
                    travelGrantRecord.BusinessmanCode    = BusinessmanCode;
                    travelGrantRecord.BusinessmanName    = BusinessmanName;
                    travelGrantRecord.UseBusinessmanCode = useBusinessmanCode;
                    travelGrantRecord.UseBusinessmanName = useBusinessmanName;
                    travelGrantRecord.GrantTime          = System.DateTime.Now;
                    travelGrantRecord.Office             = useOffice;
                    travelGrantRecord.TripCount          = int.Parse(end) - int.Parse(start) + 1;
                    travelGrantRecord.TripScope          = startTripNumber + "-" + endTripNumber;
                    travelGrantRecord.TripRemark         = tripRemark;
                    //添加发放记录
                    unitOfWorkRepository.PersistCreationOf(travelGrantRecord);
                    unitOfWork.Commit();
                }
            }
            if (!string.IsNullOrEmpty(strMsg))
            {
                throw new OrderCommException(strMsg);
            }
            return(dataCount);
        }
Beispiel #5
0
        public int GrantBlankRecoveryTravelPaper(
            string useBusinessman, string useOffice, string iataCode,
            string ticketCompanyName, string TripRemark, List <int> selectIds)
        {
            int    dataCount          = -1;
            string strMsg             = string.Empty;
            string BusinessmanCode    = currentUser.Code;
            string BusinessmanName    = currentUser.BusinessmanName;
            string useBusinessmanCode = string.Empty;
            string useBusinessmanName = string.Empty;
            var    result             = m_travelPaperRepository.FindAll(p => p.BusinessmanCode.Trim() == BusinessmanCode.Trim());

            Businessman businessman = this.m_businessmanRepository.FindAll(p => p.Code.Trim() == useBusinessman.Trim() || p.Name.Trim() == useBusinessman.Trim()).FirstOrDefault();

            if (businessman == null)
            {
                strMsg = "分配采购商户号或者采购商户名称不存在!";
            }
            else
            {
                useBusinessmanCode = businessman.Code;
                useBusinessmanName = businessman.Name;
            }
            //useBusinessmanCode = "caigou";//businessman.Code;
            //useBusinessmanName = "采购";//businessman.Name;
            if (string.IsNullOrEmpty(strMsg))
            {
                List <int>    Ids        = new List <int>();
                List <string> tripNumber = new List <string>();
                result.Where(p => selectIds.Contains(p.ID)).Each(p =>
                {
                    Ids.Add(p.ID);
                    tripNumber.Add(p.TripNumber);
                });

                //发放空白行程单
                dataCount = unitOfWorkRepository.ExecuteCommand(
                    "EXEC [dbo].[TravelPaperImport] @p0,@p1,@p2,@p3,@p4,@p5,@p6,@p7,@p8,@p9,@p10,@p11,@p12 ",
                    "2",
                    "",
                    "0",
                    "0",
                    useOffice,
                    iataCode,
                    ticketCompanyName,
                    BusinessmanCode,
                    BusinessmanName,
                    useBusinessmanCode,
                    useBusinessmanName,
                    TripRemark,
                    string.Join(",", Ids.ToArray())
                    );
                if (dataCount <= 0)
                {
                    strMsg = "发放空白行程单失败!";
                }
                else
                {
                    if (dataCount > 0)
                    {
                        TravelGrantRecord travelGrantRecord = new TravelGrantRecord();
                        travelGrantRecord.BusinessmanCode    = BusinessmanCode;
                        travelGrantRecord.BusinessmanName    = BusinessmanName;
                        travelGrantRecord.UseBusinessmanCode = useBusinessmanCode;
                        travelGrantRecord.UseBusinessmanName = useBusinessmanName;
                        travelGrantRecord.GrantTime          = System.DateTime.Now;
                        travelGrantRecord.Office             = useOffice;
                        travelGrantRecord.TripCount          = tripNumber.Count();
                        travelGrantRecord.TripScope          = string.Join(",", tripNumber.ToArray());
                        travelGrantRecord.TripRemark         = TripRemark;
                        //添加发放记录
                        unitOfWorkRepository.PersistCreationOf(travelGrantRecord);
                        unitOfWork.Commit();
                    }
                }
            }
            if (!string.IsNullOrEmpty(strMsg))
            {
                throw new OrderCommException(strMsg);
            }
            return(dataCount);
        }
Beispiel #6
0
 void Start( )
 {
     instance = this;
     _InitShop();
 }
 public void Add(Businessman businessman)
 {
     db.Businessmens.Add(businessman);
     db.SaveChanges();
 }
Beispiel #8
0
 void Start( )
 {
     instance = this;
     _InitShop();
 }
Beispiel #9
0
 public void Add(Businessman businessman)
 {
     BusinessmanList.Add(businessman);
 }
Beispiel #10
0
    /// <summary>
    /// 更新商人的道具
    /// </summary>
    protected void UpdateBusinessman()
    {
        //获取当前商人
        businessman = businessmanStates.BusinessmanList.FirstOrDefault(temp => temp.BusinessmanID == iInteractiveState.ClickInteractiveNPCID && string.Equals(iGameState.SceneName, temp.BusinessmanScene));
        NPCDataInfo npcDataInfo = npcData.GetNPCDataInfo(iGameState.SceneName, iInteractiveState.ClickInteractiveNPCID);

        if (businessman == null && npcDataInfo != null)
        {
            businessman = new Businessman();
            businessman.BusinessManDataInfo = BusinessmanDataInfo.DeSerializeNow <BusinessmanDataInfo>(npcDataInfo.OtherValue);
            businessman.BusinessmanID       = iInteractiveState.ClickInteractiveNPCID;
            businessman.BusinessmanScene    = iGameState.SceneName;
            businessmanStates.BusinessmanList.Add(businessman);
        }
        if (businessman != null)
        {
            #region 刷新商品
            //如果商人的基础道具不足则刷新
            EnumGoodsType[] baseGoodsTypes = businessman.BusinessManDataInfo.GoodsDic.Select(temp => temp.Key).ToArray();//商人基础的物品
            foreach (EnumGoodsType baseGoodsType in baseGoodsTypes)
            {
                //如果不存在该物品则添加
                if (businessman.BaseList.FirstOrDefault(temp => temp.GoodsInfo.EnumGoodsType == baseGoodsType) == null)
                {
                    Goods addGoods = goodsMetaInfoMations[baseGoodsType].Clone(true);//获取需要添加物品的原始属性
                    BusinessmanDataInfo.GoodsDataInfoInner mustAddDataInfoInner = businessman.BusinessManDataInfo.GoodsDic[baseGoodsType];
                    EnumQualityType qualityTypeMin = mustAddDataInfoInner.MinQualityType;
                    EnumQualityType qualityTypeMax = mustAddDataInfoInner.MaxQualityType;
                    int             count          = mustAddDataInfoInner.Count;
                    //如果是道具或炼金物品则可以叠加,但是没有品质
                    if (baseGoodsType > EnumGoodsType.Item && baseGoodsType < EnumGoodsType.SpecialItem)
                    {
                        //尝试从玩家道具中获取id,如果没有则新建一个(这个id并没有什么卵用)
                        int addGoodsID = playerState.PlayerAllGoods.Where(temp => temp.GoodsInfo.EnumGoodsType == baseGoodsType).Select(temp => temp.ID).FirstOrDefault();
                        if (addGoodsID == 0)
                        {
                            addGoodsID = NowTimeToID.GetNowID(DataCenter.Instance.GetEntity <GameRunnedState>());
                        }
                        PlayGoods playGoods = new PlayGoods(addGoodsID, addGoods, GoodsLocation.None);
                        playGoods.QualityType = EnumQualityType.White;
                        playGoods.Count       = count;
                        businessman.BaseList.Add(playGoods);
                    }
                    //如果不是道具和炼金物品则不可以叠加,但是存在品质
                    else
                    {
                        int             addGoodsID  = NowTimeToID.GetNowID(DataCenter.Instance.GetEntity <GameRunnedState>());
                        EnumQualityType qualityType = (EnumQualityType)UnityEngine.Random.Range((int)qualityTypeMin, (int)qualityTypeMax + 1);
                        // 根据品质设置属性
                        if (qualityType != EnumQualityType.Red)//如果是唯一的则不用改变属性
                        {
                            float minRate = ((int)qualityType) * 0.2f + 0.8f;
                            float maxRate = minRate + 0.2f;
                            //将所有属性随机
                            addGoods.goodsAbilities.ForEach(temp =>
                            {
                                float min  = temp.Value * minRate;
                                float max  = temp.Value * maxRate;
                                temp.Value = (int)UnityEngine.Random.Range(min, max);
                            });
                            //取出用于分割固定属性以及随机属性的条目
                            GoodsAbility goodsAbility_nothing = addGoods.goodsAbilities.FirstOrDefault(temp => temp.AbilibityKind == EnumGoodsAbility.Nothing);
                            int          index = -1;
                            if (goodsAbility_nothing != null)
                            {
                                index = addGoods.goodsAbilities.IndexOf(goodsAbility_nothing);
                            }
                            //存在分割属性
                            if (index > -1 && index + 1 < addGoods.goodsAbilities.Count)
                            {
                                //取出分割项后的可变项
                                List <EnumGoodsAbility> randomAbilitys = Enumerable.Range(index + 1, addGoods.goodsAbilities.Count - index - 1).
                                                                         Select(temp => addGoods.goodsAbilities[temp]).Select(temp => temp.AbilibityKind).ToList();
                                int saveAbilityCount = (int)qualityType;//可保留的属性
                                while (randomAbilitys.Count > saveAbilityCount)
                                {
                                    int removeIndex = UnityEngine.Random.Range(0, randomAbilitys.Count);
                                    EnumGoodsAbility removeGoodsAbility = randomAbilitys[removeIndex];
                                    addGoods.goodsAbilities.RemoveAll(temp => temp.AbilibityKind == removeGoodsAbility);
                                    randomAbilitys.RemoveAt(removeIndex);
                                }
                            }
                        }
                        addGoods.goodsAbilities.RemoveAll(temp => temp.AbilibityKind == EnumGoodsAbility.Nothing);
                        //--------------------
                        PlayGoods playGoods = new PlayGoods(addGoodsID, addGoods, GoodsLocation.None);
                        playGoods.QualityType = qualityType;
                        playGoods.Count       = 1;
                        businessman.BaseList.Add(playGoods);
                    }
                }
            }
            #endregion
        }
    }