Beispiel #1
0
        //private string flag_operType = string.Empty; //I : insert ; U : update ; S : save
        #endregion



        #region 表单加载
        private void Core_Enter_Load(object sender, EventArgs e)
        {
            //需要分页,每次获取一页的所有数据

            //获取事件
            g_QAInfoList = enterClient.GetQAInfoList();
            if (g_QAInfoList != null && g_QAInfoList.Count > 0)
            {
                g_QAInfo = g_QAInfoList[0];
            }
            ////获取句子
            //g_senetenceInfoList = enterClient.GetSentenceInfoList(g_QAInfo.EVENTINFO_CODE);
            //if (g_senetenceInfoList != null && g_senetenceInfoList.Count > 0) g_sentenceInfo = g_senetenceInfoList[0];
            ////获取词汇
            //g_vocabularyInfoList = enterClient.GetVocabularyInfoList(g_sentenceInfo.SENTENCEINFO_CODE);
            ////获取属性、关系
            //g_propertyInfoList = enterClient.GetPropertyInfoList();
            //g_relationInfoList = enterClient.GetRelationInfoList();
            ////获取对象属性、对象关系(第一个词汇或句子或事件的属性、关系)
            //if(g_vocabularyInfo != null)
            //{


            //}
        }
Beispiel #2
0
    public string GetQAInfoList()
    {
        MemoryStream strm = new MemoryStream();

        List <MyQAInfo> myQAInfoList = new List <MyQAInfo>();
        DataSet         infods       = new DataSet();


        string sql = string.Empty;

        sql    = @" select * from QA ";
        infods = db.ExecuteDataSet(sql);


        #region 反射转换ds到list
        foreach (DataRow infodr in infods.Tables[0].Rows)
        {
            MyQAInfo       qaInfo     = new MyQAInfo();
            PropertyInfo[] qaproperty = qaInfo.GetType().GetProperties();
            foreach (PropertyInfo info in qaproperty)
            {
                if (infods.Tables[0].Columns.Contains(info.Name))
                {
                    object value = infodr[info.Name];
                    if (value != DBNull.Value)
                    {
                        info.SetValue(qaInfo, value, null);
                    }
                }
            }
            myQAInfoList.Add(qaInfo);
        }
        #endregion

        //SoapFormatter formatter = new SoapFormatter();
        BinaryFormatter formatter = new BinaryFormatter();
        formatter.Serialize(strm, myQAInfoList);
        //StreamReader reader = new StreamReader(strm, Encoding.GetEncoding("gb2312"));//用指定的编码方式
        //string result = reader.ReadToEnd();

        strm.Position = 0;
        byte[] buffer = new byte[strm.Length];
        strm.Read(buffer, 0, buffer.Length);
        strm.Flush();
        strm.Close();
        string result = Convert.ToBase64String(buffer);

        return(result);
    }