Пример #1
0
 public BallSoulUsedEntity(ItemInfoEntity item)
 {
     this.ItemId    = item.ItemId;
     this.ItemCode  = item.ItemCode;
     this.IsBinding = item.IsBinding;
     this.Property  = item.ItemProperty.Clone() as BallSoulProperty;
 }
Пример #2
0
        /// <summary>
        /// item
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="operationType"></param>
        public void AddShadow(ItemInfoEntity entity, EnumOperationType operationType, int operationCount)
        {
            if (CacheFactory.AppsettingCache.NotShadowItem)
            {
                return;
            }
            var shadow = ItemShadows.Find(d => d.Shadow.ItemId == entity.ItemId);

            if (shadow != null)
            {
                if (shadow.Shadow.OperationType != (int)operationType)
                {
                    shadow.Shadow.OperationCount = operationCount;
                    shadow.Shadow.OperationType  = (int)operationType;
                }
                else
                {
                    shadow.Shadow.OperationCount += operationCount;
                }
            }
            else
            {
                ItemShadows.Add(new ItemShadow(entity, operationType, TransactionId, operationCount));
            }
        }
Пример #3
0
 public DataTable Insert_Update_ItemInfo(string procedure, string callname, ItemInfoEntity objItem)
 {
     dbConn = new SqlConnection(ConnectionString);
     dbConn.Open();
     cmd             = new SqlCommand(procedure, dbConn);
     cmd.CommandType = CommandType.StoredProcedure;
     cmd.Parameters.Add(new SqlParameter("@call_name", callname));
     cmd.Parameters.Add(new SqlParameter("@p_GroupId", objItem.Togcn));
     cmd.Parameters.Add(new SqlParameter("@p_ItemCode", objItem.ICNo));
     cmd.Parameters.Add(new SqlParameter("@p_ItemId", objItem.IID));
     cmd.Parameters.Add(new SqlParameter("@p_ItemName", objItem.ICName));
     cmd.Parameters.Add(new SqlParameter("@p_ShortName", objItem.ShortName));
     cmd.Parameters.Add(new SqlParameter("@p_Unit", objItem.Unit));
     cmd.Parameters.Add(new SqlParameter("@p_MinQnty", objItem.MinQnty));
     cmd.Parameters.Add(new SqlParameter("@p_MaxQnty", objItem.MaxQnty));
     cmd.Parameters.Add(new SqlParameter("@p_OdQnty", objItem.OdQnty));
     cmd.Parameters.Add(new SqlParameter("@p_SRate", objItem.SRate));
     cmd.Parameters.Add(new SqlParameter("@p_ItemTypeId", objItem.ITCode));
     cmd.Parameters.Add(new SqlParameter("@p_Remarks", objItem.Remarks));
     cmd.Parameters.Add(new SqlParameter("@p_UserId", objItem.UserId));
     cmd.Parameters.Add(new SqlParameter("@p_TermId", objItem.TermId));
     da = new SqlDataAdapter(cmd);
     dt = new DataTable();
     da.Fill(dt);
     dbConn.Close();
     return(dt);
 }
Пример #4
0
        public ItemPackageResponse ReadPackage(byte[] buffer)
        {
            var response = new ItemPackageResponse();

            response.Data = new ItemPackageEntity();
            int offset = 0;

            response.Data.PackageSize = ByteReader.ReadInt32(buffer, ref offset);
            response.Data.Items       = new List <ItemInfoEntity>();
            int num1 = ByteReader.ReadInt32(buffer, ref offset);

            if (num1 > 0)
            {
                for (int i = 0; i < num1; i++)
                {
                    ItemInfoEntity item = new ItemInfoEntity();
                    item.ItemCount = ByteReader.ReadInt32(buffer, ref offset);
                    item.ItemCode  = ByteReader.ReadInt32(buffer, ref offset);
                    item.ItemId    = new Guid(ByteReader.ReadString(buffer, ref offset));
                    item.ItemType  = ByteReader.ReadByte(buffer, ref offset);
                    switch (item.ItemType)
                    {
                    case (int)EnumItemType.PlayerCard:
                        item.ItemProperty = ReadPlayerCardProperty(buffer, ref offset);
                        break;

                    case (int)EnumItemType.Equipment:
                        item.ItemProperty = ReadEquipmentProperty(buffer, ref offset);
                        break;
                    }
                    response.Data.Items.Add(item);
                }
            }
            return(response);
        }
Пример #5
0
 public MallItemUsedEntity(ItemInfoEntity item)
 {
     this.ItemId    = item.ItemId;
     this.ItemCode  = item.ItemCode;
     this.IsBinding = item.IsBinding;
     this.IsDeal    = item.IsDeal;
     this.Property  = item.ItemProperty.Clone() as MallItemProperty;
 }
Пример #6
0
 public EquipmentUsedEntity(ItemInfoEntity item)
 {
     this.ItemId    = item.ItemId;
     this.ItemCode  = item.ItemCode;
     this.IsBinding = item.IsBinding;
     this.IsDeal    = item.IsDeal;
     this.Property  = item.ItemProperty.Clone() as EquipmentProperty;
 }
Пример #7
0
 public PlayerCardUsedEntity(ItemInfoEntity item)
 {
     this.ItemId    = item.ItemId;
     this.ItemCode  = item.ItemCode;
     this.IsBinding = item.IsBinding;
     this.IsDeal    = item.IsDeal;
     this.Property  = item.ItemProperty.Clone() as PlayerCardProperty;
 }
Пример #8
0
        public ItemInfoEntity GenerateMaxItemCode()
        {
            var rv = new ItemInfoEntity();
            var dt = new DataTable();

            dt      = _common.select_data_dt_10("", "sp_select_Item_info", "get_max_item_code");
            rv.ICNo = dt.Rows[0]["ICNo"].ToString();
            return(rv);
        }
Пример #9
0
        public ActionResult SaveItemInfo(ItemInfoEntity objItem)
        {
            var user = (User)Session["CurrentUser"];

            objItem.UserId = user.EMPID;
            objItem.TermId = user.TermID;
            var res = _itemInfoRepository.SaveItemInfo(objItem);

            return(Json(res, JsonRequestBehavior.AllowGet));
        }
        public static DBTIdxRealtimeDetailEntity From(ItemInfoEntity info)
        {
            if (info == null || string.IsNullOrWhiteSpace(info.Code))
            {
                return(null);
            }
            var entity = new DBTIdxRealtimeDetailEntity(info.Code);

            entity.Index     = info.Value;
            entity.VolAmount = info.Amount;
            entity.VolMoney  = info.Money;
            entity.Time      = info.Time;
            return(entity);
        }
Пример #11
0
        public static void BuildEquipmentData(ItemInfoEntity entity, string itemString)
        {
            if (entity == null)
            {
                return;
            }
            int start = 0;
            int end   = 0;

            start = itemString.IndexOf("ItemProperty") + 14;
            end   = itemString.IndexOf("GridIndex") - 2;
            var ss = itemString.Substring(start, end - start);

            entity.ItemProperty = JsonConvert.DeserializeObject <EquipmentProperty>(ss);
        }
Пример #12
0
        public string SaveItemInfo(ItemInfoEntity objItem)
        {
            string rv = "";

            try
            {
                Insert_Update_ItemInfo("sp_insert_item_info", "saveiteminfo", objItem);
                rv = Operation.Success.ToString();
            }
            catch (Exception ex)
            {
                rv = ex.Message;
            }
            return(rv);
        }
Пример #13
0
        public string SaveItemInfo(ItemInfoEntity objItem)
        {
            var res  = "";
            var res1 = CheckIsExist(objItem.IID, objItem.ICNo);

            if (!res1)
            {
                res = _itemInfoDataService.SaveItemInfo(objItem);
            }
            else
            {
                res = Operation.Exists.ToString();
            }
            return(res);
        }
Пример #14
0
 public ItemShadow(ItemInfoEntity entity, EnumOperationType operationType, Guid transactionId, int operationCount)
 {
     Shadow = new ShadowItemEntity();
     Shadow.TransactionId  = transactionId;
     Shadow.OperationType  = (int)operationType;
     Shadow.ItemId         = entity.ItemId;
     Shadow.ItemCode       = entity.ItemCode;
     Shadow.ItemType       = entity.ItemType;
     Shadow.ItemCount      = entity.ItemCount;
     Shadow.IsBinding      = entity.IsBinding;
     Shadow.ItemProperty   = SerializationHelper.ToByte(entity.ItemProperty);
     Shadow.GridIndex      = entity.GridIndex;
     Shadow.Status         = entity.Status;
     Shadow.OperationCount = operationCount;
 }
Пример #15
0
        /// <summary>
        /// 更新物品并保存
        /// </summary>
        /// <param name="package"></param>
        /// <param name="item"></param>
        /// <returns></returns>
        public MessageCode UpdateItem(ItemPackageFrame package, ItemInfoEntity item)
        {
            var code = package.Update(item);

            if (code == MessageCode.Success)
            {
                if (package.Save())
                {
                    package.Shadow.Save();
                    return(code);
                }
                else
                {
                    return(MessageCode.NbUpdateFail);
                }
            }
            return(code);
        }
Пример #16
0
        public static DTOSkillCardItem GetMallSkillCard(ItemInfoEntity src)
        {
            if (null == src || src.ItemType != (int)EnumItemType.MallItem)
            {
                return(null);
            }
            var mallCfg = CacheFactory.ItemsdicCache.GetMallEntityWithoutPointByItemCode(src.ItemCode);

            if (null == mallCfg || mallCfg.EffectType != (int)EnumMallEffectType.SkillCardExp)
            {
                return(null);
            }
            var obj = new DTOSkillCardItem();

            obj.ItemId   = src.ItemId.ToString("N");
            obj.ItemCode = mallCfg.MallCode.ToString();
            obj.Exp      = mallCfg.EffectValue;
            return(obj);
        }
Пример #17
0
        void BuildItemInfo(ItemInfoEntity itemInfo, AdminItemInfoEntity wpfItemInfo)
        {
            var    itemCode = itemInfo.ItemCode;
            string enumName = "";

            switch (itemInfo.ItemType)
            {
            case (int)EnumItemType.PlayerCard:
                enumName = "EnumPlayerCardLevel";
                break;

            case (int)EnumItemType.Equipment:
                enumName = "EnumEquipmentQuality";
                break;

            case (int)EnumItemType.BallSoul:
                enumName = "EnumBallSoulColor";
                break;

            case (int)EnumItemType.MallItem:
                enumName = "EnumMallType";
                break;

            case (int)EnumItemType.SuitDrawing:
                enumName = "";
                break;
            }
            var itemDic = AdminCache.Instance.GetItem(itemCode);

            if (itemDic != null)
            {
                wpfItemInfo.Name = itemDic.ItemName;
                if (!string.IsNullOrEmpty(enumName))
                {
                    wpfItemInfo.SubTypeV = CacheDataHelper.Instance.GetEnumDescription(enumName, itemDic.SubType);
                }
            }
        }
Пример #18
0
        static MessageCode InnerSaveMix(Guid mid, ItemPackageFrame pack, SkillBagWrap bag, ItemInfoEntity mixItems, string setSkills = null)
        {
            string itemMap   = mixItems.ItemId.ToString();
            int    errorCode = (int)MessageCode.FailUpdate;

            using (var tranMgr = new TransactionManager(Dal.ConnectionFactory.Instance.GetDefault()))
            {
                tranMgr.BeginTransaction();
                do
                {
                    if (null != pack && !pack.Save(tranMgr.TransactionObject))
                    {
                        break;
                    }
                    NbManagerskillbagMgr.MixUpTran(false, mid, setSkills, bag.SetMap, itemMap, bag.RawBag.RowVersion, ref errorCode);
                }while (false);
                if (errorCode == (int)MessageCode.Success)
                {
                    tranMgr.Commit();
                }
                else
                {
                    tranMgr.Rollback();
                }
            }
            itemMap = null;
            return((MessageCode)errorCode);
        }
Пример #19
0
        /// <summary>
        /// 添加附件,已使用的物品,如拍卖行里的
        /// </summary>
        /// <param name="attachmentType"></param>
        /// <param name="count"></param>
        /// <param name="itemInfoEntity"></param>
        public bool AddAttachmentUsedItem(EnumAttachmentType attachmentType, int count, ItemInfoEntity itemInfoEntity)
        {
            ItemUsedEntity usedEntity = null;

            switch (attachmentType)
            {
            case EnumAttachmentType.UsedPlayerCard:
                usedEntity = new PlayerCardUsedEntity(itemInfoEntity);
                break;

            case EnumAttachmentType.UsedEquipment:
                usedEntity = new EquipmentUsedEntity(itemInfoEntity);
                break;
            }
            if (usedEntity == null)
            {
                return(false);
            }
            return(AddAttachmentUsedItem(attachmentType, count, usedEntity));
        }
Пример #20
0
        TeammemberResponse SetEquipment(TeammemberEntity teammember, ItemPackageFrame package, ItemInfoEntity item, int mod)
        {
            var newEquip     = new EquipmentUsedEntity(item);
            var newEquipData = SerializationHelper.ToByte(newEquip);

            return(SaveSetEquipment(teammember, package, newEquipData, mod));
        }
Пример #21
0
        private bool TryParse(string script, out TengxunIndexInfoEntity entity)
        {
            entity = null;
            if (string.IsNullOrWhiteSpace(script))
            {
                return(false);
            }
            var match  = Regex.Match(script, "^[a-zA-Z0-9/_]+[=]{1}\"(?<data>.*)\";$", RegexOptions.IgnoreCase | RegexOptions.Singleline);
            var result = match.Success;

            if (result)
            {
                var data = match.Groups["data"].Value;
                if (string.IsNullOrWhiteSpace(data))
                {
                    return(false);
                }

                string[] temp = data.Split('~');
                if (temp.Length < 50)
                {
                    return(false);
                }

                entity                = new TengxunIndexInfoEntity();
                entity.Name           = temp[1];
                entity.Code           = temp[2];
                entity.Current        = (string.IsNullOrWhiteSpace(temp[3])) ? 0m : decimal.Parse(temp[3]);
                entity.YesterdayClose = (string.IsNullOrWhiteSpace(temp[4])) ? 0m : decimal.Parse(temp[4]);
                entity.TodayOpen      = (string.IsNullOrWhiteSpace(temp[5])) ? 0m : decimal.Parse(temp[5]);

                var stime  = temp[30];
                var year   = Convert.ToInt32(stime.Substring(0, 4));
                var month  = Convert.ToInt32(stime.Substring(4, 2));
                var day    = Convert.ToInt32(stime.Substring(6, 2));
                var hour   = Convert.ToInt32(stime.Substring(8, 2));
                var minute = Convert.ToInt32(stime.Substring(10, 2));
                var second = Convert.ToInt32(stime.Substring(12, 2));
                entity.Time = new DateTime(year, month, day, hour, minute, second);

                entity.High = (string.IsNullOrWhiteSpace(temp[33])) ? 0m : decimal.Parse(temp[33]);
                entity.Low  = (string.IsNullOrWhiteSpace(temp[34])) ? 0m : decimal.Parse(temp[34]);

                entity.GVolAmount = (string.IsNullOrWhiteSpace(temp[36])) ? 0m : int.Parse(temp[36]);
                entity.GVolMoney  = (string.IsNullOrWhiteSpace(temp[37])) ? 0m : decimal.Parse(temp[37]);

                var date      = entity.Time.Date.ToString("yyyy-MM-dd");
                var list      = entity.IndexList;
                var subscript = temp[29];
                var scripts   = subscript.Split(new char[] { '|' });
                var code      = entity.Code;
                if (scripts != null && scripts.Length > 0)
                {
                    new List <string>(scripts).ForEach(s =>
                    {
                        var scrpts = s.Split(new char[] { '/' });
                        if (scrpts.Length < 6)
                        {
                            return;
                        }
                        var ent      = new ItemInfoEntity(code);
                        ent.CodeType = CODETYPE.index;
                        ent.Time     = DateTime.Parse(string.Format("{0} {1}", date, scrpts[0]));
                        ent.Value    = (string.IsNullOrWhiteSpace(scrpts[1])) ? 0m : decimal.Parse(scrpts[1]);
                        ent.Amount   = (string.IsNullOrWhiteSpace(scrpts[2])) ? 0m : decimal.Parse(scrpts[2]);
                        ent.Type     = (string.IsNullOrWhiteSpace(scrpts[3])) ? TRADE.none : "S".Equals(scrpts[3].Trim().ToUpper()) ? TRADE.sale : "B".Equals(scrpts[3].Trim().ToUpper()) ? TRADE.buy : "M".Equals(scrpts[3].Trim().ToUpper()) ? TRADE.middle : TRADE.none;
                        ent.Money    = (string.IsNullOrWhiteSpace(scrpts[4])) ? 0m : decimal.Parse(scrpts[4]);
                        list.Add(ent);
                    });
                }
                if (entity.IndexList != null && entity.IndexList.Count > 0)
                {
                    entity.IndexList.Sort(new IndexSort());
                }
            }
            return(result);
        }
Пример #22
0
        private bool TryParse(string script, out TengxunStockInfoEntity entity)
        {
            entity = null;
            if (string.IsNullOrWhiteSpace(script))
            {
                return(false);
            }
            var match  = Regex.Match(script, "^[a-zA-Z0-9/_]+[=]{1}\"(?<data>.*)\";$", RegexOptions.IgnoreCase | RegexOptions.Singleline);
            var result = match.Success;

            if (result)
            {
                var data = match.Groups["data"].Value;
                if (string.IsNullOrWhiteSpace(data))
                {
                    return(false);
                }

                string[] temp = data.Split('~');
                if (temp.Length < 50)
                {
                    return(false);
                }

                int index = 0;
                entity                = new TengxunStockInfoEntity();
                entity.Name           = temp[++index];                                                                                  // index:1
                entity.Code           = temp[++index];                                                                                  // index:2
                entity.Current        = (string.IsNullOrWhiteSpace(temp[++index])) ? 0m : decimal.Parse(temp[index]);                   // index:3
                entity.YesterdayClose = (string.IsNullOrWhiteSpace(temp[++index])) ? 0m : decimal.Parse(temp[index]);                   // index:4
                entity.TodayOpen      = (string.IsNullOrWhiteSpace(temp[++index])) ? 0m : decimal.Parse(temp[index]);                   // index:5
                ++index; ++index; ++index;

                for (int i = 0; i < 5; i++)
                {
                    entity.BuyList.Add(new OrderItemEntity()
                    {
                        Price  = (string.IsNullOrWhiteSpace(temp[++index])) ? 0m : Convert.ToDecimal(temp[index]),
                        Amount = (string.IsNullOrWhiteSpace(temp[++index])) ? 0m : Convert.ToDecimal(temp[index]),
                        Flag   = TRADE.buy
                    });
                }

                for (int i = 0; i < 5; i++)
                {
                    entity.SellList.Add(new OrderItemEntity()
                    {
                        Price  = (string.IsNullOrWhiteSpace(temp[++index])) ? 0m : Convert.ToDecimal(temp[index]),
                        Amount = (string.IsNullOrWhiteSpace(temp[++index])) ? 0m : Convert.ToDecimal(temp[index]),
                        Flag   = TRADE.sale
                    });
                }

                ++index; // the lateset 5 trades

                var stime  = temp[++index];
                var year   = Convert.ToInt32(stime.Substring(0, 4));
                var month  = Convert.ToInt32(stime.Substring(4, 2));
                var day    = Convert.ToInt32(stime.Substring(6, 2));
                var hour   = Convert.ToInt32(stime.Substring(8, 2));
                var minute = Convert.ToInt32(stime.Substring(10, 2));
                var second = Convert.ToInt32(stime.Substring(12, 2));
                entity.Time = new DateTime(year, month, day, hour, minute, second);
                ++index; ++index;

                entity.High = (string.IsNullOrWhiteSpace(temp[++index])) ? 0m : decimal.Parse(temp[index]);
                entity.Low  = (string.IsNullOrWhiteSpace(temp[++index])) ? 0m : decimal.Parse(temp[index]);

                entity.TurnoverRatio = (string.IsNullOrWhiteSpace(temp[38])) ? 0m : decimal.Parse(temp[38]);
                entity.PBRatio       = (string.IsNullOrWhiteSpace(temp[46])) ? 0m : decimal.Parse(temp[46]);
                entity.PERatio       = (string.IsNullOrWhiteSpace(temp[39])) ? 0m : decimal.Parse(temp[39]);

                entity.GVolAmount = (string.IsNullOrWhiteSpace(temp[36])) ? 0m : int.Parse(temp[36]);
                entity.GVolMoney  = (string.IsNullOrWhiteSpace(temp[37])) ? 0m : decimal.Parse(temp[37]);

                var date      = entity.Time.Date.ToString("yyyy-MM-dd");
                var list      = entity.TradeList;
                var subscript = temp[29];
                var scripts   = subscript.Split(new char[] { '|' });
                var code      = entity.Code;
                if (scripts != null && scripts.Length > 0)
                {
                    new List <string>(scripts).ForEach(s =>
                    {
                        var scrpts = s.Split(new char[] { '/' });
                        if (scrpts.Length < 6)
                        {
                            return;
                        }
                        var ent      = new ItemInfoEntity(code);
                        ent.CodeType = CODETYPE.stock;
                        ent.Time     = DateTime.Parse(string.Format("{0} {1}", date, scrpts[0]));
                        ent.Value    = (string.IsNullOrWhiteSpace(scrpts[1])) ? 0m : decimal.Parse(scrpts[1]);
                        ent.Amount   = (string.IsNullOrWhiteSpace(scrpts[2])) ? 0m : decimal.Parse(scrpts[2]);
                        ent.Type     = (string.IsNullOrWhiteSpace(scrpts[3])) ? TRADE.none : "S".Equals(scrpts[3].Trim().ToUpper()) ? TRADE.sale : "B".Equals(scrpts[3].Trim().ToUpper()) ? TRADE.buy : "M".Equals(scrpts[3].Trim().ToUpper()) ? TRADE.middle : TRADE.none;
                        ent.Money    = (string.IsNullOrWhiteSpace(scrpts[4])) ? 0m : decimal.Parse(scrpts[4]);
                        list.Add(ent);
                    });
                }

                if (entity.TradeList != null && entity.TradeList.Count > 0)
                {
                    entity.TradeList.Sort(new TradeSort());
                }
            }
            return(result);
        }