Example #1
0
    public void UpdateFundEquityPool(string stockCode, string poolFlag, string reason, int analystId, bool isEquity, int hedgeFundId)
    {
        try
        {
            if (stockCode == null || stockCode.Length < 9)
            {
                return;
            }

            string inBase, inCore, inRest, inProh;
            inBase = inCore = inRest = inProh = null;

            switch (poolFlag)
            {
            case "0001":     //禁止
                inProh = "1";
                break;

            case "0010":     //限制
                inRest = "1";
                break;

            case "1000":     //基础
                inBase = "1";
                break;

            case "1100":     //核心
                inBase = "1";
                inCore = "1";
                break;

            case "0000":     //不分配
                break;

            default:
                break;
            }

            DBServiceClient      client = new DBServiceClient();
            ProcedureParameter[] paraList;

            paraList    = new ProcedureParameter[10];
            paraList[0] = new ProcedureParameter(); paraList[0].Name = "i_stockcode"; paraList[0].Value = stockCode; paraList[0].Direction = ParameterDirection.Input; paraList[0].Type = ProcedureParameter.DBType.NVarChar;
            paraList[1] = new ProcedureParameter(); paraList[1].Name = "i_inbasepool"; paraList[1].Value = inBase; paraList[1].Direction = ParameterDirection.Input; paraList[1].Type = ProcedureParameter.DBType.Char;
            paraList[2] = new ProcedureParameter(); paraList[2].Name = "i_incorepool"; paraList[2].Value = inCore; paraList[2].Direction = ParameterDirection.Input; paraList[2].Type = ProcedureParameter.DBType.Char;
            paraList[3] = new ProcedureParameter(); paraList[3].Name = "i_inprohpool"; paraList[3].Value = inProh; paraList[3].Direction = ParameterDirection.Input; paraList[3].Type = ProcedureParameter.DBType.Char;
            paraList[4] = new ProcedureParameter(); paraList[4].Name = "i_opuser"; paraList[4].Value = "system"; paraList[4].Direction = ParameterDirection.Input; paraList[4].Type = ProcedureParameter.DBType.NVarChar;
            paraList[5] = new ProcedureParameter(); paraList[5].Name = "i_reason"; paraList[5].Value = reason; paraList[5].Direction = ParameterDirection.Input; paraList[5].Type = ProcedureParameter.DBType.NVarChar;
            paraList[6] = new ProcedureParameter(); paraList[6].Name = "i_analystid"; paraList[6].Value = analystId; paraList[6].Direction = ParameterDirection.Input; paraList[6].Type = ProcedureParameter.DBType.Int;
            paraList[7] = new ProcedureParameter(); paraList[7].Name = "i_sectype"; paraList[7].Value = (isEquity?"E":"B"); paraList[7].Direction = ParameterDirection.Input; paraList[7].Type = ProcedureParameter.DBType.Char;
            paraList[8] = new ProcedureParameter(); paraList[8].Name = "i_inrestpool"; paraList[8].Value = inRest; paraList[8].Direction = ParameterDirection.Input; paraList[8].Type = ProcedureParameter.DBType.Char;
            paraList[9] = new ProcedureParameter(); paraList[9].Name = "i_hedgefundid"; paraList[9].Value = hedgeFundId; paraList[9].Direction = ParameterDirection.Input; paraList[9].Type = ProcedureParameter.DBType.Int;

            if (hedgeFundId == 0 || hedgeFundId == 1)
            {
                client.ExecuteNonQuery("db2_proc_updatefundpool", paraList, null);    //公募 | 专户
            }
            else if (hedgeFundId > 10)
            {
                client.ExecuteNonQuery("db2_proc_updatefundpool_hf", paraList, null); //专户: 限制|禁止
            }
            else
            {
                throw new Exception("公募/专户类别错误");
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }