예제 #1
0
파일: QAWebService.cs 프로젝트: NIEJie/Core
    public bool SaveQAInfoList(string str)
    {
        //BinaryFormatter formatter = new BinaryFormatter();

        //byte[] array = Encoding.ASCII.GetBytes(str);
        //MemoryStream strm = new MemoryStream(array);
        //List<MyQAInfo> myQAInfoList = (List<MyQAInfo>)formatter.Deserialize(strm);
        List <MyQAInfo> myQAInfoList = changeType.changeStrToT <List <MyQAInfo> >(str);

        try
        {
            List <string> sqllist = new List <string>();
            foreach (MyQAInfo item in myQAInfoList)
            {
                string sql = string.Empty;
                sql = @" insert into QA (QAINFO_ID, .QAINFO_CODE, .QAINFO_PARENTID,
                    .QAINFO_QUESTION, .QAINFO_ANSWER, .QAINFO_CREATETIME,
                    .QAINFO_LASTMODIFIEDTIME, .QAINFO_MODIFICATIONTIMES,
                    .QAINFO_IFINVALID, .QAINFO_STATE) values ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}')";
                sql = string.Format(sql, item.QAINFO_ID, item.QAINFO_CODE, item.QAINFO_PARENTID,
                                    item.QAINFO_QUESTION, item.QAINFO_ANSWER, item.QAINFO_CREATETIME,
                                    item.QAINFO_LASTMODIFIEDTIME, item.QAINFO_MODIFICATIONTIMES,
                                    item.QAINFO_IFINVALID, item.QAINFO_STATE);
                sqllist.Add(sql);
            }
            db.Execute(sqllist);
            return(true);
        }
        catch (Exception ex)
        {
            return(false);
        }
    }