Example #1
0
        private List <BusinessMsg> DataTable2BusinessMsgs(DataTable dt)
        {
            List <BusinessMsg> list = new List <BusinessMsg>();

            foreach (DataRow dr in dt.Rows)
            {
                BusinessMsg bizmsg = DataRow2BusinessMsg(dr);
                list.Add(bizmsg);
            }
            return(list);
        }
Example #2
0
        private BusinessMsg DataRow2BusinessMsg(DataRow dr)
        {
            BusinessMsg bizmsg = new BusinessMsg();

            bizmsg.MsgID           = dr["MsgId"].ToInt64();
            bizmsg.SystemName      = dr["SystemName"].ToString();
            bizmsg.ModuleName      = dr["ModuleName"].ToString();
            bizmsg.KeyString       = dr["KeyString"].ToString();
            bizmsg.MsgType         = (BizMsgType)Enum.Parse(typeof(BizMsgType), dr["MsgType"].ToString());
            bizmsg.MsgInfo         = dr["MsgInfo"].ToString();
            bizmsg.OperatorID      = dr["OperatorId"].ToString();
            bizmsg.OperatorName    = dr["OperatorName"].ToString();
            bizmsg.OperateDateTime = dr["OperateDateTime"].ToDateTime();
            return(bizmsg);
        }
Example #3
0
        public BusinessMsg AppendBizMsg(BusinessMsg businessMsg)
        {
            SqlParameterCollection spc = DB.CreateSqlParameterCollection();

            spc.Add("@SystemName", businessMsg.SystemName);
            spc.Add("@ModuleName", businessMsg.ModuleName);
            spc.Add("@KeyString", businessMsg.KeyString);
            spc.Add("@MsgType", businessMsg.MsgType.ToString());
            spc.Add("@MsgInfo", businessMsg.MsgInfo);
            spc.Add("@OperatorID", businessMsg.OperatorID);
            spc.Add("@OperatorName", businessMsg.OperatorName);

            businessMsg.OperateDateTime = DateTime.Now;

            spc.Add("@OperateDateTime", businessMsg.OperateDateTime);

            string sql = "insert into g_BusinessMsg(SystemName, ModuleName, KeyString, MsgType, MsgInfo, OperatorID, OperatorName, OperateDateTime)"
                         + "values(@SystemName, @ModuleName, @KeyString, @MsgType, @MsgInfo, @OperatorID, @OperatorName, @OperateDateTime)";

            DB.ExecuteNonQuerySql(sql, spc);

            businessMsg.MsgID = DB.ExeSqlForObject("select max(MsgID) from g_BusinessMsg", null).ToInt64();
            return(businessMsg);
        }