Example #1
0
        /// <summary>
        /// 添加
        /// </summary>
        /// yaoy    16.05.25
        /// <param name="value"></param>
        /// <returns></returns>
        public int Add(NameValueCollection data)
        {
            bool            result        = true;
            int             reportFilesId = 0;
            ReportFilesInfo value         = new ReportFilesInfo();

            value.MessageFileId = Convert.ToInt32(data["messageFileId"].ToString());
            value.ServiceObj    = Convert.ToInt32(data["serviceObj"].ToString());
            value.ReportState   = 3;//编辑状态
            value.CreateTime    = DateTime.Now;
            value.Operator      = new BLL.User.User().CurrentUser().Name;
            //获取报文类型列表
            List <MessageTypeInfo> list   = messageTypeMapper.List(value.MessageFileId);
            ReportInfo             report = new ReportInfo();

            using (TransactionScope scope = new TransactionScope())
            {
                reportFilesId = reportFilesMapper.Insert(value);
                result        = reportFilesId > 0;

                report.ReportFileID = reportFilesId;
                foreach (var item in list)
                {
                    report.MessageTypeID = item.MessageTypeId;

                    reportMapper.Insert(report);
                    result = report.ReportID > 0;
                }

                if (result)
                {
                    scope.Complete();
                }
            }

            return(reportFilesId);
        }