public MessageEntity DeleteEventType(M_EventType eventType)
 {
     using (var conn = ConnectionFactory.GetDBConn(ConnectionFactory.DBConnNames.PipeInspectionBase_Gis_OutSide))
     {
         var rows   = 0;
         var excSql = DapperExtentions.MakeDeleteSql(eventType);
         if (string.IsNullOrEmpty(excSql))
         {
             return(MessageEntityTool.GetMessage(ErrorType.SqlError, "请检查实体类"));
         }
         try
         {
             rows = conn.Execute(excSql, eventType);
             return(MessageEntityTool.GetMessage(rows));
         }
         catch (Exception e)
         {
             return(MessageEntityTool.GetMessage(ErrorType.SqlError, e.Message));
         }
     }
 }
Example #2
0
        public int DeleteEntity(object entity, ConnectionFactory.DBConnNames dBConnName, out MessageEntity messageEntity)
        {
            using (var conn = ConnectionFactory.GetDBConn(dBConnName))
            {
                var rows   = 0;
                var result = DapperExtentions.MakeDeleteSql(entity);
                if (string.IsNullOrEmpty(result))
                {
                    messageEntity = MessageEntityTool.GetMessage(ErrorType.SqlError, "请检查实体类");
                    return(0);
                }
                try
                {
                    rows          = conn.Execute(result, entity);
                    messageEntity = MessageEntityTool.GetMessage(rows);
                }
                catch (Exception e)
                {
                    messageEntity = MessageEntityTool.GetMessage(ErrorType.SqlError, e.Message);
                }

                return(rows);
            }
        }