Ejemplo n.º 1
0
        /// <summary>
        /// 更新类别信息
        /// </summary>
        /// <param name="requestID">请求ID</param>
        /// <param name="category">类别</param>
        /// <returns>状态</returns>
        public int UpdateCategory(int requestID, UserSecurityCategory category)
        {
            List <UserSecurityCategory> categories = new List <UserSecurityCategory>();

            categories.Add(category);
            int ret = Send(FUNCTIONID_USERSECURITY_UPDATECATEGORIES, requestID, categories);

            categories.Clear();
            return(ret > 0 ? 1 : 0);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 删除证券
        /// </summary>
        /// <param name="requestID">请求ID</param>
        /// <param name="category">类别</param>
        /// <returns>状态</returns>
        public int DeleteSecurities(int requestID, UserSecurityCategory category)
        {
            List <UserSecurityCategory> categories = new List <UserSecurityCategory>();

            categories.Add(category);
            int ret = Send(FUNCTIONID_USERSECURITY_DELETESECURITIES, requestID, categories);

            categories.Clear();
            return(ret > 0 ? 1 : 0);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 发送消息
        /// </summary>
        /// <param name="functionID">方法ID</param>
        /// <param name="requestID">请求ID</param>
        /// <param name="categories">类别集合</param>
        /// <returns>状态</returns>
        public int Send(int functionID, int requestID, List <UserSecurityCategory> categories)
        {
            Binary bw             = new Binary();
            int    categoriesSize = categories.Count;

            bw.WriteInt(categoriesSize);
            for (int i = 0; i < categoriesSize; i++)
            {
                UserSecurityCategory category = categories[i];
                bw.WriteString(category.m_categoryID);
                bw.WriteInt(category.m_userID);
                bw.WriteString(category.m_name);
                bw.WriteString(category.m_codes);
                bw.WriteInt(category.m_type);
                bw.WriteInt(category.m_orderNum);
            }
            byte[] bytes = bw.GetBytes();
            int    ret   = Send(new CMessage(GroupID, ServiceID, functionID, SessionID, requestID, m_socketID, 0, CompressType, bytes.Length, bytes));

            bw.Close();
            return(ret);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 通过流获取类别信息列表
        /// </summary>
        /// <param name="categories">类别信息</param>
        /// <param name="body">包体</param>
        /// <param name="bodyLength">包体长度</param>
        /// <returns>状态</returns>
        public static int GetCategories(List <UserSecurityCategory> categories, byte[] body, int bodyLength)
        {
            Binary br = new Binary();

            br.Write(body, bodyLength);
            int size = br.ReadInt();

            if (size > 0)
            {
                for (int i = 0; i < size; i++)
                {
                    UserSecurityCategory category = new UserSecurityCategory();
                    category.m_categoryID = br.ReadString();
                    category.m_userID     = br.ReadInt();
                    category.m_name       = br.ReadString();
                    category.m_codes      = br.ReadString();
                    category.m_type       = br.ReadInt();
                    category.m_orderNum   = br.ReadInt();
                    categories.Add(category);
                }
            }
            br.Close();
            return(1);
        }